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 OnTouchEvent(int pointer_id, ui::EventType action, float x, float y, |
| 36 int64 time_ms); |
33 | 37 |
34 private: | 38 private: |
35 // Overridden from NativeViewport: | 39 // Overridden from NativeViewport: |
36 virtual gfx::Size GetSize() OVERRIDE; | 40 virtual gfx::Size GetSize() OVERRIDE; |
37 virtual void Close() OVERRIDE; | 41 virtual void Close() OVERRIDE; |
38 | 42 |
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_; |
| 48 ui::SequentialIDGenerator id_generator_; |
44 | 49 |
45 base::WeakPtrFactory<NativeViewportAndroid> weak_factory_; | 50 base::WeakPtrFactory<NativeViewportAndroid> weak_factory_; |
46 | 51 |
47 DISALLOW_COPY_AND_ASSIGN(NativeViewportAndroid); | 52 DISALLOW_COPY_AND_ASSIGN(NativeViewportAndroid); |
48 }; | 53 }; |
49 | 54 |
50 | 55 |
51 } // namespace services | 56 } // namespace services |
52 } // namespace mojo | 57 } // namespace mojo |
53 | 58 |
54 #endif // MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_ANDROID_H_ | 59 #endif // MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_ANDROID_H_ |
OLD | NEW |