widget/gtk/nsColorPicker.h

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef nsColorPicker_h__
     7 #define nsColorPicker_h__
     9 #include <gtk/gtk.h>
    11 #include "nsCOMPtr.h"
    12 #include "nsIColorPicker.h"
    13 #include "nsString.h"
    15 class nsIWidget;
    17 class nsColorPicker MOZ_FINAL : public nsIColorPicker
    18 {
    19 public:
    20   NS_DECL_ISUPPORTS
    21   NS_DECL_NSICOLORPICKER
    23   nsColorPicker() {};
    25 private:
    26   ~nsColorPicker() {};
    28   static void OnColorChanged(GtkColorSelection* colorselection,
    29                              gpointer user_data);
    30   static void OnResponse(GtkWidget* dialog, gint response_id,
    31                          gpointer user_data);
    32   static void OnDestroy(GtkWidget* dialog, gpointer user_data);
    34   // Conversion functions for color
    35   static int convertGdkColorComponent(guint16 color_component);
    36   static guint16 convertToGdkColorComponent(int color_component);
    37   static GdkColor convertToGdkColor(nscolor color);
    38   static nsString ToHexString(int n);
    40   static GtkColorSelection* WidgetGetColorSelection(GtkWidget* widget);
    42   void Done(GtkWidget* dialog, gint response_id);
    43   void Update(GtkColorSelection* colorselection);
    44   void ReadValueFromColorSelection(GtkColorSelection* colorselection);
    46   nsCOMPtr<nsIWidget> mParentWidget;
    47   nsCOMPtr<nsIColorPickerShownCallback> mCallback;
    48   nsString mTitle;
    49   nsString mColor;
    50   nsString mInitialColor;
    51 };
    53 #endif // nsColorPicker_h__

mercurial