Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_SCHEDULER_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_SCHEDULER_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_SCHEDULER_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_SCHEDULER_H_ |
| 7 | 7 |
| 8 #include "components/offline_pages/core/background/device_conditions.h" | |
| 9 | |
| 8 namespace offline_pages { | 10 namespace offline_pages { |
| 9 | 11 |
| 10 // Interface of a class responsible for scheduling a task to initiate | 12 // Interface of a class responsible for scheduling a task to initiate |
| 11 // processing of background offlining requests upon select system conditions | 13 // processing of background offlining requests upon select system conditions |
| 12 // (such as having a network connection). | 14 // (such as having a network connection). |
| 13 class Scheduler { | 15 class Scheduler { |
| 14 public: | 16 public: |
| 15 // Defines a set of system conditions to trigger background processing. | 17 // Defines a set of system conditions to trigger background processing. |
| 16 struct TriggerConditions { | 18 struct TriggerConditions { |
| 17 TriggerConditions(bool power, int battery, bool unmetered) | 19 TriggerConditions(bool power, int battery, bool unmetered) |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 33 virtual void Schedule(const TriggerConditions& trigger_conditions) = 0; | 35 virtual void Schedule(const TriggerConditions& trigger_conditions) = 0; |
| 34 | 36 |
| 35 // Schedules the triggering of a task in case Chromium is killed, | 37 // Schedules the triggering of a task in case Chromium is killed, |
| 36 // so we can continue processing background download requests. This will | 38 // so we can continue processing background download requests. This will |
| 37 // not overwrite existing tasks. | 39 // not overwrite existing tasks. |
| 38 virtual void BackupSchedule(const TriggerConditions& trigger_conditions, | 40 virtual void BackupSchedule(const TriggerConditions& trigger_conditions, |
| 39 long delay_in_seconds) = 0; | 41 long delay_in_seconds) = 0; |
| 40 | 42 |
| 41 // Unschedules the currently scheduled task, if any. | 43 // Unschedules the currently scheduled task, if any. |
| 42 virtual void Unschedule() = 0; | 44 virtual void Unschedule() = 0; |
| 45 | |
| 46 // Get the current device conditions from the android APIs. | |
| 47 virtual DeviceConditions& GetCurrentDeviceConditions() = 0; | |
|
dewittj
2017/01/30 19:18:02
const
Pete Williamson
2017/01/30 21:35:24
Done.
| |
| 43 }; | 48 }; |
| 44 | 49 |
| 45 } // namespace offline_pages | 50 } // namespace offline_pages |
| 46 | 51 |
| 47 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_SCHEDULER_H_ | 52 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_SCHEDULER_H_ |
| OLD | NEW |