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

Unified Diff: components/doodle/doodle_fetcher_impl.cc

Issue 2776973003: [Doodle] Move ttl clamping from fetcher to service (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/doodle/doodle_fetcher_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/doodle/doodle_fetcher_impl.cc
diff --git a/components/doodle/doodle_fetcher_impl.cc b/components/doodle/doodle_fetcher_impl.cc
index af98588f26c07c2a792880101fffc98ad2463e61..48f6abee8348942112738c167da4cf828f0d407a 100644
--- a/components/doodle/doodle_fetcher_impl.cc
+++ b/components/doodle/doodle_fetcher_impl.cc
@@ -23,8 +23,6 @@ namespace doodle {
namespace {
-const double kMaxTimeToLiveMS = 30.0 * 24 * 60 * 60 * 1000; // 30 days
-
// "/async/ddljson" is the base API path. "ntp:1" identifies this request as
// being for a New Tab page. The "graybg:" param specifies whether the doodle
// will be displayed on a gray background.
@@ -148,17 +146,12 @@ base::Optional<DoodleConfig> DoodleFetcherImpl::ParseDoodleConfigAndTimeToLive(
DoodleConfig::FromDictionary(ddljson, GetGoogleBaseUrl());
// The JSON doesn't guarantee the number to fit into an int.
- double ttl = 0; // Expires immediately if the parameter is missing.
- if (!ddljson.GetDouble("time_to_live_ms", &ttl) || ttl < 0) {
+ double ttl_ms = 0; // Expires immediately if the parameter is missing.
+ if (!ddljson.GetDouble("time_to_live_ms", &ttl_ms) || ttl_ms < 0) {
DLOG(WARNING) << "No valid Doodle TTL present in ddljson!";
- ttl = 0;
- }
- // TODO(treib,fhorschig): Move this logic into the service.
- if (ttl > kMaxTimeToLiveMS) {
- ttl = kMaxTimeToLiveMS;
- DLOG(WARNING) << "Clamping Doodle TTL to 30 days!";
+ ttl_ms = 0;
}
- *time_to_live = base::TimeDelta::FromMillisecondsD(ttl);
+ *time_to_live = base::TimeDelta::FromMillisecondsD(ttl_ms);
return doodle;
}
« no previous file with comments | « no previous file | components/doodle/doodle_fetcher_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698