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

Side by Side Diff: net/spdy/spdy_proxy_client_socket.cc

Issue 8990001: base::Bind: Convert most of net/http. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clang. Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/spdy/spdy_proxy_client_socket.h" 5 #include "net/spdy/spdy_proxy_client_socket.h"
6 6
7 #include <algorithm> // min 7 #include <algorithm> // min
8 8
9 #include "base/bind.h"
10 #include "base/bind_helpers.h"
9 #include "base/logging.h" 11 #include "base/logging.h"
10 #include "base/string_util.h" 12 #include "base/string_util.h"
11 #include "googleurl/src/gurl.h" 13 #include "googleurl/src/gurl.h"
12 #include "net/base/auth.h" 14 #include "net/base/auth.h"
13 #include "net/base/io_buffer.h" 15 #include "net/base/io_buffer.h"
14 #include "net/base/net_util.h" 16 #include "net/base/net_util.h"
15 #include "net/http/http_auth_cache.h" 17 #include "net/http/http_auth_cache.h"
16 #include "net/http/http_auth_handler_factory.h" 18 #include "net/http/http_auth_handler_factory.h"
17 #include "net/http/http_net_log_params.h" 19 #include "net/http/http_net_log_params.h"
18 #include "net/http/http_proxy_utils.h" 20 #include "net/http/http_proxy_utils.h"
19 #include "net/http/http_response_headers.h" 21 #include "net/http/http_response_headers.h"
20 #include "net/spdy/spdy_http_utils.h" 22 #include "net/spdy/spdy_http_utils.h"
21 23
22 namespace net { 24 namespace net {
23 25
24 SpdyProxyClientSocket::SpdyProxyClientSocket( 26 SpdyProxyClientSocket::SpdyProxyClientSocket(
25 SpdyStream* spdy_stream, 27 SpdyStream* spdy_stream,
26 const std::string& user_agent, 28 const std::string& user_agent,
27 const HostPortPair& endpoint, 29 const HostPortPair& endpoint,
28 const GURL& url, 30 const GURL& url,
29 const HostPortPair& proxy_server, 31 const HostPortPair& proxy_server,
30 HttpAuthCache* auth_cache, 32 HttpAuthCache* auth_cache,
31 HttpAuthHandlerFactory* auth_handler_factory) 33 HttpAuthHandlerFactory* auth_handler_factory)
32 : ALLOW_THIS_IN_INITIALIZER_LIST( 34 : next_state_(STATE_DISCONNECTED),
33 io_callback_(this, &SpdyProxyClientSocket::OnIOComplete)),
34 next_state_(STATE_DISCONNECTED),
35 spdy_stream_(spdy_stream), 35 spdy_stream_(spdy_stream),
36 endpoint_(endpoint), 36 endpoint_(endpoint),
37 auth_( 37 auth_(
38 new HttpAuthController(HttpAuth::AUTH_PROXY, 38 new HttpAuthController(HttpAuth::AUTH_PROXY,
39 GURL("https://" + proxy_server.ToString()), 39 GURL("https://" + proxy_server.ToString()),
40 auth_cache, 40 auth_cache,
41 auth_handler_factory)), 41 auth_handler_factory)),
42 user_buffer_(NULL), 42 user_buffer_(NULL),
43 write_buffer_len_(0), 43 write_buffer_len_(0),
44 write_bytes_outstanding_(0), 44 write_bytes_outstanding_(0),
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 rv = ERR_UNEXPECTED; 297 rv = ERR_UNEXPECTED;
298 break; 298 break;
299 } 299 }
300 } while (rv != ERR_IO_PENDING && next_state_ != STATE_DISCONNECTED && 300 } while (rv != ERR_IO_PENDING && next_state_ != STATE_DISCONNECTED &&
301 next_state_ != STATE_OPEN); 301 next_state_ != STATE_OPEN);
302 return rv; 302 return rv;
303 } 303 }
304 304
305 int SpdyProxyClientSocket::DoGenerateAuthToken() { 305 int SpdyProxyClientSocket::DoGenerateAuthToken() {
306 next_state_ = STATE_GENERATE_AUTH_TOKEN_COMPLETE; 306 next_state_ = STATE_GENERATE_AUTH_TOKEN_COMPLETE;
307 return auth_->MaybeGenerateAuthToken(&request_, &io_callback_, net_log_); 307 return auth_->MaybeGenerateAuthToken(
308 &request_,
309 base::Bind(&SpdyProxyClientSocket::OnIOComplete, base::Unretained(this)),
310 net_log_);
308 } 311 }
309 312
310 int SpdyProxyClientSocket::DoGenerateAuthTokenComplete(int result) { 313 int SpdyProxyClientSocket::DoGenerateAuthTokenComplete(int result) {
311 DCHECK_NE(ERR_IO_PENDING, result); 314 DCHECK_NE(ERR_IO_PENDING, result);
312 if (result == OK) 315 if (result == OK)
313 next_state_ = STATE_SEND_REQUEST; 316 next_state_ = STATE_SEND_REQUEST;
314 return result; 317 return result;
315 } 318 }
316 319
317 int SpdyProxyClientSocket::DoSendRequest() { 320 int SpdyProxyClientSocket::DoSendRequest() {
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 } 507 }
505 // This may have been deleted by read_callback_, so check first. 508 // This may have been deleted by read_callback_, so check first.
506 if (weak_ptr && !write_callback.is_null()) 509 if (weak_ptr && !write_callback.is_null())
507 write_callback.Run(ERR_CONNECTION_CLOSED); 510 write_callback.Run(ERR_CONNECTION_CLOSED);
508 } 511 }
509 512
510 void SpdyProxyClientSocket::set_chunk_callback(ChunkCallback* /*callback*/) { 513 void SpdyProxyClientSocket::set_chunk_callback(ChunkCallback* /*callback*/) {
511 } 514 }
512 515
513 } // namespace net 516 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698