widget/cocoa/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  *
     3  * This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef nsColorPicker_h_
     8 #define nsColorPicker_h_
    10 #include "nsIColorPicker.h"
    11 #include "nsString.h"
    12 #include "nsCOMPtr.h"
    14 class nsIColorPickerShownCallback;
    15 class nsIDOMWindow;
    16 @class NSColorPanelWrapper;
    17 @class NSColor;
    19 class nsColorPicker MOZ_FINAL : public nsIColorPicker
    20 {
    21 public:
    22   NS_DECL_ISUPPORTS
    24   NS_IMETHOD Init(nsIDOMWindow* aParent, const nsAString& aTitle,
    25                   const nsAString& aInitialColor);
    26   NS_IMETHOD Open(nsIColorPickerShownCallback* aCallback);
    28   // For NSColorPanelWrapper.
    29   void Update(NSColor* aColor);
    30   // Call this method if you are done with this input, but the color picker needs to
    31   // stay open as it will be associated to another input
    32   void DoneWithRetarget();
    33   // Same as DoneWithRetarget + clean the static instance of sColorPanelWrapper,
    34   // as it is not needed anymore for now
    35   void Done();
    37 private:
    38   static NSColor* GetNSColorFromHexString(const nsAString& aColor);
    39   static void GetHexStringFromNSColor(NSColor* aColor, nsAString& aResult);
    41   static NSColorPanelWrapper* sColorPanelWrapper;
    43   nsString             mTitle;
    44   nsString             mColor;
    45   nsCOMPtr<nsIColorPickerShownCallback> mCallback;
    46 };
    48 #endif // nsColorPicker_h_

mercurial