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_OFFLINE_PAGES_BACKGROUND_SCHEDULER_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_SCHEDULER_H_ |
| 7 |
| 8 namespace offline_pages { |
| 9 |
| 10 // Interface of a class responsible for scheduling a task to initiate |
| 11 // processing of background offlining requests upon select system conditions |
| 12 // (such as having a network connection). |
| 13 class Scheduler { |
| 14 public: |
| 15 // Defines a set of system conditions to trigger background processing. |
| 16 struct TriggerCondition { |
| 17 // TODO(dougarnett): define network, battery, power conditions. |
| 18 }; |
| 19 |
| 20 virtual ~Scheduler() {} |
| 21 |
| 22 // Ensures that the system has a task scheduled for |trigger_conditions|. |
| 23 // This may overwrite any previous scheduled task with a new one for |
| 24 // these conditions. |
| 25 virtual void EnsureScheduled(const TriggerCondition& trigger_condition) = 0; |
| 26 |
| 27 // Clears the currently scheduled task, if any. |
| 28 virtual void ClearScheduled() = 0; |
| 29 }; |
| 30 |
| 31 } // namespace offline_pages |
| 32 |
| 33 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_SCHEDULER_H_ |
OLD | NEW |