OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/file_util_proxy.h" | 5 #include "base/file_util_proxy.h" |
6 #include "base/platform_file.h" | 6 #include "base/platform_file.h" |
7 #include "chrome/browser/chrome_thread.h" | 7 #include "chrome/browser/chrome_thread.h" |
8 #include "chrome/browser/file_system/file_system_backend.h" | 8 #include "chrome/browser/file_system/file_system_backend.h" |
9 #include "chrome/browser/file_system/file_system_backend_client.h" | 9 #include "chrome/browser/file_system/file_system_backend_client.h" |
10 #include "third_party/WebKit/WebKit/chromium/public/WebFileError.h" | 10 #include "third_party/WebKit/WebKit/chromium/public/WebFileError.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 134 |
135 void FileSystemBackend::DidFinishFileOperation(base::PlatformFileError rv) { | 135 void FileSystemBackend::DidFinishFileOperation(base::PlatformFileError rv) { |
136 DCHECK(client_); | 136 DCHECK(client_); |
137 if (rv == base::PLATFORM_FILE_OK) | 137 if (rv == base::PLATFORM_FILE_OK) |
138 client_->DidSucceed(request_id_); | 138 client_->DidSucceed(request_id_); |
139 else | 139 else |
140 client_->DidFail(PlatformToWebkitError(rv), request_id_); | 140 client_->DidFail(PlatformToWebkitError(rv), request_id_); |
141 } | 141 } |
142 | 142 |
143 void FileSystemBackend::DidDirectoryExists( | 143 void FileSystemBackend::DidDirectoryExists( |
144 base::PlatformFileError rv, const file_util::FileInfo& file_info) { | 144 base::PlatformFileError rv, const base::PlatformFileInfo& file_info) { |
145 DCHECK(client_); | 145 DCHECK(client_); |
146 if (rv == base::PLATFORM_FILE_OK) { | 146 if (rv == base::PLATFORM_FILE_OK) { |
147 if (file_info.is_directory) | 147 if (file_info.is_directory) |
148 client_->DidSucceed(request_id_); | 148 client_->DidSucceed(request_id_); |
149 else | 149 else |
150 client_->DidFail(WebKit::WebFileErrorInvalidState, request_id_); | 150 client_->DidFail(WebKit::WebFileErrorInvalidState, request_id_); |
151 } else { | 151 } else { |
152 // Something else went wrong. | 152 // Something else went wrong. |
153 client_->DidFail(PlatformToWebkitError(rv), request_id_); | 153 client_->DidFail(PlatformToWebkitError(rv), request_id_); |
154 } | 154 } |
155 } | 155 } |
156 | 156 |
157 void FileSystemBackend::DidFileExists(base::PlatformFileError rv, | 157 void FileSystemBackend::DidFileExists( |
158 const file_util::FileInfo& file_info) { | 158 base::PlatformFileError rv, |
| 159 const base::PlatformFileInfo& file_info) { |
159 DCHECK(client_); | 160 DCHECK(client_); |
160 if (rv == base::PLATFORM_FILE_OK) { | 161 if (rv == base::PLATFORM_FILE_OK) { |
161 if (file_info.is_directory) | 162 if (file_info.is_directory) |
162 client_->DidFail(WebKit::WebFileErrorInvalidState, request_id_); | 163 client_->DidFail(WebKit::WebFileErrorInvalidState, request_id_); |
163 else | 164 else |
164 client_->DidSucceed(request_id_); | 165 client_->DidSucceed(request_id_); |
165 } else { | 166 } else { |
166 // Something else went wrong. | 167 // Something else went wrong. |
167 client_->DidFail(PlatformToWebkitError(rv), request_id_); | 168 client_->DidFail(PlatformToWebkitError(rv), request_id_); |
168 } | 169 } |
169 } | 170 } |
170 | 171 |
171 void FileSystemBackend::DidGetMetadata(base::PlatformFileError rv, | 172 void FileSystemBackend::DidGetMetadata( |
172 const file_util::FileInfo& file_info) { | 173 base::PlatformFileError rv, |
| 174 const base::PlatformFileInfo& file_info) { |
173 DCHECK(client_); | 175 DCHECK(client_); |
174 if (rv == base::PLATFORM_FILE_OK) | 176 if (rv == base::PLATFORM_FILE_OK) |
175 client_->DidReadMetadata(file_info, request_id_); | 177 client_->DidReadMetadata(file_info, request_id_); |
176 else | 178 else |
177 client_->DidFail(PlatformToWebkitError(rv), request_id_); | 179 client_->DidFail(PlatformToWebkitError(rv), request_id_); |
178 } | 180 } |
179 | 181 |
180 void FileSystemBackend::DidReadDirectory( | 182 void FileSystemBackend::DidReadDirectory( |
181 base::PlatformFileError rv, | 183 base::PlatformFileError rv, |
182 const std::vector<base::file_util_proxy::Entry>& entries) { | 184 const std::vector<base::file_util_proxy::Entry>& entries) { |
183 DCHECK(client_); | 185 DCHECK(client_); |
184 if (rv == base::PLATFORM_FILE_OK) | 186 if (rv == base::PLATFORM_FILE_OK) |
185 client_->DidReadDirectory(entries, false /* has_more */ , request_id_); | 187 client_->DidReadDirectory(entries, false /* has_more */ , request_id_); |
186 else | 188 else |
187 client_->DidFail(PlatformToWebkitError(rv), request_id_); | 189 client_->DidFail(PlatformToWebkitError(rv), request_id_); |
188 } | 190 } |
OLD | NEW |