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: 40; indent-tabs-mode: nil; c-basic-offset: 4; -*- */ |
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 "mozilla/CondVar.h" |
michael@0 | 10 | #include "mozilla/Mutex.h" |
michael@0 | 11 | #include "nsBaseAppShell.h" |
michael@0 | 12 | #include "nsCOMPtr.h" |
michael@0 | 13 | #include "nsTArray.h" |
michael@0 | 14 | #include "nsInterfaceHashtable.h" |
michael@0 | 15 | #include "nsIAndroidBridge.h" |
michael@0 | 16 | |
michael@0 | 17 | namespace mozilla { |
michael@0 | 18 | class AndroidGeckoEvent; |
michael@0 | 19 | bool ProcessNextEvent(); |
michael@0 | 20 | void NotifyEvent(); |
michael@0 | 21 | } |
michael@0 | 22 | |
michael@0 | 23 | class nsWindow; |
michael@0 | 24 | |
michael@0 | 25 | class nsAppShell : |
michael@0 | 26 | public nsBaseAppShell |
michael@0 | 27 | { |
michael@0 | 28 | typedef mozilla::CondVar CondVar; |
michael@0 | 29 | typedef mozilla::Mutex Mutex; |
michael@0 | 30 | |
michael@0 | 31 | public: |
michael@0 | 32 | static nsAppShell *gAppShell; |
michael@0 | 33 | static mozilla::AndroidGeckoEvent *gEarlyEvent; |
michael@0 | 34 | |
michael@0 | 35 | nsAppShell(); |
michael@0 | 36 | |
michael@0 | 37 | NS_DECL_ISUPPORTS_INHERITED |
michael@0 | 38 | NS_DECL_NSIOBSERVER |
michael@0 | 39 | |
michael@0 | 40 | nsresult Init(); |
michael@0 | 41 | |
michael@0 | 42 | void NotifyNativeEvent(); |
michael@0 | 43 | |
michael@0 | 44 | virtual bool ProcessNextNativeEvent(bool mayWait); |
michael@0 | 45 | |
michael@0 | 46 | void PostEvent(mozilla::AndroidGeckoEvent *event); |
michael@0 | 47 | void OnResume(); |
michael@0 | 48 | |
michael@0 | 49 | nsresult AddObserver(const nsAString &aObserverKey, nsIObserver *aObserver); |
michael@0 | 50 | void ResendLastResizeEvent(nsWindow* aDest); |
michael@0 | 51 | |
michael@0 | 52 | void SetBrowserApp(nsIAndroidBrowserApp* aBrowserApp) { |
michael@0 | 53 | mBrowserApp = aBrowserApp; |
michael@0 | 54 | } |
michael@0 | 55 | |
michael@0 | 56 | void GetBrowserApp(nsIAndroidBrowserApp* *aBrowserApp) { |
michael@0 | 57 | *aBrowserApp = mBrowserApp; |
michael@0 | 58 | } |
michael@0 | 59 | |
michael@0 | 60 | protected: |
michael@0 | 61 | virtual void ScheduleNativeEventCallback(); |
michael@0 | 62 | virtual ~nsAppShell(); |
michael@0 | 63 | |
michael@0 | 64 | Mutex mQueueLock; |
michael@0 | 65 | Mutex mCondLock; |
michael@0 | 66 | CondVar mQueueCond; |
michael@0 | 67 | mozilla::AndroidGeckoEvent *mQueuedDrawEvent; |
michael@0 | 68 | mozilla::AndroidGeckoEvent *mQueuedViewportEvent; |
michael@0 | 69 | bool mAllowCoalescingNextDraw; |
michael@0 | 70 | bool mAllowCoalescingTouches; |
michael@0 | 71 | nsTArray<mozilla::AndroidGeckoEvent *> mEventQueue; |
michael@0 | 72 | nsInterfaceHashtable<nsStringHashKey, nsIObserver> mObserversHash; |
michael@0 | 73 | |
michael@0 | 74 | mozilla::AndroidGeckoEvent *PopNextEvent(); |
michael@0 | 75 | mozilla::AndroidGeckoEvent *PeekNextEvent(); |
michael@0 | 76 | |
michael@0 | 77 | nsCOMPtr<nsIAndroidBrowserApp> mBrowserApp; |
michael@0 | 78 | }; |
michael@0 | 79 | |
michael@0 | 80 | #endif // nsAppShell_h__ |
michael@0 | 81 |