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