| OLD | NEW |
| 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 "webkit/fileapi/file_system_dir_url_request_job.h" | 5 #include "webkit/fileapi/file_system_dir_url_request_job.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/file_util_proxy.h" | 11 #include "base/file_util_proxy.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "base/platform_file.h" | 13 #include "base/platform_file.h" |
| 14 #include "base/sys_string_conversions.h" | 14 #include "base/sys_string_conversions.h" |
| 15 #include "base/time.h" | 15 #include "base/time.h" |
| 16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
| 17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
| 19 #include "net/base/io_buffer.h" | 19 #include "net/base/io_buffer.h" |
| 20 #include "net/base/net_errors.h" | 20 #include "net/base/net_errors.h" |
| 21 #include "net/base/net_util.h" | 21 #include "net/base/net_util.h" |
| 22 #include "net/url_request/url_request.h" | 22 #include "net/url_request/url_request.h" |
| 23 #include "webkit/fileapi/file_system_context.h" | 23 #include "webkit/fileapi/file_system_context.h" |
| 24 #include "webkit/fileapi/file_system_operation_interface.h" | 24 #include "webkit/fileapi/file_system_operation.h" |
| 25 #include "webkit/fileapi/file_system_url.h" | 25 #include "webkit/fileapi/file_system_url.h" |
| 26 | 26 |
| 27 using net::NetworkDelegate; | 27 using net::NetworkDelegate; |
| 28 using net::URLRequest; | 28 using net::URLRequest; |
| 29 using net::URLRequestJob; | 29 using net::URLRequestJob; |
| 30 using net::URLRequestStatus; | 30 using net::URLRequestStatus; |
| 31 | 31 |
| 32 namespace fileapi { | 32 namespace fileapi { |
| 33 | 33 |
| 34 FileSystemDirURLRequestJob::FileSystemDirURLRequestJob( | 34 FileSystemDirURLRequestJob::FileSystemDirURLRequestJob( |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 bool FileSystemDirURLRequestJob::GetCharset(std::string* charset) { | 74 bool FileSystemDirURLRequestJob::GetCharset(std::string* charset) { |
| 75 *charset = "utf-8"; | 75 *charset = "utf-8"; |
| 76 return true; | 76 return true; |
| 77 } | 77 } |
| 78 | 78 |
| 79 void FileSystemDirURLRequestJob::StartAsync() { | 79 void FileSystemDirURLRequestJob::StartAsync() { |
| 80 if (!request_) | 80 if (!request_) |
| 81 return; | 81 return; |
| 82 url_ = FileSystemURL(request_->url()); | 82 url_ = FileSystemURL(request_->url()); |
| 83 FileSystemOperationInterface* operation = GetNewOperation(); | 83 FileSystemOperation* operation = GetNewOperation(); |
| 84 if (!operation) { | 84 if (!operation) { |
| 85 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, | 85 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, |
| 86 net::ERR_INVALID_URL)); | 86 net::ERR_INVALID_URL)); |
| 87 return; | 87 return; |
| 88 } | 88 } |
| 89 operation->ReadDirectory( | 89 operation->ReadDirectory( |
| 90 url_, | 90 url_, |
| 91 base::Bind(&FileSystemDirURLRequestJob::DidReadDirectory, this)); | 91 base::Bind(&FileSystemDirURLRequestJob::DidReadDirectory, this)); |
| 92 } | 92 } |
| 93 | 93 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 if (has_more) { | 126 if (has_more) { |
| 127 GetNewOperation()->ReadDirectory( | 127 GetNewOperation()->ReadDirectory( |
| 128 url_, | 128 url_, |
| 129 base::Bind(&FileSystemDirURLRequestJob::DidReadDirectory, this)); | 129 base::Bind(&FileSystemDirURLRequestJob::DidReadDirectory, this)); |
| 130 } else { | 130 } else { |
| 131 set_expected_content_size(data_.size()); | 131 set_expected_content_size(data_.size()); |
| 132 NotifyHeadersComplete(); | 132 NotifyHeadersComplete(); |
| 133 } | 133 } |
| 134 } | 134 } |
| 135 | 135 |
| 136 FileSystemOperationInterface* | 136 FileSystemOperation* FileSystemDirURLRequestJob::GetNewOperation() { |
| 137 FileSystemDirURLRequestJob::GetNewOperation() { | |
| 138 return file_system_context_->CreateFileSystemOperation(url_); | 137 return file_system_context_->CreateFileSystemOperation(url_); |
| 139 } | 138 } |
| 140 | 139 |
| 141 } // namespace fileapi | 140 } // namespace fileapi |
| OLD | NEW |