| 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 "chrome/browser/chromeos/gdata/drive_system_service.h" | 5 #include "chrome/browser/chromeos/gdata/drive_system_service.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 "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chromeos/gdata/drive_api_service.h" | 10 #include "chrome/browser/chromeos/gdata/drive_api_service.h" |
| 11 #include "chrome/browser/chromeos/gdata/drive_file_system.h" | 11 #include "chrome/browser/chromeos/gdata/drive_file_system.h" |
| 12 #include "chrome/browser/chromeos/gdata/drive_file_system_proxy.h" | 12 #include "chrome/browser/chromeos/gdata/drive_file_system_proxy.h" |
| 13 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h" | 13 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h" |
| 14 #include "chrome/browser/chromeos/gdata/file_write_helper.h" | 14 #include "chrome/browser/chromeos/gdata/file_write_helper.h" |
| 15 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" | 15 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" |
| 16 #include "chrome/browser/chromeos/gdata/gdata_sync_client.h" | 16 #include "chrome/browser/chromeos/gdata/gdata_sync_client.h" |
| 17 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" | 17 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" |
| 18 #include "chrome/browser/chromeos/gdata/gdata_util.h" | 18 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
| 19 #include "chrome/browser/chromeos/gdata/gdata_wapi_service.h" | 19 #include "chrome/browser/chromeos/gdata/gdata_wapi_service.h" |
| 20 #include "chrome/browser/chromeos/gdata/stale_cache_files_remover.h" |
| 20 #include "chrome/browser/download/download_service.h" | 21 #include "chrome/browser/download/download_service.h" |
| 21 #include "chrome/browser/download/download_service_factory.h" | 22 #include "chrome/browser/download/download_service_factory.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/profiles/profile_dependency_manager.h" | 24 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 24 #include "content/public/browser/browser_context.h" | 25 #include "content/public/browser/browser_context.h" |
| 25 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
| 26 #include "webkit/fileapi/file_system_context.h" | 27 #include "webkit/fileapi/file_system_context.h" |
| 27 #include "webkit/fileapi/file_system_mount_point_provider.h" | 28 #include "webkit/fileapi/file_system_mount_point_provider.h" |
| 28 | 29 |
| 29 using content::BrowserContext; | 30 using content::BrowserContext; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 file_system_.reset(new DriveFileSystem(profile_, | 68 file_system_.reset(new DriveFileSystem(profile_, |
| 68 cache(), | 69 cache(), |
| 69 drive_service_.get(), | 70 drive_service_.get(), |
| 70 uploader(), | 71 uploader(), |
| 71 webapps_registry(), | 72 webapps_registry(), |
| 72 blocking_task_runner_)); | 73 blocking_task_runner_)); |
| 73 file_write_helper_.reset(new FileWriteHelper(file_system())); | 74 file_write_helper_.reset(new FileWriteHelper(file_system())); |
| 74 download_observer_.reset(new GDataDownloadObserver(uploader(), | 75 download_observer_.reset(new GDataDownloadObserver(uploader(), |
| 75 file_system())); | 76 file_system())); |
| 76 sync_client_.reset(new GDataSyncClient(profile_, file_system(), cache())); | 77 sync_client_.reset(new GDataSyncClient(profile_, file_system(), cache())); |
| 78 stale_cache_files_remover_.reset(new StaleCacheFilesRemover(file_system(), |
| 79 cache())); |
| 77 | 80 |
| 78 sync_client_->Initialize(); | 81 sync_client_->Initialize(); |
| 79 file_system_->Initialize(); | 82 file_system_->Initialize(); |
| 80 cache_->RequestInitializeOnUIThread(); | 83 cache_->RequestInitializeOnUIThread(); |
| 81 | 84 |
| 82 content::DownloadManager* download_manager = | 85 content::DownloadManager* download_manager = |
| 83 g_browser_process->download_status_updater() ? | 86 g_browser_process->download_status_updater() ? |
| 84 BrowserContext::GetDownloadManager(profile_) : NULL; | 87 BrowserContext::GetDownloadManager(profile_) : NULL; |
| 85 download_observer_->Initialize( | 88 download_observer_->Initialize( |
| 86 download_manager, | 89 download_manager, |
| 87 cache_->GetCacheDirectoryPath( | 90 cache_->GetCacheDirectoryPath( |
| 88 DriveCache::CACHE_TYPE_TMP_DOWNLOADS)); | 91 DriveCache::CACHE_TYPE_TMP_DOWNLOADS)); |
| 89 | 92 |
| 90 AddDriveMountPoint(); | 93 AddDriveMountPoint(); |
| 91 } | 94 } |
| 92 | 95 |
| 93 void DriveSystemService::Shutdown() { | 96 void DriveSystemService::Shutdown() { |
| 94 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 97 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 95 RemoveDriveMountPoint(); | 98 RemoveDriveMountPoint(); |
| 96 | 99 |
| 97 // Shut down the member objects in the reverse order of creation. | 100 // Shut down the member objects in the reverse order of creation. |
| 101 stale_cache_files_remover_.reset(); |
| 98 sync_client_.reset(); | 102 sync_client_.reset(); |
| 99 download_observer_.reset(); | 103 download_observer_.reset(); |
| 100 file_write_helper_.reset(); | 104 file_write_helper_.reset(); |
| 101 file_system_.reset(); | 105 file_system_.reset(); |
| 102 webapps_registry_.reset(); | 106 webapps_registry_.reset(); |
| 103 uploader_.reset(); | 107 uploader_.reset(); |
| 104 drive_service_.reset(); | 108 drive_service_.reset(); |
| 105 } | 109 } |
| 106 | 110 |
| 107 void DriveSystemService::ClearCacheAndRemountFileSystem( | 111 void DriveSystemService::ClearCacheAndRemountFileSystem( |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 g_test_cache_root ? FilePath(*g_test_cache_root) : | 223 g_test_cache_root ? FilePath(*g_test_cache_root) : |
| 220 DriveCache::GetCacheRootPath(profile); | 224 DriveCache::GetCacheRootPath(profile); |
| 221 delete g_test_cache_root; | 225 delete g_test_cache_root; |
| 222 g_test_cache_root = NULL; | 226 g_test_cache_root = NULL; |
| 223 | 227 |
| 224 service->Initialize(drive_service, cache_root); | 228 service->Initialize(drive_service, cache_root); |
| 225 return service; | 229 return service; |
| 226 } | 230 } |
| 227 | 231 |
| 228 } // namespace gdata | 232 } // namespace gdata |
| OLD | NEW |