widget/android/nsAppShell.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/widget/android/nsAppShell.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,81 @@
     1.4 +/* -*- Mode: c++; tab-width: 40; indent-tabs-mode: nil; c-basic-offset: 4; -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef nsAppShell_h__
    1.10 +#define nsAppShell_h__
    1.11 +
    1.12 +#include "mozilla/CondVar.h"
    1.13 +#include "mozilla/Mutex.h"
    1.14 +#include "nsBaseAppShell.h"
    1.15 +#include "nsCOMPtr.h"
    1.16 +#include "nsTArray.h"
    1.17 +#include "nsInterfaceHashtable.h"
    1.18 +#include "nsIAndroidBridge.h"
    1.19 +
    1.20 +namespace mozilla {
    1.21 +class AndroidGeckoEvent;
    1.22 +bool ProcessNextEvent();
    1.23 +void NotifyEvent();
    1.24 +}
    1.25 +
    1.26 +class nsWindow;
    1.27 +
    1.28 +class nsAppShell :
    1.29 +    public nsBaseAppShell
    1.30 +{
    1.31 +    typedef mozilla::CondVar CondVar;
    1.32 +    typedef mozilla::Mutex Mutex;
    1.33 +
    1.34 +public:
    1.35 +    static nsAppShell *gAppShell;
    1.36 +    static mozilla::AndroidGeckoEvent *gEarlyEvent;
    1.37 +
    1.38 +    nsAppShell();
    1.39 +
    1.40 +    NS_DECL_ISUPPORTS_INHERITED
    1.41 +    NS_DECL_NSIOBSERVER
    1.42 +
    1.43 +    nsresult Init();
    1.44 +
    1.45 +    void NotifyNativeEvent();
    1.46 +
    1.47 +    virtual bool ProcessNextNativeEvent(bool mayWait);
    1.48 +
    1.49 +    void PostEvent(mozilla::AndroidGeckoEvent *event);
    1.50 +    void OnResume();
    1.51 +
    1.52 +    nsresult AddObserver(const nsAString &aObserverKey, nsIObserver *aObserver);
    1.53 +    void ResendLastResizeEvent(nsWindow* aDest);
    1.54 +
    1.55 +    void SetBrowserApp(nsIAndroidBrowserApp* aBrowserApp) {
    1.56 +        mBrowserApp = aBrowserApp;
    1.57 +    }
    1.58 +
    1.59 +    void GetBrowserApp(nsIAndroidBrowserApp* *aBrowserApp) {
    1.60 +        *aBrowserApp = mBrowserApp;
    1.61 +    }
    1.62 +
    1.63 +protected:
    1.64 +    virtual void ScheduleNativeEventCallback();
    1.65 +    virtual ~nsAppShell();
    1.66 +
    1.67 +    Mutex mQueueLock;
    1.68 +    Mutex mCondLock;
    1.69 +    CondVar mQueueCond;
    1.70 +    mozilla::AndroidGeckoEvent *mQueuedDrawEvent;
    1.71 +    mozilla::AndroidGeckoEvent *mQueuedViewportEvent;
    1.72 +    bool mAllowCoalescingNextDraw;
    1.73 +    bool mAllowCoalescingTouches;
    1.74 +    nsTArray<mozilla::AndroidGeckoEvent *> mEventQueue;
    1.75 +    nsInterfaceHashtable<nsStringHashKey, nsIObserver> mObserversHash;
    1.76 +
    1.77 +    mozilla::AndroidGeckoEvent *PopNextEvent();
    1.78 +    mozilla::AndroidGeckoEvent *PeekNextEvent();
    1.79 +
    1.80 +    nsCOMPtr<nsIAndroidBrowserApp> mBrowserApp;
    1.81 +};
    1.82 +
    1.83 +#endif // nsAppShell_h__
    1.84 +

mercurial