Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Side by Side Diff: content/browser/background_fetch/background_fetch_job_info.h

Issue 2763613004: Use std::unique_ptr for access to BackgroundFetchJobInfo (Closed)
Patch Set: Missed one Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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();
27 BackgroundFetchJobInfo(const BackgroundFetchJobInfo& other);
28 ~BackgroundFetchJobInfo(); 25 ~BackgroundFetchJobInfo();
29 26
30 const std::string& guid() const { return guid_; } 27 const std::string& guid() const { return guid_; }
31 const std::string& tag() const { return tag_; } 28 const std::string& tag() const { return tag_; }
32 const url::Origin& origin() const { return origin_; } 29 const url::Origin& origin() const { return origin_; }
33 int64_t service_worker_registration_id() const { 30 int64_t service_worker_registration_id() const {
34 return service_worker_registration_id_; 31 return service_worker_registration_id_;
35 } 32 }
36 33
37 const std::vector<std::string>& request_guids() const { 34 const std::vector<std::string>& request_guids() const {
38 return request_guids_; 35 return request_guids_;
39 } 36 }
40 37
41 private: 38 private:
42 std::string guid_; 39 std::string guid_;
43 std::string tag_; 40 std::string tag_;
44 url::Origin origin_; 41 url::Origin origin_;
45 int64_t service_worker_registration_id_ = kInvalidServiceWorkerRegistrationId; 42 int64_t service_worker_registration_id_ = kInvalidServiceWorkerRegistrationId;
46 std::vector<std::string> request_guids_; 43 std::vector<std::string> request_guids_;
47 44
48 // TODO(harkness): Other things this class should track: estimated download 45 // TODO(harkness): Other things this class should track: estimated download
49 // size, current download size, total number of files, number of complete 46 // size, current download size, total number of files, number of complete
50 // files, (possibly) data to show the notification, (possibly) list of in 47 // files, (possibly) data to show the notification, (possibly) list of in
51 // progress FetchRequests. 48 // progress FetchRequests.
49
50 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchJobInfo);
52 }; 51 };
53 52
54 } // namespace content 53 } // namespace content
55 54
56 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_INFO_H 55 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_INFO_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698