1 /* Copyright 2012 Mozilla Foundation and Mozilla contributors
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
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 #include "mozilla/Mutex.h"
22 #include "nsBaseAppShell.h"
25 #include "utils/RefBase.h"
28 bool ProcessNextEvent();
32 extern bool gDrawRequest
;
35 typedef void(*FdHandlerCallback
)(int, FdHandler
*);
41 memset(name
, 0, sizeof(name
));
46 FdHandlerCallback func
;
56 class InputReaderThread
;
59 class GeckoInputReaderPolicy
;
60 class GeckoInputDispatcher
;
62 class nsAppShell
: public nsBaseAppShell
{
66 NS_DECL_ISUPPORTS_INHERITED
71 NS_IMETHOD
Exit() MOZ_OVERRIDE
;
73 virtual bool ProcessNextNativeEvent(bool maywait
);
75 void NotifyNativeEvent();
77 static void NotifyScreenInitialized();
78 static void NotifyScreenRotation();
81 virtual ~nsAppShell();
83 virtual void ScheduleNativeEventCallback();
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
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
;
106 #endif /* nsAppShell_h */