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