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 MOJO_SERVICES_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_ANDROID_H_ | |
6 #define MOJO_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/rect.h" | |
15 #include "ui/gfx/sequential_id_generator.h" | |
16 #include "ui/gfx/size.h" | |
17 | |
18 namespace gpu { | |
19 class GLInProcessContext; | |
20 } | |
21 | |
22 struct ANativeWindow; | |
23 | |
24 namespace mojo { | |
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, jobject obj, jint width, jint height); | |
37 bool TouchEvent(JNIEnv* env, jobject obj, jint pointer_id, jint action, | |
38 jfloat x, jfloat y, jlong time_ms); | |
39 | |
40 private: | |
41 // Overridden from PlatformViewport: | |
42 virtual void Init(const gfx::Rect& bounds) override; | |
43 virtual void Show() override; | |
44 virtual void Hide() override; | |
45 virtual void Close() override; | |
46 virtual gfx::Size GetSize() override; | |
47 virtual void SetBounds(const gfx::Rect& bounds) override; | |
48 virtual void SetCapture() override; | |
49 virtual void ReleaseCapture() override; | |
50 | |
51 void ReleaseWindow(); | |
52 | |
53 Delegate* delegate_; | |
54 ANativeWindow* window_; | |
55 gfx::Rect bounds_; | |
56 ui::SequentialIDGenerator id_generator_; | |
57 | |
58 base::WeakPtrFactory<PlatformViewportAndroid> weak_factory_; | |
59 | |
60 DISALLOW_COPY_AND_ASSIGN(PlatformViewportAndroid); | |
61 }; | |
62 | |
63 | |
64 } // namespace mojo | |
65 | |
66 #endif // MOJO_SERVICES_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_ANDROID_H_ | |
OLD | NEW |