| 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 namespace client { | 21 namespace client { |
| 21 | 22 class BlimpContents; |
| 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 { |
| 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, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 jfloat raw_pos_y, | 85 jfloat raw_pos_y, |
| 85 jint android_tool_type_0, | 86 jint android_tool_type_0, |
| 86 jint android_tool_type_1, | 87 jint android_tool_type_1, |
| 87 jint android_button_state, | 88 jint android_button_state, |
| 88 jint android_meta_state); | 89 jint android_meta_state); |
| 89 | 90 |
| 90 private: | 91 private: |
| 91 virtual ~BlimpView(); | 92 virtual ~BlimpView(); |
| 92 | 93 |
| 93 void ReleaseAcceleratedWidget(); | 94 void ReleaseAcceleratedWidget(); |
| 94 | 95 void OnSwapBuffersCompleted(); |
| 95 // BlimpCompositorManagerClient implementation. | |
| 96 void OnSwapBuffersCompleted() override; | |
| 97 void DidCommitAndDrawFrame() override; | |
| 98 | 96 |
| 99 // Reference to the Java object which owns this class. | 97 // Reference to the Java object which owns this class. |
| 100 base::android::ScopedJavaGlobalRef<jobject> java_obj_; | 98 base::android::ScopedJavaGlobalRef<jobject> java_obj_; |
| 101 | 99 |
| 102 const float device_scale_factor_; | 100 const float device_scale_factor_; |
| 103 | 101 |
| 104 std::unique_ptr<BlimpCompositorManagerAndroid> compositor_manager_; | 102 BlimpContentsManager blimp_contents_manager_; |
| 103 std::unique_ptr<BlimpContentsImpl> blimp_contents_; |
| 105 | 104 |
| 106 // The format of the current surface owned by |compositor_|. See | 105 // The format of the current surface owned by |compositor_|. See |
| 107 // android.graphics.PixelFormat.java. | 106 // android.graphics.PixelFormat.java. |
| 108 int current_surface_format_; | 107 int current_surface_format_; |
| 109 | 108 |
| 110 gfx::AcceleratedWidget window_; | 109 gfx::AcceleratedWidget window_; |
| 111 | 110 |
| 111 // BlimpConnectionStatistics* blimp_connection_statistics_; |
| 112 base::WeakPtrFactory<BlimpView> weak_ptr_factory_; |
| 113 |
| 112 DISALLOW_COPY_AND_ASSIGN(BlimpView); | 114 DISALLOW_COPY_AND_ASSIGN(BlimpView); |
| 113 }; | 115 }; |
| 114 | 116 |
| 115 } // namespace client | 117 } // namespace client |
| 116 } // namespace blimp | 118 } // namespace blimp |
| 117 | 119 |
| 118 #endif // BLIMP_CLIENT_APP_ANDROID_BLIMP_VIEW_H_ | 120 #endif // BLIMP_CLIENT_APP_ANDROID_BLIMP_VIEW_H_ |
| OLD | NEW |