| 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 EXPECT_TRUE(is_filesystem_opened_); | 242 EXPECT_TRUE(is_filesystem_opened_); |
| 243 | 243 |
| 244 GURL url(root_url_.spec() + path); | 244 GURL url(root_url_.spec() + path); |
| 245 return file_system_context_->CrackURL(url); | 245 return file_system_context_->CrackURL(url); |
| 246 } | 246 } |
| 247 | 247 |
| 248 PlatformFileError CannedSyncableFileSystem::OpenFileSystem() { | 248 PlatformFileError CannedSyncableFileSystem::OpenFileSystem() { |
| 249 EXPECT_TRUE(is_filesystem_set_up_); | 249 EXPECT_TRUE(is_filesystem_set_up_); |
| 250 EXPECT_FALSE(is_filesystem_opened_); | 250 EXPECT_FALSE(is_filesystem_opened_); |
| 251 file_system_context_->OpenSyncableFileSystem( | 251 file_system_context_->OpenSyncableFileSystem( |
| 252 service_name_, origin_, type_, true /* create */, | 252 service_name_, origin_, type_, |
| 253 fileapi::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, |
| 253 base::Bind(&CannedSyncableFileSystem::DidOpenFileSystem, | 254 base::Bind(&CannedSyncableFileSystem::DidOpenFileSystem, |
| 254 base::Unretained(this))); | 255 base::Unretained(this))); |
| 255 base::MessageLoop::current()->Run(); | 256 base::MessageLoop::current()->Run(); |
| 256 if (file_system_context_->sync_context()) { | 257 if (file_system_context_->sync_context()) { |
| 257 // Register 'this' as a sync status observer. | 258 // Register 'this' as a sync status observer. |
| 258 RunOnThread(io_task_runner_, | 259 RunOnThread(io_task_runner_, |
| 259 FROM_HERE, | 260 FROM_HERE, |
| 260 base::Bind( | 261 base::Bind( |
| 261 &CannedSyncableFileSystem::InitializeSyncStatusObserver, | 262 &CannedSyncableFileSystem::InitializeSyncStatusObserver, |
| 262 base::Unretained(this))); | 263 base::Unretained(this))); |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 sync_status_ = status; | 598 sync_status_ = status; |
| 598 base::MessageLoop::current()->Quit(); | 599 base::MessageLoop::current()->Quit(); |
| 599 } | 600 } |
| 600 | 601 |
| 601 void CannedSyncableFileSystem::InitializeSyncStatusObserver() { | 602 void CannedSyncableFileSystem::InitializeSyncStatusObserver() { |
| 602 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); | 603 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); |
| 603 file_system_context_->sync_context()->sync_status()->AddObserver(this); | 604 file_system_context_->sync_context()->sync_status()->AddObserver(this); |
| 604 } | 605 } |
| 605 | 606 |
| 606 } // namespace sync_file_system | 607 } // namespace sync_file_system |
| OLD | NEW |