| 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 namespace client { | 20 namespace client { |
| 21 class BrowserCompositor; | 21 class BrowserCompositor; |
| 22 |
| 23 namespace app { |
| 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 { | 29 class BlimpView { |
| 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 blimp::client::RenderWidgetFeature* render_widget_feature); |
| 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 OnContentAreaSizeChanged( | 47 void OnContentAreaSizeChanged( |
| 46 JNIEnv* env, | 48 JNIEnv* env, |
| 47 const base::android::JavaParamRef<jobject>& jobj, | 49 const base::android::JavaParamRef<jobject>& jobj, |
| 48 jint width, | 50 jint width, |
| 49 jint height, | 51 jint height, |
| 50 jfloat dpToPx); | 52 jfloat dpToPx); |
| 51 void OnSurfaceChanged(JNIEnv* env, | 53 void OnSurfaceChanged(JNIEnv* env, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // android.graphics.PixelFormat.java. | 110 // android.graphics.PixelFormat.java. |
| 109 int current_surface_format_; | 111 int current_surface_format_; |
| 110 | 112 |
| 111 gfx::AcceleratedWidget window_; | 113 gfx::AcceleratedWidget window_; |
| 112 | 114 |
| 113 base::WeakPtrFactory<BlimpView> weak_ptr_factory_; | 115 base::WeakPtrFactory<BlimpView> weak_ptr_factory_; |
| 114 | 116 |
| 115 DISALLOW_COPY_AND_ASSIGN(BlimpView); | 117 DISALLOW_COPY_AND_ASSIGN(BlimpView); |
| 116 }; | 118 }; |
| 117 | 119 |
| 120 } // namespace app |
| 118 } // namespace client | 121 } // namespace client |
| 119 } // namespace blimp | 122 } // namespace blimp |
| 120 | 123 |
| 121 #endif // BLIMP_CLIENT_APP_ANDROID_BLIMP_VIEW_H_ | 124 #endif // BLIMP_CLIENT_APP_ANDROID_BLIMP_VIEW_H_ |
| OLD | NEW |