michael@0: /* -*- Mode: c++; tab-width: 40; indent-tabs-mode: nil; c-basic-offset: 4; -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsAppShell_h__ michael@0: #define nsAppShell_h__ michael@0: michael@0: #include "mozilla/CondVar.h" michael@0: #include "mozilla/Mutex.h" michael@0: #include "nsBaseAppShell.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsTArray.h" michael@0: #include "nsInterfaceHashtable.h" michael@0: #include "nsIAndroidBridge.h" michael@0: michael@0: namespace mozilla { michael@0: class AndroidGeckoEvent; michael@0: bool ProcessNextEvent(); michael@0: void NotifyEvent(); michael@0: } michael@0: michael@0: class nsWindow; michael@0: michael@0: class nsAppShell : michael@0: public nsBaseAppShell michael@0: { michael@0: typedef mozilla::CondVar CondVar; michael@0: typedef mozilla::Mutex Mutex; michael@0: michael@0: public: michael@0: static nsAppShell *gAppShell; michael@0: static mozilla::AndroidGeckoEvent *gEarlyEvent; michael@0: michael@0: nsAppShell(); michael@0: michael@0: NS_DECL_ISUPPORTS_INHERITED michael@0: NS_DECL_NSIOBSERVER michael@0: michael@0: nsresult Init(); michael@0: michael@0: void NotifyNativeEvent(); michael@0: michael@0: virtual bool ProcessNextNativeEvent(bool mayWait); michael@0: michael@0: void PostEvent(mozilla::AndroidGeckoEvent *event); michael@0: void OnResume(); michael@0: michael@0: nsresult AddObserver(const nsAString &aObserverKey, nsIObserver *aObserver); michael@0: void ResendLastResizeEvent(nsWindow* aDest); michael@0: michael@0: void SetBrowserApp(nsIAndroidBrowserApp* aBrowserApp) { michael@0: mBrowserApp = aBrowserApp; michael@0: } michael@0: michael@0: void GetBrowserApp(nsIAndroidBrowserApp* *aBrowserApp) { michael@0: *aBrowserApp = mBrowserApp; michael@0: } michael@0: michael@0: protected: michael@0: virtual void ScheduleNativeEventCallback(); michael@0: virtual ~nsAppShell(); michael@0: michael@0: Mutex mQueueLock; michael@0: Mutex mCondLock; michael@0: CondVar mQueueCond; michael@0: mozilla::AndroidGeckoEvent *mQueuedDrawEvent; michael@0: mozilla::AndroidGeckoEvent *mQueuedViewportEvent; michael@0: bool mAllowCoalescingNextDraw; michael@0: bool mAllowCoalescingTouches; michael@0: nsTArray mEventQueue; michael@0: nsInterfaceHashtable mObserversHash; michael@0: michael@0: mozilla::AndroidGeckoEvent *PopNextEvent(); michael@0: mozilla::AndroidGeckoEvent *PeekNextEvent(); michael@0: michael@0: nsCOMPtr mBrowserApp; michael@0: }; michael@0: michael@0: #endif // nsAppShell_h__ michael@0: