Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: chrome/common/thumbnail_score.cc

Issue 12767006: [Cleanup] Remove StringPrintf from global namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase, once more Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #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 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 9
10 using base::Time; 10 using base::Time;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 bool ThumbnailScore::Equals(const ThumbnailScore& rhs) const { 64 bool ThumbnailScore::Equals(const ThumbnailScore& rhs) const {
65 return boring_score == rhs.boring_score && 65 return boring_score == rhs.boring_score &&
66 good_clipping == rhs.good_clipping && 66 good_clipping == rhs.good_clipping &&
67 at_top == rhs.at_top && 67 at_top == rhs.at_top &&
68 time_at_snapshot == rhs.time_at_snapshot && 68 time_at_snapshot == rhs.time_at_snapshot &&
69 redirect_hops_from_dest == rhs.redirect_hops_from_dest; 69 redirect_hops_from_dest == rhs.redirect_hops_from_dest;
70 } 70 }
71 71
72 std::string ThumbnailScore::ToString() const { 72 std::string ThumbnailScore::ToString() const {
73 return StringPrintf("boring_score: %f, at_top %d, good_clipping %d, " 73 return base::StringPrintf(
74 "load_completed: %d, " 74 "boring_score: %f, at_top %d, good_clipping %d, "
75 "time_at_snapshot: %f, redirect_hops_from_dest: %d", 75 "load_completed: %d, "
76 boring_score, 76 "time_at_snapshot: %f, redirect_hops_from_dest: %d",
77 at_top, 77 boring_score,
78 good_clipping, 78 at_top,
79 load_completed, 79 good_clipping,
80 time_at_snapshot.ToDoubleT(), 80 load_completed,
81 redirect_hops_from_dest); 81 time_at_snapshot.ToDoubleT(),
82 redirect_hops_from_dest);
82 } 83 }
83 84
84 bool ShouldReplaceThumbnailWith(const ThumbnailScore& current, 85 bool ShouldReplaceThumbnailWith(const ThumbnailScore& current,
85 const ThumbnailScore& replacement) { 86 const ThumbnailScore& replacement) {
86 int current_type = GetThumbnailType(current); 87 int current_type = GetThumbnailType(current);
87 int replacement_type = GetThumbnailType(replacement); 88 int replacement_type = GetThumbnailType(replacement);
88 if (replacement_type < current_type) { 89 if (replacement_type < current_type) {
89 // If we have a better class of thumbnail, add it if it meets 90 // If we have a better class of thumbnail, add it if it meets
90 // certain minimum boringness. 91 // certain minimum boringness.
91 return replacement.boring_score < 92 return replacement.boring_score <
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 bool ThumbnailScore::ShouldConsiderUpdating() { 131 bool ThumbnailScore::ShouldConsiderUpdating() {
131 const TimeDelta time_elapsed = Time::Now() - time_at_snapshot; 132 const TimeDelta time_elapsed = Time::Now() - time_at_snapshot;
132 if (time_elapsed < TimeDelta::FromDays(kUpdateThumbnailTimeDays) && 133 if (time_elapsed < TimeDelta::FromDays(kUpdateThumbnailTimeDays) &&
133 good_clipping && at_top && load_completed) { 134 good_clipping && at_top && load_completed) {
134 // The current thumbnail is new and has good properties. 135 // The current thumbnail is new and has good properties.
135 return false; 136 return false;
136 } 137 }
137 // The current thumbnail should be updated. 138 // The current thumbnail should be updated.
138 return true; 139 return true;
139 } 140 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698