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

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

Issue 2453213003: Have WebContentsViewAndroid own ViewAndroid (Closed)
Patch Set: Created 4 years, 1 month 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // static 200 // static
201 ContentViewCore* ContentViewCore::FromWebContents( 201 ContentViewCore* ContentViewCore::FromWebContents(
202 content::WebContents* web_contents) { 202 content::WebContents* web_contents) {
203 return ContentViewCoreImpl::FromWebContents(web_contents); 203 return ContentViewCoreImpl::FromWebContents(web_contents);
204 } 204 }
205 205
206 ContentViewCoreImpl::ContentViewCoreImpl( 206 ContentViewCoreImpl::ContentViewCoreImpl(
207 JNIEnv* env, 207 JNIEnv* env,
208 const JavaRef<jobject>& obj, 208 const JavaRef<jobject>& obj,
209 WebContents* web_contents, 209 WebContents* web_contents,
210 const JavaRef<jobject>& view_android_delegate,
211 ui::WindowAndroid* window_android,
212 const JavaRef<jobject>& java_bridge_retained_object_set) 210 const JavaRef<jobject>& java_bridge_retained_object_set)
213 : WebContentsObserver(web_contents), 211 : WebContentsObserver(web_contents),
214 java_ref_(env, obj), 212 java_ref_(env, obj),
215 view_(view_android_delegate),
216 web_contents_(static_cast<WebContentsImpl*>(web_contents)), 213 web_contents_(static_cast<WebContentsImpl*>(web_contents)),
217 page_scale_(1), 214 page_scale_(1),
218 dpi_scale_(ui::GetScaleFactorForNativeView(&view_)), 215 dpi_scale_(ui::GetScaleFactorForNativeView(GetViewAndroid())),
219 device_orientation_(0), 216 device_orientation_(0),
220 accessibility_enabled_(false) { 217 accessibility_enabled_(false) {
221 CHECK(web_contents) << 218 GetViewAndroid()->SetLayer(cc::Layer::Create());
222 "A ContentViewCoreImpl should be created with a valid WebContents.";
223 DCHECK(window_android);
224 DCHECK(!view_android_delegate.is_null());
225 window_android->AddChild(&view_);
226 view_.SetLayer(cc::Layer::Create());
227 gfx::Size physical_size( 219 gfx::Size physical_size(
228 Java_ContentViewCore_getPhysicalBackingWidthPix(env, obj), 220 Java_ContentViewCore_getPhysicalBackingWidthPix(env, obj),
229 Java_ContentViewCore_getPhysicalBackingHeightPix(env, obj)); 221 Java_ContentViewCore_getPhysicalBackingHeightPix(env, obj));
230 view_.GetLayer()->SetBounds(physical_size); 222 GetViewAndroid()->GetLayer()->SetBounds(physical_size);
231 223
232 // Currently, the only use case we have for overriding a user agent involves 224 // Currently, the only use case we have for overriding a user agent involves
233 // spoofing a desktop Linux user agent for "Request desktop site". 225 // spoofing a desktop Linux user agent for "Request desktop site".
234 // Automatically set it for all WebContents so that it is available when a 226 // Automatically set it for all WebContents so that it is available when a
235 // NavigationEntry requires the user agent to be overridden. 227 // NavigationEntry requires the user agent to be overridden.
236 const char kLinuxInfoStr[] = "X11; Linux x86_64"; 228 const char kLinuxInfoStr[] = "X11; Linux x86_64";
237 std::string product = content::GetContentClient()->GetProduct(); 229 std::string product = content::GetContentClient()->GetProduct();
238 std::string spoofed_ua = 230 std::string spoofed_ua =
239 BuildUserAgentFromOSAndProduct(kLinuxInfoStr, product); 231 BuildUserAgentFromOSAndProduct(kLinuxInfoStr, product);
240 web_contents->SetUserAgentOverride(spoofed_ua); 232 web_contents->SetUserAgentOverride(spoofed_ua);
241 233
242 java_bridge_dispatcher_host_ = 234 java_bridge_dispatcher_host_ =
243 new GinJavaBridgeDispatcherHost(web_contents, 235 new GinJavaBridgeDispatcherHost(web_contents,
244 java_bridge_retained_object_set); 236 java_bridge_retained_object_set);
245 237
246 InitWebContents(); 238 InitWebContents();
247 } 239 }
248 240
249 void ContentViewCoreImpl::AddObserver( 241 void ContentViewCoreImpl::AddObserver(
250 ContentViewCoreImplObserver* observer) { 242 ContentViewCoreImplObserver* observer) {
251 observer_list_.AddObserver(observer); 243 observer_list_.AddObserver(observer);
252 } 244 }
253 245
254 void ContentViewCoreImpl::RemoveObserver( 246 void ContentViewCoreImpl::RemoveObserver(
255 ContentViewCoreImplObserver* observer) { 247 ContentViewCoreImplObserver* observer) {
256 observer_list_.RemoveObserver(observer); 248 observer_list_.RemoveObserver(observer);
257 } 249 }
258 250
259 ContentViewCoreImpl::~ContentViewCoreImpl() { 251 ContentViewCoreImpl::~ContentViewCoreImpl() {
260 view_.GetLayer()->RemoveFromParent();
261 for (auto& observer : observer_list_) 252 for (auto& observer : observer_list_)
262 observer.OnContentViewCoreDestroyed(); 253 observer.OnContentViewCoreDestroyed();
263 observer_list_.Clear(); 254 observer_list_.Clear();
264 255
265 JNIEnv* env = base::android::AttachCurrentThread(); 256 JNIEnv* env = base::android::AttachCurrentThread();
266 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); 257 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
267 java_ref_.reset(); 258 java_ref_.reset();
268 if (!j_obj.is_null()) { 259 if (!j_obj.is_null()) {
269 Java_ContentViewCore_onNativeContentViewCoreDestroyed( 260 Java_ContentViewCore_onNativeContentViewCoreDestroyed(
270 env, j_obj, reinterpret_cast<intptr_t>(this)); 261 env, j_obj, reinterpret_cast<intptr_t>(this));
271 } 262 }
272 } 263 }
273 264
274 void ContentViewCoreImpl::UpdateWindowAndroid( 265 void ContentViewCoreImpl::UpdateWindowAndroid(
275 JNIEnv* env, 266 JNIEnv* env,
276 const base::android::JavaParamRef<jobject>& obj, 267 const base::android::JavaParamRef<jobject>& obj,
277 jlong window_android) { 268 jlong window_android) {
269 ui::ViewAndroid* view = GetViewAndroid();
278 if (window_android) { 270 if (window_android) {
279 DCHECK(!view_.GetWindowAndroid()); 271 DCHECK(!GetWindowAndroid());
280 ui::WindowAndroid* window = 272 ui::WindowAndroid* window =
281 reinterpret_cast<ui::WindowAndroid*>(window_android); 273 reinterpret_cast<ui::WindowAndroid*>(window_android);
282 window->AddChild(&view_); 274 window->AddChild(view);
283 for (auto& observer : observer_list_) 275 for (auto& observer : observer_list_)
284 observer.OnAttachedToWindow(); 276 observer.OnAttachedToWindow();
285 } else { 277 } else {
286 for (auto& observer : observer_list_) 278 for (auto& observer : observer_list_)
287 observer.OnDetachedFromWindow(); 279 observer.OnDetachedFromWindow();
288 view_.RemoveFromParent(); 280 view->RemoveFromParent();
289 } 281 }
290 } 282 }
291 283
292 base::android::ScopedJavaLocalRef<jobject> 284 base::android::ScopedJavaLocalRef<jobject>
293 ContentViewCoreImpl::GetWebContentsAndroid(JNIEnv* env, 285 ContentViewCoreImpl::GetWebContentsAndroid(JNIEnv* env,
294 const JavaParamRef<jobject>& obj) { 286 const JavaParamRef<jobject>& obj) {
295 return web_contents_->GetJavaWebContents(); 287 return web_contents_->GetJavaWebContents();
296 } 288 }
297 289
298 base::android::ScopedJavaLocalRef<jobject> 290 base::android::ScopedJavaLocalRef<jobject>
299 ContentViewCoreImpl::GetJavaWindowAndroid(JNIEnv* env, 291 ContentViewCoreImpl::GetJavaWindowAndroid(JNIEnv* env,
300 const JavaParamRef<jobject>& obj) { 292 const JavaParamRef<jobject>& obj) {
301 if (!view_.GetWindowAndroid()) 293 if (!GetWindowAndroid())
302 return ScopedJavaLocalRef<jobject>(); 294 return ScopedJavaLocalRef<jobject>();
303 return view_.GetWindowAndroid()->GetJavaObject(); 295 return GetWindowAndroid()->GetJavaObject();
304 } 296 }
305 297
306 void ContentViewCoreImpl::OnJavaContentViewCoreDestroyed( 298 void ContentViewCoreImpl::OnJavaContentViewCoreDestroyed(
307 JNIEnv* env, 299 JNIEnv* env,
308 const JavaParamRef<jobject>& obj) { 300 const JavaParamRef<jobject>& obj) {
309 DCHECK(env->IsSameObject(java_ref_.get(env).obj(), obj)); 301 DCHECK(env->IsSameObject(java_ref_.get(env).obj(), obj));
310 java_ref_.reset(); 302 java_ref_.reset();
311 // Java peer has gone, ContentViewCore is not functional and waits to 303 // Java peer has gone, ContentViewCore is not functional and waits to
312 // be destroyed with WebContents. 304 // be destroyed with WebContents.
313 // We need to reset WebContentsViewAndroid's reference, otherwise, there 305 // We need to reset WebContentsViewAndroid's reference, otherwise, there
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 const gfx::SizeF& content_size, 401 const gfx::SizeF& content_size,
410 const gfx::SizeF& viewport_size, 402 const gfx::SizeF& viewport_size,
411 const float top_controls_height, 403 const float top_controls_height,
412 const float top_controls_shown_ratio, 404 const float top_controls_shown_ratio,
413 const float bottom_controls_height, 405 const float bottom_controls_height,
414 const float bottom_controls_shown_ratio, 406 const float bottom_controls_shown_ratio,
415 bool is_mobile_optimized_hint, 407 bool is_mobile_optimized_hint,
416 const gfx::SelectionBound& selection_start) { 408 const gfx::SelectionBound& selection_start) {
417 JNIEnv* env = AttachCurrentThread(); 409 JNIEnv* env = AttachCurrentThread();
418 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 410 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
419 if (obj.is_null() || !view_.GetWindowAndroid()) 411 if (obj.is_null() || !GetWindowAndroid())
420 return; 412 return;
421 413
422 view_.GetWindowAndroid()->set_content_offset( 414 GetWindowAndroid()->set_content_offset(
423 gfx::Vector2dF(0.0f, top_controls_height * top_controls_shown_ratio)); 415 gfx::Vector2dF(0.0f, top_controls_height * top_controls_shown_ratio));
424 416
425 page_scale_ = page_scale_factor; 417 page_scale_ = page_scale_factor;
426 418
427 // The CursorAnchorInfo API in Android only supports zero width selection 419 // The CursorAnchorInfo API in Android only supports zero width selection
428 // bounds. 420 // bounds.
429 const jboolean has_insertion_marker = 421 const jboolean has_insertion_marker =
430 selection_start.type() == gfx::SelectionBound::CENTER; 422 selection_start.type() == gfx::SelectionBound::CENTER;
431 const jboolean is_insertion_marker_visible = selection_start.visible(); 423 const jboolean is_insertion_marker_visible = selection_start.visible();
432 const jfloat insertion_marker_horizontal = 424 const jfloat insertion_marker_horizontal =
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 for (size_t i = 0; i < items.size(); ++i) { 498 for (size_t i = 0; i < items.size(); ++i) {
507 labels.push_back(items[i].label); 499 labels.push_back(items[i].label);
508 jint enabled = 500 jint enabled =
509 (items[i].type == MenuItem::GROUP ? POPUP_ITEM_TYPE_GROUP : 501 (items[i].type == MenuItem::GROUP ? POPUP_ITEM_TYPE_GROUP :
510 (items[i].enabled ? POPUP_ITEM_TYPE_ENABLED : 502 (items[i].enabled ? POPUP_ITEM_TYPE_ENABLED :
511 POPUP_ITEM_TYPE_DISABLED)); 503 POPUP_ITEM_TYPE_DISABLED));
512 env->SetIntArrayRegion(enabled_array.obj(), i, 1, &enabled); 504 env->SetIntArrayRegion(enabled_array.obj(), i, 1, &enabled);
513 } 505 }
514 ScopedJavaLocalRef<jobjectArray> items_array( 506 ScopedJavaLocalRef<jobjectArray> items_array(
515 base::android::ToJavaArrayOfStrings(env, labels)); 507 base::android::ToJavaArrayOfStrings(env, labels));
516 select_popup_ = view_.AcquireAnchorView(); 508 ui::ViewAndroid* view = GetViewAndroid();
509 select_popup_ = view->AcquireAnchorView();
517 const ScopedJavaLocalRef<jobject> popup_view = select_popup_.view(); 510 const ScopedJavaLocalRef<jobject> popup_view = select_popup_.view();
518 if (popup_view.is_null()) 511 if (popup_view.is_null())
519 return; 512 return;
520 view_.SetAnchorRect(popup_view, 513 view->SetAnchorRect(popup_view,
521 gfx::ScaleRect(gfx::RectF(bounds), page_scale_)); 514 gfx::ScaleRect(gfx::RectF(bounds), page_scale_));
522 Java_ContentViewCore_showSelectPopup( 515 Java_ContentViewCore_showSelectPopup(
523 env, j_obj, popup_view, reinterpret_cast<intptr_t>(frame), items_array, 516 env, j_obj, popup_view, reinterpret_cast<intptr_t>(frame), items_array,
524 enabled_array, multiple, selected_array, right_aligned); 517 enabled_array, multiple, selected_array, right_aligned);
525 } 518 }
526 519
527 void ContentViewCoreImpl::HideSelectPopupMenu() { 520 void ContentViewCoreImpl::HideSelectPopupMenu() {
528 JNIEnv* env = AttachCurrentThread(); 521 JNIEnv* env = AttachCurrentThread();
529 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); 522 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
530 if (!j_obj.is_null()) 523 if (!j_obj.is_null())
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 800
808 gfx::Point base_point = gfx::ToRoundedPoint(base); 801 gfx::Point base_point = gfx::ToRoundedPoint(base);
809 gfx::Point extent_point = gfx::ToRoundedPoint(extent); 802 gfx::Point extent_point = gfx::ToRoundedPoint(extent);
810 if (base_point == extent_point) 803 if (base_point == extent_point)
811 return; 804 return;
812 805
813 web_contents_->SelectRange(base_point, extent_point); 806 web_contents_->SelectRange(base_point, extent_point);
814 } 807 }
815 808
816 ui::WindowAndroid* ContentViewCoreImpl::GetWindowAndroid() const { 809 ui::WindowAndroid* ContentViewCoreImpl::GetWindowAndroid() const {
817 return view_.GetWindowAndroid(); 810 return GetViewAndroid()->GetWindowAndroid();
818 } 811 }
819 812
820 ui::ViewAndroid* ContentViewCoreImpl::GetViewAndroid() { 813 ui::ViewAndroid* ContentViewCoreImpl::GetViewAndroid() const {
821 return &view_; 814 return web_contents_->GetView()->GetNativeView();
822 } 815 }
823 816
824 817
825 // ---------------------------------------------------------------------------- 818 // ----------------------------------------------------------------------------
826 // Methods called from Java via JNI 819 // Methods called from Java via JNI
827 // ---------------------------------------------------------------------------- 820 // ----------------------------------------------------------------------------
828 821
829 void ContentViewCoreImpl::SelectPopupMenuItems( 822 void ContentViewCoreImpl::SelectPopupMenuItems(
830 JNIEnv* env, 823 JNIEnv* env,
831 const JavaParamRef<jobject>& obj, 824 const JavaParamRef<jobject>& obj,
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 java_bridge_dispatcher_host_->RemoveNamedObject( 1216 java_bridge_dispatcher_host_->RemoveNamedObject(
1224 ConvertJavaStringToUTF8(env, name)); 1217 ConvertJavaStringToUTF8(env, name));
1225 } 1218 }
1226 1219
1227 void ContentViewCoreImpl::WasResized(JNIEnv* env, 1220 void ContentViewCoreImpl::WasResized(JNIEnv* env,
1228 const JavaParamRef<jobject>& obj) { 1221 const JavaParamRef<jobject>& obj) {
1229 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); 1222 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid();
1230 gfx::Size physical_size( 1223 gfx::Size physical_size(
1231 Java_ContentViewCore_getPhysicalBackingWidthPix(env, obj), 1224 Java_ContentViewCore_getPhysicalBackingWidthPix(env, obj),
1232 Java_ContentViewCore_getPhysicalBackingHeightPix(env, obj)); 1225 Java_ContentViewCore_getPhysicalBackingHeightPix(env, obj));
1233 view_.GetLayer()->SetBounds(physical_size); 1226 GetViewAndroid()->GetLayer()->SetBounds(physical_size);
1234 1227
1235 if (view) { 1228 if (view) {
1236 web_contents_->SendScreenRects(); 1229 web_contents_->SendScreenRects();
1237 view->WasResized(); 1230 view->WasResized();
1238 } 1231 }
1239 } 1232 }
1240 1233
1241 long ContentViewCoreImpl::GetNativeImeAdapter( 1234 long ContentViewCoreImpl::GetNativeImeAdapter(
1242 JNIEnv* env, 1235 JNIEnv* env,
1243 const JavaParamRef<jobject>& obj) { 1236 const JavaParamRef<jobject>& obj) {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 if (web_contents_) { 1345 if (web_contents_) {
1353 web_contents_->SetAccessibilityMode( 1346 web_contents_->SetAccessibilityMode(
1354 accessibility_state->accessibility_mode()); 1347 accessibility_state->accessibility_mode());
1355 } 1348 }
1356 } 1349 }
1357 } 1350 }
1358 1351
1359 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { 1352 void ContentViewCoreImpl::SendOrientationChangeEventInternal() {
1360 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); 1353 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid();
1361 if (rwhv) 1354 if (rwhv)
1362 rwhv->UpdateScreenInfo(&view_); 1355 rwhv->UpdateScreenInfo(GetViewAndroid());
1363 1356
1364 static_cast<WebContentsImpl*>(web_contents())-> 1357 static_cast<WebContentsImpl*>(web_contents())->
1365 screen_orientation_dispatcher_host()->OnOrientationChange(); 1358 screen_orientation_dispatcher_host()->OnOrientationChange();
1366 } 1359 }
1367 1360
1368 void ContentViewCoreImpl::ExtractSmartClipData(JNIEnv* env, 1361 void ContentViewCoreImpl::ExtractSmartClipData(JNIEnv* env,
1369 const JavaParamRef<jobject>& obj, 1362 const JavaParamRef<jobject>& obj,
1370 jint x, 1363 jint x,
1371 jint y, 1364 jint y,
1372 jint width, 1365 jint width,
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 void ContentViewCoreImpl::PullReset() { 1528 void ContentViewCoreImpl::PullReset() {
1536 JNIEnv* env = AttachCurrentThread(); 1529 JNIEnv* env = AttachCurrentThread();
1537 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 1530 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
1538 if (!obj.is_null()) 1531 if (!obj.is_null())
1539 Java_ContentViewCore_onOverscrollRefreshReset(env, obj); 1532 Java_ContentViewCore_onOverscrollRefreshReset(env, obj);
1540 } 1533 }
1541 1534
1542 // This is called for each ContentView. 1535 // This is called for each ContentView.
1543 jlong Init(JNIEnv* env, 1536 jlong Init(JNIEnv* env,
1544 const JavaParamRef<jobject>& obj, 1537 const JavaParamRef<jobject>& obj,
1545 const JavaParamRef<jobject>& web_contents, 1538 const JavaParamRef<jobject>& jweb_contents,
1546 const JavaParamRef<jobject>& view_android_delegate, 1539 const JavaParamRef<jobject>& jview_android_delegate,
1547 jlong window_android, 1540 jlong window_android,
1548 const JavaParamRef<jobject>& retained_objects_set) { 1541 const JavaParamRef<jobject>& retained_objects_set) {
1542 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(
1543 WebContents::FromJavaWebContents(jweb_contents));
1544 CHECK(web_contents) <<
1545 "A ContentViewCoreImpl should be created with a valid WebContents.";
1546 web_contents->GetView()->CreateView(
boliu 2016/10/28 15:58:58 it's not ok to just reuse this call to *set* ViewA
Jinsuk Kim 2016/10/31 01:17:00 Done.
1547 gfx::Size(), new ui::ViewAndroid(jview_android_delegate));
1548
1549 ui::WindowAndroid* window =
1550 reinterpret_cast<ui::WindowAndroid*>(window_android);
1551 DCHECK(window);
1552 window->AddChild(web_contents->GetView()->GetNativeView());
1553
1549 ContentViewCoreImpl* view = new ContentViewCoreImpl( 1554 ContentViewCoreImpl* view = new ContentViewCoreImpl(
1550 env, obj, WebContents::FromJavaWebContents(web_contents), 1555 env, obj, web_contents, retained_objects_set);
1551 view_android_delegate,
1552 reinterpret_cast<ui::WindowAndroid*>(window_android),
1553 retained_objects_set);
1554 return reinterpret_cast<intptr_t>(view); 1556 return reinterpret_cast<intptr_t>(view);
1555 } 1557 }
1556 1558
1557 static ScopedJavaLocalRef<jobject> FromWebContentsAndroid( 1559 static ScopedJavaLocalRef<jobject> FromWebContentsAndroid(
1558 JNIEnv* env, 1560 JNIEnv* env,
1559 const JavaParamRef<jclass>& clazz, 1561 const JavaParamRef<jclass>& clazz,
1560 const JavaParamRef<jobject>& jweb_contents) { 1562 const JavaParamRef<jobject>& jweb_contents) {
1561 WebContents* web_contents = WebContents::FromJavaWebContents(jweb_contents); 1563 WebContents* web_contents = WebContents::FromJavaWebContents(jweb_contents);
1562 if (!web_contents) 1564 if (!web_contents)
1563 return ScopedJavaLocalRef<jobject>(); 1565 return ScopedJavaLocalRef<jobject>();
1564 1566
1565 ContentViewCore* view = ContentViewCore::FromWebContents(web_contents); 1567 ContentViewCore* view = ContentViewCore::FromWebContents(web_contents);
1566 if (!view) 1568 if (!view)
1567 return ScopedJavaLocalRef<jobject>(); 1569 return ScopedJavaLocalRef<jobject>();
1568 1570
1569 return view->GetJavaObject(); 1571 return view->GetJavaObject();
1570 } 1572 }
1571 1573
1572 bool RegisterContentViewCore(JNIEnv* env) { 1574 bool RegisterContentViewCore(JNIEnv* env) {
1573 return RegisterNativesImpl(env); 1575 return RegisterNativesImpl(env);
1574 } 1576 }
1575 1577
1576 } // namespace content 1578 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/content_view_core_impl.h ('k') | content/browser/renderer_host/render_widget_host_view_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698