| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 64 | 64 | 
| 65 void ProcessCapturedBitmap(scoped_refptr<ThumbnailingContext> context, | 65 void ProcessCapturedBitmap(scoped_refptr<ThumbnailingContext> context, | 
| 66                            scoped_refptr<ThumbnailingAlgorithm> algorithm, | 66                            scoped_refptr<ThumbnailingAlgorithm> algorithm, | 
| 67                            const SkBitmap& bitmap, | 67                            const SkBitmap& bitmap, | 
| 68                            content::ReadbackResponse response) { | 68                            content::ReadbackResponse response) { | 
| 69   if (response != content::READBACK_SUCCESS) | 69   if (response != content::READBACK_SUCCESS) | 
| 70     return; | 70     return; | 
| 71 | 71 | 
| 72   // On success, we must be on the UI thread (on failure because of shutdown we | 72   // On success, we must be on the UI thread (on failure because of shutdown we | 
| 73   // are not on the UI thread). | 73   // are not on the UI thread). | 
| 74   DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 74   DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 
| 75 | 75 | 
| 76   algorithm->ProcessBitmap(context, base::Bind(&UpdateThumbnail), bitmap); | 76   algorithm->ProcessBitmap(context, base::Bind(&UpdateThumbnail), bitmap); | 
| 77 } | 77 } | 
| 78 | 78 | 
| 79 void AsyncProcessThumbnail(content::WebContents* web_contents, | 79 void AsyncProcessThumbnail(content::WebContents* web_contents, | 
| 80                            scoped_refptr<ThumbnailingContext> context, | 80                            scoped_refptr<ThumbnailingContext> context, | 
| 81                            scoped_refptr<ThumbnailingAlgorithm> algorithm) { | 81                            scoped_refptr<ThumbnailingAlgorithm> algorithm) { | 
| 82   DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 82   DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 
| 83   RenderWidgetHost* render_widget_host = web_contents->GetRenderViewHost(); | 83   RenderWidgetHost* render_widget_host = web_contents->GetRenderViewHost(); | 
| 84   content::RenderWidgetHostView* view = render_widget_host->GetView(); | 84   content::RenderWidgetHostView* view = render_widget_host->GetView(); | 
| 85   if (!view) | 85   if (!view) | 
| 86     return; | 86     return; | 
| 87   if (!view->IsSurfaceAvailableForCopy()) | 87   if (!view->IsSurfaceAvailableForCopy()) | 
| 88     return; | 88     return; | 
| 89 | 89 | 
| 90   gfx::Rect copy_rect = gfx::Rect(view->GetViewBounds().size()); | 90   gfx::Rect copy_rect = gfx::Rect(view->GetViewBounds().size()); | 
| 91   // Clip the pixels that will commonly hold a scrollbar, which looks bad in | 91   // Clip the pixels that will commonly hold a scrollbar, which looks bad in | 
| 92   // thumbnails. | 92   // thumbnails. | 
| (...skipping 126 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 | 
|---|