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 |
(...skipping 21 matching lines...) Expand all Loading... | |
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 // Serialize the registration_id into a string so that it can be sent to | |
43 // embedders in a neutral format. Syntax is: | |
44 // service_worker_registration_id:origin:tag | |
Peter Beverloo
2017/03/31 01:32:23
I personally wouldn't document the syntax of the s
harkness
2017/03/31 10:11:44
OK, I've moved the documentation to the .cc file.
| |
45 std::string Serialize() const; | |
46 | |
47 // Deserialize the string format of a registration_id. | |
48 static bool Deserialize(const std::string& serialized_registration_id, | |
49 BackgroundFetchRegistrationId& out_registration_id); | |
Peter Beverloo
2017/03/31 01:32:23
micro nit: style guide says static methods should
harkness
2017/03/31 10:11:44
Done.
| |
50 | |
42 int64_t service_worker_registration_id() const { | 51 int64_t service_worker_registration_id() const { |
43 return service_worker_registration_id_; | 52 return service_worker_registration_id_; |
44 } | 53 } |
45 const url::Origin& origin() const { return origin_; } | 54 const url::Origin& origin() const { return origin_; } |
46 const std::string& tag() const { return tag_; } | 55 const std::string& tag() const { return tag_; } |
47 | 56 |
48 private: | 57 private: |
49 int64_t service_worker_registration_id_; | 58 int64_t service_worker_registration_id_; |
50 url::Origin origin_; | 59 url::Origin origin_; |
51 std::string tag_; | 60 std::string tag_; |
52 }; | 61 }; |
53 | 62 |
54 } // namespace content | 63 } // namespace content |
55 | 64 |
56 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_REGISTRATION_ID_H_ | 65 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_REGISTRATION_ID_H_ |
OLD | NEW |