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

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 908093003: Revert of Add support for ContentViewCore helpers on Tab (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 "content/browser/android/content_view_core_impl.h" 5 #include "content/browser/android/content_view_core_impl.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 web_contents->SetUserAgentOverride(spoofed_ua); 249 web_contents->SetUserAgentOverride(spoofed_ua);
250 250
251 java_bridge_dispatcher_host_ = 251 java_bridge_dispatcher_host_ =
252 new GinJavaBridgeDispatcherHost(web_contents, 252 new GinJavaBridgeDispatcherHost(web_contents,
253 java_bridge_retained_object_set); 253 java_bridge_retained_object_set);
254 254
255 InitWebContents(); 255 InitWebContents();
256 } 256 }
257 257
258 ContentViewCoreImpl::~ContentViewCoreImpl() { 258 ContentViewCoreImpl::~ContentViewCoreImpl() {
259 root_layer_->RemoveFromParent();
260
261 JNIEnv* env = base::android::AttachCurrentThread(); 259 JNIEnv* env = base::android::AttachCurrentThread();
262 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); 260 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
263 java_ref_.reset(); 261 java_ref_.reset();
264 if (!j_obj.is_null()) { 262 if (!j_obj.is_null()) {
265 Java_ContentViewCore_onNativeContentViewCoreDestroyed( 263 Java_ContentViewCore_onNativeContentViewCoreDestroyed(
266 env, j_obj.obj(), reinterpret_cast<intptr_t>(this)); 264 env, j_obj.obj(), reinterpret_cast<intptr_t>(this));
267 } 265 }
268 } 266 }
269 267
270 base::android::ScopedJavaLocalRef<jobject> 268 base::android::ScopedJavaLocalRef<jobject>
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 void ContentViewCoreImpl::SetBackgroundOpaque(JNIEnv* env, jobject jobj, 1296 void ContentViewCoreImpl::SetBackgroundOpaque(JNIEnv* env, jobject jobj,
1299 jboolean opaque) { 1297 jboolean opaque) {
1300 if (GetRenderWidgetHostViewAndroid()) { 1298 if (GetRenderWidgetHostViewAndroid()) {
1301 if (opaque) 1299 if (opaque)
1302 GetRenderWidgetHostViewAndroid()->SetBackgroundColorToDefault(); 1300 GetRenderWidgetHostViewAndroid()->SetBackgroundColorToDefault();
1303 else 1301 else
1304 GetRenderWidgetHostViewAndroid()->SetBackgroundColor(SK_ColorTRANSPARENT); 1302 GetRenderWidgetHostViewAndroid()->SetBackgroundColor(SK_ColorTRANSPARENT);
1305 } 1303 }
1306 } 1304 }
1307 1305
1308 void ContentViewCoreImpl::SetDrawsContent(JNIEnv* env,
1309 jobject jobj,
1310 jboolean draws) {
1311 GetLayer()->SetHideLayerAndSubtree(!draws);
1312 }
1313
1314 void ContentViewCoreImpl::RequestTextSurroundingSelection( 1306 void ContentViewCoreImpl::RequestTextSurroundingSelection(
1315 int max_length, 1307 int max_length,
1316 const base::Callback< 1308 const base::Callback<
1317 void(const base::string16& content, int start_offset, int end_offset)>& 1309 void(const base::string16& content, int start_offset, int end_offset)>&
1318 callback) { 1310 callback) {
1319 DCHECK(!callback.is_null()); 1311 DCHECK(!callback.is_null());
1320 RenderFrameHost* focused_frame = web_contents_->GetFocusedFrame(); 1312 RenderFrameHost* focused_frame = web_contents_->GetFocusedFrame();
1321 if (!focused_frame) 1313 if (!focused_frame)
1322 return; 1314 return;
1323 if (GetRenderWidgetHostViewAndroid()) { 1315 if (GetRenderWidgetHostViewAndroid()) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1389 return NULL; 1381 return NULL;
1390 1382
1391 return view->GetJavaObject().Release(); 1383 return view->GetJavaObject().Release();
1392 } 1384 }
1393 1385
1394 bool RegisterContentViewCore(JNIEnv* env) { 1386 bool RegisterContentViewCore(JNIEnv* env) {
1395 return RegisterNativesImpl(env); 1387 return RegisterNativesImpl(env);
1396 } 1388 }
1397 1389
1398 } // namespace content 1390 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698