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/syncable/canned_syncable_file_system.h" | 5 #include "webkit/fileapi/syncable/canned_syncable_file_system.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 285 |
286 PlatformFileError CannedSyncableFileSystem::TruncateFile( | 286 PlatformFileError CannedSyncableFileSystem::TruncateFile( |
287 const FileSystemURL& url, int64 size) { | 287 const FileSystemURL& url, int64 size) { |
288 return RunOnThread<PlatformFileError>( | 288 return RunOnThread<PlatformFileError>( |
289 io_task_runner_, | 289 io_task_runner_, |
290 FROM_HERE, | 290 FROM_HERE, |
291 base::Bind(&CannedSyncableFileSystem::DoTruncateFile, | 291 base::Bind(&CannedSyncableFileSystem::DoTruncateFile, |
292 base::Unretained(this), url, size)); | 292 base::Unretained(this), url, size)); |
293 } | 293 } |
294 | 294 |
| 295 PlatformFileError CannedSyncableFileSystem::TouchFile( |
| 296 const FileSystemURL& url, |
| 297 const base::Time& last_access_time, |
| 298 const base::Time& last_modified_time) { |
| 299 return RunOnThread<PlatformFileError>( |
| 300 io_task_runner_, |
| 301 FROM_HERE, |
| 302 base::Bind(&CannedSyncableFileSystem::DoTouchFile, |
| 303 base::Unretained(this), url, |
| 304 last_access_time, last_modified_time)); |
| 305 } |
| 306 |
295 PlatformFileError CannedSyncableFileSystem::Remove( | 307 PlatformFileError CannedSyncableFileSystem::Remove( |
296 const FileSystemURL& url, bool recursive) { | 308 const FileSystemURL& url, bool recursive) { |
297 return RunOnThread<PlatformFileError>( | 309 return RunOnThread<PlatformFileError>( |
298 io_task_runner_, | 310 io_task_runner_, |
299 FROM_HERE, | 311 FROM_HERE, |
300 base::Bind(&CannedSyncableFileSystem::DoRemove, | 312 base::Bind(&CannedSyncableFileSystem::DoRemove, |
301 base::Unretained(this), url, recursive)); | 313 base::Unretained(this), url, recursive)); |
302 } | 314 } |
303 | 315 |
304 PlatformFileError CannedSyncableFileSystem::FileExists( | 316 PlatformFileError CannedSyncableFileSystem::FileExists( |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 NewOperation()->Move(src_url, dest_url, callback); | 443 NewOperation()->Move(src_url, dest_url, callback); |
432 } | 444 } |
433 | 445 |
434 void CannedSyncableFileSystem::DoTruncateFile( | 446 void CannedSyncableFileSystem::DoTruncateFile( |
435 const FileSystemURL& url, int64 size, | 447 const FileSystemURL& url, int64 size, |
436 const StatusCallback& callback) { | 448 const StatusCallback& callback) { |
437 EXPECT_TRUE(is_filesystem_opened_); | 449 EXPECT_TRUE(is_filesystem_opened_); |
438 NewOperation()->Truncate(url, size, callback); | 450 NewOperation()->Truncate(url, size, callback); |
439 } | 451 } |
440 | 452 |
| 453 void CannedSyncableFileSystem::DoTouchFile( |
| 454 const FileSystemURL& url, |
| 455 const base::Time& last_access_time, |
| 456 const base::Time& last_modified_time, |
| 457 const StatusCallback& callback) { |
| 458 EXPECT_TRUE(is_filesystem_opened_); |
| 459 NewOperation()->TouchFile(url, last_access_time, |
| 460 last_modified_time, callback); |
| 461 } |
| 462 |
441 void CannedSyncableFileSystem::DoRemove( | 463 void CannedSyncableFileSystem::DoRemove( |
442 const FileSystemURL& url, bool recursive, | 464 const FileSystemURL& url, bool recursive, |
443 const StatusCallback& callback) { | 465 const StatusCallback& callback) { |
444 EXPECT_TRUE(is_filesystem_opened_); | 466 EXPECT_TRUE(is_filesystem_opened_); |
445 NewOperation()->Remove(url, recursive, callback); | 467 NewOperation()->Remove(url, recursive, callback); |
446 } | 468 } |
447 | 469 |
448 void CannedSyncableFileSystem::DoFileExists( | 470 void CannedSyncableFileSystem::DoFileExists( |
449 const FileSystemURL& url, const StatusCallback& callback) { | 471 const FileSystemURL& url, const StatusCallback& callback) { |
450 EXPECT_TRUE(is_filesystem_opened_); | 472 EXPECT_TRUE(is_filesystem_opened_); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 sync_status_ = status; | 535 sync_status_ = status; |
514 MessageLoop::current()->Quit(); | 536 MessageLoop::current()->Quit(); |
515 } | 537 } |
516 | 538 |
517 void CannedSyncableFileSystem::InitializeSyncStatusObserver() { | 539 void CannedSyncableFileSystem::InitializeSyncStatusObserver() { |
518 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); | 540 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); |
519 file_system_context_->sync_context()->sync_status()->AddObserver(this); | 541 file_system_context_->sync_context()->sync_status()->AddObserver(this); |
520 } | 542 } |
521 | 543 |
522 } // namespace fileapi | 544 } // namespace fileapi |
OLD | NEW |