Chromium Code Reviews| 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" | |
| 11 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 12 #include "content/common/service_worker/service_worker_types.h" | 13 #include "content/common/service_worker/service_worker_types.h" |
| 13 #include "url/origin.h" | 14 #include "url/origin.h" |
| 14 | 15 |
| 15 namespace content { | 16 namespace content { |
| 16 | 17 |
| 17 // Class to encapsulate a batch of FetchRequests into a single grouping which is | 18 // Class to encapsulate a batch of FetchRequests into a single grouping which is |
| 18 // what the developer requested. | 19 // what the developer requested. |
| 19 class CONTENT_EXPORT BackgroundFetchJobInfo { | 20 class CONTENT_EXPORT BackgroundFetchJobInfo { |
| 20 public: | 21 public: |
| 21 BackgroundFetchJobInfo(const std::string& tag, | 22 BackgroundFetchJobInfo(const std::string& tag, |
| 22 const url::Origin& origin, | 23 const url::Origin& origin, |
| 23 int64_t service_worker_registration_id); | 24 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(); | 25 BackgroundFetchJobInfo(); |
|
Peter Beverloo
2017/03/20 18:14:05
We should be able to remove the BackgroundFetchJob
harkness
2017/03/20 18:40:26
Done.
| |
| 27 BackgroundFetchJobInfo(const BackgroundFetchJobInfo& other); | |
| 28 ~BackgroundFetchJobInfo(); | 26 ~BackgroundFetchJobInfo(); |
| 29 | 27 |
| 30 const std::string& guid() const { return guid_; } | 28 const std::string& guid() const { return guid_; } |
| 31 const std::string& tag() const { return tag_; } | 29 const std::string& tag() const { return tag_; } |
| 32 const url::Origin& origin() const { return origin_; } | 30 const url::Origin& origin() const { return origin_; } |
| 33 int64_t service_worker_registration_id() const { | 31 int64_t service_worker_registration_id() const { |
| 34 return service_worker_registration_id_; | 32 return service_worker_registration_id_; |
| 35 } | 33 } |
| 36 | 34 |
| 37 const std::vector<std::string>& request_guids() const { | 35 const std::vector<std::string>& request_guids() const { |
| 38 return request_guids_; | 36 return request_guids_; |
| 39 } | 37 } |
| 40 | 38 |
| 41 private: | 39 private: |
| 42 std::string guid_; | 40 std::string guid_; |
| 43 std::string tag_; | 41 std::string tag_; |
| 44 url::Origin origin_; | 42 url::Origin origin_; |
| 45 int64_t service_worker_registration_id_ = kInvalidServiceWorkerRegistrationId; | 43 int64_t service_worker_registration_id_ = kInvalidServiceWorkerRegistrationId; |
| 46 std::vector<std::string> request_guids_; | 44 std::vector<std::string> request_guids_; |
| 47 | 45 |
| 48 // TODO(harkness): Other things this class should track: estimated download | 46 // TODO(harkness): Other things this class should track: estimated download |
| 49 // size, current download size, total number of files, number of complete | 47 // size, current download size, total number of files, number of complete |
| 50 // files, (possibly) data to show the notification, (possibly) list of in | 48 // files, (possibly) data to show the notification, (possibly) list of in |
| 51 // progress FetchRequests. | 49 // progress FetchRequests. |
| 50 | |
| 51 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchJobInfo); | |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 } // namespace content | 54 } // namespace content |
| 55 | 55 |
| 56 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_INFO_H | 56 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_INFO_H |
| OLD | NEW |