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 #ifndef CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_REQUEST_SCHEDULER_MOBILE_H_ | 5 #ifndef CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_REQUEST_SCHEDULER_MOBILE_H_ |
6 #define CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_REQUEST_SCHEDULER_MOBILE_H_ | 6 #define CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_REQUEST_SCHEDULER_MOBILE_H_ |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "chrome/browser/metrics/variations/variations_request_scheduler.h" | 9 #include "chrome/browser/metrics/variations/variations_request_scheduler.h" |
10 | 10 |
11 class PrefService; | 11 class PrefService; |
12 | 12 |
13 namespace chrome_variations { | 13 namespace chrome_variations { |
14 | 14 |
15 // A specialized VariationsRequestScheduler that manages request cycles for | 15 // A specialized VariationsRequestScheduler that manages request cycles for |
16 // VariationsService on mobile platforms. | 16 // VariationsService on mobile platforms. |
17 class VariationsRequestSchedulerMobile : public VariationsRequestScheduler { | 17 class VariationsRequestSchedulerMobile : public VariationsRequestScheduler { |
18 public: | 18 public: |
19 // |task} is the closure to call when the scheduler deems ready. |local_state| | 19 // |task} is the closure to call when the scheduler deems ready. |local_state| |
20 // is the PrefService that contains the time of the last fetch. | 20 // is the PrefService that contains the time of the last fetch. |
21 explicit VariationsRequestSchedulerMobile(const base::Closure& task, | 21 explicit VariationsRequestSchedulerMobile(const base::Closure& task, |
22 PrefService* local_state); | 22 PrefService* local_state); |
23 virtual ~VariationsRequestSchedulerMobile(); | 23 virtual ~VariationsRequestSchedulerMobile(); |
24 | 24 |
25 // Base class overrides. | 25 // Base class overrides. |
26 virtual void Start() OVERRIDE; | 26 virtual void Start() OVERRIDE; |
27 virtual void Reset() OVERRIDE; | 27 virtual void Reset() OVERRIDE; |
28 virtual void OnAppEnterForeground() OVERRIDE; | |
28 | 29 |
29 private: | 30 private: |
31 FRIEND_TEST_ALL_PREFIXES(VariationsRequestSchedulerMobileTest, | |
32 OnAppEnterForegroundNoRun); | |
33 FRIEND_TEST_ALL_PREFIXES(VariationsRequestSchedulerMobileTest, | |
34 OnAppEnterForegroundRun); | |
35 FRIEND_TEST_ALL_PREFIXES(VariationsRequestSchedulerMobileTest, | |
36 OnAppEnterForegroundOnStartup); | |
37 | |
38 | |
Alexei Svitkine (slow)
2014/02/14 19:11:51
Nit: Remove extra blank lines.
rkaplow
2014/02/14 19:18:04
Done.
| |
39 | |
30 // The local state instance that provides the last fetch time. | 40 // The local state instance that provides the last fetch time. |
31 PrefService* local_state_; | 41 PrefService* local_state_; |
32 | 42 |
43 // Timer used for triggering a delayed fetch for ScheduleFetch(). | |
44 base::OneShotTimer<VariationsRequestSchedulerMobile> schedule_fetch_timer_; | |
45 | |
46 // The time the last seed request was initiated. | |
47 base::Time last_request_time_; | |
48 | |
33 DISALLOW_COPY_AND_ASSIGN(VariationsRequestSchedulerMobile); | 49 DISALLOW_COPY_AND_ASSIGN(VariationsRequestSchedulerMobile); |
34 }; | 50 }; |
35 | 51 |
36 } // namespace chrome_variations | 52 } // namespace chrome_variations |
37 | 53 |
38 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_REQUEST_SCHEDULER_MOBILE _H_ | 54 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_REQUEST_SCHEDULER_MOBILE _H_ |
OLD | NEW |