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_VIEW_H_ |
6 #define BLIMP_CLIENT_APP_ANDROID_BLIMP_VIEW_H_ | 6 #define BLIMP_CLIENT_APP_ANDROID_BLIMP_VIEW_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 "blimp/client/app/android/blimp_compositor_manager_android.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "blimp/client/core/contents/blimp_contents_manager.h" |
13 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
14 | 15 |
15 namespace gfx { | 16 namespace gfx { |
16 class Size; | 17 class Size; |
17 } | 18 } |
18 | 19 |
19 namespace blimp { | 20 namespace blimp { |
20 class BlimpConnectionStatistics; | 21 class BlimpConnectionStatistics; |
21 | 22 |
22 namespace client { | 23 namespace client { |
23 | 24 class BlimpContents; |
24 class RenderWidgetFeature; | 25 class RenderWidgetFeature; |
25 | 26 |
26 // The native component of org.chromium.blimp.BlimpView. This builds and | 27 // The native component of org.chromium.blimp.BlimpView. This builds and |
27 // maintains a BlimpCompositorAndroid and handles notifying the compositor of | 28 // maintains a BlimpCompositorAndroid and handles notifying the compositor of |
28 // SurfaceView surface changes (size, creation, destruction, etc.). | 29 // SurfaceView surface changes (size, creation, destruction, etc.). |
29 class BlimpView : public BlimpCompositorManagerClient { | 30 class BlimpView { |
30 public: | 31 public: |
31 static bool RegisterJni(JNIEnv* env); | 32 static bool RegisterJni(JNIEnv* env); |
32 | 33 |
33 // |real_size| is the total display area including system decorations (see | 34 // |real_size| is the total display area including system decorations (see |
34 // android.view.Display.getRealSize()). |size| is the total display | 35 // android.view.Display.getRealSize()). |size| is the total display |
35 // area not including system decorations (see android.view.Display.getSize()). | 36 // area not including system decorations (see android.view.Display.getSize()). |
36 // |dp_to_px| is the scale factor that is required to convert dp (device | 37 // |dp_to_px| is the scale factor that is required to convert dp (device |
37 // pixels) to px. | 38 // pixels) to px. |
38 BlimpView(JNIEnv* env, | 39 BlimpView(JNIEnv* env, |
39 const base::android::JavaParamRef<jobject>& jobj, | 40 const base::android::JavaParamRef<jobject>& jobj, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 jfloat raw_pos_y, | 88 jfloat raw_pos_y, |
88 jint android_tool_type_0, | 89 jint android_tool_type_0, |
89 jint android_tool_type_1, | 90 jint android_tool_type_1, |
90 jint android_button_state, | 91 jint android_button_state, |
91 jint android_meta_state); | 92 jint android_meta_state); |
92 | 93 |
93 private: | 94 private: |
94 virtual ~BlimpView(); | 95 virtual ~BlimpView(); |
95 | 96 |
96 void ReleaseAcceleratedWidget(); | 97 void ReleaseAcceleratedWidget(); |
97 | 98 void OnSwapBuffersCompleted(); |
98 // BlimpCompositorManagerClient implementation. | |
99 void OnSwapBuffersCompleted() override; | |
100 void DidCommitAndDrawFrame() override; | |
101 | 99 |
102 // Reference to the Java object which owns this class. | 100 // Reference to the Java object which owns this class. |
103 base::android::ScopedJavaGlobalRef<jobject> java_obj_; | 101 base::android::ScopedJavaGlobalRef<jobject> java_obj_; |
104 | 102 |
105 const float device_scale_factor_; | 103 const float device_scale_factor_; |
106 | 104 |
107 std::unique_ptr<BlimpCompositorManagerAndroid> compositor_manager_; | 105 BlimpContentsManager blimp_contents_manager_; |
| 106 std::unique_ptr<BlimpContentsImpl> blimp_contents_; |
108 | 107 |
109 // The format of the current surface owned by |compositor_|. See | 108 // The format of the current surface owned by |compositor_|. See |
110 // android.graphics.PixelFormat.java. | 109 // android.graphics.PixelFormat.java. |
111 int current_surface_format_; | 110 int current_surface_format_; |
112 | 111 |
113 gfx::AcceleratedWidget window_; | 112 gfx::AcceleratedWidget window_; |
114 | 113 |
115 BlimpConnectionStatistics* blimp_connection_statistics_; | 114 // BlimpConnectionStatistics* blimp_connection_statistics_; |
| 115 base::WeakPtrFactory<BlimpView> weak_ptr_factory_; |
116 | 116 |
117 DISALLOW_COPY_AND_ASSIGN(BlimpView); | 117 DISALLOW_COPY_AND_ASSIGN(BlimpView); |
118 }; | 118 }; |
119 | 119 |
120 } // namespace client | 120 } // namespace client |
121 } // namespace blimp | 121 } // namespace blimp |
122 | 122 |
123 #endif // BLIMP_CLIENT_APP_ANDROID_BLIMP_VIEW_H_ | 123 #endif // BLIMP_CLIENT_APP_ANDROID_BLIMP_VIEW_H_ |
OLD | NEW |