| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 | 265 |
| 266 String filename(result.filename, result.filenameLength); | 266 String filename(result.filename, result.filenameLength); |
| 267 if (result.type == FTPDirectoryEntry) { | 267 if (result.type == FTPDirectoryEntry) { |
| 268 filename.append("/"); | 268 filename.append("/"); |
| 269 | 269 |
| 270 // We have no interest in linking to "current directory" | 270 // We have no interest in linking to "current directory" |
| 271 if (filename == "./") | 271 if (filename == "./") |
| 272 return; | 272 return; |
| 273 } | 273 } |
| 274 | 274 |
| 275 LOG(FTP, "Appending entry - %s, %s", filename.ascii().data(), result.fileSiz
e.ascii().data()); | 275 LOG_INFO(FTP, "Appending entry - %s, %s", filename.ascii().data(), result.fi
leSize.ascii().data()); |
| 276 | 276 |
| 277 appendEntry(filename, processFilesizeString(result.fileSize, result.type ==
FTPDirectoryEntry), processFileDateString(result.modifiedTime), result.type == F
TPDirectoryEntry); | 277 appendEntry(filename, processFilesizeString(result.fileSize, result.type ==
FTPDirectoryEntry), processFileDateString(result.modifiedTime), result.type == F
TPDirectoryEntry); |
| 278 } | 278 } |
| 279 | 279 |
| 280 static inline PassRefPtr<SharedBuffer> createTemplateDocumentData(Settings* sett
ings) | 280 static inline PassRefPtr<SharedBuffer> createTemplateDocumentData(Settings* sett
ings) |
| 281 { | 281 { |
| 282 RefPtr<SharedBuffer> buffer = 0; | 282 RefPtr<SharedBuffer> buffer = 0; |
| 283 if (settings) | 283 if (settings) |
| 284 buffer = SharedBuffer::createWithContentsOfFile(settings->ftpDirectoryTe
mplatePath()); | 284 buffer = SharedBuffer::createWithContentsOfFile(settings->ftpDirectoryTe
mplatePath()); |
| 285 if (buffer) | 285 if (buffer) |
| 286 LOG(FTP, "Loaded FTPDirectoryTemplate of length %i\n", buffer->size()); | 286 LOG_INFO(FTP, "Loaded FTPDirectoryTemplate of length %i\n", buffer->size
()); |
| 287 return buffer.release(); | 287 return buffer.release(); |
| 288 } | 288 } |
| 289 | 289 |
| 290 bool FTPDirectoryDocumentParser::loadDocumentTemplate() | 290 bool FTPDirectoryDocumentParser::loadDocumentTemplate() |
| 291 { | 291 { |
| 292 DEFINE_STATIC_LOCAL(RefPtr<SharedBuffer>, templateDocumentData, (createTempl
ateDocumentData(document()->settings()))); | 292 DEFINE_STATIC_LOCAL(RefPtr<SharedBuffer>, templateDocumentData, (createTempl
ateDocumentData(document()->settings()))); |
| 293 // FIXME: Instead of storing the data, we'd rather actually parse the templa
te data into the template Document once, | 293 // FIXME: Instead of storing the data, we'd rather actually parse the templa
te data into the template Document once, |
| 294 // store that document, then "copy" it whenever we get an FTP directory list
ing. There are complexities with this | 294 // store that document, then "copy" it whenever we get an FTP directory list
ing. There are complexities with this |
| 295 // approach that make it worth putting this off. | 295 // approach that make it worth putting this off. |
| 296 | 296 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 324 if (Element* body = document()->body()) | 324 if (Element* body = document()->body()) |
| 325 body->appendChild(m_tableElement, IGNORE_EXCEPTION); | 325 body->appendChild(m_tableElement, IGNORE_EXCEPTION); |
| 326 else | 326 else |
| 327 document()->appendChild(m_tableElement, IGNORE_EXCEPTION); | 327 document()->appendChild(m_tableElement, IGNORE_EXCEPTION); |
| 328 | 328 |
| 329 return true; | 329 return true; |
| 330 } | 330 } |
| 331 | 331 |
| 332 void FTPDirectoryDocumentParser::createBasicDocument() | 332 void FTPDirectoryDocumentParser::createBasicDocument() |
| 333 { | 333 { |
| 334 LOG(FTP, "Creating a basic FTP document structure as no template was loaded"
); | 334 LOG_INFO(FTP, "Creating a basic FTP document structure as no template was lo
aded"); |
| 335 | 335 |
| 336 // FIXME: Make this "basic document" more acceptable | 336 // FIXME: Make this "basic document" more acceptable |
| 337 | 337 |
| 338 RefPtr<Element> bodyElement = document()->createElement(bodyTag, false); | 338 RefPtr<Element> bodyElement = document()->createElement(bodyTag, false); |
| 339 | 339 |
| 340 document()->appendChild(bodyElement, IGNORE_EXCEPTION); | 340 document()->appendChild(bodyElement, IGNORE_EXCEPTION); |
| 341 | 341 |
| 342 RefPtr<Element> tableElement = document()->createElement(tableTag, false); | 342 RefPtr<Element> tableElement = document()->createElement(tableTag, false); |
| 343 m_tableElement = static_cast<HTMLTableElement*>(tableElement.get()); | 343 m_tableElement = static_cast<HTMLTableElement*>(tableElement.get()); |
| 344 m_tableElement->setAttribute("id", "ftpDirectoryTable", IGNORE_EXCEPTION); | 344 m_tableElement->setAttribute("id", "ftpDirectoryTable", IGNORE_EXCEPTION); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 m_dest = m_buffer; | 390 m_dest = m_buffer; |
| 391 return; | 391 return; |
| 392 } | 392 } |
| 393 | 393 |
| 394 UChar* start = m_buffer; | 394 UChar* start = m_buffer; |
| 395 UChar* cursor = start; | 395 UChar* cursor = start; |
| 396 | 396 |
| 397 while (cursor < m_dest) { | 397 while (cursor < m_dest) { |
| 398 if (*cursor == '\n') { | 398 if (*cursor == '\n') { |
| 399 m_carryOver.append(String(start, cursor - start)); | 399 m_carryOver.append(String(start, cursor - start)); |
| 400 LOG(FTP, "%s", m_carryOver.ascii().data()); | 400 LOG_INFO(FTP, "%s", m_carryOver.ascii().data()); |
| 401 parseAndAppendOneLine(m_carryOver); | 401 parseAndAppendOneLine(m_carryOver); |
| 402 m_carryOver = String(); | 402 m_carryOver = String(); |
| 403 | 403 |
| 404 start = ++cursor; | 404 start = ++cursor; |
| 405 } else | 405 } else |
| 406 cursor++; | 406 cursor++; |
| 407 } | 407 } |
| 408 | 408 |
| 409 // Copy the partial line we have left to the carryover buffer | 409 // Copy the partial line we have left to the carryover buffer |
| 410 if (cursor - start > 1) | 410 if (cursor - start > 1) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 434 } | 434 } |
| 435 | 435 |
| 436 PassRefPtr<DocumentParser> FTPDirectoryDocument::createParser() | 436 PassRefPtr<DocumentParser> FTPDirectoryDocument::createParser() |
| 437 { | 437 { |
| 438 return FTPDirectoryDocumentParser::create(this); | 438 return FTPDirectoryDocumentParser::create(this); |
| 439 } | 439 } |
| 440 | 440 |
| 441 } | 441 } |
| 442 | 442 |
| 443 #endif // ENABLE(FTPDIR) | 443 #endif // ENABLE(FTPDIR) |
| OLD | NEW |