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