Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_THUMBNAILING_CONTEXT_H_ | 5 #ifndef CHROME_BROWSER_THUMBNAILS_THUMBNAILING_CONTEXT_H_ |
| 6 #define CHROME_BROWSER_THUMBNAILS_THUMBNAILING_CONTEXT_H_ | 6 #define CHROME_BROWSER_THUMBNAILS_THUMBNAILING_CONTEXT_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "chrome/browser/thumbnails/thumbnail_service.h" | 10 #include "chrome/browser/thumbnails/thumbnail_service.h" |
| 11 #include "chrome/common/thumbnail_score.h" | 11 #include "chrome/common/thumbnail_score.h" |
| 12 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
| 13 #include "ui/base/layout.h" | |
|
mazda
2013/05/23 19:13:57
Is this needed?
motek.
2013/05/27 16:54:54
layout? Not anymore, my bad. Sorry for the sloppin
| |
| 14 #include "ui/gfx/size.h" | |
| 13 | 15 |
| 14 namespace thumbnails { | 16 namespace thumbnails { |
| 15 | 17 |
| 16 // The result of clipping. This can be used to determine if the | 18 // The result of clipping. This can be used to determine if the |
| 17 // generated thumbnail is good or not. | 19 // generated thumbnail is good or not. |
| 18 enum ClipResult { | 20 enum ClipResult { |
| 19 // Clipping is not done yet. | 21 // Clipping is not done yet. |
| 20 CLIP_RESULT_UNPROCESSED, | 22 CLIP_RESULT_UNPROCESSED, |
| 21 // The source image is smaller. | 23 // The source image is smaller. |
| 22 CLIP_RESULT_SOURCE_IS_SMALLER, | 24 CLIP_RESULT_SOURCE_IS_SMALLER, |
| 23 // Wider than tall by twice or more, clip horizontally. | 25 // Wider than tall by twice or more, clip horizontally. |
| 24 CLIP_RESULT_MUCH_WIDER_THAN_TALL, | 26 CLIP_RESULT_MUCH_WIDER_THAN_TALL, |
| 25 // Wider than tall, clip horizontally. | 27 // Wider than tall, clip horizontally. |
| 26 CLIP_RESULT_WIDER_THAN_TALL, | 28 CLIP_RESULT_WIDER_THAN_TALL, |
| 27 // Taller than wide, clip vertically. | 29 // Taller than wide, clip vertically. |
| 28 CLIP_RESULT_TALLER_THAN_WIDE, | 30 CLIP_RESULT_TALLER_THAN_WIDE, |
| 29 // The source and destination aspect ratios are identical. | 31 // The source and destination aspect ratios are identical. |
| 30 CLIP_RESULT_NOT_CLIPPED, | 32 CLIP_RESULT_NOT_CLIPPED, |
| 33 // The source and destination are identical. | |
| 34 CLIP_RESULT_SOURCE_SAME_AS_TARGET | |
|
mazda
2013/05/23 19:13:57
nit: add "," at the end
motek.
2013/05/27 16:54:54
Done.
| |
| 31 }; | 35 }; |
| 32 | 36 |
| 33 // Holds the information needed for processing a thumbnail. | 37 // Holds the information needed for processing a thumbnail. |
| 34 struct ThumbnailingContext : base::RefCountedThreadSafe<ThumbnailingContext> { | 38 struct ThumbnailingContext : base::RefCountedThreadSafe<ThumbnailingContext> { |
| 35 ThumbnailingContext(content::WebContents* web_contents, | 39 ThumbnailingContext(content::WebContents* web_contents, |
| 36 ThumbnailService* receiving_service, | 40 ThumbnailService* receiving_service, |
| 37 bool load_interrupted); | 41 bool load_interrupted); |
| 38 | 42 |
| 39 scoped_refptr<ThumbnailService> service; | 43 scoped_refptr<ThumbnailService> service; |
| 40 GURL url; | 44 GURL url; |
| 41 ClipResult clip_result; | 45 ClipResult clip_result; |
| 46 gfx::Size requested_copy_size; | |
| 42 ThumbnailScore score; | 47 ThumbnailScore score; |
| 43 | 48 |
| 44 private: | 49 protected: |
| 50 ThumbnailingContext() { } // Introduced as a test seam only. | |
|
mazda
2013/05/23 19:13:57
I don't think inheritance is necessary.
Why don't
motek.
2013/05/27 16:54:54
Good idea. Done.
| |
| 45 ~ThumbnailingContext(); | 51 ~ThumbnailingContext(); |
| 52 | |
| 46 friend class base::RefCountedThreadSafe<ThumbnailingContext>; | 53 friend class base::RefCountedThreadSafe<ThumbnailingContext>; |
| 47 }; | 54 }; |
| 48 | 55 |
| 49 } | 56 } |
| 50 | 57 |
| 51 #endif // CHROME_BROWSER_THUMBNAILS_THUMBNAILING_CONTEXT_H_ | 58 #endif // CHROME_BROWSER_THUMBNAILS_THUMBNAILING_CONTEXT_H_ |
| OLD | NEW |