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" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 if (result == base::PLATFORM_FILE_ERROR_INVALID_URL) | 101 if (result == base::PLATFORM_FILE_ERROR_INVALID_URL) |
102 rv = net::ERR_INVALID_URL; | 102 rv = net::ERR_INVALID_URL; |
103 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); | 103 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); |
104 return; | 104 return; |
105 } | 105 } |
106 | 106 |
107 if (!request_) | 107 if (!request_) |
108 return; | 108 return; |
109 | 109 |
110 if (data_.empty()) { | 110 if (data_.empty()) { |
111 FilePath relative_path = url_.path(); | 111 base::FilePath relative_path = url_.path(); |
112 #if defined(OS_POSIX) | 112 #if defined(OS_POSIX) |
113 relative_path = FilePath(FILE_PATH_LITERAL("/") + relative_path.value()); | 113 relative_path = base::FilePath(FILE_PATH_LITERAL("/") + relative_path.value(
)); |
114 #endif | 114 #endif |
115 const string16& title = relative_path.LossyDisplayName(); | 115 const string16& title = relative_path.LossyDisplayName(); |
116 data_.append(net::GetDirectoryListingHeader(title)); | 116 data_.append(net::GetDirectoryListingHeader(title)); |
117 } | 117 } |
118 | 118 |
119 typedef std::vector<base::FileUtilProxy::Entry>::const_iterator EntryIterator; | 119 typedef std::vector<base::FileUtilProxy::Entry>::const_iterator EntryIterator; |
120 for (EntryIterator it = entries.begin(); it != entries.end(); ++it) { | 120 for (EntryIterator it = entries.begin(); it != entries.end(); ++it) { |
121 const string16& name = FilePath(it->name).LossyDisplayName(); | 121 const string16& name = base::FilePath(it->name).LossyDisplayName(); |
122 data_.append(net::GetDirectoryListingEntry( | 122 data_.append(net::GetDirectoryListingEntry( |
123 name, std::string(), it->is_directory, it->size, | 123 name, std::string(), it->is_directory, it->size, |
124 it->last_modified_time)); | 124 it->last_modified_time)); |
125 } | 125 } |
126 | 126 |
127 if (has_more) { | 127 if (has_more) { |
128 base::PlatformFileError error_code; | 128 base::PlatformFileError error_code; |
129 FileSystemOperation* operation = GetNewOperation(&error_code); | 129 FileSystemOperation* operation = GetNewOperation(&error_code); |
130 if (error_code != base::PLATFORM_FILE_OK) { | 130 if (error_code != base::PLATFORM_FILE_OK) { |
131 NotifyDone(URLRequestStatus( | 131 NotifyDone(URLRequestStatus( |
(...skipping 10 matching lines...) Expand all Loading... |
142 NotifyHeadersComplete(); | 142 NotifyHeadersComplete(); |
143 } | 143 } |
144 } | 144 } |
145 | 145 |
146 FileSystemOperation* FileSystemDirURLRequestJob::GetNewOperation( | 146 FileSystemOperation* FileSystemDirURLRequestJob::GetNewOperation( |
147 base::PlatformFileError* error_code) { | 147 base::PlatformFileError* error_code) { |
148 return file_system_context_->CreateFileSystemOperation(url_, error_code); | 148 return file_system_context_->CreateFileSystemOperation(url_, error_code); |
149 } | 149 } |
150 | 150 |
151 } // namespace fileapi | 151 } // namespace fileapi |
OLD | NEW |