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() { return subtype.empty() ? category : subtype; } | |
jianli
2016/08/17 21:12:08
nit: add const modifier
johnme
2016/08/18 17:43:22
Done.
| |
81 | |
82 // GCM category field derived from the |app_id|. | |
jianli
2016/08/17 21:12:08
Having "derived from the |app_id|" in this comment
johnme
2016/08/18 17:43:22
Done.
| |
83 std::string category; | |
84 // GCM subtype field derived from the |app_id|. | |
85 std::string subtype; | |
79 }; | 86 }; |
80 | 87 |
81 // Encapsulates the custom logic that is needed to build and process the | 88 // Encapsulates the custom logic that is needed to build and process the |
82 // registration request. | 89 // registration request. |
83 class GCM_EXPORT CustomRequestHandler { | 90 class GCM_EXPORT CustomRequestHandler { |
84 public: | 91 public: |
85 CustomRequestHandler(); | 92 CustomRequestHandler(); |
86 virtual ~CustomRequestHandler(); | 93 virtual ~CustomRequestHandler(); |
87 | 94 |
88 // Builds the HTTP request body data. It is called after | 95 // 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_; | 147 std::string source_to_record_; |
141 | 148 |
142 base::WeakPtrFactory<RegistrationRequest> weak_ptr_factory_; | 149 base::WeakPtrFactory<RegistrationRequest> weak_ptr_factory_; |
143 | 150 |
144 DISALLOW_COPY_AND_ASSIGN(RegistrationRequest); | 151 DISALLOW_COPY_AND_ASSIGN(RegistrationRequest); |
145 }; | 152 }; |
146 | 153 |
147 } // namespace gcm | 154 } // namespace gcm |
148 | 155 |
149 #endif // GOOGLE_APIS_GCM_ENGINE_REGISTRATION_REQUEST_H_ | 156 #endif // GOOGLE_APIS_GCM_ENGINE_REGISTRATION_REQUEST_H_ |
OLD | NEW |