| 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/render_widget_snapshot_taker.h" | |
| 10 #include "chrome/browser/thumbnails/thumbnail_service.h" | 9 #include "chrome/browser/thumbnails/thumbnail_service.h" |
| 11 #include "chrome/browser/thumbnails/thumbnail_service_factory.h" | 10 #include "chrome/browser/thumbnails/thumbnail_service_factory.h" |
| 12 #include "chrome/browser/thumbnails/thumbnailing_algorithm.h" | 11 #include "chrome/browser/thumbnails/thumbnailing_algorithm.h" |
| 13 #include "chrome/browser/thumbnails/thumbnailing_context.h" | 12 #include "chrome/browser/thumbnails/thumbnailing_context.h" |
| 14 #include "content/public/browser/notification_details.h" | 13 #include "content/public/browser/notification_details.h" |
| 15 #include "content/public/browser/notification_source.h" | 14 #include "content/public/browser/notification_source.h" |
| 16 #include "content/public/browser/notification_types.h" | 15 #include "content/public/browser/notification_types.h" |
| 17 #include "content/public/browser/render_view_host.h" | 16 #include "content/public/browser/render_view_host.h" |
| 18 #include "content/public/browser/render_widget_host_view.h" | 17 #include "content/public/browser/render_widget_host_view.h" |
| 19 #include "ui/gfx/color_utils.h" | 18 #include "ui/gfx/color_utils.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 WidgetHidden(content::Source<RenderWidgetHost>(source).ptr()); | 156 WidgetHidden(content::Source<RenderWidgetHost>(source).ptr()); |
| 158 break; | 157 break; |
| 159 | 158 |
| 160 default: | 159 default: |
| 161 NOTREACHED() << "Unexpected notification type: " << type; | 160 NOTREACHED() << "Unexpected notification type: " << type; |
| 162 } | 161 } |
| 163 } | 162 } |
| 164 | 163 |
| 165 void ThumbnailTabHelper::RenderViewDeleted( | 164 void ThumbnailTabHelper::RenderViewDeleted( |
| 166 content::RenderViewHost* render_view_host) { | 165 content::RenderViewHost* render_view_host) { |
| 167 g_browser_process->GetRenderWidgetSnapshotTaker()->CancelSnapshot( | |
| 168 render_view_host); | |
| 169 | |
| 170 bool registered = registrar_.IsRegistered( | 166 bool registered = registrar_.IsRegistered( |
| 171 this, | 167 this, |
| 172 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, | 168 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, |
| 173 content::Source<RenderWidgetHost>(render_view_host)); | 169 content::Source<RenderWidgetHost>(render_view_host)); |
| 174 if (registered) { | 170 if (registered) { |
| 175 registrar_.Remove( | 171 registrar_.Remove( |
| 176 this, | 172 this, |
| 177 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, | 173 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, |
| 178 content::Source<RenderWidgetHost>(render_view_host)); | 174 content::Source<RenderWidgetHost>(render_view_host)); |
| 179 } | 175 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, | 233 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, |
| 238 content::Source<RenderWidgetHost>(renderer)); | 234 content::Source<RenderWidgetHost>(renderer)); |
| 239 } | 235 } |
| 240 } | 236 } |
| 241 | 237 |
| 242 void ThumbnailTabHelper::WidgetHidden(RenderWidgetHost* widget) { | 238 void ThumbnailTabHelper::WidgetHidden(RenderWidgetHost* widget) { |
| 243 if (!enabled_) | 239 if (!enabled_) |
| 244 return; | 240 return; |
| 245 UpdateThumbnailIfNecessary(web_contents()); | 241 UpdateThumbnailIfNecessary(web_contents()); |
| 246 } | 242 } |
| OLD | NEW |