| 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 "webkit/fileapi/file_system_operation.h" | 5 #include "webkit/fileapi/file_system_operation.h" |
| 6 | 6 |
| 7 #include "base/time.h" | 7 #include "base/time.h" |
| 8 #include "net/url_request/url_request_context.h" | 8 #include "net/url_request/url_request_context.h" |
| 9 #include "webkit/fileapi/file_system_callback_dispatcher.h" | 9 #include "webkit/fileapi/file_system_callback_dispatcher.h" |
| 10 #include "webkit/fileapi/file_writer_delegate.h" | 10 #include "webkit/fileapi/file_writer_delegate.h" |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 } | 249 } |
| 250 | 250 |
| 251 void FileSystemOperation::DidDirectoryExists( | 251 void FileSystemOperation::DidDirectoryExists( |
| 252 base::PlatformFileError rv, | 252 base::PlatformFileError rv, |
| 253 const base::PlatformFileInfo& file_info) { | 253 const base::PlatformFileInfo& file_info) { |
| 254 if (rv == base::PLATFORM_FILE_OK) { | 254 if (rv == base::PLATFORM_FILE_OK) { |
| 255 if (file_info.is_directory) | 255 if (file_info.is_directory) |
| 256 dispatcher_->DidSucceed(); | 256 dispatcher_->DidSucceed(); |
| 257 else | 257 else |
| 258 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_FAILED); | 258 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_FAILED); |
| 259 } else | 259 } else { |
| 260 dispatcher_->DidFail(rv); | 260 dispatcher_->DidFail(rv); |
| 261 } |
| 261 } | 262 } |
| 262 | 263 |
| 263 void FileSystemOperation::DidFileExists( | 264 void FileSystemOperation::DidFileExists( |
| 264 base::PlatformFileError rv, | 265 base::PlatformFileError rv, |
| 265 const base::PlatformFileInfo& file_info) { | 266 const base::PlatformFileInfo& file_info) { |
| 266 if (rv == base::PLATFORM_FILE_OK) { | 267 if (rv == base::PLATFORM_FILE_OK) { |
| 267 if (file_info.is_directory) | 268 if (file_info.is_directory) |
| 268 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_FAILED); | 269 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_FAILED); |
| 269 else | 270 else |
| 270 dispatcher_->DidSucceed(); | 271 dispatcher_->DidSucceed(); |
| 271 } else | 272 } else { |
| 272 dispatcher_->DidFail(rv); | 273 dispatcher_->DidFail(rv); |
| 274 } |
| 273 } | 275 } |
| 274 | 276 |
| 275 void FileSystemOperation::DidGetMetadata( | 277 void FileSystemOperation::DidGetMetadata( |
| 276 base::PlatformFileError rv, | 278 base::PlatformFileError rv, |
| 277 const base::PlatformFileInfo& file_info) { | 279 const base::PlatformFileInfo& file_info) { |
| 278 if (rv == base::PLATFORM_FILE_OK) | 280 if (rv == base::PLATFORM_FILE_OK) |
| 279 dispatcher_->DidReadMetadata(file_info); | 281 dispatcher_->DidReadMetadata(file_info); |
| 280 else | 282 else |
| 281 dispatcher_->DidFail(rv); | 283 dispatcher_->DidFail(rv); |
| 282 } | 284 } |
| 283 | 285 |
| 284 void FileSystemOperation::DidReadDirectory( | 286 void FileSystemOperation::DidReadDirectory( |
| 285 base::PlatformFileError rv, | 287 base::PlatformFileError rv, |
| 286 const std::vector<base::file_util_proxy::Entry>& entries) { | 288 const std::vector<base::FileUtilProxy::Entry>& entries) { |
| 287 if (rv == base::PLATFORM_FILE_OK) | 289 if (rv == base::PLATFORM_FILE_OK) |
| 288 dispatcher_->DidReadDirectory(entries, false /* has_more */); | 290 dispatcher_->DidReadDirectory(entries, false /* has_more */); |
| 289 else | 291 else |
| 290 dispatcher_->DidFail(rv); | 292 dispatcher_->DidFail(rv); |
| 291 } | 293 } |
| 292 | 294 |
| 293 void FileSystemOperation::DidWrite( | 295 void FileSystemOperation::DidWrite( |
| 294 base::PlatformFileError rv, | 296 base::PlatformFileError rv, |
| 295 int64 bytes, | 297 int64 bytes, |
| 296 bool complete) { | 298 bool complete) { |
| 297 if (rv == base::PLATFORM_FILE_OK) | 299 if (rv == base::PLATFORM_FILE_OK) |
| 298 dispatcher_->DidWrite(bytes, complete); | 300 dispatcher_->DidWrite(bytes, complete); |
| 299 else | 301 else |
| 300 dispatcher_->DidFail(rv); | 302 dispatcher_->DidFail(rv); |
| 301 } | 303 } |
| 302 | 304 |
| 303 void FileSystemOperation::DidTouchFile(base::PlatformFileError rv) { | 305 void FileSystemOperation::DidTouchFile(base::PlatformFileError rv) { |
| 304 if (rv == base::PLATFORM_FILE_OK) | 306 if (rv == base::PLATFORM_FILE_OK) |
| 305 dispatcher_->DidSucceed(); | 307 dispatcher_->DidSucceed(); |
| 306 else | 308 else |
| 307 dispatcher_->DidFail(rv); | 309 dispatcher_->DidFail(rv); |
| 308 } | 310 } |
| 309 | 311 |
| 310 } // namespace fileapi | 312 } // namespace fileapi |
| OLD | NEW |