Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(336)

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_system_service.cc

Issue 10818017: contacts: Add GDataContactsService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor cleanup Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 webapps_registry_.reset(new DriveWebAppsRegistry); 70 webapps_registry_.reset(new DriveWebAppsRegistry);
70 file_system_.reset(new GDataFileSystem(profile_, 71 file_system_.reset(new GDataFileSystem(profile_,
71 cache(), 72 cache(),
72 docs_service(), 73 docs_service(),
73 uploader(), 74 uploader(),
74 webapps_registry(), 75 webapps_registry(),
75 GetTaskRunner(sequence_token_))); 76 GetTaskRunner(sequence_token_)));
76 download_observer_.reset(new GDataDownloadObserver(uploader(), 77 download_observer_.reset(new GDataDownloadObserver(uploader(),
77 file_system())); 78 file_system()));
78 sync_client_.reset(new GDataSyncClient(profile_, file_system(), cache())); 79 sync_client_.reset(new GDataSyncClient(profile_, file_system(), cache()));
80 contacts_service_.reset(new GDataContactsService(profile_));
79 81
80 sync_client_->Initialize(); 82 sync_client_->Initialize();
81 file_system_->Initialize(); 83 file_system_->Initialize();
82 cache_->RequestInitializeOnUIThread(); 84 cache_->RequestInitializeOnUIThread();
83 85
84 content::DownloadManager* download_manager = 86 content::DownloadManager* download_manager =
85 g_browser_process->download_status_updater() ? 87 g_browser_process->download_status_updater() ?
86 BrowserContext::GetDownloadManager(profile_) : NULL; 88 BrowserContext::GetDownloadManager(profile_) : NULL;
87 download_observer_->Initialize( 89 download_observer_->Initialize(
88 download_manager, 90 download_manager,
89 cache_->GetCacheDirectoryPath( 91 cache_->GetCacheDirectoryPath(
90 GDataCache::CACHE_TYPE_TMP_DOWNLOADS)); 92 GDataCache::CACHE_TYPE_TMP_DOWNLOADS));
91 93
92 AddDriveMountPoint(); 94 AddDriveMountPoint();
95 contacts_service_->Initialize();
93 } 96 }
94 97
95 void GDataSystemService::Shutdown() { 98 void GDataSystemService::Shutdown() {
96 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 99 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
97 RemoveDriveMountPoint(); 100 RemoveDriveMountPoint();
98 101
99 // Shut down the member objects in the reverse order of creation. 102 // Shut down the member objects in the reverse order of creation.
103 contacts_service_.reset();
100 sync_client_.reset(); 104 sync_client_.reset();
101 download_observer_.reset(); 105 download_observer_.reset();
102 file_system_.reset(); 106 file_system_.reset();
103 webapps_registry_.reset(); 107 webapps_registry_.reset();
104 uploader_.reset(); 108 uploader_.reset();
105 documents_service_.reset(); 109 documents_service_.reset();
106 } 110 }
107 111
108 void GDataSystemService::AddDriveMountPoint() { 112 void GDataSystemService::AddDriveMountPoint() {
109 if (!gdata::util::IsGDataAvailable(profile_)) 113 if (!gdata::util::IsGDataAvailable(profile_))
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 g_test_cache_root ? FilePath(*g_test_cache_root) : 190 g_test_cache_root ? FilePath(*g_test_cache_root) :
187 GDataCache::GetCacheRootPath(profile); 191 GDataCache::GetCacheRootPath(profile);
188 delete g_test_cache_root; 192 delete g_test_cache_root;
189 g_test_cache_root = NULL; 193 g_test_cache_root = NULL;
190 194
191 service->Initialize(documents_service, cache_root); 195 service->Initialize(documents_service, cache_root);
192 return service; 196 return service;
193 } 197 }
194 198
195 } // namespace gdata 199 } // namespace gdata
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698