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

Side by Side Diff: net/websockets/websocket_basic_handshake_stream.cc

Issue 1223153003: Move JoinString to the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: windows Created 5 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 unified diff | Download patch
« no previous file with comments | « media/capture/capture_resolution_chooser.cc ('k') | remoting/base/capabilities.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "net/websockets/websocket_basic_handshake_stream.h" 5 #include "net/websockets/websocket_basic_handshake_stream.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 std::string encoded_challenge; 92 std::string encoded_challenge;
93 base::Base64Encode(raw_challenge, &encoded_challenge); 93 base::Base64Encode(raw_challenge, &encoded_challenge);
94 return encoded_challenge; 94 return encoded_challenge;
95 } 95 }
96 96
97 void AddVectorHeaderIfNonEmpty(const char* name, 97 void AddVectorHeaderIfNonEmpty(const char* name,
98 const std::vector<std::string>& value, 98 const std::vector<std::string>& value,
99 HttpRequestHeaders* headers) { 99 HttpRequestHeaders* headers) {
100 if (value.empty()) 100 if (value.empty())
101 return; 101 return;
102 headers->SetHeader(name, JoinString(value, ", ")); 102 headers->SetHeader(name, base::JoinString(value, ", "));
103 } 103 }
104 104
105 GetHeaderResult GetSingleHeaderValue(const HttpResponseHeaders* headers, 105 GetHeaderResult GetSingleHeaderValue(const HttpResponseHeaders* headers,
106 const base::StringPiece& name, 106 const base::StringPiece& name,
107 std::string* value) { 107 std::string* value) {
108 void* state = nullptr; 108 void* state = nullptr;
109 size_t num_values = 0; 109 size_t num_values = 0;
110 std::string temp_value; 110 std::string temp_value;
111 while (headers->EnumerateHeader(&state, name, &temp_value)) { 111 while (headers->EnumerateHeader(&state, name, &temp_value)) {
112 if (++num_values > 1) 112 if (++num_values > 1)
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 } 339 }
340 header_values.push_back(header_value); 340 header_values.push_back(header_value);
341 } else { 341 } else {
342 *failure_message = "Found an unsupported extension '" + 342 *failure_message = "Found an unsupported extension '" +
343 extension.name() + 343 extension.name() +
344 "' in 'Sec-WebSocket-Extensions' header"; 344 "' in 'Sec-WebSocket-Extensions' header";
345 return false; 345 return false;
346 } 346 }
347 } 347 }
348 } 348 }
349 *accepted_extensions_descriptor = JoinString(header_values, ", "); 349 *accepted_extensions_descriptor = base::JoinString(header_values, ", ");
350 return true; 350 return true;
351 } 351 }
352 352
353 } // namespace 353 } // namespace
354 354
355 WebSocketBasicHandshakeStream::WebSocketBasicHandshakeStream( 355 WebSocketBasicHandshakeStream::WebSocketBasicHandshakeStream(
356 scoped_ptr<ClientSocketHandle> connection, 356 scoped_ptr<ClientSocketHandle> connection,
357 WebSocketStream::ConnectDelegate* connect_delegate, 357 WebSocketStream::ConnectDelegate* connect_delegate,
358 bool using_proxy, 358 bool using_proxy,
359 std::vector<std::string> requested_sub_protocols, 359 std::vector<std::string> requested_sub_protocols,
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 set_failure_message("Error during WebSocket handshake: " + failure_message); 647 set_failure_message("Error during WebSocket handshake: " + failure_message);
648 return ERR_INVALID_RESPONSE; 648 return ERR_INVALID_RESPONSE;
649 } 649 }
650 650
651 void WebSocketBasicHandshakeStream::set_failure_message( 651 void WebSocketBasicHandshakeStream::set_failure_message(
652 const std::string& failure_message) { 652 const std::string& failure_message) {
653 *failure_message_ = failure_message; 653 *failure_message_ = failure_message;
654 } 654 }
655 655
656 } // namespace net 656 } // namespace net
OLDNEW
« no previous file with comments | « media/capture/capture_resolution_chooser.cc ('k') | remoting/base/capabilities.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698