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.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef nsToolkit_h_
michael@0 7 #define nsToolkit_h_
michael@0 8
michael@0 9 #include "nscore.h"
michael@0 10 #include "nsCocoaFeatures.h"
michael@0 11
michael@0 12 #import <Carbon/Carbon.h>
michael@0 13 #import <Cocoa/Cocoa.h>
michael@0 14 #import <objc/Object.h>
michael@0 15 #import <IOKit/IOKitLib.h>
michael@0 16
michael@0 17 class nsToolkit
michael@0 18 {
michael@0 19 public:
michael@0 20 nsToolkit();
michael@0 21 virtual ~nsToolkit();
michael@0 22
michael@0 23 static nsToolkit* GetToolkit();
michael@0 24
michael@0 25 static void Shutdown() {
michael@0 26 delete gToolkit;
michael@0 27 gToolkit = nullptr;
michael@0 28 }
michael@0 29
michael@0 30 static void PostSleepWakeNotification(const char* aNotification);
michael@0 31
michael@0 32 static nsresult SwizzleMethods(Class aClass, SEL orgMethod, SEL posedMethod,
michael@0 33 bool classMethods = false);
michael@0 34
michael@0 35 void RegisterForAllProcessMouseEvents();
michael@0 36 void UnregisterAllProcessMouseEventHandlers();
michael@0 37
michael@0 38 protected:
michael@0 39
michael@0 40 nsresult RegisterForSleepWakeNotifcations();
michael@0 41 void RemoveSleepWakeNotifcations();
michael@0 42
michael@0 43 protected:
michael@0 44
michael@0 45 static nsToolkit* gToolkit;
michael@0 46
michael@0 47 CFRunLoopSourceRef mSleepWakeNotificationRLS;
michael@0 48 io_object_t mPowerNotifier;
michael@0 49
michael@0 50 CFMachPortRef mEventTapPort;
michael@0 51 CFRunLoopSourceRef mEventTapRLS;
michael@0 52 };
michael@0 53
michael@0 54 #endif // nsToolkit_h_

mercurial