Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "android_webview/native/aw_contents.h" | 5 #include "android_webview/native/aw_contents.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "android_webview/browser/aw_browser_context.h" | 10 #include "android_webview/browser/aw_browser_context.h" |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 #include "android_webview/native/aw_contents_lifecycle_notifier.h" | 27 #include "android_webview/native/aw_contents_lifecycle_notifier.h" |
| 28 #include "android_webview/native/aw_gl_functor.h" | 28 #include "android_webview/native/aw_gl_functor.h" |
| 29 #include "android_webview/native/aw_message_port_service_impl.h" | 29 #include "android_webview/native/aw_message_port_service_impl.h" |
| 30 #include "android_webview/native/aw_pdf_exporter.h" | 30 #include "android_webview/native/aw_pdf_exporter.h" |
| 31 #include "android_webview/native/aw_picture.h" | 31 #include "android_webview/native/aw_picture.h" |
| 32 #include "android_webview/native/aw_web_contents_delegate.h" | 32 #include "android_webview/native/aw_web_contents_delegate.h" |
| 33 #include "android_webview/native/java_browser_view_renderer_helper.h" | 33 #include "android_webview/native/java_browser_view_renderer_helper.h" |
| 34 #include "android_webview/native/permission/aw_permission_request.h" | 34 #include "android_webview/native/permission/aw_permission_request.h" |
| 35 #include "android_webview/native/permission/permission_request_handler.h" | 35 #include "android_webview/native/permission/permission_request_handler.h" |
| 36 #include "android_webview/native/permission/simple_permission_request.h" | 36 #include "android_webview/native/permission/simple_permission_request.h" |
| 37 #include "android_webview/native/popup_touch_handle_drawable.h" | |
| 37 #include "android_webview/native/state_serializer.h" | 38 #include "android_webview/native/state_serializer.h" |
| 38 #include "android_webview/public/browser/draw_gl.h" | 39 #include "android_webview/public/browser/draw_gl.h" |
| 39 #include "base/android/jni_android.h" | 40 #include "base/android/jni_android.h" |
| 40 #include "base/android/jni_array.h" | 41 #include "base/android/jni_array.h" |
| 41 #include "base/android/jni_string.h" | 42 #include "base/android/jni_string.h" |
| 42 #include "base/android/locale_utils.h" | 43 #include "base/android/locale_utils.h" |
| 43 #include "base/android/scoped_java_ref.h" | 44 #include "base/android/scoped_java_ref.h" |
| 44 #include "base/atomicops.h" | 45 #include "base/atomicops.h" |
| 45 #include "base/bind.h" | 46 #include "base/bind.h" |
| 46 #include "base/callback.h" | 47 #include "base/callback.h" |
| (...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1053 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1054 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1054 JNIEnv* env = AttachCurrentThread(); | 1055 JNIEnv* env = AttachCurrentThread(); |
| 1055 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 1056 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 1056 if (obj.is_null()) | 1057 if (obj.is_null()) |
| 1057 return; | 1058 return; |
| 1058 Java_AwContents_didOverscroll(env, obj, overscroll_delta.x(), | 1059 Java_AwContents_didOverscroll(env, obj, overscroll_delta.x(), |
| 1059 overscroll_delta.y(), overscroll_velocity.x(), | 1060 overscroll_delta.y(), overscroll_velocity.x(), |
| 1060 overscroll_velocity.y()); | 1061 overscroll_velocity.y()); |
| 1061 } | 1062 } |
| 1062 | 1063 |
| 1064 ui::TouchHandleDrawable* AwContents::CreateDrawable(float dip_scale) { | |
| 1065 JNIEnv* env = AttachCurrentThread(); | |
| 1066 auto obj = java_ref_.get(env); | |
|
boliu
2016/08/24 23:35:30
don't use auto, jni types are scary, but not that
Jinsuk Kim
2016/08/25 07:32:21
Done.
| |
| 1067 if (obj.is_null()) | |
| 1068 return nullptr; | |
| 1069 auto cvc = ContentViewCore::FromWebContents(web_contents_.get()); | |
|
boliu
2016/08/24 23:35:30
ditto here and below, imo auto is making things ha
Jinsuk Kim
2016/08/25 07:32:21
Done.
| |
| 1070 DCHECK(cvc); | |
| 1071 auto drawable = PopupTouchHandleDrawable::Create(cvc, dip_scale); | |
|
boliu
2016/08/24 23:35:30
if gc runs between this line and the line below, t
Jinsuk Kim
2016/08/25 07:32:21
Oops did it again.... Done.
| |
| 1072 auto drawable_obj = drawable->GetJavaObj().get(env); | |
| 1073 if (!drawable_obj.is_null()) | |
| 1074 Java_AwContents_onCreatedTouchHandle(env, obj, drawable_obj); | |
| 1075 return drawable.release(); | |
| 1076 } | |
| 1077 | |
| 1063 void AwContents::SetDipScale(JNIEnv* env, | 1078 void AwContents::SetDipScale(JNIEnv* env, |
| 1064 const JavaParamRef<jobject>& obj, | 1079 const JavaParamRef<jobject>& obj, |
| 1065 jfloat dip_scale) { | 1080 jfloat dip_scale) { |
| 1066 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1081 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1067 SetDipScaleInternal(dip_scale); | 1082 SetDipScaleInternal(dip_scale); |
| 1068 } | 1083 } |
| 1069 | 1084 |
| 1070 void AwContents::SetDipScaleInternal(float dip_scale) { | 1085 void AwContents::SetDipScaleInternal(float dip_scale) { |
| 1071 browser_view_renderer_.SetDipScale(dip_scale); | 1086 browser_view_renderer_.SetDipScale(dip_scale); |
| 1072 } | 1087 } |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1285 int routing_id = new_host->GetRoutingID(); | 1300 int routing_id = new_host->GetRoutingID(); |
| 1286 // At this point, the current RVH may or may not contain a compositor. So | 1301 // At this point, the current RVH may or may not contain a compositor. So |
| 1287 // compositor_ may be nullptr, in which case | 1302 // compositor_ may be nullptr, in which case |
| 1288 // BrowserViewRenderer::DidInitializeCompositor() callback is time when the | 1303 // BrowserViewRenderer::DidInitializeCompositor() callback is time when the |
| 1289 // new compositor is constructed. | 1304 // new compositor is constructed. |
| 1290 browser_view_renderer_.SetActiveCompositorID( | 1305 browser_view_renderer_.SetActiveCompositorID( |
| 1291 CompositorID(process_id, routing_id)); | 1306 CompositorID(process_id, routing_id)); |
| 1292 } | 1307 } |
| 1293 | 1308 |
| 1294 } // namespace android_webview | 1309 } // namespace android_webview |
| OLD | NEW |