OLD | NEW |
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 #ifndef NET_SPDY_SPDY_PROXY_CLIENT_SOCKET_H_ | 5 #ifndef NET_SPDY_SPDY_PROXY_CLIENT_SOCKET_H_ |
6 #define NET_SPDY_SPDY_PROXY_CLIENT_SOCKET_H_ | 6 #define NET_SPDY_SPDY_PROXY_CLIENT_SOCKET_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 void OnClose(int status) override; | 99 void OnClose(int status) override; |
100 | 100 |
101 private: | 101 private: |
102 enum State { | 102 enum State { |
103 STATE_DISCONNECTED, | 103 STATE_DISCONNECTED, |
104 STATE_GENERATE_AUTH_TOKEN, | 104 STATE_GENERATE_AUTH_TOKEN, |
105 STATE_GENERATE_AUTH_TOKEN_COMPLETE, | 105 STATE_GENERATE_AUTH_TOKEN_COMPLETE, |
106 STATE_SEND_REQUEST, | 106 STATE_SEND_REQUEST, |
107 STATE_SEND_REQUEST_COMPLETE, | 107 STATE_SEND_REQUEST_COMPLETE, |
108 STATE_READ_REPLY_COMPLETE, | 108 STATE_READ_REPLY_COMPLETE, |
| 109 STATE_HANDLE_PROXY_AUTH_CHALLENGE, |
| 110 STATE_HANDLE_PROXY_AUTH_CHALLENGE_COMPLETE, |
109 STATE_OPEN, | 111 STATE_OPEN, |
110 STATE_CLOSED | 112 STATE_CLOSED |
111 }; | 113 }; |
112 | 114 |
113 void LogBlockedTunnelResponse() const; | 115 void LogBlockedTunnelResponse() const; |
114 | 116 |
115 // Calls |callback.Run(result)|. Used to run a callback posted to the | 117 // Calls |callback.Run(result)|. Used to run a callback posted to the |
116 // message loop. | 118 // message loop. |
117 void RunCallback(const CompletionCallback& callback, int result) const; | 119 void RunCallback(const CompletionCallback& callback, int result) const; |
118 | 120 |
119 void OnIOComplete(int result); | 121 void OnIOComplete(int result); |
120 | 122 |
121 int DoLoop(int last_io_result); | 123 int DoLoop(int last_io_result); |
122 int DoGenerateAuthToken(); | 124 int DoGenerateAuthToken(); |
123 int DoGenerateAuthTokenComplete(int result); | 125 int DoGenerateAuthTokenComplete(int result); |
124 int DoSendRequest(); | 126 int DoSendRequest(); |
125 int DoSendRequestComplete(int result); | 127 int DoSendRequestComplete(int result); |
126 int DoReadReplyComplete(int result); | 128 int DoReadReplyComplete(int result); |
| 129 int DoHandleProxyAuthChallenge(); |
| 130 int DoHandleProxyAuthChallengeComplete(int result); |
127 | 131 |
128 // Populates |user_buffer_| with as much read data as possible | 132 // Populates |user_buffer_| with as much read data as possible |
129 // and returns the number of bytes read. | 133 // and returns the number of bytes read. |
130 size_t PopulateUserReadBuffer(char* out, size_t len); | 134 size_t PopulateUserReadBuffer(char* out, size_t len); |
131 | 135 |
132 State next_state_; | 136 State next_state_; |
133 | 137 |
134 // Pointer to the SPDY Stream that this sits on top of. | 138 // Pointer to the SPDY Stream that this sits on top of. |
135 base::WeakPtr<SpdyStream> spdy_stream_; | 139 base::WeakPtr<SpdyStream> spdy_stream_; |
136 | 140 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // Only used for posting write callbacks. Weak pointers created by this | 180 // Only used for posting write callbacks. Weak pointers created by this |
177 // factory are invalidated in Disconnect(). | 181 // factory are invalidated in Disconnect(). |
178 base::WeakPtrFactory<SpdyProxyClientSocket> write_callback_weak_factory_; | 182 base::WeakPtrFactory<SpdyProxyClientSocket> write_callback_weak_factory_; |
179 | 183 |
180 DISALLOW_COPY_AND_ASSIGN(SpdyProxyClientSocket); | 184 DISALLOW_COPY_AND_ASSIGN(SpdyProxyClientSocket); |
181 }; | 185 }; |
182 | 186 |
183 } // namespace net | 187 } // namespace net |
184 | 188 |
185 #endif // NET_SPDY_SPDY_PROXY_CLIENT_SOCKET_H_ | 189 #endif // NET_SPDY_SPDY_PROXY_CLIENT_SOCKET_H_ |
OLD | NEW |