| 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(int64_t service_worker_registration_id, | 20 BackgroundFetchRegistrationId(int64_t service_worker_registration_id, |
| 22 const url::Origin& origin, | 21 const url::Origin& origin, |
| 23 const std::string& tag); | 22 const std::string& tag); |
| 23 BackgroundFetchRegistrationId(const BackgroundFetchRegistrationId& other); |
| 24 BackgroundFetchRegistrationId(BackgroundFetchRegistrationId&& other); | 24 BackgroundFetchRegistrationId(BackgroundFetchRegistrationId&& other); |
| 25 ~BackgroundFetchRegistrationId(); | 25 ~BackgroundFetchRegistrationId(); |
| 26 | 26 |
| 27 // Returns whether the |other| registration id are identical or different. | 27 // Returns whether the |other| registration id are identical or different. |
| 28 bool operator==(const BackgroundFetchRegistrationId& other) const; | 28 bool operator==(const BackgroundFetchRegistrationId& other) const; |
| 29 bool operator!=(const BackgroundFetchRegistrationId& other) const; | 29 bool operator!=(const BackgroundFetchRegistrationId& other) const; |
| 30 | 30 |
| 31 // Enables this type to be used in an std::map and std::set. | 31 // Enables this type to be used in an std::map and std::set. |
| 32 // TODO(peter): Delete this when we switch away from using maps. | 32 // TODO(peter): Delete this when we switch away from using maps. |
| 33 bool operator<(const BackgroundFetchRegistrationId& other) const; | 33 bool operator<(const BackgroundFetchRegistrationId& other) const; |
| 34 | 34 |
| 35 int64_t service_worker_registration_id() const { | 35 int64_t service_worker_registration_id() const { |
| 36 return service_worker_registration_id_; | 36 return service_worker_registration_id_; |
| 37 } | 37 } |
| 38 const url::Origin& origin() const { return origin_; } | 38 const url::Origin& origin() const { return origin_; } |
| 39 const std::string& tag() const { return tag_; } | 39 const std::string& tag() const { return tag_; } |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 int64_t service_worker_registration_id_; | 42 int64_t service_worker_registration_id_; |
| 43 url::Origin origin_; | 43 url::Origin origin_; |
| 44 std::string tag_; | 44 std::string tag_; |
| 45 | |
| 46 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchRegistrationId); | |
| 47 }; | 45 }; |
| 48 | 46 |
| 49 } // namespace content | 47 } // namespace content |
| 50 | 48 |
| 51 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_REGISTRATION_ID_H_ | 49 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_REGISTRATION_ID_H_ |
| OLD | NEW |