| 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 SERVICES_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_ANDROID_H_ | 5 #ifndef SERVICES_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_ANDROID_H_ |
| 6 #define SERVICES_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_ANDROID_H_ | 6 #define SERVICES_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 "services/native_viewport/platform_viewport.h" | 11 #include "services/native_viewport/platform_viewport.h" |
| 12 #include "ui/events/event_constants.h" | 12 #include "ui/events/event_constants.h" |
| 13 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
| 14 #include "ui/gfx/sequential_id_generator.h" | 14 #include "ui/gfx/sequential_id_generator.h" |
| 15 #include "ui/gfx/size.h" | 15 #include "ui/gfx/size.h" |
| 16 | 16 |
| 17 namespace gpu { | 17 namespace gpu { |
| 18 class GLInProcessContext; | 18 class GLInProcessContext; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace mojo { |
| 22 class ApplicationImpl; |
| 23 } |
| 24 |
| 21 struct ANativeWindow; | 25 struct ANativeWindow; |
| 22 | 26 |
| 23 namespace native_viewport { | 27 namespace native_viewport { |
| 24 | 28 |
| 25 class PlatformViewportAndroid : public PlatformViewport { | 29 class PlatformViewportAndroid : public PlatformViewport { |
| 26 public: | 30 public: |
| 27 static bool Register(JNIEnv* env); | 31 static bool Register(JNIEnv* env); |
| 28 | 32 |
| 29 explicit PlatformViewportAndroid(Delegate* delegate); | 33 explicit PlatformViewportAndroid(mojo::ApplicationImpl* application, |
| 34 Delegate* delegate); |
| 30 virtual ~PlatformViewportAndroid(); | 35 virtual ~PlatformViewportAndroid(); |
| 31 | 36 |
| 32 void Destroy(JNIEnv* env, jobject obj); | 37 void Destroy(JNIEnv* env, jobject obj); |
| 38 void SurfaceAttached(JNIEnv* env, jobject obj, jobject platform_viewport); |
| 33 void SurfaceCreated(JNIEnv* env, jobject obj, jobject jsurface); | 39 void SurfaceCreated(JNIEnv* env, jobject obj, jobject jsurface); |
| 34 void SurfaceDestroyed(JNIEnv* env, jobject obj); | 40 void SurfaceDestroyed(JNIEnv* env, jobject obj); |
| 35 void SurfaceSetSize(JNIEnv* env, | 41 void SurfaceSetSize(JNIEnv* env, |
| 36 jobject obj, | 42 jobject obj, |
| 37 jint width, | 43 jint width, |
| 38 jint height, | 44 jint height, |
| 39 jfloat density); | 45 jfloat density); |
| 40 bool TouchEvent(JNIEnv* env, | 46 bool TouchEvent(JNIEnv* env, |
| 41 jobject obj, | 47 jobject obj, |
| 42 jlong time_ms, | 48 jlong time_ms, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 55 // Overridden from PlatformViewport: | 61 // Overridden from PlatformViewport: |
| 56 virtual void Init(const gfx::Rect& bounds) override; | 62 virtual void Init(const gfx::Rect& bounds) override; |
| 57 virtual void Show() override; | 63 virtual void Show() override; |
| 58 virtual void Hide() override; | 64 virtual void Hide() override; |
| 59 virtual void Close() override; | 65 virtual void Close() override; |
| 60 virtual gfx::Size GetSize() override; | 66 virtual gfx::Size GetSize() override; |
| 61 virtual void SetBounds(const gfx::Rect& bounds) override; | 67 virtual void SetBounds(const gfx::Rect& bounds) override; |
| 62 | 68 |
| 63 void ReleaseWindow(); | 69 void ReleaseWindow(); |
| 64 | 70 |
| 71 mojo::ApplicationImpl* application_; |
| 65 Delegate* const delegate_; | 72 Delegate* const delegate_; |
| 66 JavaObjectWeakGlobalRef java_platform_viewport_android_; | 73 JavaObjectWeakGlobalRef java_platform_viewport_request_; |
| 67 ANativeWindow* window_; | 74 ANativeWindow* window_; |
| 68 mojo::ViewportMetricsPtr metrics_; | 75 mojo::ViewportMetricsPtr metrics_; |
| 69 ui::SequentialIDGenerator id_generator_; | 76 ui::SequentialIDGenerator id_generator_; |
| 70 | 77 |
| 71 base::WeakPtrFactory<PlatformViewportAndroid> weak_factory_; | 78 base::WeakPtrFactory<PlatformViewportAndroid> weak_factory_; |
| 72 | 79 |
| 73 DISALLOW_COPY_AND_ASSIGN(PlatformViewportAndroid); | 80 DISALLOW_COPY_AND_ASSIGN(PlatformViewportAndroid); |
| 74 }; | 81 }; |
| 75 | 82 |
| 76 } // namespace native_viewport | 83 } // namespace native_viewport |
| 77 | 84 |
| 78 #endif // SERVICES_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_ANDROID_H_ | 85 #endif // SERVICES_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_ANDROID_H_ |
| OLD | NEW |