| 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/gdata_system_service.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_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" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 53 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 54 cache_->DestroyOnUIThread(); | 54 cache_->DestroyOnUIThread(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void GDataSystemService::Initialize( | 57 void GDataSystemService::Initialize( |
| 58 DriveServiceInterface* drive_service, | 58 DriveServiceInterface* drive_service, |
| 59 const FilePath& cache_root) { | 59 const FilePath& cache_root) { |
| 60 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 60 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 61 | 61 |
| 62 drive_service_.reset(drive_service); | 62 drive_service_.reset(drive_service); |
| 63 cache_ = GDataCache::CreateGDataCacheOnUIThread( | 63 cache_ = DriveCache::CreateDriveCacheOnUIThread( |
| 64 cache_root, | 64 cache_root, |
| 65 blocking_task_runner_); | 65 blocking_task_runner_); |
| 66 uploader_.reset(new GDataUploader(drive_service_.get())); | 66 uploader_.reset(new GDataUploader(drive_service_.get())); |
| 67 webapps_registry_.reset(new DriveWebAppsRegistry); | 67 webapps_registry_.reset(new DriveWebAppsRegistry); |
| 68 file_system_.reset(new GDataFileSystem(profile_, | 68 file_system_.reset(new GDataFileSystem(profile_, |
| 69 cache(), | 69 cache(), |
| 70 drive_service_.get(), | 70 drive_service_.get(), |
| 71 uploader(), | 71 uploader(), |
| 72 webapps_registry(), | 72 webapps_registry(), |
| 73 blocking_task_runner_)); | 73 blocking_task_runner_)); |
| 74 file_write_helper_.reset(new FileWriteHelper(file_system())); | 74 file_write_helper_.reset(new FileWriteHelper(file_system())); |
| 75 download_observer_.reset(new GDataDownloadObserver(uploader(), | 75 download_observer_.reset(new GDataDownloadObserver(uploader(), |
| 76 file_system())); | 76 file_system())); |
| 77 sync_client_.reset(new GDataSyncClient(profile_, file_system(), cache())); | 77 sync_client_.reset(new GDataSyncClient(profile_, file_system(), cache())); |
| 78 contacts_service_.reset(new GDataContactsService(profile_)); | 78 contacts_service_.reset(new GDataContactsService(profile_)); |
| 79 | 79 |
| 80 sync_client_->Initialize(); | 80 sync_client_->Initialize(); |
| 81 file_system_->Initialize(); | 81 file_system_->Initialize(); |
| 82 cache_->RequestInitializeOnUIThread(); | 82 cache_->RequestInitializeOnUIThread(); |
| 83 | 83 |
| 84 content::DownloadManager* download_manager = | 84 content::DownloadManager* download_manager = |
| 85 g_browser_process->download_status_updater() ? | 85 g_browser_process->download_status_updater() ? |
| 86 BrowserContext::GetDownloadManager(profile_) : NULL; | 86 BrowserContext::GetDownloadManager(profile_) : NULL; |
| 87 download_observer_->Initialize( | 87 download_observer_->Initialize( |
| 88 download_manager, | 88 download_manager, |
| 89 cache_->GetCacheDirectoryPath( | 89 cache_->GetCacheDirectoryPath( |
| 90 GDataCache::CACHE_TYPE_TMP_DOWNLOADS)); | 90 DriveCache::CACHE_TYPE_TMP_DOWNLOADS)); |
| 91 | 91 |
| 92 AddDriveMountPoint(); | 92 AddDriveMountPoint(); |
| 93 contacts_service_->Initialize(); | 93 contacts_service_->Initialize(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void GDataSystemService::Shutdown() { | 96 void GDataSystemService::Shutdown() { |
| 97 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 97 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 98 RemoveDriveMountPoint(); | 98 RemoveDriveMountPoint(); |
| 99 | 99 |
| 100 // Shut down the member objects in the reverse order of creation. | 100 // Shut down the member objects in the reverse order of creation. |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 g_test_drive_service = NULL; | 214 g_test_drive_service = NULL; |
| 215 if (!drive_service) { | 215 if (!drive_service) { |
| 216 if (util::IsDriveV2ApiEnabled()) | 216 if (util::IsDriveV2ApiEnabled()) |
| 217 drive_service = new DriveAPIService(); | 217 drive_service = new DriveAPIService(); |
| 218 else | 218 else |
| 219 drive_service = new GDataWapiService(); | 219 drive_service = new GDataWapiService(); |
| 220 } | 220 } |
| 221 | 221 |
| 222 FilePath cache_root = | 222 FilePath cache_root = |
| 223 g_test_cache_root ? FilePath(*g_test_cache_root) : | 223 g_test_cache_root ? FilePath(*g_test_cache_root) : |
| 224 GDataCache::GetCacheRootPath(profile); | 224 DriveCache::GetCacheRootPath(profile); |
| 225 delete g_test_cache_root; | 225 delete g_test_cache_root; |
| 226 g_test_cache_root = NULL; | 226 g_test_cache_root = NULL; |
| 227 | 227 |
| 228 service->Initialize(drive_service, cache_root); | 228 service->Initialize(drive_service, cache_root); |
| 229 return service; | 229 return service; |
| 230 } | 230 } |
| 231 | 231 |
| 232 } // namespace gdata | 232 } // namespace gdata |
| OLD | NEW |