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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 line_buf_.clear(); | 76 line_buf_.clear(); |
77 } | 77 } |
78 } | 78 } |
79 } | 79 } |
80 | 80 |
81 return OK; | 81 return OK; |
82 } | 82 } |
83 | 83 |
84 namespace { | 84 namespace { |
85 | 85 |
86 scoped_ptr<base::Value> NetLogFtpCtrlResponseCallback( | 86 std::unique_ptr<base::Value> NetLogFtpCtrlResponseCallback( |
87 const FtpCtrlResponse* response, | 87 const FtpCtrlResponse* response, |
88 NetLogCaptureMode capture_mode) { | 88 NetLogCaptureMode capture_mode) { |
89 scoped_ptr<base::ListValue> lines(new base::ListValue()); | 89 std::unique_ptr<base::ListValue> lines(new base::ListValue()); |
90 lines->AppendStrings(response->lines); | 90 lines->AppendStrings(response->lines); |
91 | 91 |
92 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 92 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
93 dict->SetInteger("status_code", response->status_code); | 93 dict->SetInteger("status_code", response->status_code); |
94 dict->Set("lines", std::move(lines)); | 94 dict->Set("lines", std::move(lines)); |
95 return std::move(dict); | 95 return std::move(dict); |
96 } | 96 } |
97 | 97 |
98 } // namespace | 98 } // namespace |
99 | 99 |
100 FtpCtrlResponse FtpCtrlResponseBuffer::PopResponse() { | 100 FtpCtrlResponse FtpCtrlResponseBuffer::PopResponse() { |
101 FtpCtrlResponse result = responses_.front(); | 101 FtpCtrlResponse result = responses_.front(); |
102 responses_.pop(); | 102 responses_.pop(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 for (size_t i = 0; i < buffer_.length(); i++) { | 152 for (size_t i = 0; i < buffer_.length(); i++) { |
153 if (i >= 1 && buffer_[i - 1] == '\r' && buffer_[i] == '\n') { | 153 if (i >= 1 && buffer_[i - 1] == '\r' && buffer_[i] == '\n') { |
154 lines_.push(ParseLine(buffer_.substr(cut_pos, i - cut_pos - 1))); | 154 lines_.push(ParseLine(buffer_.substr(cut_pos, i - cut_pos - 1))); |
155 cut_pos = i + 1; | 155 cut_pos = i + 1; |
156 } | 156 } |
157 } | 157 } |
158 buffer_.erase(0, cut_pos); | 158 buffer_.erase(0, cut_pos); |
159 } | 159 } |
160 | 160 |
161 } // namespace net | 161 } // namespace net |
OLD | NEW |