| Index: chrome/browser/tab_contents/thumbnail_generator.h
|
| diff --git a/chrome/browser/tab_contents/thumbnail_generator.h b/chrome/browser/tab_contents/thumbnail_generator.h
|
| index 335b2cbcd8e4ea75f1aaa4ea4e32b3bd488f3635..c6e4cbcb6c7bc74e69ce1ed373c2f898e910bc6c 100644
|
| --- a/chrome/browser/tab_contents/thumbnail_generator.h
|
| +++ b/chrome/browser/tab_contents/thumbnail_generator.h
|
| @@ -26,6 +26,39 @@ class TabContents;
|
| class ThumbnailGenerator : NotificationObserver {
|
| public:
|
| typedef Callback1<const SkBitmap&>::Type ThumbnailReadyCallback;
|
| + // The result of clipping. This can be used to determine if the
|
| + // generated thumbnail is good or not.
|
| + enum ClipResult {
|
| + // The source image is smaller.
|
| + kSourceIsSmaller,
|
| + // Wider than tall, clip horizontally.
|
| + kWiderThanTall,
|
| + // Taller than wide, clip vertically.
|
| + kTallerThanWide,
|
| + // The source and destination aspect ratios are identical.
|
| + kNotClipped,
|
| + };
|
| +
|
| + // Bitmasks of options for generating a thumbnail.
|
| + enum ThumbnailOptions {
|
| + // No options.
|
| + kNone = 0,
|
| + // Request a clipped thumbnail with the aspect ratio preserved.
|
| + kClippedThumbnail = 1 << 0,
|
| + // Calculate the boring score.
|
| + kBoringScore = 1 << 1,
|
| + };
|
| +
|
| + // The result of thumbnailing.
|
| + struct ThumbnailResult {
|
| + ThumbnailResult() : clip_result(kNotClipped), boring_score(0.0) {}
|
| +
|
| + ClipResult clip_result;
|
| + // The boring score is the 0,1 ranged percentage of boringness. Higher
|
| + // boring scores indicate that the generated thumbnail is more like empty.
|
| + double boring_score;
|
| + };
|
| +
|
| // This class will do nothing until you call StartThumbnailing.
|
| ThumbnailGenerator();
|
| ~ThumbnailGenerator();
|
| @@ -61,6 +94,14 @@ class ThumbnailGenerator : NotificationObserver {
|
| // renderer.
|
| SkBitmap GetThumbnailForRenderer(RenderWidgetHost* renderer) const;
|
|
|
| + // This returns a thumbnail of a fixed, small size for the given
|
| + // renderer. |options| is a bitmask of ThumbnailOptions. If
|
| + // |thumbnail_result| is non-NULL, additional information like the
|
| + // boring boring score will be stored in it.
|
| + SkBitmap GetThumbnailForRendererWithOptions(RenderWidgetHost* renderer,
|
| + int options,
|
| + ThumbnailResult* result) const;
|
| +
|
| // Start or stop monitoring notifications for |renderer| based on the value
|
| // of |monitor|.
|
| void MonitorRenderer(RenderWidgetHost* renderer, bool monitor);
|
|
|