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

Unified Diff: chrome/browser/profiles/profile_impl.cc

Issue 9232011: sync: Make ProfileSyncService a ProfileKeyedService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/profiles/profile_impl.h ('k') | chrome/browser/sync/abstract_profile_sync_service_test.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_impl.cc
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 0a17b3fcdddf26495f514babdd2fde4f03d6380c..01628c7d037b0db100afe58102d3e12c086393ca 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -74,8 +74,7 @@
#include "chrome/browser/speech/chrome_speech_input_manager.h"
#include "chrome/browser/speech/chrome_speech_input_preferences.h"
#include "chrome/browser/spellchecker/spellcheck_profile.h"
-#include "chrome/browser/sync/profile_sync_components_factory_impl.h"
-#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/tabs/pinned_tab_service_factory.h"
#include "chrome/browser/transport_security_persister.h"
#include "chrome/browser/ui/browser_init.h"
@@ -255,7 +254,6 @@ ProfileImpl::ProfileImpl(const FilePath& path,
extension_devtools_manager_(NULL),
host_content_settings_map_(NULL),
host_zoom_map_(NULL),
- profile_sync_service_created_(false),
history_service_created_(false),
favicon_service_created_(false),
created_web_data_service_(false),
@@ -574,11 +572,6 @@ ProfileImpl::~ProfileImpl() {
// Remove pref observers
pref_change_registrar_.RemoveAll();
- // The sync service needs to be deleted before the services it calls.
- // TODO(stevet): Make ProfileSyncService into a PKS and let the PDM take care
- // of the cleanup below.
- sync_service_.reset();
-
ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext(
&io_data_.GetResourceContextNoInit());
@@ -1173,8 +1166,8 @@ quota::QuotaManager* ProfileImpl::GetQuotaManager() {
return quota_manager_.get();
}
-bool ProfileImpl::HasProfileSyncService() const {
- return (sync_service_.get() != NULL);
+bool ProfileImpl::HasProfileSyncService() {
+ return ProfileSyncServiceFactory::GetInstance()->HasProfileSyncService(this);
}
bool ProfileImpl::DidLastSessionExitCleanly() {
@@ -1411,22 +1404,7 @@ TokenService* ProfileImpl::GetTokenService() {
}
ProfileSyncService* ProfileImpl::GetProfileSyncService() {
- if (!ProfileSyncService::IsSyncEnabled())
- return NULL;
- if (!profile_sync_service_created_) {
- profile_sync_service_created_ = true;
- InitSyncService();
- }
- return sync_service_.get();
-}
-
-void ProfileImpl::InitSyncService() {
- profile_sync_factory_.reset(
- new ProfileSyncComponentsFactoryImpl(this,
- CommandLine::ForCurrentProcess()));
- sync_service_.reset(profile_sync_factory_->CreateProfileSyncService());
- profile_sync_factory_->RegisterDataTypes(sync_service_.get());
- sync_service_->Initialize();
+ return ProfileSyncServiceFactory::GetInstance()->GetForProfile(this);
}
ChromeBlobStorageContext* ProfileImpl::GetBlobStorageContext() {
« no previous file with comments | « chrome/browser/profiles/profile_impl.h ('k') | chrome/browser/sync/abstract_profile_sync_service_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698