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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 web_contents()->GetRenderViewHost()->GetWidget(); | 147 web_contents()->GetRenderViewHost()->GetWidget(); |
148 content::RenderWidgetHostView* view = render_widget_host->GetView(); | 148 content::RenderWidgetHostView* view = render_widget_host->GetView(); |
149 if (!view || !view->IsSurfaceAvailableForCopy()) { | 149 if (!view || !view->IsSurfaceAvailableForCopy()) { |
150 return; | 150 return; |
151 } | 151 } |
152 | 152 |
153 gfx::Rect copy_rect = gfx::Rect(view->GetViewBounds().size()); | 153 gfx::Rect copy_rect = gfx::Rect(view->GetViewBounds().size()); |
154 // Clip the pixels that will commonly hold a scrollbar, which looks bad in | 154 // Clip the pixels that will commonly hold a scrollbar, which looks bad in |
155 // thumbnails. | 155 // thumbnails. |
156 int scrollbar_size = gfx::scrollbar_size(); | 156 int scrollbar_size = gfx::scrollbar_size(); |
157 gfx::Size copy_size; | |
158 copy_rect.Inset(0, 0, scrollbar_size, scrollbar_size); | 157 copy_rect.Inset(0, 0, scrollbar_size, scrollbar_size); |
159 | 158 |
160 if (copy_rect.IsEmpty()) { | 159 if (copy_rect.IsEmpty()) { |
161 return; | 160 return; |
162 } | 161 } |
163 | 162 |
164 scoped_refptr<thumbnails::ThumbnailingAlgorithm> algorithm( | 163 scoped_refptr<thumbnails::ThumbnailingAlgorithm> algorithm( |
165 thumbnail_service->GetThumbnailingAlgorithm()); | 164 thumbnail_service->GetThumbnailingAlgorithm()); |
166 | 165 |
167 thumbnailing_context_ = new ThumbnailingContext(web_contents(), | 166 thumbnailing_context_ = new ThumbnailingContext(web_contents(), |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 content::Source<RenderWidgetHost>(renderer->GetWidget())); | 234 content::Source<RenderWidgetHost>(renderer->GetWidget())); |
236 if (!registered) { | 235 if (!registered) { |
237 registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, | 236 registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, |
238 content::Source<RenderWidgetHost>(renderer->GetWidget())); | 237 content::Source<RenderWidgetHost>(renderer->GetWidget())); |
239 } | 238 } |
240 } | 239 } |
241 | 240 |
242 void ThumbnailTabHelper::WidgetHidden(RenderWidgetHost* widget) { | 241 void ThumbnailTabHelper::WidgetHidden(RenderWidgetHost* widget) { |
243 UpdateThumbnailIfNecessary(); | 242 UpdateThumbnailIfNecessary(); |
244 } | 243 } |
OLD | NEW |