widget/gonk/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 /* Copyright 2012 Mozilla Foundation and Mozilla contributors
     2  *
     3  * Licensed under the Apache License, Version 2.0 (the "License");
     4  * you may not use this file except in compliance with the License.
     5  * You may obtain a copy of the License at
     6  *
     7  *     http://www.apache.org/licenses/LICENSE-2.0
     8  *
     9  * Unless required by applicable law or agreed to in writing, software
    10  * distributed under the License is distributed on an "AS IS" BASIS,
    11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  * See the License for the specific language governing permissions and
    13  * limitations under the License.
    14  */
    16 #ifndef nsAppShell_h
    17 #define nsAppShell_h
    19 #include <queue>
    21 #include "mozilla/Mutex.h"
    22 #include "nsBaseAppShell.h"
    23 #include "nsTArray.h"
    25 #include "utils/RefBase.h"
    27 namespace mozilla {
    28 bool ProcessNextEvent();
    29 void NotifyEvent();
    30 }
    32 extern bool gDrawRequest;
    34 class FdHandler;
    35 typedef void(*FdHandlerCallback)(int, FdHandler *);
    37 class FdHandler {
    38 public:
    39     FdHandler()
    40     {
    41         memset(name, 0, sizeof(name));
    42     }
    44     int fd;
    45     char name[64];
    46     FdHandlerCallback func;
    47     void run()
    48     {
    49         func(fd, this);
    50     }
    51 };
    53 namespace android {
    54 class EventHub;
    55 class InputReader;
    56 class InputReaderThread;
    57 }
    59 class GeckoInputReaderPolicy;
    60 class GeckoInputDispatcher;
    62 class nsAppShell : public nsBaseAppShell {
    63 public:
    64     nsAppShell();
    66     NS_DECL_ISUPPORTS_INHERITED
    67     NS_DECL_NSIOBSERVER
    69     nsresult Init();
    71     NS_IMETHOD Exit() MOZ_OVERRIDE;
    73     virtual bool ProcessNextNativeEvent(bool maywait);
    75     void NotifyNativeEvent();
    77     static void NotifyScreenInitialized();
    78     static void NotifyScreenRotation();
    80 protected:
    81     virtual ~nsAppShell();
    83     virtual void ScheduleNativeEventCallback();
    85 private:
    86     nsresult AddFdHandler(int fd, FdHandlerCallback handlerFunc,
    87                           const char* deviceName);
    88     void InitInputDevices();
    90     // This is somewhat racy but is perfectly safe given how the callback works
    91     bool mNativeCallbackRequest;
    93     // This gets flipped when we observe a browser-ui-startup-complete.
    94     // browser-ui-startup-complete means that we're really ready to draw
    95     // and can stop the boot animation
    96     bool mEnableDraw;
    97     nsTArray<FdHandler> mHandlers;
    99     android::sp<android::EventHub>               mEventHub;
   100     android::sp<GeckoInputReaderPolicy> mReaderPolicy;
   101     android::sp<GeckoInputDispatcher>   mDispatcher;
   102     android::sp<android::InputReader>            mReader;
   103     android::sp<android::InputReaderThread>      mReaderThread;
   104 };
   106 #endif /* nsAppShell_h */

mercurial