Index: google_apis/gcm/engine/unregistration_request.cc |
diff --git a/google_apis/gcm/engine/unregistration_request.cc b/google_apis/gcm/engine/unregistration_request.cc |
index bd225892a79709b44942df3719239c2c7e437adb..8b410d15895d9c2aaa654a84a8f7e0d1422b6da7 100644 |
--- a/google_apis/gcm/engine/unregistration_request.cc |
+++ b/google_apis/gcm/engine/unregistration_request.cc |
@@ -29,7 +29,8 @@ namespace { |
const char kRequestContentType[] = "application/x-www-form-urlencoded"; |
// Request constants. |
-const char kAppIdKey[] = "app"; |
+const char kCategoryKey[] = "app"; |
+const char kSubtypeKey[] = "X-subtype"; |
const char kDeleteKey[] = "delete"; |
const char kDeleteValue[] = "true"; |
const char kDeviceIdKey[] = "device"; |
@@ -37,10 +38,17 @@ const char kLoginHeader[] = "AidLogin"; |
} // namespace |
-UnregistrationRequest::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) { |
+UnregistrationRequest::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); |
} |
@@ -109,12 +117,17 @@ void UnregistrationRequest::BuildRequestHeaders(std::string* extra_headers) { |
std::string(kLoginHeader) + " " + |
base::Uint64ToString(request_info_.android_id) + ":" + |
base::Uint64ToString(request_info_.security_token)); |
- headers.SetHeader(kAppIdKey, request_info_.app_id); |
*extra_headers = headers.ToString(); |
} |
void UnregistrationRequest::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); |