Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(472)

Side by Side Diff: net/ftp/ftp_directory_listing_parser_vms.cc

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_vms.h" 5 #include "net/ftp/ftp_directory_listing_parser_vms.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 LooksLikeVmsFileProtectionListingPart(parts[3]); 126 LooksLikeVmsFileProtectionListingPart(parts[3]);
127 } 127 }
128 128
129 bool LooksLikeVmsUserIdentificationCode(const base::string16& input) { 129 bool LooksLikeVmsUserIdentificationCode(const base::string16& input) {
130 if (input.length() < 2) 130 if (input.length() < 2)
131 return false; 131 return false;
132 return input[0] == '[' && input[input.length() - 1] == ']'; 132 return input[0] == '[' && input[input.length() - 1] == ']';
133 } 133 }
134 134
135 bool LooksLikeVMSError(const base::string16& text) { 135 bool LooksLikeVMSError(const base::string16& text) {
136 static const char* kPermissionDeniedMessages[] = { 136 static const char* const kPermissionDeniedMessages[] = {
137 "%RMS-E-FNF", // File not found. 137 "%RMS-E-FNF", // File not found.
138 "%RMS-E-PRV", // Access denied. 138 "%RMS-E-PRV", // Access denied.
139 "%SYSTEM-F-NOPRIV", 139 "%SYSTEM-F-NOPRIV",
140 "privilege", 140 "privilege",
141 }; 141 };
142 142
143 for (size_t i = 0; i < arraysize(kPermissionDeniedMessages); i++) { 143 for (size_t i = 0; i < arraysize(kPermissionDeniedMessages); i++) {
144 if (text.find(base::ASCIIToUTF16(kPermissionDeniedMessages[i])) != 144 if (text.find(base::ASCIIToUTF16(kPermissionDeniedMessages[i])) !=
145 base::string16::npos) 145 base::string16::npos)
146 return true; 146 return true;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 entries->push_back(entry); 284 entries->push_back(entry);
285 } 285 }
286 286
287 // The only place where we return true is after receiving the "Total" line, 287 // The only place where we return true is after receiving the "Total" line,
288 // that should be present in every VMS listing. Alternatively, if the listing 288 // that should be present in every VMS listing. Alternatively, if the listing
289 // contains error messages, it's OK not to have the "Total" line. 289 // contains error messages, it's OK not to have the "Total" line.
290 return seen_error; 290 return seen_error;
291 } 291 }
292 292
293 } // namespace net 293 } // namespace net
OLDNEW
« no previous file with comments | « net/ftp/ftp_directory_listing_parser_unittest.cc ('k') | net/ftp/ftp_directory_listing_parser_vms_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698