OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "chrome/common/thumbnail_score.h" | 5 #include "chrome/common/thumbnail_score.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
| 9 using base::Time; |
| 10 using base::TimeDelta; |
| 11 |
9 const TimeDelta ThumbnailScore::kUpdateThumbnailTime = TimeDelta::FromDays(1); | 12 const TimeDelta ThumbnailScore::kUpdateThumbnailTime = TimeDelta::FromDays(1); |
10 const double ThumbnailScore::kThumbnailMaximumBoringness = 0.94; | 13 const double ThumbnailScore::kThumbnailMaximumBoringness = 0.94; |
11 const double ThumbnailScore::kThumbnailDegradePerHour = 0.01; | 14 const double ThumbnailScore::kThumbnailDegradePerHour = 0.01; |
12 | 15 |
13 // Calculates a numeric score from traits about where a snapshot was | 16 // Calculates a numeric score from traits about where a snapshot was |
14 // taken. We store the raw components in the database because I'm sure | 17 // taken. We store the raw components in the database because I'm sure |
15 // this will evolve and I don't want to break databases. | 18 // this will evolve and I don't want to break databases. |
16 static int GetThumbnailType(bool good_clipping, bool at_top) { | 19 static int GetThumbnailType(bool good_clipping, bool at_top) { |
17 if (good_clipping && at_top) { | 20 if (good_clipping && at_top) { |
18 return 0; | 21 return 0; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 return true; | 96 return true; |
94 } | 97 } |
95 | 98 |
96 // If the current thumbnail doesn't meet basic boringness | 99 // If the current thumbnail doesn't meet basic boringness |
97 // requirements, but the replacement does, always replace the | 100 // requirements, but the replacement does, always replace the |
98 // current one even if we're using a worse thumbnail type. | 101 // current one even if we're using a worse thumbnail type. |
99 return current.boring_score >= ThumbnailScore::kThumbnailMaximumBoringness && | 102 return current.boring_score >= ThumbnailScore::kThumbnailMaximumBoringness && |
100 replacement.boring_score < ThumbnailScore::kThumbnailMaximumBoringness; | 103 replacement.boring_score < ThumbnailScore::kThumbnailMaximumBoringness; |
101 } | 104 } |
102 | 105 |
OLD | NEW |