| 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" | 9 #include "chrome/browser/thumbnails/render_widget_snapshot_taker.h" |
| 10 #include "chrome/browser/thumbnails/thumbnail_service.h" | 10 #include "chrome/browser/thumbnails/thumbnail_service.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 this, | 201 this, |
| 202 content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, | 202 content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, |
| 203 content::Source<RenderViewHost>(renderer)); | 203 content::Source<RenderViewHost>(renderer)); |
| 204 } | 204 } |
| 205 | 205 |
| 206 void ThumbnailTabHelper::UpdateThumbnailIfNecessary( | 206 void ThumbnailTabHelper::UpdateThumbnailIfNecessary( |
| 207 WebContents* web_contents) { | 207 WebContents* web_contents) { |
| 208 // Destroying a WebContents may trigger it to be hidden, prompting a snapshot | 208 // Destroying a WebContents may trigger it to be hidden, prompting a snapshot |
| 209 // which would be unwise to attempt <http://crbug.com/130097>. If the | 209 // which would be unwise to attempt <http://crbug.com/130097>. If the |
| 210 // WebContents is in the middle of destruction, do not risk it. | 210 // WebContents is in the middle of destruction, do not risk it. |
| 211 if (web_contents->IsBeingDestroyed()) | 211 if (!web_contents || web_contents->IsBeingDestroyed()) |
| 212 return; | 212 return; |
| 213 // Skip if a pending entry exists. WidgetHidden can be called while navigating | 213 // Skip if a pending entry exists. WidgetHidden can be called while navigating |
| 214 // pages and this is not a time when thumbnails should be generated. | 214 // pages and this is not a time when thumbnails should be generated. |
| 215 if (web_contents->GetController().GetPendingEntry()) | 215 if (web_contents->GetController().GetPendingEntry()) |
| 216 return; | 216 return; |
| 217 const GURL& url = web_contents->GetURL(); | 217 const GURL& url = web_contents->GetURL(); |
| 218 Profile* profile = | 218 Profile* profile = |
| 219 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 219 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| 220 | 220 |
| 221 scoped_refptr<thumbnails::ThumbnailService> thumbnail_service = | 221 scoped_refptr<thumbnails::ThumbnailService> thumbnail_service = |
| (...skipping 18 matching lines...) Expand all Loading... |
| 240 void ThumbnailTabHelper::DidStartLoading( | 240 void ThumbnailTabHelper::DidStartLoading( |
| 241 content::RenderViewHost* render_view_host) { | 241 content::RenderViewHost* render_view_host) { |
| 242 load_interrupted_ = false; | 242 load_interrupted_ = false; |
| 243 } | 243 } |
| 244 | 244 |
| 245 void ThumbnailTabHelper::StopNavigation() { | 245 void ThumbnailTabHelper::StopNavigation() { |
| 246 // This function gets called when the page loading is interrupted by the | 246 // This function gets called when the page loading is interrupted by the |
| 247 // stop button. | 247 // stop button. |
| 248 load_interrupted_ = true; | 248 load_interrupted_ = true; |
| 249 } | 249 } |
| OLD | NEW |