Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(600)

Side by Side Diff: android_webview/native/aw_contents.cc

Issue 2263043002: android_webview: Let AwContents manage TouchHandleDrawable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DestroyAllDrawables Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1053 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1054 JNIEnv* env = AttachCurrentThread(); 1054 JNIEnv* env = AttachCurrentThread();
1055 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 1055 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
1056 if (obj.is_null()) 1056 if (obj.is_null())
1057 return; 1057 return;
1058 Java_AwContents_didOverscroll(env, obj, overscroll_delta.x(), 1058 Java_AwContents_didOverscroll(env, obj, overscroll_delta.x(),
1059 overscroll_delta.y(), overscroll_velocity.x(), 1059 overscroll_delta.y(), overscroll_velocity.x(),
1060 overscroll_velocity.y()); 1060 overscroll_velocity.y());
1061 } 1061 }
1062 1062
1063 ui::TouchHandleDrawable* AwContents::CreateDrawable() {
1064 JNIEnv* env = AttachCurrentThread();
1065 const ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
1066 if (obj.is_null())
1067 return nullptr;
1068 return reinterpret_cast<ui::TouchHandleDrawable*>(
1069 Java_AwContents_onCreateTouchHandle(env, obj));
1070 }
1071
1072 void AwContents::DestroyAllDrawables() {
1073 JNIEnv* env = AttachCurrentThread();
1074 const ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
1075 if (obj.is_null())
1076 return;
1077 Java_AwContents_onDestroyAllTouchHandles(env, obj);
1078 }
1079
1063 void AwContents::SetDipScale(JNIEnv* env, 1080 void AwContents::SetDipScale(JNIEnv* env,
1064 const JavaParamRef<jobject>& obj, 1081 const JavaParamRef<jobject>& obj,
1065 jfloat dip_scale) { 1082 jfloat dip_scale) {
1066 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1083 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1067 SetDipScaleInternal(dip_scale); 1084 SetDipScaleInternal(dip_scale);
1068 } 1085 }
1069 1086
1070 void AwContents::SetDipScaleInternal(float dip_scale) { 1087 void AwContents::SetDipScaleInternal(float dip_scale) {
1071 browser_view_renderer_.SetDipScale(dip_scale); 1088 browser_view_renderer_.SetDipScale(dip_scale);
1072 } 1089 }
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1285 int routing_id = new_host->GetRoutingID(); 1302 int routing_id = new_host->GetRoutingID();
1286 // At this point, the current RVH may or may not contain a compositor. So 1303 // At this point, the current RVH may or may not contain a compositor. So
1287 // compositor_ may be nullptr, in which case 1304 // compositor_ may be nullptr, in which case
1288 // BrowserViewRenderer::DidInitializeCompositor() callback is time when the 1305 // BrowserViewRenderer::DidInitializeCompositor() callback is time when the
1289 // new compositor is constructed. 1306 // new compositor is constructed.
1290 browser_view_renderer_.SetActiveCompositorID( 1307 browser_view_renderer_.SetActiveCompositorID(
1291 CompositorID(process_id, routing_id)); 1308 CompositorID(process_id, routing_id));
1292 } 1309 }
1293 1310
1294 } // namespace android_webview 1311 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698