OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 GOOGLE_APIS_GCM_ENGINE_REGISTRATION_REQUEST_H_ | 5 #ifndef GOOGLE_APIS_GCM_ENGINE_REGISTRATION_REQUEST_H_ |
6 #define GOOGLE_APIS_GCM_ENGINE_REGISTRATION_REQUEST_H_ | 6 #define GOOGLE_APIS_GCM_ENGINE_REGISTRATION_REQUEST_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // Callback completing the registration request. | 60 // Callback completing the registration request. |
61 typedef base::Callback<void(Status status, | 61 typedef base::Callback<void(Status status, |
62 const std::string& registration_id)> | 62 const std::string& registration_id)> |
63 RegistrationCallback; | 63 RegistrationCallback; |
64 | 64 |
65 // Defines the common info about a registration/token request. All parameters | 65 // Defines the common info about a registration/token request. All parameters |
66 // are mandatory. | 66 // are mandatory. |
67 struct GCM_EXPORT RequestInfo { | 67 struct GCM_EXPORT RequestInfo { |
68 RequestInfo(uint64_t android_id, | 68 RequestInfo(uint64_t android_id, |
69 uint64_t security_token, | 69 uint64_t security_token, |
70 const std::string& app_id); | 70 const std::string& category, |
| 71 const std::string& subtype); |
71 ~RequestInfo(); | 72 ~RequestInfo(); |
72 | 73 |
73 // Android ID of the device. | 74 // Android ID of the device. |
74 uint64_t android_id; | 75 uint64_t android_id; |
75 // Security token of the device. | 76 // Security token of the device. |
76 uint64_t security_token; | 77 uint64_t security_token; |
77 // Application ID. | 78 |
78 std::string app_id; | 79 // Application ID used in Chrome to refer to registration/token's owner. |
| 80 const std::string& app_id() const { |
| 81 return subtype.empty() ? category : subtype; |
| 82 } |
| 83 |
| 84 // GCM category field. |
| 85 std::string category; |
| 86 // GCM subtype field. |
| 87 std::string subtype; |
79 }; | 88 }; |
80 | 89 |
81 // Encapsulates the custom logic that is needed to build and process the | 90 // Encapsulates the custom logic that is needed to build and process the |
82 // registration request. | 91 // registration request. |
83 class GCM_EXPORT CustomRequestHandler { | 92 class GCM_EXPORT CustomRequestHandler { |
84 public: | 93 public: |
85 CustomRequestHandler(); | 94 CustomRequestHandler(); |
86 virtual ~CustomRequestHandler(); | 95 virtual ~CustomRequestHandler(); |
87 | 96 |
88 // Builds the HTTP request body data. It is called after | 97 // Builds the HTTP request body data. It is called after |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 std::string source_to_record_; | 149 std::string source_to_record_; |
141 | 150 |
142 base::WeakPtrFactory<RegistrationRequest> weak_ptr_factory_; | 151 base::WeakPtrFactory<RegistrationRequest> weak_ptr_factory_; |
143 | 152 |
144 DISALLOW_COPY_AND_ASSIGN(RegistrationRequest); | 153 DISALLOW_COPY_AND_ASSIGN(RegistrationRequest); |
145 }; | 154 }; |
146 | 155 |
147 } // namespace gcm | 156 } // namespace gcm |
148 | 157 |
149 #endif // GOOGLE_APIS_GCM_ENGINE_REGISTRATION_REQUEST_H_ | 158 #endif // GOOGLE_APIS_GCM_ENGINE_REGISTRATION_REQUEST_H_ |
OLD | NEW |