| 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 #include "blimp/client/app/android/blimp_view.h" | 5 #include "blimp/client/app/android/blimp_view.h" |
| 6 | 6 |
| 7 #include <android/native_window_jni.h> | 7 #include <android/native_window_jni.h> |
| 8 | 8 |
| 9 #include "blimp/client/app/android/blimp_client_session_android.h" | 9 #include "blimp/client/app/android/blimp_client_session_android.h" |
| 10 #include "blimp/client/app/android/blimp_compositor_manager_android.h" | |
| 11 #include "jni/BlimpView_jni.h" | 10 #include "jni/BlimpView_jni.h" |
| 12 #include "ui/events/android/motion_event_android.h" | 11 #include "ui/events/android/motion_event_android.h" |
| 13 #include "ui/gfx/geometry/size.h" | 12 #include "ui/gfx/geometry/size.h" |
| 14 | 13 |
| 15 namespace blimp { | 14 namespace blimp { |
| 16 namespace client { | 15 namespace client { |
| 17 | 16 |
| 18 static jlong Init(JNIEnv* env, | 17 static jlong Init(JNIEnv* env, |
| 19 const JavaParamRef<jobject>& jobj, | 18 const JavaParamRef<jobject>& jobj, |
| 20 const JavaParamRef<jobject>& blimp_client_session, | 19 const JavaParamRef<jobject>& blimp_client_session, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 41 return RegisterNativesImpl(env); | 40 return RegisterNativesImpl(env); |
| 42 } | 41 } |
| 43 | 42 |
| 44 BlimpView::BlimpView(JNIEnv* env, | 43 BlimpView::BlimpView(JNIEnv* env, |
| 45 const JavaParamRef<jobject>& jobj, | 44 const JavaParamRef<jobject>& jobj, |
| 46 const gfx::Size& real_size, | 45 const gfx::Size& real_size, |
| 47 const gfx::Size& size, | 46 const gfx::Size& size, |
| 48 float dp_to_px, | 47 float dp_to_px, |
| 49 RenderWidgetFeature* render_widget_feature) | 48 RenderWidgetFeature* render_widget_feature) |
| 50 : device_scale_factor_(dp_to_px), | 49 : device_scale_factor_(dp_to_px), |
| 51 compositor_manager_(BlimpCompositorManagerAndroid::Create(real_size, | 50 compositor_manager_( |
| 52 size, | 51 BlimpCompositorManagerAndroid::Create(real_size, |
| 53 render_widget_feature)), | 52 size, |
| 53 render_widget_feature, |
| 54 this)), |
| 54 current_surface_format_(0), | 55 current_surface_format_(0), |
| 55 window_(gfx::kNullAcceleratedWidget) { | 56 window_(gfx::kNullAcceleratedWidget) { |
| 56 java_obj_.Reset(env, jobj); | 57 java_obj_.Reset(env, jobj); |
| 57 } | 58 } |
| 58 | 59 |
| 59 BlimpView::~BlimpView() { | 60 BlimpView::~BlimpView() { |
| 60 ReleaseAcceleratedWidget(); | 61 ReleaseAcceleratedWidget(); |
| 61 } | 62 } |
| 62 | 63 |
| 63 void BlimpView::Destroy(JNIEnv* env, const JavaParamRef<jobject>& jobj) { | 64 void BlimpView::Destroy(JNIEnv* env, const JavaParamRef<jobject>& jobj) { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 android_button_state, | 168 android_button_state, |
| 168 android_meta_state, | 169 android_meta_state, |
| 169 raw_pos_x - pos_x_0, | 170 raw_pos_x - pos_x_0, |
| 170 raw_pos_y - pos_y_0, | 171 raw_pos_y - pos_y_0, |
| 171 pointer0, | 172 pointer0, |
| 172 pointer1); | 173 pointer1); |
| 173 | 174 |
| 174 return compositor_manager_->OnTouchEvent(event); | 175 return compositor_manager_->OnTouchEvent(event); |
| 175 } | 176 } |
| 176 | 177 |
| 178 void BlimpView::OnSwapBuffersCompleted() { |
| 179 JNIEnv* env = base::android::AttachCurrentThread(); |
| 180 Java_BlimpView_onSwapBuffersCompleted(env, java_obj_.obj()); |
| 181 } |
| 182 |
| 177 } // namespace client | 183 } // namespace client |
| 178 } // namespace blimp | 184 } // namespace blimp |
| OLD | NEW |