OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_GCM_DRIVER_REGISTRATION_INFO_H_ | 5 #ifndef COMPONENTS_GCM_DRIVER_REGISTRATION_INFO_H_ |
6 #define COMPONENTS_GCM_DRIVER_REGISTRATION_INFO_H_ | 6 #define COMPONENTS_GCM_DRIVER_REGISTRATION_INFO_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // Entity that is authorized to access resources associated with the Instance | 98 // Entity that is authorized to access resources associated with the Instance |
99 // ID. It can be another Instance ID or a project ID assigned by the Google | 99 // ID. It can be another Instance ID or a project ID assigned by the Google |
100 // API Console. | 100 // API Console. |
101 std::string authorized_entity; | 101 std::string authorized_entity; |
102 | 102 |
103 // Authorized actions that the authorized entity can take. | 103 // Authorized actions that the authorized entity can take. |
104 // E.g. for sending GCM messages, 'GCM' scope should be used. | 104 // E.g. for sending GCM messages, 'GCM' scope should be used. |
105 std::string scope; | 105 std::string scope; |
106 | 106 |
107 // Allows including a small number of string key/value pairs that will be | 107 // Allows including a small number of string key/value pairs that will be |
108 // associated with the token and may be used in processing the request. | 108 // associated with the token and may be used in processing the request. These |
| 109 // are not serialized/deserialized. |
109 std::map<std::string, std::string> options; | 110 std::map<std::string, std::string> options; |
110 }; | 111 }; |
111 | 112 |
112 struct RegistrationInfoComparer { | 113 struct RegistrationInfoComparer { |
113 bool operator()(const linked_ptr<RegistrationInfo>& a, | 114 bool operator()(const linked_ptr<RegistrationInfo>& a, |
114 const linked_ptr<RegistrationInfo>& b) const; | 115 const linked_ptr<RegistrationInfo>& b) const; |
115 }; | 116 }; |
116 | 117 |
117 // Collection of registration info. | 118 // Collection of registration info. |
118 // Map from RegistrationInfo instance to registration ID. | 119 // Map from RegistrationInfo instance to registration ID. |
119 typedef std::map<linked_ptr<RegistrationInfo>, | 120 typedef std::map<linked_ptr<RegistrationInfo>, |
120 std::string, | 121 std::string, |
121 RegistrationInfoComparer> RegistrationInfoMap; | 122 RegistrationInfoComparer> RegistrationInfoMap; |
122 | 123 |
123 // Returns true if a GCM registration for |app_id| exists in |map|. | 124 // Returns true if a GCM registration for |app_id| exists in |map|. |
124 bool ExistsGCMRegistrationInMap(const RegistrationInfoMap& map, | 125 bool ExistsGCMRegistrationInMap(const RegistrationInfoMap& map, |
125 const std::string& app_id); | 126 const std::string& app_id); |
126 | 127 |
127 } // namespace gcm | 128 } // namespace gcm |
128 | 129 |
129 #endif // COMPONENTS_GCM_DRIVER_REGISTRATION_INFO_H_ | 130 #endif // COMPONENTS_GCM_DRIVER_REGISTRATION_INFO_H_ |
OLD | NEW |