OLD | NEW |
---|---|
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 Loading... | |
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 ©_rect, | 119 ©_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 Loading... | |
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 } |
OLD | NEW |