Chromium Code Reviews| Index: net/ftp/ftp_ctrl_response_buffer.cc |
| diff --git a/net/ftp/ftp_ctrl_response_buffer.cc b/net/ftp/ftp_ctrl_response_buffer.cc |
| index 670c70d61814b78192b0282706790f5c60e4359a..f86f804ee1fe20d46d1047f61f997c38cc0df320 100644 |
| --- a/net/ftp/ftp_ctrl_response_buffer.cc |
| +++ b/net/ftp/ftp_ctrl_response_buffer.cc |
| @@ -4,10 +4,11 @@ |
| #include "net/ftp/ftp_ctrl_response_buffer.h" |
| +#include "base/bind.h" |
| #include "base/logging.h" |
| #include "base/string_number_conversions.h" |
| #include "base/string_piece.h" |
| -//#include "base/string_util.h" |
| +#include "base/values.h" |
| #include "net/base/net_errors.h" |
| namespace net { |
| @@ -19,7 +20,10 @@ FtpCtrlResponse::FtpCtrlResponse() : status_code(kInvalidStatusCode) {} |
| FtpCtrlResponse::~FtpCtrlResponse() {} |
| -FtpCtrlResponseBuffer::FtpCtrlResponseBuffer() : multiline_(false) {} |
| +FtpCtrlResponseBuffer::FtpCtrlResponseBuffer(const BoundNetLog& net_log) |
| + : multiline_(false), |
| + net_log_(net_log) { |
| +} |
| FtpCtrlResponseBuffer::~FtpCtrlResponseBuffer() {} |
| @@ -73,9 +77,28 @@ int FtpCtrlResponseBuffer::ConsumeData(const char* data, int data_length) { |
| return OK; |
| } |
| +namespace { |
| + |
| +Value* NetLogFtpCtrlResponseCallback(const FtpCtrlResponse& response, |
| + NetLog::LogLevel log_level) { |
| + ListValue* lines = new ListValue(); |
| + lines->AppendStrings(response.lines); |
| + |
| + DictionaryValue* dict = new DictionaryValue(); |
| + dict->SetInteger("status_code", response.status_code); |
| + dict->Set("lines", lines); |
| + return dict; |
| +} |
| + |
| +} // namespace |
| + |
| FtpCtrlResponse FtpCtrlResponseBuffer::PopResponse() { |
| FtpCtrlResponse result = responses_.front(); |
| responses_.pop(); |
| + |
| + net_log_.AddEvent(NetLog::TYPE_FTP_CONTROL_RESPONSE, |
| + base::Bind(&NetLogFtpCtrlResponseCallback, result)); |
|
eroman
2012/11/06 23:49:29
Note that this line will cause |result| to be copi
Paweł Hajdan Jr.
2012/11/07 00:42:56
Done.
|
| + |
| return result; |
| } |