OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 BLIMP_CLIENT_APP_ANDROID_BLIMP_VIEW_H_ | 5 #ifndef BLIMP_CLIENT_APP_ANDROID_BLIMP_CONTENTS_DISPLAY_H_ |
6 #define BLIMP_CLIENT_APP_ANDROID_BLIMP_VIEW_H_ | 6 #define BLIMP_CLIENT_APP_ANDROID_BLIMP_CONTENTS_DISPLAY_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
14 | 14 |
15 namespace gfx { | 15 namespace gfx { |
16 class Size; | 16 class Size; |
17 } | 17 } |
18 | 18 |
19 namespace blimp { | 19 namespace blimp { |
20 namespace client { | 20 namespace client { |
21 class BlimpCompositorDependencies; | 21 class BlimpCompositorDependencies; |
22 class BlimpDocumentManager; | 22 class BlimpDocumentManager; |
23 class BrowserCompositor; | 23 class BrowserCompositor; |
24 class RenderWidgetFeature; | 24 class RenderWidgetFeature; |
25 | 25 |
26 namespace app { | 26 namespace app { |
27 | 27 |
28 // The native component of org.chromium.blimp.BlimpView. This builds and | 28 // The native component of org.chromium.blimp.BlimpContentsDisplay. This builds |
29 // maintains a BlimpCompositorAndroid and handles notifying the compositor of | 29 // and maintains a BlimpCompositorAndroid and handles notifying the compositor |
30 // SurfaceView surface changes (size, creation, destruction, etc.). | 30 // of SurfaceView surface changes (size, creation, destruction, etc.). |
31 class BlimpView { | 31 class BlimpContentsDisplay { |
32 public: | 32 public: |
33 static bool RegisterJni(JNIEnv* env); | 33 static bool RegisterJni(JNIEnv* env); |
34 | 34 |
35 // |real_size| is the total display area including system decorations (see | 35 // |real_size| is the total display area including system decorations (see |
36 // android.view.Display.getRealSize()). |size| is the total display | 36 // android.view.Display.getRealSize()). |size| is the total display |
37 // area not including system decorations (see android.view.Display.getSize()). | 37 // area not including system decorations (see android.view.Display.getSize()). |
38 // |dp_to_px| is the scale factor that is required to convert dp (device | 38 // |dp_to_px| is the scale factor that is required to convert dp (device |
39 // pixels) to px. | 39 // pixels) to px. |
40 BlimpView(JNIEnv* env, | 40 BlimpContentsDisplay( |
41 const base::android::JavaParamRef<jobject>& jobj, | 41 JNIEnv* env, |
42 const gfx::Size& real_size, | 42 const base::android::JavaParamRef<jobject>& jobj, |
43 const gfx::Size& size, | 43 const gfx::Size& real_size, |
44 float dp_to_px, | 44 const gfx::Size& size, |
45 blimp::client::RenderWidgetFeature* render_widget_feature); | 45 float dp_to_px, |
| 46 blimp::client::RenderWidgetFeature* render_widget_feature); |
46 | 47 |
47 // Methods called from Java via JNI. | 48 // Methods called from Java via JNI. |
48 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& jobj); | 49 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& jobj); |
49 void OnContentAreaSizeChanged( | 50 void OnContentAreaSizeChanged( |
50 JNIEnv* env, | 51 JNIEnv* env, |
51 const base::android::JavaParamRef<jobject>& jobj, | 52 const base::android::JavaParamRef<jobject>& jobj, |
52 jint width, | 53 jint width, |
53 jint height, | 54 jint height, |
54 jfloat dpToPx); | 55 jfloat dpToPx); |
55 void OnSurfaceChanged(JNIEnv* env, | 56 void OnSurfaceChanged(JNIEnv* env, |
(...skipping 30 matching lines...) Expand all Loading... |
86 jfloat tilt_0, | 87 jfloat tilt_0, |
87 jfloat tilt_1, | 88 jfloat tilt_1, |
88 jfloat raw_pos_x, | 89 jfloat raw_pos_x, |
89 jfloat raw_pos_y, | 90 jfloat raw_pos_y, |
90 jint android_tool_type_0, | 91 jint android_tool_type_0, |
91 jint android_tool_type_1, | 92 jint android_tool_type_1, |
92 jint android_button_state, | 93 jint android_button_state, |
93 jint android_meta_state); | 94 jint android_meta_state); |
94 | 95 |
95 private: | 96 private: |
96 virtual ~BlimpView(); | 97 virtual ~BlimpContentsDisplay(); |
97 | 98 |
98 void OnSwapBuffersCompleted(); | 99 void OnSwapBuffersCompleted(); |
99 | 100 |
100 void SetSurface(jobject surface); | 101 void SetSurface(jobject surface); |
101 | 102 |
102 // Reference to the Java object which owns this class. | 103 // Reference to the Java object which owns this class. |
103 base::android::ScopedJavaGlobalRef<jobject> java_obj_; | 104 base::android::ScopedJavaGlobalRef<jobject> java_obj_; |
104 | 105 |
105 const float device_scale_factor_; | 106 const float device_scale_factor_; |
106 | 107 |
107 std::unique_ptr<BlimpCompositorDependencies> compositor_dependencies_; | 108 std::unique_ptr<BlimpCompositorDependencies> compositor_dependencies_; |
108 std::unique_ptr<BlimpDocumentManager> document_manager_; | 109 std::unique_ptr<BlimpDocumentManager> document_manager_; |
109 std::unique_ptr<BrowserCompositor> compositor_; | 110 std::unique_ptr<BrowserCompositor> compositor_; |
110 | 111 |
111 // The format of the current surface owned by |compositor_|. See | 112 // The format of the current surface owned by |compositor_|. See |
112 // android.graphics.PixelFormat.java. | 113 // android.graphics.PixelFormat.java. |
113 int current_surface_format_; | 114 int current_surface_format_; |
114 | 115 |
115 gfx::AcceleratedWidget window_; | 116 gfx::AcceleratedWidget window_; |
116 | 117 |
117 base::WeakPtrFactory<BlimpView> weak_ptr_factory_; | 118 base::WeakPtrFactory<BlimpContentsDisplay> weak_ptr_factory_; |
118 | 119 |
119 DISALLOW_COPY_AND_ASSIGN(BlimpView); | 120 DISALLOW_COPY_AND_ASSIGN(BlimpContentsDisplay); |
120 }; | 121 }; |
121 | 122 |
122 } // namespace app | 123 } // namespace app |
123 } // namespace client | 124 } // namespace client |
124 } // namespace blimp | 125 } // namespace blimp |
125 | 126 |
126 #endif // BLIMP_CLIENT_APP_ANDROID_BLIMP_VIEW_H_ | 127 #endif // BLIMP_CLIENT_APP_ANDROID_BLIMP_CONTENTS_DISPLAY_H_ |
OLD | NEW |