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

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

Issue 975293004: Start caching the theme color in web_contents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 "base/android/build_info.h" 9 #include "base/android/build_info.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 354
355 RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid( 355 RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid(
356 RenderWidgetHostImpl* widget_host, 356 RenderWidgetHostImpl* widget_host,
357 ContentViewCoreImpl* content_view_core) 357 ContentViewCoreImpl* content_view_core)
358 : host_(widget_host), 358 : host_(widget_host),
359 outstanding_vsync_requests_(0), 359 outstanding_vsync_requests_(0),
360 is_showing_(!widget_host->is_hidden()), 360 is_showing_(!widget_host->is_hidden()),
361 content_view_core_(NULL), 361 content_view_core_(NULL),
362 ime_adapter_android_(this), 362 ime_adapter_android_(this),
363 cached_background_color_(SK_ColorWHITE), 363 cached_background_color_(SK_ColorWHITE),
364 cached_theme_color_(SK_ColorWHITE),
364 last_output_surface_id_(kUndefinedOutputSurfaceId), 365 last_output_surface_id_(kUndefinedOutputSurfaceId),
365 gesture_provider_(CreateGestureProviderConfig(), this), 366 gesture_provider_(CreateGestureProviderConfig(), this),
366 stylus_text_selector_(this), 367 stylus_text_selector_(this),
367 accelerated_surface_route_id_(0), 368 accelerated_surface_route_id_(0),
368 using_browser_compositor_(CompositorImpl::IsInitialized()), 369 using_browser_compositor_(CompositorImpl::IsInitialized()),
369 frame_evictor_(new DelegatedFrameEvictor(this)), 370 frame_evictor_(new DelegatedFrameEvictor(this)),
370 locks_on_frame_count_(0), 371 locks_on_frame_count_(0),
371 observing_root_window_(false), 372 observing_root_window_(false),
372 weak_ptr_factory_(this) { 373 weak_ptr_factory_(this) {
373 host_->SetView(this); 374 host_->SetView(this);
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 const ViewHostMsg_SelectionBounds_Params& params) { 931 const ViewHostMsg_SelectionBounds_Params& params) {
931 NOTREACHED() << "Selection bounds should be routed through the compositor."; 932 NOTREACHED() << "Selection bounds should be routed through the compositor.";
932 } 933 }
933 934
934 void RenderWidgetHostViewAndroid::SetBackgroundColor(SkColor color) { 935 void RenderWidgetHostViewAndroid::SetBackgroundColor(SkColor color) {
935 RenderWidgetHostViewBase::SetBackgroundColor(color); 936 RenderWidgetHostViewBase::SetBackgroundColor(color);
936 host_->SetBackgroundOpaque(GetBackgroundOpaque()); 937 host_->SetBackgroundOpaque(GetBackgroundOpaque());
937 OnDidChangeBodyBackgroundColor(color); 938 OnDidChangeBodyBackgroundColor(color);
938 } 939 }
939 940
941 void RenderWidgetHostViewAndroid::SetThemeColor(SkColor color) {
942 cached_theme_color_ = color;
943 }
944
945 SkColor RenderWidgetHostViewAndroid::GetThemeColor() const {
946 return cached_theme_color_;
947 }
948
940 void RenderWidgetHostViewAndroid::CopyFromCompositingSurface( 949 void RenderWidgetHostViewAndroid::CopyFromCompositingSurface(
941 const gfx::Rect& src_subrect, 950 const gfx::Rect& src_subrect,
942 const gfx::Size& dst_size, 951 const gfx::Size& dst_size,
943 ReadbackRequestCallback& callback, 952 ReadbackRequestCallback& callback,
944 const SkColorType color_type) { 953 const SkColorType color_type) {
945 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::CopyFromCompositingSurface"); 954 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::CopyFromCompositingSurface");
946 if (!host_ || host_->is_hidden()) { 955 if (!host_ || host_->is_hidden()) {
947 callback.Run(SkBitmap(), READBACK_SURFACE_UNAVAILABLE); 956 callback.Run(SkBitmap(), READBACK_SURFACE_UNAVAILABLE);
948 return; 957 return;
949 } 958 }
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after
1940 results->orientationAngle = display.RotationAsDegree(); 1949 results->orientationAngle = display.RotationAsDegree();
1941 results->orientationType = 1950 results->orientationType =
1942 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); 1951 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display);
1943 gfx::DeviceDisplayInfo info; 1952 gfx::DeviceDisplayInfo info;
1944 results->depth = info.GetBitsPerPixel(); 1953 results->depth = info.GetBitsPerPixel();
1945 results->depthPerComponent = info.GetBitsPerComponent(); 1954 results->depthPerComponent = info.GetBitsPerComponent();
1946 results->isMonochrome = (results->depthPerComponent == 0); 1955 results->isMonochrome = (results->depthPerComponent == 0);
1947 } 1956 }
1948 1957
1949 } // namespace content 1958 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698