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