1 // Copyright 2020 The Chromium Authors
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_BACKGROUND_TASK_SCHEDULER_TASK_INFO_H_
6 #define COMPONENTS_BACKGROUND_TASK_SCHEDULER_TASK_INFO_H_
11 #include "components/background_task_scheduler/task_ids.h"
12 #include "third_party/abseil-cpp/absl/types/optional.h"
14 namespace background_task {
16 // Specifies information regarding periodic tasks.
23 bool expires_after_window_end_time;
26 // Specifies information regarding one-off tasks.
31 int64_t window_start_time_ms;
32 int64_t window_end_time_ms;
33 bool expires_after_window_end_time;
36 // TaskInfo represents a request to run a specific BackgroundTask given
37 // the required parameters, such as whether a special type of network is
40 TaskInfo(int task_id, const PeriodicInfo& timing_info);
41 TaskInfo(int task_id, const OneOffInfo& timing_info);
43 TaskInfo(const TaskInfo&) = delete;
44 TaskInfo& operator=(const TaskInfo&) = delete;
48 // A Java counterpart will be generated for this enum.
49 // GENERATED_JAVA_ENUM_PACKAGE: (
50 // org.chromium.components.background_task_scheduler)
52 // This task has no requirements for network connectivity. Default.
54 // This task requires network connectivity.
56 // This task requires network connectivity that is unmetered.
61 NetworkType network_type = NetworkType::NONE;
62 bool requires_charging = false;
63 bool is_persisted = false;
64 bool update_current = false;
67 absl::optional<PeriodicInfo> periodic_info;
68 absl::optional<OneOffInfo> one_off_info;
71 } // namespace background_task
73 #endif // COMPONENTS_BACKGROUND_TASK_SCHEDULER_TASK_INFO_H_