| 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 "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/thumbnails/thumbnail_service.h" | 10 #include "chrome/browser/thumbnails/thumbnail_service.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 } | 161 } |
| 162 | 162 |
| 163 scoped_refptr<thumbnails::ThumbnailingAlgorithm> algorithm( | 163 scoped_refptr<thumbnails::ThumbnailingAlgorithm> algorithm( |
| 164 thumbnail_service->GetThumbnailingAlgorithm()); | 164 thumbnail_service->GetThumbnailingAlgorithm()); |
| 165 | 165 |
| 166 thumbnailing_context_ = new ThumbnailingContext(web_contents(), | 166 thumbnailing_context_ = new ThumbnailingContext(web_contents(), |
| 167 thumbnail_service.get(), | 167 thumbnail_service.get(), |
| 168 load_interrupted_); | 168 load_interrupted_); |
| 169 | 169 |
| 170 ui::ScaleFactor scale_factor = | 170 ui::ScaleFactor scale_factor = |
| 171 ui::GetSupportedScaleFactor( | 171 ui::GetSupportedScaleFactor(view->GetScaleFactorForNativeView()); |
| 172 ui::GetScaleFactorForNativeView(view->GetNativeView())); | |
| 173 thumbnailing_context_->clip_result = algorithm->GetCanvasCopyInfo( | 172 thumbnailing_context_->clip_result = algorithm->GetCanvasCopyInfo( |
| 174 copy_rect.size(), | 173 copy_rect.size(), |
| 175 scale_factor, | 174 scale_factor, |
| 176 ©_rect, | 175 ©_rect, |
| 177 &thumbnailing_context_->requested_copy_size); | 176 &thumbnailing_context_->requested_copy_size); |
| 178 render_widget_host->CopyFromBackingStore( | 177 render_widget_host->CopyFromBackingStore( |
| 179 copy_rect, | 178 copy_rect, |
| 180 thumbnailing_context_->requested_copy_size, | 179 thumbnailing_context_->requested_copy_size, |
| 181 base::Bind(&ThumbnailTabHelper::ProcessCapturedBitmap, | 180 base::Bind(&ThumbnailTabHelper::ProcessCapturedBitmap, |
| 182 weak_factory_.GetWeakPtr(), | 181 weak_factory_.GetWeakPtr(), |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 content::Source<RenderWidgetHost>(renderer->GetWidget())); | 233 content::Source<RenderWidgetHost>(renderer->GetWidget())); |
| 235 if (!registered) { | 234 if (!registered) { |
| 236 registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, | 235 registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, |
| 237 content::Source<RenderWidgetHost>(renderer->GetWidget())); | 236 content::Source<RenderWidgetHost>(renderer->GetWidget())); |
| 238 } | 237 } |
| 239 } | 238 } |
| 240 | 239 |
| 241 void ThumbnailTabHelper::WidgetHidden(RenderWidgetHost* widget) { | 240 void ThumbnailTabHelper::WidgetHidden(RenderWidgetHost* widget) { |
| 242 UpdateThumbnailIfNecessary(); | 241 UpdateThumbnailIfNecessary(); |
| 243 } | 242 } |
| OLD | NEW |