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