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..76cc215d6b916ad132c8d78447ff2bf8cafdcd96 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, |
jianli
2016/08/08 22:11:51
Can we refactor this to pass category and subtype?
johnme
2016/08/10 13:09:55
Done.
|
+ bool use_subtype, |
+ const std::string& product_category_for_subtypes) |
+ : android_id(android_id), |
+ security_token(security_token), |
+ app_id(app_id), |
+ use_subtype(use_subtype), |
+ product_category_for_subtypes(product_category_for_subtypes) { |
DCHECK(android_id != 0UL); |
DCHECK(security_token != 0UL); |
} |
@@ -148,7 +156,14 @@ 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_.product_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); |