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/download/download_service.h" | 10 #include "chrome/browser/download/download_service.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 sequence_token_)), | 39 sequence_token_)), |
40 documents_service_(new DocumentsService), | 40 documents_service_(new DocumentsService), |
41 uploader_(new GDataUploader(docs_service())), | 41 uploader_(new GDataUploader(docs_service())), |
42 webapps_registry_(new DriveWebAppsRegistry), | 42 webapps_registry_(new DriveWebAppsRegistry), |
43 file_system_(new GDataFileSystem(profile, | 43 file_system_(new GDataFileSystem(profile, |
44 cache(), | 44 cache(), |
45 docs_service(), | 45 docs_service(), |
46 uploader(), | 46 uploader(), |
47 webapps_registry(), | 47 webapps_registry(), |
48 sequence_token_)), | 48 sequence_token_)), |
49 download_observer_(new GDataDownloadObserver), | 49 download_observer_(new GDataDownloadObserver(uploader(), file_system())), |
50 sync_client_(new GDataSyncClient(profile, file_system(), cache())) { | 50 sync_client_(new GDataSyncClient(profile, file_system(), cache())) { |
51 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 51 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
52 | 52 |
53 // TODO(satorux): The dependency to GDataFileSystem should be | 53 // TODO(satorux): The dependency to GDataFileSystem should be |
54 // eliminated. http://crbug.com/133860 | 54 // eliminated. http://crbug.com/133860 |
55 uploader_->set_file_system(file_system()); | 55 uploader_->set_file_system(file_system()); |
56 } | 56 } |
57 | 57 |
58 GDataSystemService::~GDataSystemService() { | 58 GDataSystemService::~GDataSystemService() { |
59 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 59 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
60 cache_->DestroyOnUIThread(); | 60 cache_->DestroyOnUIThread(); |
61 } | 61 } |
62 | 62 |
63 void GDataSystemService::Initialize() { | 63 void GDataSystemService::Initialize() { |
64 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 64 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
65 | 65 |
66 sync_client_->Initialize(); | 66 sync_client_->Initialize(); |
67 file_system_->Initialize(); | 67 file_system_->Initialize(); |
68 cache_->RequestInitializeOnUIThread(); | 68 cache_->RequestInitializeOnUIThread(); |
69 | 69 |
70 content::DownloadManager* download_manager = | 70 content::DownloadManager* download_manager = |
71 g_browser_process->download_status_updater() ? | 71 g_browser_process->download_status_updater() ? |
72 BrowserContext::GetDownloadManager(profile_) : NULL; | 72 BrowserContext::GetDownloadManager(profile_) : NULL; |
73 download_observer_->Initialize( | 73 download_observer_->Initialize( |
74 uploader_.get(), | |
75 download_manager, | 74 download_manager, |
76 cache_->GetCacheDirectoryPath( | 75 cache_->GetCacheDirectoryPath( |
77 GDataCache::CACHE_TYPE_TMP_DOWNLOADS)); | 76 GDataCache::CACHE_TYPE_TMP_DOWNLOADS)); |
78 | 77 |
79 AddDriveMountPoint(); | 78 AddDriveMountPoint(); |
80 } | 79 } |
81 | 80 |
82 void GDataSystemService::Shutdown() { | 81 void GDataSystemService::Shutdown() { |
83 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 82 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
84 RemoveDriveMountPoint(); | 83 RemoveDriveMountPoint(); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 } | 144 } |
146 | 145 |
147 ProfileKeyedService* GDataSystemServiceFactory::BuildServiceInstanceFor( | 146 ProfileKeyedService* GDataSystemServiceFactory::BuildServiceInstanceFor( |
148 Profile* profile) const { | 147 Profile* profile) const { |
149 GDataSystemService* service = new GDataSystemService(profile); | 148 GDataSystemService* service = new GDataSystemService(profile); |
150 service->Initialize(); | 149 service->Initialize(); |
151 return service; | 150 return service; |
152 } | 151 } |
153 | 152 |
154 } // namespace gdata | 153 } // namespace gdata |
OLD | NEW |