| 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 #ifndef CHROME_BROWSER_THUMBNAILS_THUMBNAIL_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_THUMBNAILS_THUMBNAIL_TAB_HELPER_H_ |
| 6 #define CHROME_BROWSER_THUMBNAILS_THUMBNAIL_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_THUMBNAILS_THUMBNAIL_TAB_HELPER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "chrome/browser/thumbnails/thumbnailing_context.h" | 10 #include "chrome/browser/thumbnails/thumbnailing_context.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 friend class content::WebContentsUserData<ThumbnailTabHelper>; | 31 friend class content::WebContentsUserData<ThumbnailTabHelper>; |
| 32 | 32 |
| 33 // content::NotificationObserver overrides. | 33 // content::NotificationObserver overrides. |
| 34 void Observe(int type, | 34 void Observe(int type, |
| 35 const content::NotificationSource& source, | 35 const content::NotificationSource& source, |
| 36 const content::NotificationDetails& details) override; | 36 const content::NotificationDetails& details) override; |
| 37 | 37 |
| 38 // content::WebContentsObserver overrides. | 38 // content::WebContentsObserver overrides. |
| 39 void RenderViewDeleted(content::RenderViewHost* render_view_host) override; | 39 void RenderViewDeleted(content::RenderViewHost* render_view_host) override; |
| 40 void DidStartLoading() override; | 40 void DidStartLoading() override; |
| 41 void DidStopLoading() override; |
| 41 void NavigationStopped() override; | 42 void NavigationStopped() override; |
| 42 | 43 |
| 43 // Update the thumbnail of the given tab contents if necessary. | 44 // Update the thumbnail of the given tab contents if necessary. |
| 44 void UpdateThumbnailIfNecessary(); | 45 void UpdateThumbnailIfNecessary(); |
| 45 | 46 |
| 46 // Initiate asynchronous generation of a thumbnail from the web contents. | 47 // Initiate asynchronous generation of a thumbnail from the web contents. |
| 47 void AsyncProcessThumbnail( | 48 void AsyncProcessThumbnail( |
| 48 scoped_refptr<thumbnails::ThumbnailService> thumbnail_service); | 49 scoped_refptr<thumbnails::ThumbnailService> thumbnail_service); |
| 49 | 50 |
| 50 // Create a thumbnail from the web contents bitmap. | 51 // Create a thumbnail from the web contents bitmap. |
| 51 void ProcessCapturedBitmap( | 52 void ProcessCapturedBitmap( |
| 52 scoped_refptr<thumbnails::ThumbnailingAlgorithm> algorithm, | 53 scoped_refptr<thumbnails::ThumbnailingAlgorithm> algorithm, |
| 53 const SkBitmap& bitmap, | 54 const SkBitmap& bitmap, |
| 54 content::ReadbackResponse response); | 55 content::ReadbackResponse response); |
| 55 | 56 |
| 56 // Pass the thumbnail to the thumbnail service. | 57 // Pass the thumbnail to the thumbnail service. |
| 57 void UpdateThumbnail( | 58 void UpdateThumbnail( |
| 58 const thumbnails::ThumbnailingContext& context, | 59 const thumbnails::ThumbnailingContext& context, |
| 59 const SkBitmap& thumbnail); | 60 const SkBitmap& thumbnail); |
| 60 | 61 |
| 61 // Clean up after thumbnail generation has ended. | 62 // Clean up after thumbnail generation has ended. |
| 62 void CleanUpFromThumbnailGeneration(); | 63 void CleanUpFromThumbnailGeneration(); |
| 63 | 64 |
| 64 // Called when a render view host was created for a WebContents. | 65 // Called when a render view host was created for a WebContents. |
| 65 void RenderViewHostCreated(content::RenderViewHost* renderer); | 66 void RenderViewHostCreated(content::RenderViewHost* renderer); |
| 66 | 67 |
| 67 // Indicates that the given widget has changed is visibility. | 68 // Indicates that the given widget has changed is visibility. |
| 68 void WidgetHidden(content::RenderWidgetHost* widget); | 69 void WidgetHidden(content::RenderWidgetHost* widget); |
| 69 | 70 |
| 71 const bool capture_on_load_finished_; |
| 72 |
| 70 content::NotificationRegistrar registrar_; | 73 content::NotificationRegistrar registrar_; |
| 71 scoped_refptr<thumbnails::ThumbnailingContext> thumbnailing_context_; | 74 scoped_refptr<thumbnails::ThumbnailingContext> thumbnailing_context_; |
| 72 | 75 |
| 73 bool load_interrupted_; | 76 bool load_interrupted_; |
| 74 | 77 |
| 75 base::WeakPtrFactory<ThumbnailTabHelper> weak_factory_; | 78 base::WeakPtrFactory<ThumbnailTabHelper> weak_factory_; |
| 76 | 79 |
| 77 DISALLOW_COPY_AND_ASSIGN(ThumbnailTabHelper); | 80 DISALLOW_COPY_AND_ASSIGN(ThumbnailTabHelper); |
| 78 }; | 81 }; |
| 79 | 82 |
| 80 #endif // CHROME_BROWSER_THUMBNAILS_THUMBNAIL_TAB_HELPER_H_ | 83 #endif // CHROME_BROWSER_THUMBNAILS_THUMBNAIL_TAB_HELPER_H_ |
| OLD | NEW |