widget/cocoa/nsToolkit.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 nsToolkit_h_
     7 #define nsToolkit_h_
     9 #include "nscore.h"
    10 #include "nsCocoaFeatures.h"
    12 #import <Carbon/Carbon.h>
    13 #import <Cocoa/Cocoa.h>
    14 #import <objc/Object.h>
    15 #import <IOKit/IOKitLib.h>
    17 class nsToolkit
    18 {
    19 public:
    20                      nsToolkit();
    21   virtual            ~nsToolkit();
    23   static nsToolkit*  GetToolkit();
    25   static void Shutdown() {
    26     delete gToolkit;
    27     gToolkit = nullptr;
    28   }
    30   static void        PostSleepWakeNotification(const char* aNotification);
    32   static nsresult    SwizzleMethods(Class aClass, SEL orgMethod, SEL posedMethod,
    33                                     bool classMethods = false);
    35   void               RegisterForAllProcessMouseEvents();
    36   void               UnregisterAllProcessMouseEventHandlers();
    38 protected:
    40   nsresult           RegisterForSleepWakeNotifcations();
    41   void               RemoveSleepWakeNotifcations();
    43 protected:
    45   static nsToolkit*  gToolkit;
    47   CFRunLoopSourceRef mSleepWakeNotificationRLS;
    48   io_object_t        mPowerNotifier;
    50   CFMachPortRef      mEventTapPort;
    51   CFRunLoopSourceRef mEventTapRLS;
    52 };
    54 #endif // nsToolkit_h_

mercurial