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_COMMON_THUMBNAIL_SCORE_H_ | 5 #ifndef COMPONENTS_HISTORY_CORE_COMMON_THUMBNAIL_SCORE_H_ |
6 #define CHROME_COMMON_THUMBNAIL_SCORE_H_ | 6 #define COMPONENTS_HISTORY_CORE_COMMON_THUMBNAIL_SCORE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 | 10 |
11 // A set of metadata about a Thumbnail. | 11 // A set of metadata about a Thumbnail. |
12 struct ThumbnailScore { | 12 struct ThumbnailScore { |
13 // Initializes the ThumbnailScore to the absolute worst possible values | 13 // Initializes the ThumbnailScore to the absolute worst possible values |
14 // except for time, which is set to Now(), and redirect_hops_from_dest which | 14 // except for time, which is set to Now(), and redirect_hops_from_dest which |
15 // is set to 0. | 15 // is set to 0. |
16 ThumbnailScore(); | 16 ThumbnailScore(); |
17 | 17 |
18 // Builds a ThumbnailScore with the passed in values, and sets the | 18 // Builds a ThumbnailScore with the passed in values, and sets the |
19 // thumbnail generation time to Now(). | 19 // thumbnail generation time to Now(). |
20 ThumbnailScore(double score, bool clipping, bool top); | 20 ThumbnailScore(double score, bool clipping, bool top); |
21 | 21 |
22 // Builds a ThumbnailScore with the passed in values. | 22 // Builds a ThumbnailScore with the passed in values. |
23 ThumbnailScore(double score, bool clipping, bool top, | 23 ThumbnailScore(double score, bool clipping, bool top, const base::Time& time); |
24 const base::Time& time); | |
25 ~ThumbnailScore(); | 24 ~ThumbnailScore(); |
26 | 25 |
27 // Tests for equivalence between two ThumbnailScore objects. | 26 // Tests for equivalence between two ThumbnailScore objects. |
28 bool Equals(const ThumbnailScore& rhs) const; | 27 bool Equals(const ThumbnailScore& rhs) const; |
29 | 28 |
30 // Returns string representation of this object. | 29 // Returns string representation of this object. |
31 std::string ToString() const; | 30 std::string ToString() const; |
32 | 31 |
33 // How "boring" a thumbnail is. The boring score is the 0,1 ranged | 32 // How "boring" a thumbnail is. The boring score is the 0,1 ranged |
34 // percentage of pixels that are the most common luma. Higher boring | 33 // percentage of pixels that are the most common luma. Higher boring |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // Checks whether we should consider updating a new thumbnail based on | 101 // Checks whether we should consider updating a new thumbnail based on |
103 // this score. For instance, we don't have to update a new thumbnail | 102 // this score. For instance, we don't have to update a new thumbnail |
104 // if the current thumbnail is new and interesting enough. | 103 // if the current thumbnail is new and interesting enough. |
105 bool ShouldConsiderUpdating(); | 104 bool ShouldConsiderUpdating(); |
106 }; | 105 }; |
107 | 106 |
108 // Checks whether we should replace one thumbnail with another. | 107 // Checks whether we should replace one thumbnail with another. |
109 bool ShouldReplaceThumbnailWith(const ThumbnailScore& current, | 108 bool ShouldReplaceThumbnailWith(const ThumbnailScore& current, |
110 const ThumbnailScore& replacement); | 109 const ThumbnailScore& replacement); |
111 | 110 |
112 #endif // CHROME_COMMON_THUMBNAIL_SCORE_H_ | 111 #endif // COMPONENTS_HISTORY_CORE_COMMON_THUMBNAIL_SCORE_H_ |
OLD | NEW |