| 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/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "content/public/browser/notification_observer.h" | 10 #include "content/public/browser/notification_observer.h" |
| 11 #include "content/public/browser/notification_registrar.h" | 11 #include "content/public/browser/notification_registrar.h" |
| 12 #include "content/public/browser/web_contents_observer.h" | 12 #include "content/public/browser/web_contents_observer.h" |
| 13 #include "content/public/browser/web_contents_user_data.h" | 13 #include "content/public/browser/web_contents_user_data.h" |
| 14 | 14 |
| 15 class GURL; | 15 class GURL; |
| 16 class Profile; | 16 class Profile; |
| 17 class SkBitmap; | 17 class SkBitmap; |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 class RenderViewHost; | 20 class RenderViewHost; |
| 21 class RenderWidgetHost; | 21 class RenderWidgetHost; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace history { | 24 namespace history { |
| 25 class TopSites; | 25 class TopSites; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace skia { | 28 namespace skia { |
| 29 class PlatformCanvas; | 29 class PlatformBitmap; |
| 30 } | 30 } |
| 31 | 31 |
| 32 class ThumbnailTabHelper | 32 class ThumbnailTabHelper |
| 33 : public content::NotificationObserver, | 33 : public content::NotificationObserver, |
| 34 public content::WebContentsObserver, | 34 public content::WebContentsObserver, |
| 35 public content::WebContentsUserData<ThumbnailTabHelper> { | 35 public content::WebContentsUserData<ThumbnailTabHelper> { |
| 36 public: | 36 public: |
| 37 // The result of clipping. This can be used to determine if the | 37 // The result of clipping. This can be used to determine if the |
| 38 // generated thumbnail is good or not. | 38 // generated thumbnail is good or not. |
| 39 enum ClipResult { | 39 enum ClipResult { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 void UpdateThumbnailWithBitmap( | 113 void UpdateThumbnailWithBitmap( |
| 114 content::WebContents* web_contents, | 114 content::WebContents* web_contents, |
| 115 ClipResult clip_result, | 115 ClipResult clip_result, |
| 116 const SkBitmap& bitmap); | 116 const SkBitmap& bitmap); |
| 117 | 117 |
| 118 // Called when the canvas for generating a thumbnail is ready after the | 118 // Called when the canvas for generating a thumbnail is ready after the |
| 119 // AsyncUpdateThumbnail invocation. This runs on the UI thread. | 119 // AsyncUpdateThumbnail invocation. This runs on the UI thread. |
| 120 void UpdateThumbnailWithCanvas( | 120 void UpdateThumbnailWithCanvas( |
| 121 content::WebContents* web_contents, | 121 content::WebContents* web_contents, |
| 122 ClipResult clip_result, | 122 ClipResult clip_result, |
| 123 skia::PlatformCanvas* temp_canvas, | 123 skia::PlatformBitmap* temp_bitmap, |
| 124 bool result); | 124 bool result); |
| 125 | 125 |
| 126 // Called when a render view host was created for a WebContents. | 126 // Called when a render view host was created for a WebContents. |
| 127 void RenderViewHostCreated(content::RenderViewHost* renderer); | 127 void RenderViewHostCreated(content::RenderViewHost* renderer); |
| 128 | 128 |
| 129 // Indicates that the given widget has changed is visibility. | 129 // Indicates that the given widget has changed is visibility. |
| 130 void WidgetHidden(content::RenderWidgetHost* widget); | 130 void WidgetHidden(content::RenderWidgetHost* widget); |
| 131 | 131 |
| 132 // Called when the given render view host was deleted. | 132 // Called when the given render view host was deleted. |
| 133 void RenderViewHostDeleted(content::RenderViewHost* renderer); | 133 void RenderViewHostDeleted(content::RenderViewHost* renderer); |
| 134 | 134 |
| 135 bool enabled_; | 135 bool enabled_; |
| 136 | 136 |
| 137 content::NotificationRegistrar registrar_; | 137 content::NotificationRegistrar registrar_; |
| 138 | 138 |
| 139 bool load_interrupted_; | 139 bool load_interrupted_; |
| 140 | 140 |
| 141 base::WeakPtrFactory<ThumbnailTabHelper> weak_factory_; | 141 base::WeakPtrFactory<ThumbnailTabHelper> weak_factory_; |
| 142 | 142 |
| 143 DISALLOW_COPY_AND_ASSIGN(ThumbnailTabHelper); | 143 DISALLOW_COPY_AND_ASSIGN(ThumbnailTabHelper); |
| 144 }; | 144 }; |
| 145 | 145 |
| 146 #endif // CHROME_BROWSER_THUMBNAILS_THUMBNAIL_TAB_HELPER_H_ | 146 #endif // CHROME_BROWSER_THUMBNAILS_THUMBNAIL_TAB_HELPER_H_ |
| OLD | NEW |