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_); } | |
128 bool is_secure() const; | 127 bool is_secure() const; |
129 const AddressList& address_list() const { return addresses_; } | 128 const AddressList& address_list() const { return addresses_; } |
130 Delegate* delegate() const { return delegate_; } | 129 Delegate* delegate() const { return delegate_; } |
131 int max_pending_send_allowed() const { return max_pending_send_allowed_; } | 130 int max_pending_send_allowed() const { return max_pending_send_allowed_; } |
132 | 131 |
133 URLRequestContext* context() { return context_; } | 132 URLRequestContext* context() { return context_; } |
134 // There're some asynchronous operations and members that are constructed from | 133 // There're some asynchronous operations and members that are constructed from |
135 // |context|. Be careful when you use this for the second time or more. | 134 // |context|. Be careful when you use this for the second time or more. |
136 void set_context(URLRequestContext* context); | 135 void set_context(URLRequestContext* context); |
137 | 136 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 void CancelWithError(int error); | 173 void CancelWithError(int error); |
175 | 174 |
176 // Cancels the connection because of receiving a certificate with an error. | 175 // Cancels the connection because of receiving a certificate with an error. |
177 void CancelWithSSLError(const SSLInfo& ssl_info); | 176 void CancelWithSSLError(const SSLInfo& ssl_info); |
178 | 177 |
179 // Continues to establish the connection in spite of an error. Usually this | 178 // Continues to establish the connection in spite of an error. Usually this |
180 // case happens because users allow certificate with an error by manual | 179 // case happens because users allow certificate with an error by manual |
181 // actions on alert dialog or browser cached such kinds of user actions. | 180 // actions on alert dialog or browser cached such kinds of user actions. |
182 void ContinueDespiteError(); | 181 void ContinueDespiteError(); |
183 | 182 |
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 | |
190 protected: | 183 protected: |
191 friend class base::RefCountedThreadSafe<SocketStream>; | 184 friend class base::RefCountedThreadSafe<SocketStream>; |
192 virtual ~SocketStream(); | 185 virtual ~SocketStream(); |
193 | 186 |
194 Delegate* delegate_; | 187 Delegate* delegate_; |
195 | 188 |
196 private: | 189 private: |
197 FRIEND_TEST_ALL_PREFIXES(SocketStreamTest, IOPending); | 190 FRIEND_TEST_ALL_PREFIXES(SocketStreamTest, IOPending); |
198 FRIEND_TEST_ALL_PREFIXES(SocketStreamTest, SwitchAfterPending); | 191 FRIEND_TEST_ALL_PREFIXES(SocketStreamTest, SwitchAfterPending); |
199 | 192 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 bool server_closed_; | 386 bool server_closed_; |
394 | 387 |
395 scoped_ptr<SocketStreamMetrics> metrics_; | 388 scoped_ptr<SocketStreamMetrics> metrics_; |
396 | 389 |
397 DISALLOW_COPY_AND_ASSIGN(SocketStream); | 390 DISALLOW_COPY_AND_ASSIGN(SocketStream); |
398 }; | 391 }; |
399 | 392 |
400 } // namespace net | 393 } // namespace net |
401 | 394 |
402 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_H_ | 395 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_H_ |
OLD | NEW |