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_webapps_registry.h" | 10 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h" |
| 11 #include "chrome/browser/chromeos/gdata/gdata_contacts_service.h" |
11 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h" | 12 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h" |
12 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" | 13 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" |
13 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" | 14 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" |
14 #include "chrome/browser/chromeos/gdata/gdata_file_system_proxy.h" | 15 #include "chrome/browser/chromeos/gdata/gdata_file_system_proxy.h" |
15 #include "chrome/browser/chromeos/gdata/gdata_sync_client.h" | 16 #include "chrome/browser/chromeos/gdata/gdata_sync_client.h" |
16 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" | 17 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" |
17 #include "chrome/browser/chromeos/gdata/gdata_util.h" | 18 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
18 #include "chrome/browser/download/download_service.h" | 19 #include "chrome/browser/download/download_service.h" |
19 #include "chrome/browser/download/download_service_factory.h" | 20 #include "chrome/browser/download/download_service_factory.h" |
20 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 webapps_registry_.reset(new DriveWebAppsRegistry); | 64 webapps_registry_.reset(new DriveWebAppsRegistry); |
64 file_system_.reset(new GDataFileSystem(profile_, | 65 file_system_.reset(new GDataFileSystem(profile_, |
65 cache(), | 66 cache(), |
66 docs_service(), | 67 docs_service(), |
67 uploader(), | 68 uploader(), |
68 webapps_registry(), | 69 webapps_registry(), |
69 blocking_task_runner_)); | 70 blocking_task_runner_)); |
70 download_observer_.reset(new GDataDownloadObserver(uploader(), | 71 download_observer_.reset(new GDataDownloadObserver(uploader(), |
71 file_system())); | 72 file_system())); |
72 sync_client_.reset(new GDataSyncClient(profile_, file_system(), cache())); | 73 sync_client_.reset(new GDataSyncClient(profile_, file_system(), cache())); |
| 74 contacts_service_.reset(new GDataContactsService(profile_)); |
73 | 75 |
74 sync_client_->Initialize(); | 76 sync_client_->Initialize(); |
75 file_system_->Initialize(); | 77 file_system_->Initialize(); |
76 cache_->RequestInitializeOnUIThread(); | 78 cache_->RequestInitializeOnUIThread(); |
77 | 79 |
78 content::DownloadManager* download_manager = | 80 content::DownloadManager* download_manager = |
79 g_browser_process->download_status_updater() ? | 81 g_browser_process->download_status_updater() ? |
80 BrowserContext::GetDownloadManager(profile_) : NULL; | 82 BrowserContext::GetDownloadManager(profile_) : NULL; |
81 download_observer_->Initialize( | 83 download_observer_->Initialize( |
82 download_manager, | 84 download_manager, |
83 cache_->GetCacheDirectoryPath( | 85 cache_->GetCacheDirectoryPath( |
84 GDataCache::CACHE_TYPE_TMP_DOWNLOADS)); | 86 GDataCache::CACHE_TYPE_TMP_DOWNLOADS)); |
85 | 87 |
86 AddDriveMountPoint(); | 88 AddDriveMountPoint(); |
| 89 contacts_service_->Initialize(); |
87 } | 90 } |
88 | 91 |
89 void GDataSystemService::Shutdown() { | 92 void GDataSystemService::Shutdown() { |
90 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 93 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
91 RemoveDriveMountPoint(); | 94 RemoveDriveMountPoint(); |
92 | 95 |
93 // Shut down the member objects in the reverse order of creation. | 96 // Shut down the member objects in the reverse order of creation. |
| 97 contacts_service_.reset(); |
94 sync_client_.reset(); | 98 sync_client_.reset(); |
95 download_observer_.reset(); | 99 download_observer_.reset(); |
96 file_system_.reset(); | 100 file_system_.reset(); |
97 webapps_registry_.reset(); | 101 webapps_registry_.reset(); |
98 uploader_.reset(); | 102 uploader_.reset(); |
99 documents_service_.reset(); | 103 documents_service_.reset(); |
100 } | 104 } |
101 | 105 |
102 void GDataSystemService::AddDriveMountPoint() { | 106 void GDataSystemService::AddDriveMountPoint() { |
103 if (!gdata::util::IsGDataAvailable(profile_)) | 107 if (!gdata::util::IsGDataAvailable(profile_)) |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 g_test_cache_root ? FilePath(*g_test_cache_root) : | 184 g_test_cache_root ? FilePath(*g_test_cache_root) : |
181 GDataCache::GetCacheRootPath(profile); | 185 GDataCache::GetCacheRootPath(profile); |
182 delete g_test_cache_root; | 186 delete g_test_cache_root; |
183 g_test_cache_root = NULL; | 187 g_test_cache_root = NULL; |
184 | 188 |
185 service->Initialize(documents_service, cache_root); | 189 service->Initialize(documents_service, cache_root); |
186 return service; | 190 return service; |
187 } | 191 } |
188 | 192 |
189 } // namespace gdata | 193 } // namespace gdata |
OLD | NEW |