1 // Copyright 2020 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_DOWNLOAD_PUBLIC_COMMON_DOWNLOAD_SCHEDULE_H_
6 #define COMPONENTS_DOWNLOAD_PUBLIC_COMMON_DOWNLOAD_SCHEDULE_H_
7 
8 #include "base/optional.h"
9 #include "base/time/time.h"
10 #include "components/download/public/common/download_export.h"
11 
12 namespace download {
13 
14 // Contains all information to schedule a download, used by download later
15 // feature.
16 class COMPONENTS_DOWNLOAD_EXPORT DownloadSchedule {
17  public:
18   DownloadSchedule(bool only_on_wifi, base::Optional<base::Time> start_time);
19   DownloadSchedule(const DownloadSchedule&);
20   ~DownloadSchedule();
21 
22   bool operator==(const DownloadSchedule&) const;
23 
only_on_wifi()24   bool only_on_wifi() const { return only_on_wifi_; }
25 
start_time()26   const base::Optional<base::Time>& start_time() const { return start_time_; }
27 
28  private:
29   // Whether to download only on WIFI. If true, |start_time_| will be ignored.
30   bool only_on_wifi_;
31 
32   // Time to start the download. Will be ignored if |only_on_wifi_| is true.
33   base::Optional<base::Time> start_time_;
34 };
35 
36 }  // namespace download
37 
38 #endif  // COMPONENTS_DOWNLOAD_PUBLIC_COMMON_DOWNLOAD_SCHEDULE_H_
39