Index: google_apis/gcm/engine/registration_request.cc |
diff --git a/google_apis/gcm/engine/registration_request.cc b/google_apis/gcm/engine/registration_request.cc |
index 287732a76803e1d4f50398a3a8b6d0310e1f6c18..79076b83434c2489ae7d021aacaeb78ba119584a 100644 |
--- a/google_apis/gcm/engine/registration_request.cc |
+++ b/google_apis/gcm/engine/registration_request.cc |
@@ -33,7 +33,8 @@ const char kRegistrationRequestContentType[] = |
"application/x-www-form-urlencoded"; |
// Request constants. |
-const char kAppIdKey[] = "app"; |
+const char kCategoryKey[] = "app"; |
+const char kSubtypeKey[] = "X-subtype"; |
const char kDeviceIdKey[] = "device"; |
const char kLoginHeader[] = "AidLogin"; |
@@ -73,10 +74,17 @@ bool ShouldRetryWithStatus(RegistrationRequest::Status status) { |
} // namespace |
-RegistrationRequest::RequestInfo::RequestInfo(uint64_t android_id, |
- uint64_t security_token, |
- const std::string& app_id) |
- : android_id(android_id), security_token(security_token), app_id(app_id) { |
+RegistrationRequest::RequestInfo::RequestInfo( |
+ uint64_t android_id, |
+ uint64_t security_token, |
+ const std::string& app_id, |
+ bool use_subtype, |
+ const std::string& category_for_subtypes) |
+ : android_id(android_id), |
+ security_token(security_token), |
+ app_id(app_id), |
+ use_subtype(use_subtype), |
+ category_for_subtypes(category_for_subtypes) { |
DCHECK(android_id != 0UL); |
DCHECK(security_token != 0UL); |
} |
@@ -148,7 +156,13 @@ void RegistrationRequest::BuildRequestHeaders(std::string* extra_headers) { |
} |
void RegistrationRequest::BuildRequestBody(std::string* body) { |
- BuildFormEncoding(kAppIdKey, request_info_.app_id, body); |
+ if (request_info_.use_subtype) { |
+ BuildFormEncoding(kCategoryKey, request_info_.category_for_subtypes, body); |
+ BuildFormEncoding(kSubtypeKey, request_info_.app_id, body); |
+ } else { |
+ BuildFormEncoding(kCategoryKey, request_info_.app_id, body); |
+ } |
+ |
BuildFormEncoding(kDeviceIdKey, |
base::Uint64ToString(request_info_.android_id), |
body); |