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