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 COMPONENTS_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_ANDROID_H_ | 5 #ifndef COMPONENTS_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_ANDROID_H_ |
6 #define COMPONENTS_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_ANDROID_H_ | 6 #define COMPONENTS_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_ANDROID_H_ |
7 | 7 |
8 #include "base/android/jni_weak_ref.h" | 8 #include "base/android/jni_weak_ref.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "components/native_viewport/platform_viewport.h" | 11 #include "components/native_viewport/platform_viewport.h" |
12 #include "ui/events/event_constants.h" | 12 #include "ui/events/event_constants.h" |
13 #include "ui/gfx/geometry/rect.h" | 13 #include "ui/gfx/geometry/rect.h" |
14 #include "ui/gfx/geometry/size.h" | 14 #include "ui/gfx/geometry/size.h" |
15 #include "ui/gfx/sequential_id_generator.h" | 15 #include "ui/gfx/sequential_id_generator.h" |
16 | 16 |
17 namespace gpu { | 17 namespace gpu { |
18 class GLInProcessContext; | 18 class GLInProcessContext; |
19 } | 19 } |
20 | 20 |
21 struct ANativeWindow; | 21 struct ANativeWindow; |
22 | 22 |
23 namespace native_viewport { | 23 namespace native_viewport { |
24 | 24 |
25 class PlatformViewportAndroid : public PlatformViewport { | 25 class PlatformViewportAndroid : public PlatformViewport { |
26 public: | 26 public: |
27 static bool Register(JNIEnv* env); | 27 static bool Register(JNIEnv* env); |
28 | 28 |
29 explicit PlatformViewportAndroid(Delegate* delegate); | 29 explicit PlatformViewportAndroid(Delegate* delegate); |
30 virtual ~PlatformViewportAndroid(); | 30 ~PlatformViewportAndroid() override; |
31 | 31 |
32 void Destroy(JNIEnv* env, jobject obj); | 32 void Destroy(JNIEnv* env, jobject obj); |
33 void SurfaceCreated(JNIEnv* env, jobject obj, jobject jsurface); | 33 void SurfaceCreated(JNIEnv* env, jobject obj, jobject jsurface); |
34 void SurfaceDestroyed(JNIEnv* env, jobject obj); | 34 void SurfaceDestroyed(JNIEnv* env, jobject obj); |
35 void SurfaceSetSize(JNIEnv* env, | 35 void SurfaceSetSize(JNIEnv* env, |
36 jobject obj, | 36 jobject obj, |
37 jint width, | 37 jint width, |
38 jint height, | 38 jint height, |
39 jfloat density); | 39 jfloat density); |
40 bool TouchEvent(JNIEnv* env, | 40 bool TouchEvent(JNIEnv* env, |
(...skipping 10 matching lines...) Expand all Loading... |
51 jfloat h_wheel, | 51 jfloat h_wheel, |
52 jfloat v_wheel); | 52 jfloat v_wheel); |
53 bool KeyEvent(JNIEnv* env, | 53 bool KeyEvent(JNIEnv* env, |
54 jobject obj, | 54 jobject obj, |
55 bool pressed, | 55 bool pressed, |
56 jint key_code, | 56 jint key_code, |
57 jint unicode_character); | 57 jint unicode_character); |
58 | 58 |
59 private: | 59 private: |
60 // Overridden from PlatformViewport: | 60 // Overridden from PlatformViewport: |
61 virtual void Init(const gfx::Rect& bounds) override; | 61 void Init(const gfx::Rect& bounds) override; |
62 virtual void Show() override; | 62 void Show() override; |
63 virtual void Hide() override; | 63 void Hide() override; |
64 virtual void Close() override; | 64 void Close() override; |
65 virtual gfx::Size GetSize() override; | 65 gfx::Size GetSize() override; |
66 virtual void SetBounds(const gfx::Rect& bounds) override; | 66 void SetBounds(const gfx::Rect& bounds) override; |
67 | 67 |
68 void ReleaseWindow(); | 68 void ReleaseWindow(); |
69 | 69 |
70 Delegate* const delegate_; | 70 Delegate* const delegate_; |
71 JavaObjectWeakGlobalRef java_platform_viewport_android_; | 71 JavaObjectWeakGlobalRef java_platform_viewport_android_; |
72 ANativeWindow* window_; | 72 ANativeWindow* window_; |
73 mojo::ViewportMetricsPtr metrics_; | 73 mojo::ViewportMetricsPtr metrics_; |
74 ui::SequentialIDGenerator id_generator_; | 74 ui::SequentialIDGenerator id_generator_; |
75 | 75 |
76 base::WeakPtrFactory<PlatformViewportAndroid> weak_factory_; | 76 base::WeakPtrFactory<PlatformViewportAndroid> weak_factory_; |
77 | 77 |
78 DISALLOW_COPY_AND_ASSIGN(PlatformViewportAndroid); | 78 DISALLOW_COPY_AND_ASSIGN(PlatformViewportAndroid); |
79 }; | 79 }; |
80 | 80 |
81 } // namespace native_viewport | 81 } // namespace native_viewport |
82 | 82 |
83 #endif // COMPONENTS_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_ANDROID_H_ | 83 #endif // COMPONENTS_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_ANDROID_H_ |
OLD | NEW |