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_contacts_service.h" |
12 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h" | 12 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h" |
13 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" | 13 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" |
14 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" | 14 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" |
15 #include "chrome/browser/chromeos/gdata/gdata_file_system_proxy.h" | 15 #include "chrome/browser/chromeos/gdata/gdata_file_system_proxy.h" |
| 16 #include "chrome/browser/chromeos/gdata/gdata_file_write_helper.h" |
16 #include "chrome/browser/chromeos/gdata/gdata_sync_client.h" | 17 #include "chrome/browser/chromeos/gdata/gdata_sync_client.h" |
17 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" | 18 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" |
18 #include "chrome/browser/chromeos/gdata/gdata_util.h" | 19 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
19 #include "chrome/browser/download/download_service.h" | 20 #include "chrome/browser/download/download_service.h" |
20 #include "chrome/browser/download/download_service_factory.h" | 21 #include "chrome/browser/download/download_service_factory.h" |
21 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/browser/profiles/profile_dependency_manager.h" | 23 #include "chrome/browser/profiles/profile_dependency_manager.h" |
23 #include "content/public/browser/browser_context.h" | 24 #include "content/public/browser/browser_context.h" |
24 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
25 #include "webkit/fileapi/file_system_context.h" | 26 #include "webkit/fileapi/file_system_context.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 cache_root, | 62 cache_root, |
62 blocking_task_runner_); | 63 blocking_task_runner_); |
63 uploader_.reset(new GDataUploader(docs_service())); | 64 uploader_.reset(new GDataUploader(docs_service())); |
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 blocking_task_runner_)); | 71 blocking_task_runner_)); |
| 72 file_write_helper_.reset(new GDataFileWriteHelper(file_system())); |
71 download_observer_.reset(new GDataDownloadObserver(uploader(), | 73 download_observer_.reset(new GDataDownloadObserver(uploader(), |
72 file_system())); | 74 file_system())); |
73 sync_client_.reset(new GDataSyncClient(profile_, file_system(), cache())); | 75 sync_client_.reset(new GDataSyncClient(profile_, file_system(), cache())); |
74 contacts_service_.reset(new GDataContactsService(profile_)); | 76 contacts_service_.reset(new GDataContactsService(profile_)); |
75 | 77 |
76 sync_client_->Initialize(); | 78 sync_client_->Initialize(); |
77 file_system_->Initialize(); | 79 file_system_->Initialize(); |
78 cache_->RequestInitializeOnUIThread(); | 80 cache_->RequestInitializeOnUIThread(); |
79 | 81 |
80 content::DownloadManager* download_manager = | 82 content::DownloadManager* download_manager = |
81 g_browser_process->download_status_updater() ? | 83 g_browser_process->download_status_updater() ? |
82 BrowserContext::GetDownloadManager(profile_) : NULL; | 84 BrowserContext::GetDownloadManager(profile_) : NULL; |
83 download_observer_->Initialize( | 85 download_observer_->Initialize( |
84 download_manager, | 86 download_manager, |
85 cache_->GetCacheDirectoryPath( | 87 cache_->GetCacheDirectoryPath( |
86 GDataCache::CACHE_TYPE_TMP_DOWNLOADS)); | 88 GDataCache::CACHE_TYPE_TMP_DOWNLOADS)); |
87 | 89 |
88 AddDriveMountPoint(); | 90 AddDriveMountPoint(); |
89 contacts_service_->Initialize(); | 91 contacts_service_->Initialize(); |
90 } | 92 } |
91 | 93 |
92 void GDataSystemService::Shutdown() { | 94 void GDataSystemService::Shutdown() { |
93 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 95 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
94 RemoveDriveMountPoint(); | 96 RemoveDriveMountPoint(); |
95 | 97 |
96 // Shut down the member objects in the reverse order of creation. | 98 // Shut down the member objects in the reverse order of creation. |
97 contacts_service_.reset(); | 99 contacts_service_.reset(); |
98 sync_client_.reset(); | 100 sync_client_.reset(); |
99 download_observer_.reset(); | 101 download_observer_.reset(); |
| 102 file_write_helper_.reset(); |
100 file_system_.reset(); | 103 file_system_.reset(); |
101 webapps_registry_.reset(); | 104 webapps_registry_.reset(); |
102 uploader_.reset(); | 105 uploader_.reset(); |
103 documents_service_.reset(); | 106 documents_service_.reset(); |
104 } | 107 } |
105 | 108 |
106 void GDataSystemService::AddDriveMountPoint() { | 109 void GDataSystemService::AddDriveMountPoint() { |
107 if (!gdata::util::IsGDataAvailable(profile_)) | 110 if (!gdata::util::IsGDataAvailable(profile_)) |
108 return; | 111 return; |
109 | 112 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 g_test_cache_root ? FilePath(*g_test_cache_root) : | 187 g_test_cache_root ? FilePath(*g_test_cache_root) : |
185 GDataCache::GetCacheRootPath(profile); | 188 GDataCache::GetCacheRootPath(profile); |
186 delete g_test_cache_root; | 189 delete g_test_cache_root; |
187 g_test_cache_root = NULL; | 190 g_test_cache_root = NULL; |
188 | 191 |
189 service->Initialize(documents_service, cache_root); | 192 service->Initialize(documents_service, cache_root); |
190 return service; | 193 return service; |
191 } | 194 } |
192 | 195 |
193 } // namespace gdata | 196 } // namespace gdata |
OLD | NEW |