widget/cocoa/nsWindowMap.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 nsWindowMap_h_
     7 #define nsWindowMap_h_
     9 #import <Cocoa/Cocoa.h>
    11 //  WindowDataMap
    12 // 
    13 //  In both mozilla and embedding apps, we need to have a place to put
    14 //  per-top-level-window logic and data, to handle such things as IME
    15 //  commit when the window gains/loses focus. We can't use a window 
    16 //  delegate, because an embeddor probably already has one. Nor can we
    17 //  subclass NSWindow, again because we can't impose that burden on the
    18 //  embeddor.
    19 // 
    20 //  So we have a global map of NSWindow -> TopLevelWindowData, and set
    21 //  up TopLevelWindowData as a notification observer etc.
    23 @interface WindowDataMap : NSObject
    24 {
    25 @private
    26   NSMutableDictionary*    mWindowMap;   // dict of TopLevelWindowData keyed by address of NSWindow
    27 }
    29 + (WindowDataMap*)sharedWindowDataMap;
    31 - (void)ensureDataForWindow:(NSWindow*)inWindow;
    32 - (id)dataForWindow:(NSWindow*)inWindow;
    34 // set data for a given window. inData is retained (and any previously set data
    35 // is released).
    36 - (void)setData:(id)inData forWindow:(NSWindow*)inWindow;
    38 // remove the data for the given window. the data is released.
    39 - (void)removeDataForWindow:(NSWindow*)inWindow;
    41 @end
    43 @class ChildView;
    45 //  TopLevelWindowData
    46 // 
    47 //  Class to hold per-window data, and handle window state changes.
    49 @interface TopLevelWindowData : NSObject
    50 {
    51 @private
    52 }
    54 - (id)initWithWindow:(NSWindow*)inWindow;
    55 + (void)activateInWindow:(NSWindow*)aWindow;
    56 + (void)deactivateInWindow:(NSWindow*)aWindow;
    57 + (void)activateInWindowViews:(NSWindow*)aWindow;
    58 + (void)deactivateInWindowViews:(NSWindow*)aWindow;
    60 @end
    62 #endif // nsWindowMap_h_

mercurial