OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_ANDROID_H_ | 5 #ifndef MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_ANDROID_H_ |
6 #define MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_ANDROID_H_ | 6 #define MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_ANDROID_H_ |
7 | 7 |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "mojo/services/native_viewport/native_viewport.h" | 9 #include "mojo/services/native_viewport/native_viewport.h" |
| 10 #include "ui/events/event_constants.h" |
| 11 #include "ui/gfx/sequential_id_generator.h" |
10 #include "ui/gfx/size.h" | 12 #include "ui/gfx/size.h" |
11 | 13 |
12 namespace gpu { | 14 namespace gpu { |
13 class GLInProcessContext; | 15 class GLInProcessContext; |
14 } | 16 } |
15 | 17 |
16 struct ANativeWindow; | 18 struct ANativeWindow; |
17 | 19 |
18 namespace mojo { | 20 namespace mojo { |
19 namespace services { | 21 namespace services { |
20 | 22 |
21 class NativeViewportAndroid : public NativeViewport { | 23 class NativeViewportAndroid : public NativeViewport { |
22 public: | 24 public: |
23 explicit NativeViewportAndroid(NativeViewportDelegate* delegate); | 25 explicit NativeViewportAndroid(NativeViewportDelegate* delegate); |
24 virtual ~NativeViewportAndroid(); | 26 virtual ~NativeViewportAndroid(); |
25 | 27 |
26 base::WeakPtr<NativeViewportAndroid> GetWeakPtr() { | 28 base::WeakPtr<NativeViewportAndroid> GetWeakPtr() { |
27 return weak_factory_.GetWeakPtr(); | 29 return weak_factory_.GetWeakPtr(); |
28 } | 30 } |
29 | 31 |
30 void OnNativeWindowCreated(ANativeWindow* window); | 32 void OnNativeWindowCreated(ANativeWindow* window); |
31 void OnNativeWindowDestroyed(); | 33 void OnNativeWindowDestroyed(); |
32 void OnResized(const gfx::Size& size); | 34 void OnResized(const gfx::Size& size); |
| 35 void OnMotionEvent(bool is_touch, int pointer_id, ui::EventType action, |
| 36 float x, float y, int64 time_ms); |
33 | 37 |
34 private: | 38 private: |
35 // Overridden from NativeViewport: | 39 // Overridden from NativeViewport: |
36 virtual void Close() OVERRIDE; | 40 virtual void Close() OVERRIDE; |
37 | 41 |
38 void OnGLContextLost(); | 42 void OnGLContextLost(); |
39 void ReleaseWindow(); | 43 void ReleaseWindow(); |
40 | 44 |
41 NativeViewportDelegate* delegate_; | 45 NativeViewportDelegate* delegate_; |
42 ANativeWindow* window_; | 46 ANativeWindow* window_; |
43 gfx::Size size_; | 47 gfx::Size size_; |
44 scoped_ptr<gpu::GLInProcessContext> gl_context_; | 48 scoped_ptr<gpu::GLInProcessContext> gl_context_; |
| 49 ui::SequentialIDGenerator id_generator_; |
45 | 50 |
46 base::WeakPtrFactory<NativeViewportAndroid> weak_factory_; | 51 base::WeakPtrFactory<NativeViewportAndroid> weak_factory_; |
47 | 52 |
48 DISALLOW_COPY_AND_ASSIGN(NativeViewportAndroid); | 53 DISALLOW_COPY_AND_ASSIGN(NativeViewportAndroid); |
49 }; | 54 }; |
50 | 55 |
51 | 56 |
52 } // namespace services | 57 } // namespace services |
53 } // namespace mojo | 58 } // namespace mojo |
54 | 59 |
55 #endif // MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_ANDROID_H_ | 60 #endif // MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_ANDROID_H_ |
OLD | NEW |