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

Side by Side Diff: content/renderer/p2p/port_allocator.cc

Issue 598323002: Use of base::StringPairs appropriately in content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/renderer/p2p/port_allocator.h" 5 #include "content/renderer/p2p/port_allocator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 request.addHTTPHeaderField( 195 request.addHTTPHeaderField(
196 WebString::fromUTF8("X-Google-Relay-Auth"), 196 WebString::fromUTF8("X-Google-Relay-Auth"),
197 WebString::fromUTF8(relay_config.username)); 197 WebString::fromUTF8(relay_config.username));
198 request.addHTTPHeaderField(WebString::fromUTF8("X-Stream-Type"), 198 request.addHTTPHeaderField(WebString::fromUTF8("X-Stream-Type"),
199 WebString::fromUTF8("chromoting")); 199 WebString::fromUTF8("chromoting"));
200 200
201 relay_session_request_->loadAsynchronously(request, this); 201 relay_session_request_->loadAsynchronously(request, this);
202 } 202 }
203 203
204 void P2PPortAllocatorSession::ParseRelayResponse() { 204 void P2PPortAllocatorSession::ParseRelayResponse() {
205 std::vector<std::pair<std::string, std::string> > value_pairs; 205 //std::vector<std::pair<std::string, std::string> > value_pairs;
Avi (use Gerrit) 2014/09/25 04:59:15 remove
MRV 2014/09/25 05:15:28 Done.
206 base::StringPairs value_pairs;
206 if (!base::SplitStringIntoKeyValuePairs(relay_session_response_, '=', '\n', 207 if (!base::SplitStringIntoKeyValuePairs(relay_session_response_, '=', '\n',
207 &value_pairs)) { 208 &value_pairs)) {
208 LOG(ERROR) << "Received invalid response from relay server"; 209 LOG(ERROR) << "Received invalid response from relay server";
209 return; 210 return;
210 } 211 }
211 212
212 relay_ip_.Clear(); 213 relay_ip_.Clear();
213 relay_udp_port_ = 0; 214 relay_udp_port_ = 0;
214 relay_tcp_port_ = 0; 215 relay_tcp_port_ = 0;
215 relay_ssltcp_port_ = 0; 216 relay_ssltcp_port_ = 0;
216 217
217 for (std::vector<std::pair<std::string, std::string> >::iterator 218 //for (std::vector<std::pair<std::string, std::string> >::iterator
Avi (use Gerrit) 2014/09/25 04:59:15 remove
MRV 2014/09/25 05:15:28 Done.
219 for (base::StringPairs::iterator
218 it = value_pairs.begin(); 220 it = value_pairs.begin();
Avi (use Gerrit) 2014/09/25 04:59:15 combine lines
MRV 2014/09/25 05:15:28 Done.
219 it != value_pairs.end(); ++it) { 221 it != value_pairs.end(); ++it) {
220 std::string key; 222 std::string key;
221 std::string value; 223 std::string value;
222 base::TrimWhitespaceASCII(it->first, base::TRIM_ALL, &key); 224 base::TrimWhitespaceASCII(it->first, base::TRIM_ALL, &key);
223 base::TrimWhitespaceASCII(it->second, base::TRIM_ALL, &value); 225 base::TrimWhitespaceASCII(it->second, base::TRIM_ALL, &value);
224 226
225 if (key == "username") { 227 if (key == "username") {
226 if (value != username()) { 228 if (value != username()) {
227 LOG(ERROR) << "When creating relay session received user name " 229 LOG(ERROR) << "When creating relay session received user name "
228 " that was different from the value specified in the query."; 230 " that was different from the value specified in the query.";
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 config.relays[i].port), 282 config.relays[i].port),
281 protocol, 283 protocol,
282 config.relays[i].secure)); 284 config.relays[i].secure));
283 relay_server.credentials = credentials; 285 relay_server.credentials = credentials;
284 port_config->AddRelay(relay_server); 286 port_config->AddRelay(relay_server);
285 } 287 }
286 ConfigReady(port_config); 288 ConfigReady(port_config);
287 } 289 }
288 290
289 } // namespace content 291 } // namespace content
OLDNEW
« content/browser/transition_request_manager.cc ('K') | « content/common/websocket.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698