| 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_VIEW_MANAGER_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_ANDROID_H_ | 5 #ifndef UI_PLATFORM_WINDOW_ANDROID_PLATFORM_WINDOW_ANDROID_H_ |
| 6 #define COMPONENTS_VIEW_MANAGER_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_ANDROID_H_ | 6 #define UI_PLATFORM_WINDOW_ANDROID_PLATFORM_WINDOW_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/view_manager/native_viewport/platform_viewport.h" | |
| 12 #include "ui/events/event_constants.h" | 11 #include "ui/events/event_constants.h" |
| 13 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
| 14 #include "ui/gfx/geometry/size.h" | 13 #include "ui/gfx/geometry/size.h" |
| 15 #include "ui/gfx/sequential_id_generator.h" | 14 #include "ui/gfx/sequential_id_generator.h" |
| 16 | 15 #include "ui/platform_window/platform_window.h" |
| 17 namespace gpu { | |
| 18 class GLInProcessContext; | |
| 19 } | |
| 20 | 16 |
| 21 struct ANativeWindow; | 17 struct ANativeWindow; |
| 22 | 18 |
| 23 namespace native_viewport { | 19 namespace ui { |
| 24 | 20 |
| 25 class PlatformViewportAndroid : public PlatformViewport { | 21 class PlatformWindowAndroid : public PlatformWindow { |
| 26 public: | 22 public: |
| 27 static bool Register(JNIEnv* env); | 23 static bool Register(JNIEnv* env); |
| 28 | 24 |
| 29 explicit PlatformViewportAndroid(Delegate* delegate); | 25 explicit PlatformWindowAndroid(PlatformWindowDelegate* delegate); |
| 30 ~PlatformViewportAndroid() override; | 26 ~PlatformWindowAndroid() override; |
| 31 | 27 |
| 32 void Destroy(JNIEnv* env, jobject obj); | 28 void Destroy(JNIEnv* env, jobject obj); |
| 33 void SurfaceCreated(JNIEnv* env, | 29 void SurfaceCreated(JNIEnv* env, |
| 34 jobject obj, | 30 jobject obj, |
| 35 jobject jsurface, | 31 jobject jsurface, |
| 36 float device_pixel_ratio); | 32 float device_pixel_ratio); |
| 37 void SurfaceDestroyed(JNIEnv* env, jobject obj); | 33 void SurfaceDestroyed(JNIEnv* env, jobject obj); |
| 38 void SurfaceSetSize(JNIEnv* env, | 34 void SurfaceSetSize(JNIEnv* env, |
| 39 jobject obj, | 35 jobject obj, |
| 40 jint width, | 36 jint width, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 51 jfloat touch_major, | 47 jfloat touch_major, |
| 52 jfloat touch_minor, | 48 jfloat touch_minor, |
| 53 jfloat orientation, | 49 jfloat orientation, |
| 54 jfloat h_wheel, | 50 jfloat h_wheel, |
| 55 jfloat v_wheel); | 51 jfloat v_wheel); |
| 56 bool KeyEvent(JNIEnv* env, | 52 bool KeyEvent(JNIEnv* env, |
| 57 jobject obj, | 53 jobject obj, |
| 58 bool pressed, | 54 bool pressed, |
| 59 jint key_code, | 55 jint key_code, |
| 60 jint unicode_character); | 56 jint unicode_character); |
| 57 private: |
| 58 void ReleaseWindow(); |
| 61 | 59 |
| 62 private: | 60 // Overridden from PlatformWindow: |
| 63 // Overridden from PlatformViewport: | |
| 64 void Init(const gfx::Rect& bounds) override; | |
| 65 void Show() override; | 61 void Show() override; |
| 66 void Hide() override; | 62 void Hide() override; |
| 67 void Close() override; | 63 void Close() override; |
| 68 gfx::Size GetSize() override; | |
| 69 void SetBounds(const gfx::Rect& bounds) override; | 64 void SetBounds(const gfx::Rect& bounds) override; |
| 65 gfx::Rect GetBounds() override; |
| 66 void SetCapture() override; |
| 67 void ReleaseCapture() override; |
| 68 void ToggleFullscreen() override; |
| 69 void Maximize() override; |
| 70 void Minimize() override; |
| 71 void Restore() override; |
| 72 void SetCursor(PlatformCursor cursor) override; |
| 73 void MoveCursorTo(const gfx::Point& location) override; |
| 74 void ConfineCursorToBounds(const gfx::Rect& bounds) override; |
| 70 | 75 |
| 71 void ReleaseWindow(); | 76 PlatformWindowDelegate* delegate_; |
| 72 | 77 |
| 73 Delegate* const delegate_; | 78 JavaObjectWeakGlobalRef java_platform_window_android_; |
| 74 JavaObjectWeakGlobalRef java_platform_viewport_android_; | |
| 75 ANativeWindow* window_; | 79 ANativeWindow* window_; |
| 76 ui::SequentialIDGenerator id_generator_; | 80 ui::SequentialIDGenerator id_generator_; |
| 77 | 81 |
| 78 gfx::Size size_; | 82 gfx::Size size_; // Origin is always (0,0) |
| 79 | 83 |
| 80 base::WeakPtrFactory<PlatformViewportAndroid> weak_factory_; | 84 base::WeakPtrFactory<PlatformWindowAndroid> weak_factory_; |
| 81 | 85 |
| 82 DISALLOW_COPY_AND_ASSIGN(PlatformViewportAndroid); | 86 DISALLOW_COPY_AND_ASSIGN(PlatformWindowAndroid); |
| 83 }; | 87 }; |
| 84 | 88 |
| 85 } // namespace native_viewport | 89 } // namespace ui |
| 86 | 90 |
| 87 #endif // COMPONENTS_VIEW_MANAGER_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_ANDROID_H_ | 91 #endif // UI_PLATFORM_WINDOW_ANDROID_PLATFORM_WINDOW_ANDROID_H_ |
| OLD | NEW |