| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 ui::GetScaleFactorForNativeView(view->GetNativeView())); | 101 ui::GetScaleFactorForNativeView(view->GetNativeView())); |
| 102 context->clip_result = algorithm->GetCanvasCopyInfo( | 102 context->clip_result = algorithm->GetCanvasCopyInfo( |
| 103 copy_rect.size(), | 103 copy_rect.size(), |
| 104 scale_factor, | 104 scale_factor, |
| 105 ©_rect, | 105 ©_rect, |
| 106 &context->requested_copy_size); | 106 &context->requested_copy_size); |
| 107 render_widget_host->CopyFromBackingStore( | 107 render_widget_host->CopyFromBackingStore( |
| 108 copy_rect, | 108 copy_rect, |
| 109 context->requested_copy_size, | 109 context->requested_copy_size, |
| 110 base::Bind(&ProcessCapturedBitmap, context, algorithm), | 110 base::Bind(&ProcessCapturedBitmap, context, algorithm), |
| 111 SkBitmap::kARGB_8888_Config); | 111 kN32_SkColorType); |
| 112 } | 112 } |
| 113 | 113 |
| 114 } // namespace | 114 } // namespace |
| 115 | 115 |
| 116 ThumbnailTabHelper::ThumbnailTabHelper(content::WebContents* contents) | 116 ThumbnailTabHelper::ThumbnailTabHelper(content::WebContents* contents) |
| 117 : content::WebContentsObserver(contents), | 117 : content::WebContentsObserver(contents), |
| 118 enabled_(true), | 118 enabled_(true), |
| 119 load_interrupted_(false) { | 119 load_interrupted_(false) { |
| 120 // Even though we deal in RenderWidgetHosts, we only care about its | 120 // Even though we deal in RenderWidgetHosts, we only care about its |
| 121 // subclass, RenderViewHost when it is in a tab. We don't make thumbnails | 121 // 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... |
| 219 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, | 219 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, |
| 220 content::Source<RenderWidgetHost>(renderer)); | 220 content::Source<RenderWidgetHost>(renderer)); |
| 221 } | 221 } |
| 222 } | 222 } |
| 223 | 223 |
| 224 void ThumbnailTabHelper::WidgetHidden(RenderWidgetHost* widget) { | 224 void ThumbnailTabHelper::WidgetHidden(RenderWidgetHost* widget) { |
| 225 if (!enabled_) | 225 if (!enabled_) |
| 226 return; | 226 return; |
| 227 UpdateThumbnailIfNecessary(web_contents()); | 227 UpdateThumbnailIfNecessary(web_contents()); |
| 228 } | 228 } |
| OLD | NEW |