layout/xul/nsMenuBarListener.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
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 #ifndef nsMenuBarListener_h__
michael@0 6 #define nsMenuBarListener_h__
michael@0 7
michael@0 8 #include "mozilla/Attributes.h"
michael@0 9 #include "nsIDOMEventListener.h"
michael@0 10
michael@0 11 // X.h defines KeyPress
michael@0 12 #ifdef KeyPress
michael@0 13 #undef KeyPress
michael@0 14 #endif
michael@0 15
michael@0 16 class nsMenuBarFrame;
michael@0 17 class nsIDOMKeyEvent;
michael@0 18
michael@0 19 /** editor Implementation of the DragListener interface
michael@0 20 */
michael@0 21 class nsMenuBarListener : public nsIDOMEventListener
michael@0 22 {
michael@0 23 public:
michael@0 24 /** default constructor
michael@0 25 */
michael@0 26 nsMenuBarListener(nsMenuBarFrame* aMenuBar);
michael@0 27 /** default destructor
michael@0 28 */
michael@0 29 virtual ~nsMenuBarListener();
michael@0 30
michael@0 31 static void InitializeStatics();
michael@0 32
michael@0 33 NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) MOZ_OVERRIDE;
michael@0 34
michael@0 35 nsresult KeyUp(nsIDOMEvent* aMouseEvent);
michael@0 36 nsresult KeyDown(nsIDOMEvent* aMouseEvent);
michael@0 37 nsresult KeyPress(nsIDOMEvent* aMouseEvent);
michael@0 38 nsresult Blur(nsIDOMEvent* aEvent);
michael@0 39 nsresult MouseDown(nsIDOMEvent* aMouseEvent);
michael@0 40
michael@0 41 static nsresult GetMenuAccessKey(int32_t* aAccessKey);
michael@0 42
michael@0 43 NS_DECL_ISUPPORTS
michael@0 44
michael@0 45 static bool IsAccessKeyPressed(nsIDOMKeyEvent* event);
michael@0 46
michael@0 47 protected:
michael@0 48 static void InitAccessKey();
michael@0 49
michael@0 50 static uint32_t GetModifiers(nsIDOMKeyEvent* event);
michael@0 51
michael@0 52 // This should only be called by the nsMenuBarListener during event dispatch,
michael@0 53 // thus ensuring that this doesn't get destroyed during the process.
michael@0 54 void ToggleMenuActiveState();
michael@0 55
michael@0 56 nsMenuBarFrame* mMenuBarFrame; // The menu bar object.
michael@0 57 // Whether or not the ALT key is currently down.
michael@0 58 bool mAccessKeyDown;
michael@0 59 // Whether or not the ALT key down is canceled by other action.
michael@0 60 bool mAccessKeyDownCanceled;
michael@0 61 static bool mAccessKeyFocuses; // Does the access key by itself focus the menubar?
michael@0 62 static int32_t mAccessKey; // See nsIDOMKeyEvent.h for sample values
michael@0 63 static uint32_t mAccessKeyMask;// Modifier mask for the access key
michael@0 64 };
michael@0 65
michael@0 66
michael@0 67 #endif

mercurial