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_REGISTRATION_ID_H_ | 5 #ifndef CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_REGISTRATION_ID_H_ |
6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_REGISTRATION_ID_H_ | 6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_REGISTRATION_ID_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/macros.h" | |
12 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
13 #include "url/origin.h" | 12 #include "url/origin.h" |
14 | 13 |
15 namespace content { | 14 namespace content { |
16 | 15 |
17 // The Background Fetch registration id corresponds to the information required | 16 // The Background Fetch registration id corresponds to the information required |
18 // to uniquely identify a Background Fetch registration in scope of a profile. | 17 // to uniquely identify a Background Fetch registration in scope of a profile. |
19 class CONTENT_EXPORT BackgroundFetchRegistrationId { | 18 class CONTENT_EXPORT BackgroundFetchRegistrationId { |
20 public: | 19 public: |
21 BackgroundFetchRegistrationId(); | 20 BackgroundFetchRegistrationId(); |
22 BackgroundFetchRegistrationId(int64_t service_worker_registration_id, | 21 BackgroundFetchRegistrationId(int64_t service_worker_registration_id, |
23 const url::Origin& origin, | 22 const url::Origin& origin, |
24 const std::string& tag); | 23 const std::string& tag); |
| 24 BackgroundFetchRegistrationId(const BackgroundFetchRegistrationId& other); |
25 BackgroundFetchRegistrationId(BackgroundFetchRegistrationId&& other); | 25 BackgroundFetchRegistrationId(BackgroundFetchRegistrationId&& other); |
26 ~BackgroundFetchRegistrationId(); | 26 ~BackgroundFetchRegistrationId(); |
27 | 27 |
28 BackgroundFetchRegistrationId& operator=( | 28 BackgroundFetchRegistrationId& operator=( |
29 const BackgroundFetchRegistrationId& other); | 29 const BackgroundFetchRegistrationId& other); |
30 | 30 |
31 // Returns whether the |other| registration id are identical or different. | 31 // Returns whether the |other| registration id are identical or different. |
32 bool operator==(const BackgroundFetchRegistrationId& other) const; | 32 bool operator==(const BackgroundFetchRegistrationId& other) const; |
33 bool operator!=(const BackgroundFetchRegistrationId& other) const; | 33 bool operator!=(const BackgroundFetchRegistrationId& other) const; |
34 | 34 |
35 // Enables this type to be used in an std::map and std::set. | 35 // Enables this type to be used in an std::map and std::set. |
36 // TODO(peter): Delete this when we switch away from using maps. | 36 // TODO(peter): Delete this when we switch away from using maps. |
37 bool operator<(const BackgroundFetchRegistrationId& other) const; | 37 bool operator<(const BackgroundFetchRegistrationId& other) const; |
38 | 38 |
39 // Returns whether this registration id refers to valid data. | 39 // Returns whether this registration id refers to valid data. |
40 bool is_null() const; | 40 bool is_null() const; |
41 | 41 |
42 int64_t service_worker_registration_id() const { | 42 int64_t service_worker_registration_id() const { |
43 return service_worker_registration_id_; | 43 return service_worker_registration_id_; |
44 } | 44 } |
45 const url::Origin& origin() const { return origin_; } | 45 const url::Origin& origin() const { return origin_; } |
46 const std::string& tag() const { return tag_; } | 46 const std::string& tag() const { return tag_; } |
47 | 47 |
48 private: | 48 private: |
49 int64_t service_worker_registration_id_; | 49 int64_t service_worker_registration_id_; |
50 url::Origin origin_; | 50 url::Origin origin_; |
51 std::string tag_; | 51 std::string tag_; |
52 | |
53 DISALLOW_COPY(BackgroundFetchRegistrationId); | |
54 }; | 52 }; |
55 | 53 |
56 } // namespace content | 54 } // namespace content |
57 | 55 |
58 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_REGISTRATION_ID_H_ | 56 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_REGISTRATION_ID_H_ |
OLD | NEW |