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_directory_listing_parser_ls.h" | 5 #include "net/ftp/ftp_directory_listing_parser_ls.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // | 56 // |
57 // 1. ftpd server name | 57 // 1. ftpd server name |
58 // 2. directory name (often just ".") | 58 // 2. directory name (often just ".") |
59 // 3. message text (usually "Permission denied") | 59 // 3. message text (usually "Permission denied") |
60 std::vector<string16> parts; | 60 std::vector<string16> parts; |
61 base::SplitString(CollapseWhitespace(text, false), ':', &parts); | 61 base::SplitString(CollapseWhitespace(text, false), ':', &parts); |
62 | 62 |
63 if (parts.size() != 3) | 63 if (parts.size() != 3) |
64 return false; | 64 return false; |
65 | 65 |
66 return parts[2] == ASCIIToUTF16("Permission denied"); | 66 return parts[2].find(ASCIIToUTF16("Permission denied")) != string16::npos; |
67 } | 67 } |
68 | 68 |
69 // Returns the column index of the end of the date listing and detected | 69 // Returns the column index of the end of the date listing and detected |
70 // last modification time. | 70 // last modification time. |
71 bool DetectColumnOffsetAndModificationTime(const std::vector<string16>& columns, | 71 bool DetectColumnOffsetAndModificationTime(const std::vector<string16>& columns, |
72 const base::Time& current_time, | 72 const base::Time& current_time, |
73 size_t* offset, | 73 size_t* offset, |
74 base::Time* modification_time) { | 74 base::Time* modification_time) { |
75 // The column offset can be arbitrarily large if some fields | 75 // The column offset can be arbitrarily large if some fields |
76 // like owner or group name contain spaces. Try offsets from left to right | 76 // like owner or group name contain spaces. Try offsets from left to right |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 entry.name = entry.name.substr(0, pos); | 213 entry.name = entry.name.substr(0, pos); |
214 } | 214 } |
215 | 215 |
216 entries->push_back(entry); | 216 entries->push_back(entry); |
217 } | 217 } |
218 | 218 |
219 return true; | 219 return true; |
220 } | 220 } |
221 | 221 |
222 } // namespace net | 222 } // namespace net |
OLD | NEW |