| 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 "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/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/file_util_proxy.h" | |
| 11 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 12 #include "base/platform_file.h" | 11 #include "base/platform_file.h" |
| 13 #include "base/sys_string_conversions.h" | 12 #include "base/sys_string_conversions.h" |
| 14 #include "base/time.h" | 13 #include "base/time.h" |
| 15 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 16 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 17 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
| 18 #include "net/base/io_buffer.h" | 17 #include "net/base/io_buffer.h" |
| 19 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
| 20 #include "net/base/net_util.h" | 19 #include "net/base/net_util.h" |
| 21 #include "net/url_request/url_request.h" | 20 #include "net/url_request/url_request.h" |
| 21 #include "webkit/fileapi/file_system_file_util_proxy.h" |
| 22 #include "webkit/fileapi/file_system_path_manager.h" | 22 #include "webkit/fileapi/file_system_path_manager.h" |
| 23 #include "webkit/fileapi/file_system_util.h" | 23 #include "webkit/fileapi/file_system_util.h" |
| 24 | 24 |
| 25 using net::URLRequest; | 25 using net::URLRequest; |
| 26 using net::URLRequestJob; | 26 using net::URLRequestJob; |
| 27 using net::URLRequestStatus; | 27 using net::URLRequestStatus; |
| 28 | 28 |
| 29 namespace fileapi { | 29 namespace fileapi { |
| 30 | 30 |
| 31 FileSystemDirURLRequestJob::FileSystemDirURLRequestJob( | 31 FileSystemDirURLRequestJob::FileSystemDirURLRequestJob( |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 if (!success) { | 95 if (!success) { |
| 96 NotifyFailed(net::ERR_FILE_NOT_FOUND); | 96 NotifyFailed(net::ERR_FILE_NOT_FOUND); |
| 97 return; | 97 return; |
| 98 } | 98 } |
| 99 | 99 |
| 100 absolute_dir_path_ = root_path.Append(relative_dir_path_); | 100 absolute_dir_path_ = root_path.Append(relative_dir_path_); |
| 101 | 101 |
| 102 // We assume it's a directory if we've gotten here: either the path | 102 // We assume it's a directory if we've gotten here: either the path |
| 103 // ends with '/', or FileSystemDirURLRequestJob already statted it and | 103 // ends with '/', or FileSystemDirURLRequestJob already statted it and |
| 104 // found it to be a directory. | 104 // found it to be a directory. |
| 105 base::FileUtilProxy::ReadDirectory(file_thread_proxy_, absolute_dir_path_, | 105 fileapi::FileSystemFileUtilProxy::ReadDirectory( |
| 106 file_system_operation_context_.get(), |
| 107 file_thread_proxy_, absolute_dir_path_, |
| 106 callback_factory_.NewCallback( | 108 callback_factory_.NewCallback( |
| 107 &FileSystemDirURLRequestJob::DidReadDirectory)); | 109 &FileSystemDirURLRequestJob::DidReadDirectory)); |
| 108 } | 110 } |
| 109 | 111 |
| 110 void FileSystemDirURLRequestJob::DidReadDirectory( | 112 void FileSystemDirURLRequestJob::DidReadDirectory( |
| 111 base::PlatformFileError error_code, | 113 base::PlatformFileError error_code, |
| 112 const std::vector<base::FileUtilProxy::Entry>& entries) { | 114 const std::vector<base::FileUtilProxy::Entry>& entries) { |
| 113 if (error_code != base::PLATFORM_FILE_OK) { | 115 if (error_code != base::PLATFORM_FILE_OK) { |
| 114 NotifyFailed(error_code); | 116 NotifyFailed(error_code); |
| 115 return; | 117 return; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 138 | 140 |
| 139 set_expected_content_size(data_.size()); | 141 set_expected_content_size(data_.size()); |
| 140 NotifyHeadersComplete(); | 142 NotifyHeadersComplete(); |
| 141 } | 143 } |
| 142 | 144 |
| 143 void FileSystemDirURLRequestJob::NotifyFailed(int rv) { | 145 void FileSystemDirURLRequestJob::NotifyFailed(int rv) { |
| 144 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); | 146 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); |
| 145 } | 147 } |
| 146 | 148 |
| 147 } // namespace fileapi | 149 } // namespace fileapi |
| OLD | NEW |