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 "blimp/client/app/android/blimp_compositor_manager_android.h" |
| 13 #include "blimp/net/blimp_connection_details.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 namespace client { | 21 namespace client { |
21 | 22 |
22 class RenderWidgetFeature; | 23 class RenderWidgetFeature; |
23 | 24 |
24 // The native component of org.chromium.blimp.BlimpView. This builds and | 25 // The native component of org.chromium.blimp.BlimpView. This builds and |
25 // maintains a BlimpCompositorAndroid and handles notifying the compositor of | 26 // maintains a BlimpCompositorAndroid and handles notifying the compositor of |
26 // SurfaceView surface changes (size, creation, destruction, etc.). | 27 // SurfaceView surface changes (size, creation, destruction, etc.). |
27 class BlimpView : public BlimpCompositorManagerClient { | 28 class BlimpView : public BlimpCompositorManagerClient { |
28 public: | 29 public: |
29 static bool RegisterJni(JNIEnv* env); | 30 static bool RegisterJni(JNIEnv* env); |
30 | 31 |
31 // |real_size| is the total display area including system decorations (see | 32 // |real_size| is the total display area including system decorations (see |
32 // android.view.Display.getRealSize()). |size| is the total display | 33 // android.view.Display.getRealSize()). |size| is the total display |
33 // area not including system decorations (see android.view.Display.getSize()). | 34 // area not including system decorations (see android.view.Display.getSize()). |
34 // |dp_to_px| is the scale factor that is required to convert dp (device | 35 // |dp_to_px| is the scale factor that is required to convert dp (device |
35 // pixels) to px. | 36 // pixels) to px. |
36 BlimpView(JNIEnv* env, | 37 BlimpView(JNIEnv* env, |
37 const base::android::JavaParamRef<jobject>& jobj, | 38 const base::android::JavaParamRef<jobject>& jobj, |
38 const gfx::Size& real_size, | 39 const gfx::Size& real_size, |
39 const gfx::Size& size, | 40 const gfx::Size& size, |
40 float dp_to_px, | 41 float dp_to_px, |
41 RenderWidgetFeature* render_widget_feature); | 42 RenderWidgetFeature* render_widget_feature, |
| 43 BlimpConnectionDetails* blimp_connection_details); |
42 | 44 |
43 // Methods called from Java via JNI. | 45 // Methods called from Java via JNI. |
44 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& jobj); | 46 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& jobj); |
45 void SetNeedsComposite(JNIEnv* env, | 47 void SetNeedsComposite(JNIEnv* env, |
46 const base::android::JavaParamRef<jobject>& jobj); | 48 const base::android::JavaParamRef<jobject>& jobj); |
47 void OnSurfaceChanged(JNIEnv* env, | 49 void OnSurfaceChanged(JNIEnv* env, |
48 const base::android::JavaParamRef<jobject>& jobj, | 50 const base::android::JavaParamRef<jobject>& jobj, |
49 jint format, | 51 jint format, |
50 jint width, | 52 jint width, |
51 jint height, | 53 jint height, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 jint android_button_state, | 89 jint android_button_state, |
88 jint android_meta_state); | 90 jint android_meta_state); |
89 | 91 |
90 private: | 92 private: |
91 virtual ~BlimpView(); | 93 virtual ~BlimpView(); |
92 | 94 |
93 void ReleaseAcceleratedWidget(); | 95 void ReleaseAcceleratedWidget(); |
94 | 96 |
95 // BlimpCompositorManagerClient implementation. | 97 // BlimpCompositorManagerClient implementation. |
96 void OnSwapBuffersCompleted() override; | 98 void OnSwapBuffersCompleted() override; |
| 99 void DidCommitAndDrawFrame() override; |
97 | 100 |
98 // Reference to the Java object which owns this class. | 101 // Reference to the Java object which owns this class. |
99 base::android::ScopedJavaGlobalRef<jobject> java_obj_; | 102 base::android::ScopedJavaGlobalRef<jobject> java_obj_; |
100 | 103 |
101 const float device_scale_factor_; | 104 const float device_scale_factor_; |
102 | 105 |
103 std::unique_ptr<BlimpCompositorManagerAndroid> compositor_manager_; | 106 std::unique_ptr<BlimpCompositorManagerAndroid> compositor_manager_; |
104 | 107 |
105 // The format of the current surface owned by |compositor_|. See | 108 // The format of the current surface owned by |compositor_|. See |
106 // android.graphics.PixelFormat.java. | 109 // android.graphics.PixelFormat.java. |
107 int current_surface_format_; | 110 int current_surface_format_; |
108 | 111 |
109 gfx::AcceleratedWidget window_; | 112 gfx::AcceleratedWidget window_; |
110 | 113 |
| 114 BlimpConnectionDetails* blimp_connection_details_; |
| 115 |
111 DISALLOW_COPY_AND_ASSIGN(BlimpView); | 116 DISALLOW_COPY_AND_ASSIGN(BlimpView); |
112 }; | 117 }; |
113 | 118 |
114 } // namespace client | 119 } // namespace client |
115 } // namespace blimp | 120 } // namespace blimp |
116 | 121 |
117 #endif // BLIMP_CLIENT_APP_ANDROID_BLIMP_VIEW_H_ | 122 #endif // BLIMP_CLIENT_APP_ANDROID_BLIMP_VIEW_H_ |
OLD | NEW |