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