| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #include "net/ftp/ftp_directory_listing_parsers.h" | 5 #include "net/ftp/ftp_directory_listing_parsers.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 | 8 |
| 9 namespace { | 9 namespace { |
| 10 | 10 |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 | 334 |
| 335 if (!UnixDateListingToTime(columns, &entry.last_modified)) | 335 if (!UnixDateListingToTime(columns, &entry.last_modified)) |
| 336 return false; | 336 return false; |
| 337 | 337 |
| 338 entry.name = columns[8]; | 338 entry.name = columns[8]; |
| 339 | 339 |
| 340 entries_.push(entry); | 340 entries_.push(entry); |
| 341 return true; | 341 return true; |
| 342 } | 342 } |
| 343 | 343 |
| 344 bool FtpLsDirectoryListingParser::OnEndOfInput() { |
| 345 return true; |
| 346 } |
| 347 |
| 344 bool FtpLsDirectoryListingParser::EntryAvailable() const { | 348 bool FtpLsDirectoryListingParser::EntryAvailable() const { |
| 345 return !entries_.empty(); | 349 return !entries_.empty(); |
| 346 } | 350 } |
| 347 | 351 |
| 348 FtpDirectoryListingEntry FtpLsDirectoryListingParser::PopEntry() { | 352 FtpDirectoryListingEntry FtpLsDirectoryListingParser::PopEntry() { |
| 349 FtpDirectoryListingEntry entry = entries_.front(); | 353 FtpDirectoryListingEntry entry = entries_.front(); |
| 350 entries_.pop(); | 354 entries_.pop(); |
| 351 return entry; | 355 return entry; |
| 352 } | 356 } |
| 353 | 357 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 374 return false; | 378 return false; |
| 375 } | 379 } |
| 376 | 380 |
| 377 if (!WindowsDateListingToTime(columns, &entry.last_modified)) | 381 if (!WindowsDateListingToTime(columns, &entry.last_modified)) |
| 378 return false; | 382 return false; |
| 379 | 383 |
| 380 entries_.push(entry); | 384 entries_.push(entry); |
| 381 return true; | 385 return true; |
| 382 } | 386 } |
| 383 | 387 |
| 388 bool FtpWindowsDirectoryListingParser::OnEndOfInput() { |
| 389 return true; |
| 390 } |
| 391 |
| 384 bool FtpWindowsDirectoryListingParser::EntryAvailable() const { | 392 bool FtpWindowsDirectoryListingParser::EntryAvailable() const { |
| 385 return !entries_.empty(); | 393 return !entries_.empty(); |
| 386 } | 394 } |
| 387 | 395 |
| 388 FtpDirectoryListingEntry FtpWindowsDirectoryListingParser::PopEntry() { | 396 FtpDirectoryListingEntry FtpWindowsDirectoryListingParser::PopEntry() { |
| 389 FtpDirectoryListingEntry entry = entries_.front(); | 397 FtpDirectoryListingEntry entry = entries_.front(); |
| 390 entries_.pop(); | 398 entries_.pop(); |
| 391 return entry; | 399 return entry; |
| 392 } | 400 } |
| 393 | 401 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 return true; | 442 return true; |
| 435 case STATE_END: | 443 case STATE_END: |
| 436 DCHECK(last_filename_.empty()); | 444 DCHECK(last_filename_.empty()); |
| 437 return false; | 445 return false; |
| 438 default: | 446 default: |
| 439 NOTREACHED(); | 447 NOTREACHED(); |
| 440 return false; | 448 return false; |
| 441 } | 449 } |
| 442 } | 450 } |
| 443 | 451 |
| 452 bool FtpVmsDirectoryListingParser::OnEndOfInput() { |
| 453 return (state_ == STATE_END); |
| 454 } |
| 455 |
| 444 bool FtpVmsDirectoryListingParser::EntryAvailable() const { | 456 bool FtpVmsDirectoryListingParser::EntryAvailable() const { |
| 445 return !entries_.empty(); | 457 return !entries_.empty(); |
| 446 } | 458 } |
| 447 | 459 |
| 448 FtpDirectoryListingEntry FtpVmsDirectoryListingParser::PopEntry() { | 460 FtpDirectoryListingEntry FtpVmsDirectoryListingParser::PopEntry() { |
| 449 FtpDirectoryListingEntry entry = entries_.front(); | 461 FtpDirectoryListingEntry entry = entries_.front(); |
| 450 entries_.pop(); | 462 entries_.pop(); |
| 451 return entry; | 463 return entry; |
| 452 } | 464 } |
| 453 | 465 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 if (entry.type != FtpDirectoryListingEntry::FILE) | 525 if (entry.type != FtpDirectoryListingEntry::FILE) |
| 514 entry.size = -1; | 526 entry.size = -1; |
| 515 if (!VmsDateListingToTime(columns, &entry.last_modified)) | 527 if (!VmsDateListingToTime(columns, &entry.last_modified)) |
| 516 return false; | 528 return false; |
| 517 | 529 |
| 518 entries_.push(entry); | 530 entries_.push(entry); |
| 519 return true; | 531 return true; |
| 520 } | 532 } |
| 521 | 533 |
| 522 } // namespace net | 534 } // namespace net |
| OLD | NEW |