| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_ctrl_response_buffer.h" | 5 #include "net/ftp/ftp_ctrl_response_buffer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 line_buf_.clear(); | 72 line_buf_.clear(); |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 | 76 |
| 77 return OK; | 77 return OK; |
| 78 } | 78 } |
| 79 | 79 |
| 80 namespace { | 80 namespace { |
| 81 | 81 |
| 82 Value* NetLogFtpCtrlResponseCallback(const FtpCtrlResponse* response, | 82 base::Value* NetLogFtpCtrlResponseCallback(const FtpCtrlResponse* response, |
| 83 NetLog::LogLevel log_level) { | 83 NetLog::LogLevel log_level) { |
| 84 ListValue* lines = new ListValue(); | 84 base::ListValue* lines = new base::ListValue(); |
| 85 lines->AppendStrings(response->lines); | 85 lines->AppendStrings(response->lines); |
| 86 | 86 |
| 87 DictionaryValue* dict = new DictionaryValue(); | 87 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 88 dict->SetInteger("status_code", response->status_code); | 88 dict->SetInteger("status_code", response->status_code); |
| 89 dict->Set("lines", lines); | 89 dict->Set("lines", lines); |
| 90 return dict; | 90 return dict; |
| 91 } | 91 } |
| 92 | 92 |
| 93 } // namespace | 93 } // namespace |
| 94 | 94 |
| 95 FtpCtrlResponse FtpCtrlResponseBuffer::PopResponse() { | 95 FtpCtrlResponse FtpCtrlResponseBuffer::PopResponse() { |
| 96 FtpCtrlResponse result = responses_.front(); | 96 FtpCtrlResponse result = responses_.front(); |
| 97 responses_.pop(); | 97 responses_.pop(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 for (size_t i = 0; i < buffer_.length(); i++) { | 143 for (size_t i = 0; i < buffer_.length(); i++) { |
| 144 if (i >= 1 && buffer_[i - 1] == '\r' && buffer_[i] == '\n') { | 144 if (i >= 1 && buffer_[i - 1] == '\r' && buffer_[i] == '\n') { |
| 145 lines_.push(ParseLine(buffer_.substr(cut_pos, i - cut_pos - 1))); | 145 lines_.push(ParseLine(buffer_.substr(cut_pos, i - cut_pos - 1))); |
| 146 cut_pos = i + 1; | 146 cut_pos = i + 1; |
| 147 } | 147 } |
| 148 } | 148 } |
| 149 buffer_.erase(0, cut_pos); | 149 buffer_.erase(0, cut_pos); |
| 150 } | 150 } |
| 151 | 151 |
| 152 } // namespace net | 152 } // namespace net |
| OLD | NEW |