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 #include "net/ftp/ftp_network_transaction.h" | 5 #include "net/ftp/ftp_network_transaction.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 FtpNetworkTransaction::FtpNetworkTransaction( | 205 FtpNetworkTransaction::FtpNetworkTransaction( |
206 FtpNetworkSession* session, | 206 FtpNetworkSession* session, |
207 ClientSocketFactory* socket_factory) | 207 ClientSocketFactory* socket_factory) |
208 : command_sent_(COMMAND_NONE), | 208 : command_sent_(COMMAND_NONE), |
209 io_callback_(base::Bind(&FtpNetworkTransaction::OnIOComplete, | 209 io_callback_(base::Bind(&FtpNetworkTransaction::OnIOComplete, |
210 base::Unretained(this))), | 210 base::Unretained(this))), |
211 session_(session), | 211 session_(session), |
212 request_(NULL), | 212 request_(NULL), |
213 resolver_(session->host_resolver()), | 213 resolver_(session->host_resolver()), |
214 read_ctrl_buf_(new IOBuffer(kCtrlBufLen)), | 214 read_ctrl_buf_(new IOBuffer(kCtrlBufLen)), |
215 ctrl_response_buffer_(NULL), | |
216 read_data_buf_len_(0), | 215 read_data_buf_len_(0), |
217 last_error_(OK), | 216 last_error_(OK), |
218 system_type_(SYSTEM_TYPE_UNKNOWN), | 217 system_type_(SYSTEM_TYPE_UNKNOWN), |
219 // Use image (binary) transfer by default. It should always work, | 218 // Use image (binary) transfer by default. It should always work, |
220 // whereas the ascii transfer may damage binary data. | 219 // whereas the ascii transfer may damage binary data. |
221 data_type_(DATA_TYPE_IMAGE), | 220 data_type_(DATA_TYPE_IMAGE), |
222 resource_type_(RESOURCE_TYPE_UNKNOWN), | 221 resource_type_(RESOURCE_TYPE_UNKNOWN), |
223 use_epsv_(true), | 222 use_epsv_(true), |
224 data_connection_port_(0), | 223 data_connection_port_(0), |
225 socket_factory_(socket_factory), | 224 socket_factory_(socket_factory), |
226 next_state_(STATE_NONE), | 225 next_state_(STATE_NONE), |
227 state_after_data_connect_complete_(STATE_CTRL_WRITE_SIZE) { | 226 state_after_data_connect_complete_(STATE_CTRL_WRITE_SIZE) {} |
228 } | |
229 | 227 |
230 FtpNetworkTransaction::~FtpNetworkTransaction() { | 228 FtpNetworkTransaction::~FtpNetworkTransaction() { |
231 } | 229 } |
232 | 230 |
233 int FtpNetworkTransaction::Stop(int error) { | 231 int FtpNetworkTransaction::Stop(int error) { |
234 if (command_sent_ == COMMAND_QUIT) | 232 if (command_sent_ == COMMAND_QUIT) |
235 return error; | 233 return error; |
236 | 234 |
237 next_state_ = STATE_CTRL_WRITE_QUIT; | 235 next_state_ = STATE_CTRL_WRITE_QUIT; |
238 last_error_ = error; | 236 last_error_ = error; |
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1393 if (!had_error_type[type]) { | 1391 if (!had_error_type[type]) { |
1394 had_error_type[type] = true; | 1392 had_error_type[type] = true; |
1395 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened", | 1393 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened", |
1396 type, NUM_OF_NET_ERROR_TYPES); | 1394 type, NUM_OF_NET_ERROR_TYPES); |
1397 } | 1395 } |
1398 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount", | 1396 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount", |
1399 type, NUM_OF_NET_ERROR_TYPES); | 1397 type, NUM_OF_NET_ERROR_TYPES); |
1400 } | 1398 } |
1401 | 1399 |
1402 } // namespace net | 1400 } // namespace net |
OLD | NEW |