Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(662)

Unified Diff: google_apis/gcm/engine/checkin_request.cc

Issue 378643002: [GCM] Check-in with signed in accounts associates device to user (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update to the code to prevent test crashes. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « google_apis/gcm/engine/checkin_request.h ('k') | google_apis/gcm/engine/checkin_request_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/gcm/engine/checkin_request.cc
diff --git a/google_apis/gcm/engine/checkin_request.cc b/google_apis/gcm/engine/checkin_request.cc
index a5558471772a4043bbc0a5753d3d685678e0a6a1..8ba65adf591949d9d6763a25220a68bb99fa5e68 100644
--- a/google_apis/gcm/engine/checkin_request.cc
+++ b/google_apis/gcm/engine/checkin_request.cc
@@ -80,10 +80,12 @@ void RecordCheckinStatusAndReportUMA(CheckinRequestStatus status,
CheckinRequest::RequestInfo::RequestInfo(
uint64 android_id,
uint64 security_token,
+ const std::map<std::string, std::string>& account_tokens,
const std::string& settings_digest,
const checkin_proto::ChromeBuildProto& chrome_build_proto)
: android_id(android_id),
security_token(security_token),
+ account_tokens(account_tokens),
settings_digest(settings_digest),
chrome_build_proto(chrome_build_proto) {
}
@@ -127,6 +129,16 @@ void CheckinRequest::Start() {
checkin->set_type(checkin_proto::DEVICE_CHROME_BROWSER);
#endif
+ // Pack a map of email -> token mappings into a repeated field, where odd
+ // entries are email addresses, while even ones are respective OAuth2 tokens.
+ for (std::map<std::string, std::string>::const_iterator iter =
+ request_info_.account_tokens.begin();
+ iter != request_info_.account_tokens.end();
+ ++iter) {
+ request.add_account_cookie(iter->first);
+ request.add_account_cookie(iter->second);
+ }
+
std::string upload_data;
CHECK(request.SerializeToString(&upload_data));
« no previous file with comments | « google_apis/gcm/engine/checkin_request.h ('k') | google_apis/gcm/engine/checkin_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698