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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 gfx::Rect copy_rect = gfx::Rect(view->GetViewBounds().size()); | 89 gfx::Rect copy_rect = gfx::Rect(view->GetViewBounds().size()); |
90 // Clip the pixels that will commonly hold a scrollbar, which looks bad in | 90 // Clip the pixels that will commonly hold a scrollbar, which looks bad in |
91 // thumbnails. | 91 // thumbnails. |
92 int scrollbar_size = gfx::scrollbar_size(); | 92 int scrollbar_size = gfx::scrollbar_size(); |
93 gfx::Size copy_size; | 93 gfx::Size copy_size; |
94 copy_rect.Inset(0, 0, scrollbar_size, scrollbar_size); | 94 copy_rect.Inset(0, 0, scrollbar_size, scrollbar_size); |
95 | 95 |
96 if (copy_rect.IsEmpty()) | 96 if (copy_rect.IsEmpty()) |
97 return; | 97 return; |
98 | 98 |
| 99 ui::ScaleFactor scale_factor = |
| 100 ui::GetSupportedScaleFactor( |
| 101 ui::GetScaleFactorForNativeView(view->GetNativeView())); |
99 context->clip_result = algorithm->GetCanvasCopyInfo( | 102 context->clip_result = algorithm->GetCanvasCopyInfo( |
100 copy_rect.size(), | 103 copy_rect.size(), |
101 ui::GetScaleFactorForNativeView(view->GetNativeView()), | 104 scale_factor, |
102 ©_rect, | 105 ©_rect, |
103 &context->requested_copy_size); | 106 &context->requested_copy_size); |
104 render_widget_host->CopyFromBackingStore( | 107 render_widget_host->CopyFromBackingStore( |
105 copy_rect, | 108 copy_rect, |
106 context->requested_copy_size, | 109 context->requested_copy_size, |
107 base::Bind(&ProcessCapturedBitmap, context, algorithm), | 110 base::Bind(&ProcessCapturedBitmap, context, algorithm), |
108 SkBitmap::kARGB_8888_Config); | 111 SkBitmap::kARGB_8888_Config); |
109 } | 112 } |
110 | 113 |
111 } // namespace | 114 } // namespace |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, | 219 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, |
217 content::Source<RenderWidgetHost>(renderer)); | 220 content::Source<RenderWidgetHost>(renderer)); |
218 } | 221 } |
219 } | 222 } |
220 | 223 |
221 void ThumbnailTabHelper::WidgetHidden(RenderWidgetHost* widget) { | 224 void ThumbnailTabHelper::WidgetHidden(RenderWidgetHost* widget) { |
222 if (!enabled_) | 225 if (!enabled_) |
223 return; | 226 return; |
224 UpdateThumbnailIfNecessary(web_contents()); | 227 UpdateThumbnailIfNecessary(web_contents()); |
225 } | 228 } |
OLD | NEW |