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_SOCKET_STREAM_SOCKET_STREAM_H_ | 5 #ifndef NET_SOCKET_STREAM_SOCKET_STREAM_H_ |
6 #define NET_SOCKET_STREAM_SOCKET_STREAM_H_ | 6 #define NET_SOCKET_STREAM_SOCKET_STREAM_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 SocketStream(const GURL& url, Delegate* delegate); | 117 SocketStream(const GURL& url, Delegate* delegate); |
118 | 118 |
119 // The user data allows the clients to associate data with this job. | 119 // The user data allows the clients to associate data with this job. |
120 // Multiple user data values can be stored under different keys. | 120 // Multiple user data values can be stored under different keys. |
121 // This job will TAKE OWNERSHIP of the given data pointer, and will | 121 // This job will TAKE OWNERSHIP of the given data pointer, and will |
122 // delete the object if it is changed or the job is destroyed. | 122 // delete the object if it is changed or the job is destroyed. |
123 UserData* GetUserData(const void* key) const; | 123 UserData* GetUserData(const void* key) const; |
124 void SetUserData(const void* key, UserData* data); | 124 void SetUserData(const void* key, UserData* data); |
125 | 125 |
126 const GURL& url() const { return url_; } | 126 const GURL& url() const { return url_; } |
| 127 GURL url_for_cookies() const { return GetURLForCookies(url_); } |
127 bool is_secure() const; | 128 bool is_secure() const; |
128 const AddressList& address_list() const { return addresses_; } | 129 const AddressList& address_list() const { return addresses_; } |
129 Delegate* delegate() const { return delegate_; } | 130 Delegate* delegate() const { return delegate_; } |
130 int max_pending_send_allowed() const { return max_pending_send_allowed_; } | 131 int max_pending_send_allowed() const { return max_pending_send_allowed_; } |
131 | 132 |
132 URLRequestContext* context() { return context_; } | 133 URLRequestContext* context() { return context_; } |
133 // There're some asynchronous operations and members that are constructed from | 134 // There're some asynchronous operations and members that are constructed from |
134 // |context|. Be careful when you use this for the second time or more. | 135 // |context|. Be careful when you use this for the second time or more. |
135 void set_context(URLRequestContext* context); | 136 void set_context(URLRequestContext* context); |
136 | 137 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 void CancelWithError(int error); | 174 void CancelWithError(int error); |
174 | 175 |
175 // Cancels the connection because of receiving a certificate with an error. | 176 // Cancels the connection because of receiving a certificate with an error. |
176 void CancelWithSSLError(const SSLInfo& ssl_info); | 177 void CancelWithSSLError(const SSLInfo& ssl_info); |
177 | 178 |
178 // Continues to establish the connection in spite of an error. Usually this | 179 // Continues to establish the connection in spite of an error. Usually this |
179 // case happens because users allow certificate with an error by manual | 180 // case happens because users allow certificate with an error by manual |
180 // actions on alert dialog or browser cached such kinds of user actions. | 181 // actions on alert dialog or browser cached such kinds of user actions. |
181 void ContinueDespiteError(); | 182 void ContinueDespiteError(); |
182 | 183 |
| 184 // Returns the URL to be used for cookie policy checking. Note that |
| 185 // this may be different than |url|; for example, the cookie policy |
| 186 // for a ws:// URL is based upon the http:// scheme for that |
| 187 // host:port pair. |
| 188 static GURL GetURLForCookies(const GURL& url); |
| 189 |
183 protected: | 190 protected: |
184 friend class base::RefCountedThreadSafe<SocketStream>; | 191 friend class base::RefCountedThreadSafe<SocketStream>; |
185 virtual ~SocketStream(); | 192 virtual ~SocketStream(); |
186 | 193 |
187 Delegate* delegate_; | 194 Delegate* delegate_; |
188 | 195 |
189 private: | 196 private: |
190 FRIEND_TEST_ALL_PREFIXES(SocketStreamTest, IOPending); | 197 FRIEND_TEST_ALL_PREFIXES(SocketStreamTest, IOPending); |
191 FRIEND_TEST_ALL_PREFIXES(SocketStreamTest, SwitchAfterPending); | 198 FRIEND_TEST_ALL_PREFIXES(SocketStreamTest, SwitchAfterPending); |
192 | 199 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 bool server_closed_; | 393 bool server_closed_; |
387 | 394 |
388 scoped_ptr<SocketStreamMetrics> metrics_; | 395 scoped_ptr<SocketStreamMetrics> metrics_; |
389 | 396 |
390 DISALLOW_COPY_AND_ASSIGN(SocketStream); | 397 DISALLOW_COPY_AND_ASSIGN(SocketStream); |
391 }; | 398 }; |
392 | 399 |
393 } // namespace net | 400 } // namespace net |
394 | 401 |
395 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_H_ | 402 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_H_ |
OLD | NEW |