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.

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

mercurial