Rename GetIconID to GetIconId
[chromium-blink-merge.git] / components / variations / variations_request_scheduler_mobile.h
blobbdcafb9922595afd01abd63baad598175bd03572
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_VARIATIONS_VARIATIONS_REQUEST_SCHEDULER_MOBILE_H_
6 #define COMPONENTS_VARIATIONS_VARIATIONS_REQUEST_SCHEDULER_MOBILE_H_
8 #include "base/bind.h"
9 #include "components/variations/variations_request_scheduler.h"
11 class PrefService;
13 namespace chrome_variations {
15 // A specialized VariationsRequestScheduler that manages request cycles for
16 // VariationsService on mobile platforms.
17 class VariationsRequestSchedulerMobile : public VariationsRequestScheduler {
18 public:
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.
21 explicit VariationsRequestSchedulerMobile(const base::Closure& task,
22 PrefService* local_state);
23 ~VariationsRequestSchedulerMobile() override;
25 // Base class overrides.
26 void Start() override;
27 void Reset() override;
28 void OnAppEnterForeground() override;
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);
38 // The local state instance that provides the last fetch time.
39 PrefService* local_state_;
41 // Timer used for triggering a delayed fetch for ScheduleFetch().
42 base::OneShotTimer<VariationsRequestSchedulerMobile> schedule_fetch_timer_;
44 // The time the last seed request was initiated.
45 base::Time last_request_time_;
47 DISALLOW_COPY_AND_ASSIGN(VariationsRequestSchedulerMobile);
50 } // namespace chrome_variations
52 #endif // COMPONENTS_VARIATIONS_VARIATIONS_REQUEST_SCHEDULER_MOBILE_H_