summaryrefslogtreecommitdiffstats
path: root/chrome/browser/profile.cc
diff options
context:
space:
mode:
authortim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-15 01:19:11 +0000
committertim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-15 01:19:11 +0000
commit48352c11fe849f7f786c43bdfe293dc2c58d12c5 (patch)
tree57708d7e211d7cbcf2b81b1395740f5859a62aa1 /chrome/browser/profile.cc
parent20cc723d102acb16b61789714bbf443ba3d7d1f5 (diff)
downloadchromium_src-48352c11fe849f7f786c43bdfe293dc2c58d12c5.zip
chromium_src-48352c11fe849f7f786c43bdfe293dc2c58d12c5.tar.gz
chromium_src-48352c11fe849f7f786c43bdfe293dc2c58d12c5.tar.bz2
Some personalization cleanup:
- Removes ProfilePersonalization (which is why the CL appears huge) - Makes Profile do the work ProfilePersonalization did for creating PSS - cloudy:stats > about:sync - Removes the cloudy:// scheme and uses chrome:// for resources. (Note SyncResourcesSource is a straight copy of CloudyResourceSource). - Moves prefs and switches to pref_names and chrome_switches. BUG=none TEST=ProfileSyncServiceTest, LiveBookmarkSyncTests, SyncSetupWizardTest Review URL: http://codereview.chromium.org/164544 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23505 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/profile.cc')
-rw-r--r--chrome/browser/profile.cc38
1 files changed, 26 insertions, 12 deletions
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index 6186394..94b4e60 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -31,6 +31,7 @@
#include "chrome/browser/sessions/tab_restore_service.h"
#include "chrome/browser/spellchecker.h"
#include "chrome/browser/ssl/ssl_host_state.h"
+#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/thumbnail_store.h"
#include "chrome/browser/visitedlink_master.h"
#include "chrome/browser/visitedlink_event_listener.h"
@@ -380,11 +381,9 @@ class OffTheRecordProfileImpl : public Profile,
return profile_->GetBookmarkModel();
}
-#ifdef CHROME_PERSONALIZATION
- virtual ProfilePersonalization* GetProfilePersonalization() {
- return profile_->GetProfilePersonalization();
+ virtual ProfileSyncService* GetProfileSyncService() {
+ return NULL;
}
-#endif
virtual bool IsSameProfile(Profile* profile) {
if (profile == static_cast<Profile*>(this))
@@ -516,11 +515,6 @@ ProfileImpl::ProfileImpl(const FilePath& path)
prefs->AddPrefObserver(prefs::kEnableSpellCheck, this);
prefs->AddPrefObserver(prefs::kEnableAutoSpellCorrect, this);
-#ifdef CHROME_PERSONALIZATION
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableSync))
- personalization_.reset(Personalization::CreateProfilePersonalization(this));
-#endif
-
if (CommandLine::ForCurrentProcess()->
HasSwitch(switches::kPrivacyBlacklist)) {
std::wstring option = CommandLine::ForCurrentProcess()->GetSwitchValue(
@@ -541,6 +535,10 @@ ProfileImpl::ProfileImpl(const FilePath& path)
// Listen for theme installation.
registrar_.Add(this, NotificationType::THEME_INSTALLED,
NotificationService::AllSources());
+
+ // Listen for bookmark model load, to bootstrap the sync service.
+ registrar_.Add(this, NotificationType::BOOKMARK_MODEL_LOADED,
+ Source<Profile>(this));
}
void ProfileImpl::InitExtensions() {
@@ -633,7 +631,7 @@ ProfileImpl::~ProfileImpl() {
prefs->RemovePrefObserver(prefs::kEnableAutoSpellCorrect, this);
#ifdef CHROME_PERSONALIZATION
- personalization_.reset();
+ sync_service_.reset();
#endif
// Both HistoryService and WebDataService maintain threads for background
@@ -1210,6 +1208,10 @@ void ProfileImpl::Observe(NotificationType type,
} else if (NotificationType::THEME_INSTALLED == type) {
Extension* extension = Details<Extension>(details).ptr();
SetTheme(extension);
+ } else if (NotificationType::BOOKMARK_MODEL_LOADED == type) {
+ GetProfileSyncService(); // Causes lazy-load if sync is enabled.
+ registrar_.Remove(this, NotificationType::BOOKMARK_MODEL_LOADED,
+ Source<Profile>(this));
}
}
@@ -1217,8 +1219,20 @@ void ProfileImpl::StopCreateSessionServiceTimer() {
create_session_service_timer_.Stop();
}
+ProfileSyncService* ProfileImpl::GetProfileSyncService() {
#ifdef CHROME_PERSONALIZATION
-ProfilePersonalization* ProfileImpl::GetProfilePersonalization() {
- return personalization_.get();
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableSync)) {
+ if (!sync_service_.get())
+ InitSyncService();
+ return sync_service_.get();
+ }
+#endif
+ return NULL;
}
+
+void ProfileImpl::InitSyncService() {
+#ifdef CHROME_PERSONALIZATION
+ sync_service_.reset(new ProfileSyncService(this));
+ sync_service_->Initialize();
#endif
+}