| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_INFO_H | 5 #ifndef CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_INFO_H |
| 6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_INFO_H | 6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_INFO_H |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/macros.h" | |
| 12 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 13 #include "content/common/service_worker/service_worker_types.h" | 12 #include "content/common/service_worker/service_worker_types.h" |
| 14 #include "url/origin.h" | 13 #include "url/origin.h" |
| 15 | 14 |
| 16 namespace content { | 15 namespace content { |
| 17 | 16 |
| 18 // Class to encapsulate a batch of FetchRequests into a single grouping which is | 17 // Class to encapsulate a batch of FetchRequests into a single grouping which is |
| 19 // what the developer requested. | 18 // what the developer requested. |
| 20 class CONTENT_EXPORT BackgroundFetchJobInfo { | 19 class CONTENT_EXPORT BackgroundFetchJobInfo { |
| 21 public: | 20 public: |
| 22 BackgroundFetchJobInfo(const std::string& tag, | 21 BackgroundFetchJobInfo(const std::string& tag, |
| 23 const url::Origin& origin, | 22 const url::Origin& origin, |
| 24 int64_t service_worker_registration_id); | 23 int64_t service_worker_registration_id); |
| 24 // TODO(harkness): Remove copy constructor once the final (non-map-based) |
| 25 // state management is in place and make the class DISALLOW_COPY_AND_ASSIGN. |
| 26 BackgroundFetchJobInfo(); |
| 27 BackgroundFetchJobInfo(const BackgroundFetchJobInfo& other); |
| 25 ~BackgroundFetchJobInfo(); | 28 ~BackgroundFetchJobInfo(); |
| 26 | 29 |
| 27 const std::string& guid() const { return guid_; } | 30 const std::string& guid() const { return guid_; } |
| 28 const std::string& tag() const { return tag_; } | 31 const std::string& tag() const { return tag_; } |
| 29 const url::Origin& origin() const { return origin_; } | 32 const url::Origin& origin() const { return origin_; } |
| 30 int64_t service_worker_registration_id() const { | 33 int64_t service_worker_registration_id() const { |
| 31 return service_worker_registration_id_; | 34 return service_worker_registration_id_; |
| 32 } | 35 } |
| 33 | 36 |
| 34 const std::vector<std::string>& request_guids() const { | 37 const std::vector<std::string>& request_guids() const { |
| 35 return request_guids_; | 38 return request_guids_; |
| 36 } | 39 } |
| 37 | 40 |
| 38 private: | 41 private: |
| 39 std::string guid_; | 42 std::string guid_; |
| 40 std::string tag_; | 43 std::string tag_; |
| 41 url::Origin origin_; | 44 url::Origin origin_; |
| 42 int64_t service_worker_registration_id_ = kInvalidServiceWorkerRegistrationId; | 45 int64_t service_worker_registration_id_ = kInvalidServiceWorkerRegistrationId; |
| 43 std::vector<std::string> request_guids_; | 46 std::vector<std::string> request_guids_; |
| 44 | 47 |
| 45 // TODO(harkness): Other things this class should track: estimated download | 48 // TODO(harkness): Other things this class should track: estimated download |
| 46 // size, current download size, total number of files, number of complete | 49 // size, current download size, total number of files, number of complete |
| 47 // files, (possibly) data to show the notification, (possibly) list of in | 50 // files, (possibly) data to show the notification, (possibly) list of in |
| 48 // progress FetchRequests. | 51 // progress FetchRequests. |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchJobInfo); | |
| 51 }; | 52 }; |
| 52 | 53 |
| 53 } // namespace content | 54 } // namespace content |
| 54 | 55 |
| 55 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_INFO_H | 56 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_INFO_H |
| OLD | NEW |