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

Side by Side Diff: chrome/browser/thumbnails/thumbnail_tab_helper.cc

Issue 188633002: Query the preferred readback config in CopyFromBackingStore (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add Preferred format support for all functions. Created 6 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 "chrome/browser/thumbnails/thumbnail_tab_helper.h" 5 #include "chrome/browser/thumbnails/thumbnail_tab_helper.h"
6 6
7 #include "chrome/browser/browser_process.h" 7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/thumbnails/thumbnail_service.h" 9 #include "chrome/browser/thumbnails/thumbnail_service.h"
10 #include "chrome/browser/thumbnails/thumbnail_service_factory.h" 10 #include "chrome/browser/thumbnails/thumbnail_service_factory.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 copy_rect.Inset(0, 0, scrollbar_size, scrollbar_size); 111 copy_rect.Inset(0, 0, scrollbar_size, scrollbar_size);
112 112
113 if (copy_rect.IsEmpty()) 113 if (copy_rect.IsEmpty())
114 return; 114 return;
115 115
116 context->clip_result = algorithm->GetCanvasCopyInfo( 116 context->clip_result = algorithm->GetCanvasCopyInfo(
117 copy_rect.size(), 117 copy_rect.size(),
118 ui::GetScaleFactorForNativeView(view->GetNativeView()), 118 ui::GetScaleFactorForNativeView(view->GetNativeView()),
119 &copy_rect, 119 &copy_rect,
120 &context->requested_copy_size); 120 &context->requested_copy_size);
121 121 SkBitmap::Config preferred_format =
122 render_widget_host->PreferredReadbackFormat();
122 render_widget_host->CopyFromBackingStore( 123 render_widget_host->CopyFromBackingStore(
123 copy_rect, 124 copy_rect,
124 context->requested_copy_size, 125 context->requested_copy_size,
125 base::Bind(&ProcessCapturedBitmap, context, algorithm)); 126 base::Bind(&ProcessCapturedBitmap, context, algorithm),
127 preferred_format);
piman 2014/03/10 18:27:20 I believe the receiving path expects 8888 bitmaps.
sivag 2014/03/11 14:41:50 Done.
126 } 128 }
127 129
128 } // namespace 130 } // namespace
129 131
130 ThumbnailTabHelper::ThumbnailTabHelper(content::WebContents* contents) 132 ThumbnailTabHelper::ThumbnailTabHelper(content::WebContents* contents)
131 : content::WebContentsObserver(contents), 133 : content::WebContentsObserver(contents),
132 enabled_(true), 134 enabled_(true),
133 load_interrupted_(false) { 135 load_interrupted_(false) {
134 // Even though we deal in RenderWidgetHosts, we only care about its 136 // Even though we deal in RenderWidgetHosts, we only care about its
135 // subclass, RenderViewHost when it is in a tab. We don't make thumbnails 137 // subclass, RenderViewHost when it is in a tab. We don't make thumbnails
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, 235 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED,
234 content::Source<RenderWidgetHost>(renderer)); 236 content::Source<RenderWidgetHost>(renderer));
235 } 237 }
236 } 238 }
237 239
238 void ThumbnailTabHelper::WidgetHidden(RenderWidgetHost* widget) { 240 void ThumbnailTabHelper::WidgetHidden(RenderWidgetHost* widget) {
239 if (!enabled_) 241 if (!enabled_)
240 return; 242 return;
241 UpdateThumbnailIfNecessary(web_contents()); 243 UpdateThumbnailIfNecessary(web_contents());
242 } 244 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698