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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 webapps_registry_.reset(new DriveWebAppsRegistry); | 65 webapps_registry_.reset(new DriveWebAppsRegistry); |
65 file_system_.reset(new GDataFileSystem(profile_, | 66 file_system_.reset(new GDataFileSystem(profile_, |
66 cache(), | 67 cache(), |
67 docs_service(), | 68 docs_service(), |
68 uploader(), | 69 uploader(), |
69 webapps_registry(), | 70 webapps_registry(), |
70 GetTaskRunner(sequence_token_))); | 71 GetTaskRunner(sequence_token_))); |
71 download_observer_.reset(new GDataDownloadObserver(uploader(), | 72 download_observer_.reset(new GDataDownloadObserver(uploader(), |
72 file_system())); | 73 file_system())); |
73 sync_client_.reset(new GDataSyncClient(profile_, file_system(), cache())); | 74 sync_client_.reset(new GDataSyncClient(profile_, file_system(), cache())); |
| 75 contacts_service_.reset(new GDataContactsService(profile_)); |
74 | 76 |
75 sync_client_->Initialize(); | 77 sync_client_->Initialize(); |
76 file_system_->Initialize(); | 78 file_system_->Initialize(); |
77 cache_->RequestInitializeOnUIThread(); | 79 cache_->RequestInitializeOnUIThread(); |
78 | 80 |
79 content::DownloadManager* download_manager = | 81 content::DownloadManager* download_manager = |
80 g_browser_process->download_status_updater() ? | 82 g_browser_process->download_status_updater() ? |
81 BrowserContext::GetDownloadManager(profile_) : NULL; | 83 BrowserContext::GetDownloadManager(profile_) : NULL; |
82 download_observer_->Initialize( | 84 download_observer_->Initialize( |
83 download_manager, | 85 download_manager, |
84 cache_->GetCacheDirectoryPath( | 86 cache_->GetCacheDirectoryPath( |
85 GDataCache::CACHE_TYPE_TMP_DOWNLOADS)); | 87 GDataCache::CACHE_TYPE_TMP_DOWNLOADS)); |
86 | 88 |
87 AddDriveMountPoint(); | 89 AddDriveMountPoint(); |
| 90 contacts_service_->Initialize(); |
88 } | 91 } |
89 | 92 |
90 void GDataSystemService::Shutdown() { | 93 void GDataSystemService::Shutdown() { |
91 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 94 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
92 RemoveDriveMountPoint(); | 95 RemoveDriveMountPoint(); |
93 | 96 |
94 // Shut down the member objects in the reverse order of creation. | 97 // Shut down the member objects in the reverse order of creation. |
| 98 contacts_service_.reset(); |
95 sync_client_.reset(); | 99 sync_client_.reset(); |
96 download_observer_.reset(); | 100 download_observer_.reset(); |
97 file_system_.reset(); | 101 file_system_.reset(); |
98 webapps_registry_.reset(); | 102 webapps_registry_.reset(); |
99 uploader_.reset(); | 103 uploader_.reset(); |
100 documents_service_.reset(); | 104 documents_service_.reset(); |
101 } | 105 } |
102 | 106 |
103 void GDataSystemService::AddDriveMountPoint() { | 107 void GDataSystemService::AddDriveMountPoint() { |
104 if (!gdata::util::IsGDataAvailable(profile_)) | 108 if (!gdata::util::IsGDataAvailable(profile_)) |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 } | 175 } |
172 | 176 |
173 ProfileKeyedService* GDataSystemServiceFactory::BuildServiceInstanceFor( | 177 ProfileKeyedService* GDataSystemServiceFactory::BuildServiceInstanceFor( |
174 Profile* profile) const { | 178 Profile* profile) const { |
175 GDataSystemService* service = new GDataSystemService(profile); | 179 GDataSystemService* service = new GDataSystemService(profile); |
176 service->Initialize(new DocumentsService); | 180 service->Initialize(new DocumentsService); |
177 return service; | 181 return service; |
178 } | 182 } |
179 | 183 |
180 } // namespace gdata | 184 } // namespace gdata |
OLD | NEW |