fixup! [M120 Migration] Notify media device state to webbrowser
[platform/framework/web/chromium-efl.git] / components / background_task_scheduler / task_info.h
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.
4
5 #ifndef COMPONENTS_BACKGROUND_TASK_SCHEDULER_TASK_INFO_H_
6 #define COMPONENTS_BACKGROUND_TASK_SCHEDULER_TASK_INFO_H_
7
8 #include <stdint.h>
9 #include <string>
10
11 #include "components/background_task_scheduler/task_ids.h"
12 #include "third_party/abseil-cpp/absl/types/optional.h"
13
14 namespace background_task {
15
16 // Specifies information regarding periodic tasks.
17 struct PeriodicInfo {
18   PeriodicInfo();
19   ~PeriodicInfo();
20
21   int64_t interval_ms;
22   int64_t flex_ms;
23   bool expires_after_window_end_time;
24 };
25
26 // Specifies information regarding one-off tasks.
27 struct OneOffInfo {
28   OneOffInfo();
29   ~OneOffInfo();
30
31   int64_t window_start_time_ms;
32   int64_t window_end_time_ms;
33   bool expires_after_window_end_time;
34 };
35
36 // TaskInfo represents a request to run a specific BackgroundTask given
37 // the required parameters, such as whether a special type of network is
38 // available.
39 struct TaskInfo {
40   TaskInfo(int task_id, const PeriodicInfo& timing_info);
41   TaskInfo(int task_id, const OneOffInfo& timing_info);
42
43   TaskInfo(const TaskInfo&) = delete;
44   TaskInfo& operator=(const TaskInfo&) = delete;
45
46   ~TaskInfo();
47
48   // A Java counterpart will be generated for this enum.
49   // GENERATED_JAVA_ENUM_PACKAGE: (
50   // org.chromium.components.background_task_scheduler)
51   enum NetworkType {
52     // This task has no requirements for network connectivity. Default.
53     NONE = 0,
54     // This task requires network connectivity.
55     ANY = 1,
56     // This task requires network connectivity that is unmetered.
57     UNMETERED = 2,
58   };
59
60   int task_id;
61   NetworkType network_type = NetworkType::NONE;
62   bool requires_charging = false;
63   bool is_persisted = false;
64   bool update_current = false;
65   std::string extras;
66
67   absl::optional<PeriodicInfo> periodic_info;
68   absl::optional<OneOffInfo> one_off_info;
69 };
70
71 }  // namespace background_task
72
73 #endif  // COMPONENTS_BACKGROUND_TASK_SCHEDULER_TASK_INFO_H_