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 MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_ANDROID_H_ | 5 #ifndef MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_ANDROID_H_ |
6 #define MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_ANDROID_H_ | 6 #define MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_ANDROID_H_ |
7 | 7 |
8 #include "base/android/jni_weak_ref.h" | 8 #include "base/android/jni_weak_ref.h" |
9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 struct ANativeWindow; | 22 struct ANativeWindow; |
23 | 23 |
24 namespace mojo { | 24 namespace mojo { |
25 namespace services { | 25 namespace services { |
26 | 26 |
27 class MOJO_NATIVE_VIEWPORT_EXPORT NativeViewportAndroid | 27 class MOJO_NATIVE_VIEWPORT_EXPORT NativeViewportAndroid |
28 : public NativeViewport { | 28 : public NativeViewport { |
29 public: | 29 public: |
30 static MOJO_NATIVE_VIEWPORT_EXPORT bool Register(JNIEnv* env); | 30 static MOJO_NATIVE_VIEWPORT_EXPORT bool Register(JNIEnv* env); |
31 | 31 |
32 explicit NativeViewportAndroid(shell::Context* context, | 32 explicit NativeViewportAndroid(NativeViewportDelegate* delegate); |
33 NativeViewportDelegate* delegate); | |
34 virtual ~NativeViewportAndroid(); | 33 virtual ~NativeViewportAndroid(); |
35 | 34 |
36 void Destroy(JNIEnv* env, jobject obj); | 35 void Destroy(JNIEnv* env, jobject obj); |
37 void SurfaceCreated(JNIEnv* env, jobject obj, jobject jsurface); | 36 void SurfaceCreated(JNIEnv* env, jobject obj, jobject jsurface); |
38 void SurfaceDestroyed(JNIEnv* env, jobject obj); | 37 void SurfaceDestroyed(JNIEnv* env, jobject obj); |
39 void SurfaceSetSize(JNIEnv* env, jobject obj, jint width, jint height); | 38 void SurfaceSetSize(JNIEnv* env, jobject obj, jint width, jint height); |
40 bool TouchEvent(JNIEnv* env, jobject obj, jint pointer_id, jint action, | 39 bool TouchEvent(JNIEnv* env, jobject obj, jint pointer_id, jint action, |
41 jfloat x, jfloat y, jlong time_ms); | 40 jfloat x, jfloat y, jlong time_ms); |
42 | 41 |
43 private: | 42 private: |
44 // Overridden from NativeViewport: | 43 // Overridden from NativeViewport: |
45 virtual void Init(const gfx::Rect& bounds) OVERRIDE; | 44 virtual void Init(const gfx::Rect& bounds) OVERRIDE; |
46 virtual void Show() OVERRIDE; | 45 virtual void Show() OVERRIDE; |
47 virtual void Hide() OVERRIDE; | 46 virtual void Hide() OVERRIDE; |
48 virtual void Close() OVERRIDE; | 47 virtual void Close() OVERRIDE; |
49 virtual gfx::Size GetSize() OVERRIDE; | 48 virtual gfx::Size GetSize() OVERRIDE; |
50 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; | 49 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; |
51 virtual void SetCapture() OVERRIDE; | 50 virtual void SetCapture() OVERRIDE; |
52 virtual void ReleaseCapture() OVERRIDE; | 51 virtual void ReleaseCapture() OVERRIDE; |
53 | 52 |
54 void ReleaseWindow(); | 53 void ReleaseWindow(); |
55 | 54 |
56 NativeViewportDelegate* delegate_; | 55 NativeViewportDelegate* delegate_; |
57 shell::Context* context_; | |
58 ANativeWindow* window_; | 56 ANativeWindow* window_; |
59 gfx::Rect bounds_; | 57 gfx::Rect bounds_; |
60 ui::SequentialIDGenerator id_generator_; | 58 ui::SequentialIDGenerator id_generator_; |
61 | 59 |
62 base::WeakPtrFactory<NativeViewportAndroid> weak_factory_; | 60 base::WeakPtrFactory<NativeViewportAndroid> weak_factory_; |
63 | 61 |
64 DISALLOW_COPY_AND_ASSIGN(NativeViewportAndroid); | 62 DISALLOW_COPY_AND_ASSIGN(NativeViewportAndroid); |
65 }; | 63 }; |
66 | 64 |
67 | 65 |
68 } // namespace services | 66 } // namespace services |
69 } // namespace mojo | 67 } // namespace mojo |
70 | 68 |
71 #endif // MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_ANDROID_H_ | 69 #endif // MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_ANDROID_H_ |
OLD | NEW |