| 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 | |
| 6 #ifndef NET_FTP_FTP_CTRL_RESPONSE_BUFFER_H_ | 5 #ifndef NET_FTP_FTP_CTRL_RESPONSE_BUFFER_H_ |
| 7 #define NET_FTP_FTP_CTRL_RESPONSE_BUFFER_H_ | 6 #define NET_FTP_FTP_CTRL_RESPONSE_BUFFER_H_ |
| 8 | 7 |
| 9 #include <queue> | 8 #include <queue> |
| 10 #include <string> | 9 #include <string> |
| 11 #include <vector> | 10 #include <vector> |
| 12 | 11 |
| 13 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 14 #include "net/base/net_export.h" | 13 #include "net/base/net_export.h" |
| 15 #include "net/base/net_log.h" | 14 #include "net/base/net_log.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 27 }; | 26 }; |
| 28 | 27 |
| 29 class NET_EXPORT_PRIVATE FtpCtrlResponseBuffer { | 28 class NET_EXPORT_PRIVATE FtpCtrlResponseBuffer { |
| 30 public: | 29 public: |
| 31 FtpCtrlResponseBuffer(const BoundNetLog& net_log); | 30 FtpCtrlResponseBuffer(const BoundNetLog& net_log); |
| 32 ~FtpCtrlResponseBuffer(); | 31 ~FtpCtrlResponseBuffer(); |
| 33 | 32 |
| 34 // Called when data is received from the control socket. Returns error code. | 33 // Called when data is received from the control socket. Returns error code. |
| 35 int ConsumeData(const char* data, int data_length); | 34 int ConsumeData(const char* data, int data_length); |
| 36 | 35 |
| 37 bool ResponseAvailable() const { | 36 bool ResponseAvailable() const { return !responses_.empty(); } |
| 38 return !responses_.empty(); | |
| 39 } | |
| 40 | 37 |
| 41 // Returns the next response. It is an error to call this function | 38 // Returns the next response. It is an error to call this function |
| 42 // unless ResponseAvailable returns true. | 39 // unless ResponseAvailable returns true. |
| 43 FtpCtrlResponse PopResponse(); | 40 FtpCtrlResponse PopResponse(); |
| 44 | 41 |
| 45 private: | 42 private: |
| 46 struct ParsedLine { | 43 struct ParsedLine { |
| 47 ParsedLine(); | 44 ParsedLine(); |
| 48 | 45 |
| 49 // Indicates that this line begins with a valid 3-digit status code. | 46 // Indicates that this line begins with a valid 3-digit status code. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 std::queue<FtpCtrlResponse> responses_; | 89 std::queue<FtpCtrlResponse> responses_; |
| 93 | 90 |
| 94 BoundNetLog net_log_; | 91 BoundNetLog net_log_; |
| 95 | 92 |
| 96 DISALLOW_COPY_AND_ASSIGN(FtpCtrlResponseBuffer); | 93 DISALLOW_COPY_AND_ASSIGN(FtpCtrlResponseBuffer); |
| 97 }; | 94 }; |
| 98 | 95 |
| 99 } // namespace net | 96 } // namespace net |
| 100 | 97 |
| 101 #endif // NET_FTP_FTP_CTRL_RESPONSE_BUFFER_H_ | 98 #endif // NET_FTP_FTP_CTRL_RESPONSE_BUFFER_H_ |
| OLD | NEW |