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