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 #include "components/variations/variations_request_scheduler.h" | 5 #include "components/variations/variations_request_scheduler.h" | 
| 6 | 6 | 
| 7 #include <stddef.h> | 7 #include <stddef.h> | 
| 8 | 8 | 
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" | 
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" | 
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 task_); | 40 task_); | 
| 41 } | 41 } | 
| 42 | 42 | 
| 43 void VariationsRequestScheduler::OnAppEnterForeground() { | 43 void VariationsRequestScheduler::OnAppEnterForeground() { | 
| 44 NOTREACHED() << "Attempted to OnAppEnterForeground on non-mobile device"; | 44 NOTREACHED() << "Attempted to OnAppEnterForeground on non-mobile device"; | 
| 45 } | 45 } | 
| 46 | 46 | 
| 47 base::TimeDelta VariationsRequestScheduler::GetFetchPeriod() const { | 47 base::TimeDelta VariationsRequestScheduler::GetFetchPeriod() const { | 
| 48 // The fetch interval can be overridden by a variation param. | 48 // The fetch interval can be overridden by a variation param. | 
| 49 std::string period_min_str = | 49 std::string period_min_str = | 
| 50 variations::GetVariationParamValue("VarationsServiceControl", | 50 variations::GetVariationParamValue("VariationsServiceControl", | 
| 
 
rkaplow
2016/08/08 22:30:09
this typo exists in client side logic as well. Did
 
Alexei Svitkine (slow)
2016/08/08 22:33:38
So we still want to keep this param, as the plan t
 
rkaplow
2016/08/08 22:45:48
Ok, wasn't sure what would happen - I guess it jus
 
 | |
| 51 "fetch_period_min"); | 51 "fetch_period_min"); | 
| 52 size_t period_min; | 52 size_t period_min; | 
| 53 if (base::StringToSizeT(period_min_str, &period_min)) | 53 if (base::StringToSizeT(period_min_str, &period_min)) | 
| 54 return base::TimeDelta::FromMinutes(period_min); | 54 return base::TimeDelta::FromMinutes(period_min); | 
| 55 | 55 | 
| 56 // The default fetch interval is every 30 minutes. | 56 // The default fetch interval is every 30 minutes. | 
| 57 return base::TimeDelta::FromMinutes(30); | 57 return base::TimeDelta::FromMinutes(30); | 
| 58 } | 58 } | 
| 59 | 59 | 
| 60 base::Closure VariationsRequestScheduler::task() const { | 60 base::Closure VariationsRequestScheduler::task() const { | 
| 61 return task_; | 61 return task_; | 
| 62 } | 62 } | 
| 63 | 63 | 
| 64 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 64 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 
| 65 // static | 65 // static | 
| 66 VariationsRequestScheduler* VariationsRequestScheduler::Create( | 66 VariationsRequestScheduler* VariationsRequestScheduler::Create( | 
| 67 const base::Closure& task, | 67 const base::Closure& task, | 
| 68 PrefService* local_state) { | 68 PrefService* local_state) { | 
| 69 return new VariationsRequestScheduler(task); | 69 return new VariationsRequestScheduler(task); | 
| 70 } | 70 } | 
| 71 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | 71 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | 
| 72 | 72 | 
| 73 } // namespace variations | 73 } // namespace variations | 
| OLD | NEW |