Chromium Code Reviews| Index: components/offline_pages/background_scheduler.h |
| diff --git a/components/offline_pages/background_scheduler.h b/components/offline_pages/background_scheduler.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3e3826155ca6dbf806d66e36ea712787a34fbeb9 |
| --- /dev/null |
| +++ b/components/offline_pages/background_scheduler.h |
| @@ -0,0 +1,35 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_SCHEDULER_H_ |
| +#define COMPONENTS_OFFLINE_PAGES_BACKGROUND_SCHEDULER_H_ |
| + |
| +#include <stdint.h> |
|
fgorski
2016/04/25 21:07:38
what is this needed for?
dougarnett
2016/04/25 21:49:08
Done.
|
| + |
| +namespace offline_pages { |
| + |
| +// Interface of a class responsible for scheduling a task to initiate |
| +// processing of background offlining requests upon select system conditions |
| +// (such as having a network connection). |
| +class BackgroundScheduler { |
| + public: |
| + // Defines a set of system conditions to trigger background processing. |
| + struct TriggerCondition { |
| + // TODO(dougarnett): define network, battery, power conditions. |
| + }; |
| + |
| + virtual ~BackgroundScheduler() {} |
| + |
| + // Ensures that the system has a task scheduled for |trigger_conditions|. |
| + // This may overwrite any previous scheduled task with a new one for |
| + // these conditions. |
| + virtual void EnsureScheduled(const TriggerCondition& trigger_condition) = 0; |
| + |
| + // Clears the currently scheduled task, if any. |
| + virtual void ClearScheduled() = 0; |
| +}; |
| + |
| +} // namespace offline_pages |
| + |
| +#endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_SCHEDULER_H_ |