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 // TODO(ukai): code is similar with http_network_transaction.cc. We should | 5 // TODO(ukai): code is similar with http_network_transaction.cc. We should |
6 // think about ways to share code, if possible. | 6 // think about ways to share code, if possible. |
7 | 7 |
8 #include "net/socket_stream/socket_stream.h" | 8 #include "net/socket_stream/socket_stream.h" |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 : delegate_(delegate), | 93 : delegate_(delegate), |
94 url_(url), | 94 url_(url), |
95 max_pending_send_allowed_(kMaxPendingSendAllowed), | 95 max_pending_send_allowed_(kMaxPendingSendAllowed), |
96 context_(context), | 96 context_(context), |
97 next_state_(STATE_NONE), | 97 next_state_(STATE_NONE), |
98 factory_(ClientSocketFactory::GetDefaultFactory()), | 98 factory_(ClientSocketFactory::GetDefaultFactory()), |
99 proxy_mode_(kDirectConnection), | 99 proxy_mode_(kDirectConnection), |
100 proxy_url_(url), | 100 proxy_url_(url), |
101 pac_request_(NULL), | 101 pac_request_(NULL), |
102 connection_(new ClientSocketHandle), | 102 connection_(new ClientSocketHandle), |
103 privacy_mode_(kPrivacyModeDisabled), | 103 privacy_mode_(PRIVACY_MODE_DISABLED), |
104 // Unretained() is required; without it, Bind() creates a circular | 104 // Unretained() is required; without it, Bind() creates a circular |
105 // dependency and the SocketStream object will not be freed. | 105 // dependency and the SocketStream object will not be freed. |
106 io_callback_(base::Bind(&SocketStream::OnIOCompleted, | 106 io_callback_(base::Bind(&SocketStream::OnIOCompleted, |
107 base::Unretained(this))), | 107 base::Unretained(this))), |
108 read_buf_(NULL), | 108 read_buf_(NULL), |
109 current_write_buf_(NULL), | 109 current_write_buf_(NULL), |
110 waiting_for_write_completion_(false), | 110 waiting_for_write_completion_(false), |
111 closing_(false), | 111 closing_(false), |
112 server_closed_(false), | 112 server_closed_(false), |
113 metrics_(new SocketStreamMetrics(url)), | 113 metrics_(new SocketStreamMetrics(url)), |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 net_log_ = BoundNetLog(); | 159 net_log_ = BoundNetLog(); |
160 | 160 |
161 context_ = NULL; | 161 context_ = NULL; |
162 cookie_store_ = NULL; | 162 cookie_store_ = NULL; |
163 } | 163 } |
164 | 164 |
165 void SocketStream::CheckPrivacyMode() { | 165 void SocketStream::CheckPrivacyMode() { |
166 if (context_ && context_->network_delegate()) { | 166 if (context_ && context_->network_delegate()) { |
167 bool enable = context_->network_delegate()->CanEnablePrivacyMode(url_, | 167 bool enable = context_->network_delegate()->CanEnablePrivacyMode(url_, |
168 url_); | 168 url_); |
169 privacy_mode_ = enable ? kPrivacyModeEnabled : kPrivacyModeDisabled; | 169 privacy_mode_ = enable ? PRIVACY_MODE_ENABLED : PRIVACY_MODE_DISABLED; |
170 // Disable Channel ID if privacy mode is enabled. | 170 // Disable Channel ID if privacy mode is enabled. |
171 if (enable) | 171 if (enable) |
172 server_ssl_config_.channel_id_enabled = false; | 172 server_ssl_config_.channel_id_enabled = false; |
173 } | 173 } |
174 } | 174 } |
175 | 175 |
176 void SocketStream::Connect() { | 176 void SocketStream::Connect() { |
177 DCHECK(base::MessageLoop::current()) | 177 DCHECK(base::MessageLoop::current()) |
178 << "The current base::MessageLoop must exist"; | 178 << "The current base::MessageLoop must exist"; |
179 DCHECK(base::MessageLoopForIO::IsCurrent()) | 179 DCHECK(base::MessageLoopForIO::IsCurrent()) |
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1346 | 1346 |
1347 delegate_->OnSSLCertificateError(this, ssl_info, fatal); | 1347 delegate_->OnSSLCertificateError(this, ssl_info, fatal); |
1348 return ERR_IO_PENDING; | 1348 return ERR_IO_PENDING; |
1349 } | 1349 } |
1350 | 1350 |
1351 CookieStore* SocketStream::cookie_store() const { | 1351 CookieStore* SocketStream::cookie_store() const { |
1352 return cookie_store_; | 1352 return cookie_store_; |
1353 } | 1353 } |
1354 | 1354 |
1355 } // namespace net | 1355 } // namespace net |
OLD | NEW |