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