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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 2707403004: Unify background color gutters. (Closed)
Patch Set: Rebase Created 3 years, 9 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/renderer_host/render_widget_host_view_android.h" 5 #include "content/browser/renderer_host/render_widget_host_view_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 observing_root_window_(false), 440 observing_root_window_(false),
441 prev_top_shown_pix_(0.f), 441 prev_top_shown_pix_(0.f),
442 prev_bottom_shown_pix_(0.f), 442 prev_bottom_shown_pix_(0.f),
443 weak_ptr_factory_(this) { 443 weak_ptr_factory_(this) {
444 // Set the layer which will hold the content layer for this view. The content 444 // Set the layer which will hold the content layer for this view. The content
445 // layer is managed by the DelegatedFrameHost. 445 // layer is managed by the DelegatedFrameHost.
446 view_.SetLayer(cc::Layer::Create()); 446 view_.SetLayer(cc::Layer::Create());
447 if (using_browser_compositor_) { 447 if (using_browser_compositor_) {
448 cc::FrameSinkId frame_sink_id = 448 cc::FrameSinkId frame_sink_id =
449 host_->AllocateFrameSinkId(false /* is_guest_view_hack */); 449 host_->AllocateFrameSinkId(false /* is_guest_view_hack */);
450 delegated_frame_host_.reset(new ui::DelegatedFrameHostAndroid( 450 delegated_frame_host_.reset(
451 &view_, cached_background_color_, this, frame_sink_id)); 451 new ui::DelegatedFrameHostAndroid(&view_, this, frame_sink_id));
452 } 452 }
453 453
454 host_->SetView(this); 454 host_->SetView(this);
455 SetContentViewCore(content_view_core); 455 SetContentViewCore(content_view_core);
456 456
457 CreateOverscrollControllerIfPossible(); 457 CreateOverscrollControllerIfPossible();
458 458
459 if (GetTextInputManager()) 459 if (GetTextInputManager())
460 GetTextInputManager()->AddObserver(this); 460 GetTextInputManager()->AddObserver(this);
461 } 461 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 RenderWidgetHostView* reference_host_view) { 508 RenderWidgetHostView* reference_host_view) {
509 NOTIMPLEMENTED(); 509 NOTIMPLEMENTED();
510 } 510 }
511 511
512 RenderWidgetHost* 512 RenderWidgetHost*
513 RenderWidgetHostViewAndroid::GetRenderWidgetHost() const { 513 RenderWidgetHostViewAndroid::GetRenderWidgetHost() const {
514 return host_; 514 return host_;
515 } 515 }
516 516
517 void RenderWidgetHostViewAndroid::WasResized() { 517 void RenderWidgetHostViewAndroid::WasResized() {
518 if (delegated_frame_host_ && content_view_core_)
519 delegated_frame_host_->UpdateContainerSizeinDIP(
520 content_view_core_->GetViewportSizeDip());
521 host_->WasResized(); 518 host_->WasResized();
522 } 519 }
523 520
524 void RenderWidgetHostViewAndroid::SetSize(const gfx::Size& size) { 521 void RenderWidgetHostViewAndroid::SetSize(const gfx::Size& size) {
525 // Ignore the given size as only the Java code has the power to 522 // Ignore the given size as only the Java code has the power to
526 // resize the view on Android. 523 // resize the view on Android.
527 default_bounds_ = gfx::Rect(default_bounds_.origin(), size); 524 default_bounds_ = gfx::Rect(default_bounds_.origin(), size);
528 } 525 }
529 526
530 void RenderWidgetHostViewAndroid::SetBounds(const gfx::Rect& rect) { 527 void RenderWidgetHostViewAndroid::SetBounds(const gfx::Rect& rect) {
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 if (selection.GetSelectedText(&selected_text)) 777 if (selection.GetSelectedText(&selected_text))
781 content_view_core_->OnSelectionChanged(base::UTF16ToUTF8(selected_text)); 778 content_view_core_->OnSelectionChanged(base::UTF16ToUTF8(selected_text));
782 } 779 }
783 780
784 void RenderWidgetHostViewAndroid::UpdateBackgroundColor(SkColor color) { 781 void RenderWidgetHostViewAndroid::UpdateBackgroundColor(SkColor color) {
785 if (cached_background_color_ == color) 782 if (cached_background_color_ == color)
786 return; 783 return;
787 784
788 cached_background_color_ = color; 785 cached_background_color_ = color;
789 786
790 if (delegated_frame_host_)
791 delegated_frame_host_->UpdateBackgroundColor(color);
792
793 view_.OnBackgroundColorChanged(color); 787 view_.OnBackgroundColorChanged(color);
794 } 788 }
795 789
796 void RenderWidgetHostViewAndroid::SetNeedsBeginFrames(bool needs_begin_frames) { 790 void RenderWidgetHostViewAndroid::SetNeedsBeginFrames(bool needs_begin_frames) {
797 TRACE_EVENT1("cc", "RenderWidgetHostViewAndroid::SetNeedsBeginFrames", 791 TRACE_EVENT1("cc", "RenderWidgetHostViewAndroid::SetNeedsBeginFrames",
798 "needs_begin_frames", needs_begin_frames); 792 "needs_begin_frames", needs_begin_frames);
799 if (needs_begin_frames) 793 if (needs_begin_frames)
800 AddBeginFrameRequest(PERSISTENT_BEGIN_FRAME); 794 AddBeginFrameRequest(PERSISTENT_BEGIN_FRAME);
801 else 795 else
802 ClearBeginFrameRequest(PERSISTENT_BEGIN_FRAME); 796 ClearBeginFrameRequest(PERSISTENT_BEGIN_FRAME);
(...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1992 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); 1986 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor();
1993 if (!compositor) 1987 if (!compositor)
1994 return; 1988 return;
1995 1989
1996 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( 1990 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>(
1997 overscroll_refresh_handler, compositor, 1991 overscroll_refresh_handler, compositor,
1998 ui::GetScaleFactorForNativeView(GetNativeView())); 1992 ui::GetScaleFactorForNativeView(GetNativeView()));
1999 } 1993 }
2000 1994
2001 } // namespace content 1995 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/android/compositor/tab_content_manager.cc ('k') | ui/android/delegated_frame_host_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698