| 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 #include "google_apis/gcm/engine/registration_request.h" | 5 #include "google_apis/gcm/engine/registration_request.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 BuildFormEncoding(kDeviceIdKey, android_id, &body); | 104 BuildFormEncoding(kDeviceIdKey, android_id, &body); |
| 105 | 105 |
| 106 std::string senders; | 106 std::string senders; |
| 107 for (std::vector<std::string>::const_iterator iter = | 107 for (std::vector<std::string>::const_iterator iter = |
| 108 request_info_.sender_ids.begin(); | 108 request_info_.sender_ids.begin(); |
| 109 iter != request_info_.sender_ids.end(); | 109 iter != request_info_.sender_ids.end(); |
| 110 ++iter) { | 110 ++iter) { |
| 111 DCHECK(!iter->empty()); | 111 DCHECK(!iter->empty()); |
| 112 if (!senders.empty()) | 112 if (!senders.empty()) |
| 113 senders.append(","); | 113 senders.append(","); |
| 114 senders.append(net::EscapeUrlEncodedData(*iter, true)); | 114 senders.append(*iter); |
| 115 } | 115 } |
| 116 BuildFormEncoding(kSenderKey, senders, &body); | 116 BuildFormEncoding(kSenderKey, senders, &body); |
| 117 | 117 |
| 118 if (request_info_.user_serial_number != 0) { | 118 if (request_info_.user_serial_number != 0) { |
| 119 DCHECK(request_info_.user_android_id != 0); | 119 DCHECK(request_info_.user_android_id != 0); |
| 120 BuildFormEncoding(kUserSerialNumberKey, | 120 BuildFormEncoding(kUserSerialNumberKey, |
| 121 base::IntToString(request_info_.user_serial_number), | 121 base::IntToString(request_info_.user_serial_number), |
| 122 &body); | 122 &body); |
| 123 BuildFormEncoding(kUserAndroidIdKey, | 123 BuildFormEncoding(kUserAndroidIdKey, |
| 124 base::Uint64ToString(request_info_.user_android_id), | 124 base::Uint64ToString(request_info_.user_android_id), |
| (...skipping 22 matching lines...) Expand all Loading... |
| 147 size_t token_pos = response.find(kTokenPrefix); | 147 size_t token_pos = response.find(kTokenPrefix); |
| 148 std::string token; | 148 std::string token; |
| 149 if (token_pos != std::string::npos) | 149 if (token_pos != std::string::npos) |
| 150 token = response.substr(token_pos + strlen(kTokenPrefix)); | 150 token = response.substr(token_pos + strlen(kTokenPrefix)); |
| 151 else | 151 else |
| 152 LOG(ERROR) << "Failed to extract token."; | 152 LOG(ERROR) << "Failed to extract token."; |
| 153 callback_.Run(token); | 153 callback_.Run(token); |
| 154 } | 154 } |
| 155 | 155 |
| 156 } // namespace gcm | 156 } // namespace gcm |
| OLD | NEW |