| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_VIEW_MANAGER_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_ANDROID_H_ | |
| 6 #define COMPONENTS_VIEW_MANAGER_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_ANDROID_H_ | |
| 7 | |
| 8 #include "base/android/jni_weak_ref.h" | |
| 9 #include "base/macros.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" | |
| 13 #include "ui/gfx/geometry/rect.h" | |
| 14 #include "ui/gfx/geometry/size.h" | |
| 15 #include "ui/gfx/sequential_id_generator.h" | |
| 16 | |
| 17 namespace gpu { | |
| 18 class GLInProcessContext; | |
| 19 } | |
| 20 | |
| 21 struct ANativeWindow; | |
| 22 | |
| 23 namespace native_viewport { | |
| 24 | |
| 25 class PlatformViewportAndroid : public PlatformViewport { | |
| 26 public: | |
| 27 static bool Register(JNIEnv* env); | |
| 28 | |
| 29 explicit PlatformViewportAndroid(Delegate* delegate); | |
| 30 ~PlatformViewportAndroid() override; | |
| 31 | |
| 32 void Destroy(JNIEnv* env, jobject obj); | |
| 33 void SurfaceCreated(JNIEnv* env, | |
| 34 jobject obj, | |
| 35 jobject jsurface, | |
| 36 float device_pixel_ratio); | |
| 37 void SurfaceDestroyed(JNIEnv* env, jobject obj); | |
| 38 void SurfaceSetSize(JNIEnv* env, | |
| 39 jobject obj, | |
| 40 jint width, | |
| 41 jint height, | |
| 42 jfloat density); | |
| 43 bool TouchEvent(JNIEnv* env, | |
| 44 jobject obj, | |
| 45 jlong time_ms, | |
| 46 jint masked_action, | |
| 47 jint pointer_id, | |
| 48 jfloat x, | |
| 49 jfloat y, | |
| 50 jfloat pressure, | |
| 51 jfloat touch_major, | |
| 52 jfloat touch_minor, | |
| 53 jfloat orientation, | |
| 54 jfloat h_wheel, | |
| 55 jfloat v_wheel); | |
| 56 bool KeyEvent(JNIEnv* env, | |
| 57 jobject obj, | |
| 58 bool pressed, | |
| 59 jint key_code, | |
| 60 jint unicode_character); | |
| 61 | |
| 62 private: | |
| 63 // Overridden from PlatformViewport: | |
| 64 void Init(const gfx::Rect& bounds) override; | |
| 65 void Show() override; | |
| 66 void Hide() override; | |
| 67 void Close() override; | |
| 68 gfx::Size GetSize() override; | |
| 69 void SetBounds(const gfx::Rect& bounds) override; | |
| 70 | |
| 71 void ReleaseWindow(); | |
| 72 | |
| 73 Delegate* const delegate_; | |
| 74 JavaObjectWeakGlobalRef java_platform_viewport_android_; | |
| 75 ANativeWindow* window_; | |
| 76 ui::SequentialIDGenerator id_generator_; | |
| 77 | |
| 78 gfx::Size size_; | |
| 79 | |
| 80 base::WeakPtrFactory<PlatformViewportAndroid> weak_factory_; | |
| 81 | |
| 82 DISALLOW_COPY_AND_ASSIGN(PlatformViewportAndroid); | |
| 83 }; | |
| 84 | |
| 85 } // namespace native_viewport | |
| 86 | |
| 87 #endif // COMPONENTS_VIEW_MANAGER_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_ANDROID_H_ | |
| OLD | NEW |