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

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

Issue 2707403004: Unify background color gutters. (Closed)
Patch Set: Remove debug logging 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 (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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 synchronous_compositor_client_(nullptr), 434 synchronous_compositor_client_(nullptr),
435 frame_evictor_(new DelegatedFrameEvictor(this)), 435 frame_evictor_(new DelegatedFrameEvictor(this)),
436 observing_root_window_(false), 436 observing_root_window_(false),
437 weak_ptr_factory_(this) { 437 weak_ptr_factory_(this) {
438 // Set the layer which will hold the content layer for this view. The content 438 // Set the layer which will hold the content layer for this view. The content
439 // layer is managed by the DelegatedFrameHost. 439 // layer is managed by the DelegatedFrameHost.
440 view_.SetLayer(cc::Layer::Create()); 440 view_.SetLayer(cc::Layer::Create());
441 if (using_browser_compositor_) { 441 if (using_browser_compositor_) {
442 cc::FrameSinkId frame_sink_id = 442 cc::FrameSinkId frame_sink_id =
443 host_->AllocateFrameSinkId(false /* is_guest_view_hack */); 443 host_->AllocateFrameSinkId(false /* is_guest_view_hack */);
444 delegated_frame_host_.reset(new ui::DelegatedFrameHostAndroid( 444 delegated_frame_host_.reset(
445 &view_, cached_background_color_, this, frame_sink_id)); 445 new ui::DelegatedFrameHostAndroid(&view_, this, frame_sink_id));
446 } 446 }
447 447
448 host_->SetView(this); 448 host_->SetView(this);
449 SetContentViewCore(content_view_core); 449 SetContentViewCore(content_view_core);
450 450
451 CreateOverscrollControllerIfPossible(); 451 CreateOverscrollControllerIfPossible();
452 452
453 if (GetTextInputManager()) 453 if (GetTextInputManager())
454 GetTextInputManager()->AddObserver(this); 454 GetTextInputManager()->AddObserver(this);
455 } 455 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 RenderWidgetHostView* reference_host_view) { 502 RenderWidgetHostView* reference_host_view) {
503 NOTIMPLEMENTED(); 503 NOTIMPLEMENTED();
504 } 504 }
505 505
506 RenderWidgetHost* 506 RenderWidgetHost*
507 RenderWidgetHostViewAndroid::GetRenderWidgetHost() const { 507 RenderWidgetHostViewAndroid::GetRenderWidgetHost() const {
508 return host_; 508 return host_;
509 } 509 }
510 510
511 void RenderWidgetHostViewAndroid::WasResized() { 511 void RenderWidgetHostViewAndroid::WasResized() {
512 if (delegated_frame_host_ && content_view_core_)
513 delegated_frame_host_->UpdateContainerSizeinDIP(
514 content_view_core_->GetViewportSizeDip());
515 host_->WasResized(); 512 host_->WasResized();
516 } 513 }
517 514
518 void RenderWidgetHostViewAndroid::SetSize(const gfx::Size& size) { 515 void RenderWidgetHostViewAndroid::SetSize(const gfx::Size& size) {
519 // Ignore the given size as only the Java code has the power to 516 // Ignore the given size as only the Java code has the power to
520 // resize the view on Android. 517 // resize the view on Android.
521 default_bounds_ = gfx::Rect(default_bounds_.origin(), size); 518 default_bounds_ = gfx::Rect(default_bounds_.origin(), size);
522 } 519 }
523 520
524 void RenderWidgetHostViewAndroid::SetBounds(const gfx::Rect& rect) { 521 void RenderWidgetHostViewAndroid::SetBounds(const gfx::Rect& rect) {
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 if (selection.GetSelectedText(&selected_text)) 771 if (selection.GetSelectedText(&selected_text))
775 content_view_core_->OnSelectionChanged(base::UTF16ToUTF8(selected_text)); 772 content_view_core_->OnSelectionChanged(base::UTF16ToUTF8(selected_text));
776 } 773 }
777 774
778 void RenderWidgetHostViewAndroid::UpdateBackgroundColor(SkColor color) { 775 void RenderWidgetHostViewAndroid::UpdateBackgroundColor(SkColor color) {
779 if (cached_background_color_ == color) 776 if (cached_background_color_ == color)
780 return; 777 return;
781 778
782 cached_background_color_ = color; 779 cached_background_color_ = color;
783 780
784 if (delegated_frame_host_)
785 delegated_frame_host_->UpdateBackgroundColor(color);
786
787 if (content_view_core_) 781 if (content_view_core_)
788 content_view_core_->OnBackgroundColorChanged(color); 782 content_view_core_->OnBackgroundColorChanged(color);
789 } 783 }
790 784
791 void RenderWidgetHostViewAndroid::SetNeedsBeginFrames(bool needs_begin_frames) { 785 void RenderWidgetHostViewAndroid::SetNeedsBeginFrames(bool needs_begin_frames) {
792 TRACE_EVENT1("cc", "RenderWidgetHostViewAndroid::SetNeedsBeginFrames", 786 TRACE_EVENT1("cc", "RenderWidgetHostViewAndroid::SetNeedsBeginFrames",
793 "needs_begin_frames", needs_begin_frames); 787 "needs_begin_frames", needs_begin_frames);
794 if (needs_begin_frames) 788 if (needs_begin_frames)
795 AddBeginFrameRequest(PERSISTENT_BEGIN_FRAME); 789 AddBeginFrameRequest(PERSISTENT_BEGIN_FRAME);
796 else 790 else
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1968 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); 1962 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor();
1969 if (!compositor) 1963 if (!compositor)
1970 return; 1964 return;
1971 1965
1972 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( 1966 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>(
1973 overscroll_refresh_handler, compositor, 1967 overscroll_refresh_handler, compositor,
1974 ui::GetScaleFactorForNativeView(GetNativeView())); 1968 ui::GetScaleFactorForNativeView(GetNativeView()));
1975 } 1969 }
1976 1970
1977 } // namespace content 1971 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698