OLD | NEW |
| (Empty) |
1 // Copyright 2016 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. | |
4 | |
5 #ifndef COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_SCHEDULER_H_ | |
6 #define COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_SCHEDULER_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "base/time/time.h" | |
10 | |
11 namespace ntp_snippets { | |
12 | |
13 // Interface to schedule the periodic fetching of snippets. | |
14 class NTPSnippetsScheduler { | |
15 public: | |
16 // Schedule periodic fetching of snippets, with different periods depending on | |
17 // network state. The concrete implementation should call | |
18 // NTPSnippetsService::FetchSnippets once per period. | |
19 // Any of the periods can be zero to indicate that the corresponding task | |
20 // should not be scheduled. | |
21 virtual bool Schedule(base::TimeDelta period_wifi, | |
22 base::TimeDelta period_fallback) = 0; | |
23 | |
24 // Cancel any scheduled tasks. | |
25 virtual bool Unschedule() = 0; | |
26 | |
27 protected: | |
28 NTPSnippetsScheduler() = default; | |
29 | |
30 private: | |
31 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsScheduler); | |
32 }; | |
33 | |
34 } // namespace ntp_snippets | |
35 | |
36 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_SCHEDULER_H_ | |
OLD | NEW |