Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */ |
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 nsAppShell_h__ |
michael@0 | 7 | #define nsAppShell_h__ |
michael@0 | 8 | |
michael@0 | 9 | #include "nsBaseAppShell.h" |
michael@0 | 10 | #include <windows.h> |
michael@0 | 11 | #include "mozilla/TimeStamp.h" |
michael@0 | 12 | #include "mozilla/Mutex.h" |
michael@0 | 13 | |
michael@0 | 14 | // The maximum time we allow before forcing a native event callback. |
michael@0 | 15 | // In seconds. |
michael@0 | 16 | #define NATIVE_EVENT_STARVATION_LIMIT 1 |
michael@0 | 17 | |
michael@0 | 18 | /** |
michael@0 | 19 | * Native Win32 Application shell wrapper |
michael@0 | 20 | */ |
michael@0 | 21 | class nsAppShell : public nsBaseAppShell |
michael@0 | 22 | { |
michael@0 | 23 | public: |
michael@0 | 24 | nsAppShell() : |
michael@0 | 25 | mEventWnd(nullptr), |
michael@0 | 26 | mNativeCallbackPending(false), |
michael@0 | 27 | mLastNativeEventScheduledMutex("nsAppShell::mLastNativeEventScheduledMutex") |
michael@0 | 28 | {} |
michael@0 | 29 | typedef mozilla::TimeStamp TimeStamp; |
michael@0 | 30 | typedef mozilla::Mutex Mutex; |
michael@0 | 31 | |
michael@0 | 32 | nsresult Init(); |
michael@0 | 33 | void DoProcessMoreGeckoEvents(); |
michael@0 | 34 | |
michael@0 | 35 | static UINT GetTaskbarButtonCreatedMessage(); |
michael@0 | 36 | |
michael@0 | 37 | protected: |
michael@0 | 38 | NS_IMETHOD Run(); |
michael@0 | 39 | NS_IMETHOD Exit(); |
michael@0 | 40 | virtual void ScheduleNativeEventCallback(); |
michael@0 | 41 | virtual bool ProcessNextNativeEvent(bool mayWait); |
michael@0 | 42 | virtual ~nsAppShell(); |
michael@0 | 43 | |
michael@0 | 44 | static LRESULT CALLBACK EventWindowProc(HWND, UINT, WPARAM, LPARAM); |
michael@0 | 45 | |
michael@0 | 46 | protected: |
michael@0 | 47 | HWND mEventWnd; |
michael@0 | 48 | bool mNativeCallbackPending; |
michael@0 | 49 | |
michael@0 | 50 | Mutex mLastNativeEventScheduledMutex; |
michael@0 | 51 | TimeStamp mLastNativeEventScheduled; |
michael@0 | 52 | }; |
michael@0 | 53 | |
michael@0 | 54 | #endif // nsAppShell_h__ |