| 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 | |
| 122 render_widget_host->CopyFromBackingStore( | 121 render_widget_host->CopyFromBackingStore( |
| 123 copy_rect, | 122 copy_rect, |
| 124 context->requested_copy_size, | 123 context->requested_copy_size, |
| 125 base::Bind(&ProcessCapturedBitmap, context, algorithm)); | 124 base::Bind(&ProcessCapturedBitmap, context, algorithm), |
| 125 SkBitmap::kARGB_8888_Config); |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace | 128 } // namespace |
| 129 | 129 |
| 130 ThumbnailTabHelper::ThumbnailTabHelper(content::WebContents* contents) | 130 ThumbnailTabHelper::ThumbnailTabHelper(content::WebContents* contents) |
| 131 : content::WebContentsObserver(contents), | 131 : content::WebContentsObserver(contents), |
| 132 enabled_(true), | 132 enabled_(true), |
| 133 load_interrupted_(false) { | 133 load_interrupted_(false) { |
| 134 // Even though we deal in RenderWidgetHosts, we only care about its | 134 // 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 | 135 // 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, | 233 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, |
| 234 content::Source<RenderWidgetHost>(renderer)); | 234 content::Source<RenderWidgetHost>(renderer)); |
| 235 } | 235 } |
| 236 } | 236 } |
| 237 | 237 |
| 238 void ThumbnailTabHelper::WidgetHidden(RenderWidgetHost* widget) { | 238 void ThumbnailTabHelper::WidgetHidden(RenderWidgetHost* widget) { |
| 239 if (!enabled_) | 239 if (!enabled_) |
| 240 return; | 240 return; |
| 241 UpdateThumbnailIfNecessary(web_contents()); | 241 UpdateThumbnailIfNecessary(web_contents()); |
| 242 } | 242 } |
| OLD | NEW |