widget/android/nsAppShell.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial