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

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

Issue 2682593002: Refactor ContentViewClient (4/6) (Closed)
Patch Set: . Created 3 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 <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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 jint ContentViewCoreImpl::GetBackgroundColor(JNIEnv* env, jobject obj) { 404 jint ContentViewCoreImpl::GetBackgroundColor(JNIEnv* env, jobject obj) {
405 RenderWidgetHostViewAndroid* rwhva = GetRenderWidgetHostViewAndroid(); 405 RenderWidgetHostViewAndroid* rwhva = GetRenderWidgetHostViewAndroid();
406 if (!rwhva) 406 if (!rwhva)
407 return SK_ColorWHITE; 407 return SK_ColorWHITE;
408 return rwhva->GetCachedBackgroundColor(); 408 return rwhva->GetCachedBackgroundColor();
409 } 409 }
410 410
411 // All positions and sizes are in CSS pixels. 411 // All positions and sizes are in CSS pixels.
412 // Note that viewport_width/height is a best effort based. 412 // Note that viewport_width/height is a best effort based.
413 // ContentViewCore has the actual information about the physical viewport size. 413 // ContentViewCore has the actual information about the physical viewport size.
414 void ContentViewCoreImpl::UpdateFrameInfo( 414 void ContentViewCoreImpl::UpdateFrameInfo(
boliu 2017/02/07 21:47:06 how much of this method can be cleaned up? I see t
Jinsuk Kim 2017/02/07 23:51:04 Yes. Done. Also removed the relevant var/method al
415 const gfx::Vector2dF& scroll_offset, 415 const gfx::Vector2dF& scroll_offset,
416 float page_scale_factor, 416 float page_scale_factor,
417 const gfx::Vector2dF& page_scale_factor_limits, 417 const gfx::Vector2dF& page_scale_factor_limits,
418 const gfx::SizeF& content_size, 418 const gfx::SizeF& content_size,
419 const gfx::SizeF& viewport_size, 419 const gfx::SizeF& viewport_size,
420 const float top_controls_height, 420 const float top_controls_height,
421 const float top_controls_shown_ratio, 421 const float top_controls_shown_ratio,
422 const float bottom_controls_height, 422 const float bottom_controls_height,
423 const float bottom_controls_shown_ratio, 423 const float bottom_controls_shown_ratio,
424 bool is_mobile_optimized_hint, 424 bool is_mobile_optimized_hint,
(...skipping 24 matching lines...) Expand all
449 env, obj, scroll_offset.x(), scroll_offset.y(), page_scale_factor, 449 env, obj, scroll_offset.x(), scroll_offset.y(), page_scale_factor,
450 page_scale_factor_limits.x(), page_scale_factor_limits.y(), 450 page_scale_factor_limits.x(), page_scale_factor_limits.y(),
451 content_size.width(), content_size.height(), viewport_size.width(), 451 content_size.width(), content_size.height(), viewport_size.width(),
452 viewport_size.height(), top_controls_height, top_controls_shown_ratio, 452 viewport_size.height(), top_controls_height, top_controls_shown_ratio,
453 bottom_controls_height, bottom_controls_shown_ratio, 453 bottom_controls_height, bottom_controls_shown_ratio,
454 is_mobile_optimized_hint, has_insertion_marker, 454 is_mobile_optimized_hint, has_insertion_marker,
455 is_insertion_marker_visible, insertion_marker_horizontal, 455 is_insertion_marker_visible, insertion_marker_horizontal,
456 insertion_marker_top, insertion_marker_bottom); 456 insertion_marker_top, insertion_marker_bottom);
457 } 457 }
458 458
459 void ContentViewCoreImpl::OnBackgroundColorChanged(SkColor color) {
460 JNIEnv* env = AttachCurrentThread();
461 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
462 if (obj.is_null())
463 return;
464 Java_ContentViewCore_onBackgroundColorChanged(env, obj, color);
465 }
466
467 void ContentViewCoreImpl::ShowSelectPopupMenu( 459 void ContentViewCoreImpl::ShowSelectPopupMenu(
468 RenderFrameHost* frame, 460 RenderFrameHost* frame,
469 const gfx::Rect& bounds, 461 const gfx::Rect& bounds,
470 const std::vector<MenuItem>& items, 462 const std::vector<MenuItem>& items,
471 int selected_item, 463 int selected_item,
472 bool multiple, 464 bool multiple,
473 bool right_aligned) { 465 bool right_aligned) {
474 JNIEnv* env = AttachCurrentThread(); 466 JNIEnv* env = AttachCurrentThread();
475 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); 467 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
476 if (j_obj.is_null()) 468 if (j_obj.is_null())
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 return; 638 return;
647 639
648 JNIEnv* env = AttachCurrentThread(); 640 JNIEnv* env = AttachCurrentThread();
649 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 641 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
650 if (obj.is_null()) 642 if (obj.is_null())
651 return; 643 return;
652 Java_ContentViewCore_showPastePopup(env, obj, x_dip, 644 Java_ContentViewCore_showPastePopup(env, obj, x_dip,
653 y_dip); 645 y_dip);
654 } 646 }
655 647
656 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url,
657 bool is_main_frame) {
658 JNIEnv* env = AttachCurrentThread();
659 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
660 if (j_obj.is_null())
661 return;
662 ScopedJavaLocalRef<jstring> jcontent_url =
663 ConvertUTF8ToJavaString(env, content_url.spec());
664 Java_ContentViewCore_startContentIntent(env, j_obj, jcontent_url,
665 is_main_frame);
666 }
667
668 void ContentViewCoreImpl::ShowDisambiguationPopup( 648 void ContentViewCoreImpl::ShowDisambiguationPopup(
669 const gfx::Rect& rect_pixels, 649 const gfx::Rect& rect_pixels,
670 const SkBitmap& zoomed_bitmap) { 650 const SkBitmap& zoomed_bitmap) {
671 JNIEnv* env = AttachCurrentThread(); 651 JNIEnv* env = AttachCurrentThread();
672 652
673 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 653 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
674 if (obj.is_null()) 654 if (obj.is_null())
675 return; 655 return;
676 656
677 ScopedJavaLocalRef<jobject> rect_object(CreateJavaRect(env, rect_pixels)); 657 ScopedJavaLocalRef<jobject> rect_object(CreateJavaRect(env, rect_pixels));
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after
1586 return ScopedJavaLocalRef<jobject>(); 1566 return ScopedJavaLocalRef<jobject>();
1587 1567
1588 return view->GetJavaObject(); 1568 return view->GetJavaObject();
1589 } 1569 }
1590 1570
1591 bool RegisterContentViewCore(JNIEnv* env) { 1571 bool RegisterContentViewCore(JNIEnv* env) {
1592 return RegisterNativesImpl(env); 1572 return RegisterNativesImpl(env);
1593 } 1573 }
1594 1574
1595 } // namespace content 1575 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698