summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/profile_sync_service.cc
diff options
context:
space:
mode:
authordantasse@chromium.org <dantasse@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-31 20:49:04 +0000
committerdantasse@chromium.org <dantasse@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-31 20:49:04 +0000
commita7ab833c92b6d9bd23fbd98b5650a2508ad65aba (patch)
tree6369fd571af8a8d297537056de6dd63f8a36af47 /chrome/browser/sync/profile_sync_service.cc
parent4f30638aceaf44af1d12cca32a2c39dbcca48bd9 (diff)
downloadchromium_src-a7ab833c92b6d9bd23fbd98b5650a2508ad65aba.zip
chromium_src-a7ab833c92b6d9bd23fbd98b5650a2508ad65aba.tar.gz
chromium_src-a7ab833c92b6d9bd23fbd98b5650a2508ad65aba.tar.bz2
The "Customize Sync" dialog will let users select to sync or not sync each data type (bookmarks, preferences, etc).
The Customize Sync dialog appears if you click a button on the gaia login or the Options->Personal Stuff tab. This button only appears if you've set the --enable-sync-preferences or --enable-sync-autofill command-line flag. On the Gaia login, the Customize Sync button grays out when you click 'sign in'. If the "customize sync" dialog is open, it closes when you click "cancel" on the Gaia login, and it accepts when you log in to Gaia. Removed "Merge and Sync" from the login sequence. Also deleted the 'merge_allowed' parameter from DataTypeController and its subclasses. Fixed strings so they all refer to "Google Chrome/Chromium sync" instead of "Bookmark sync". BUG=34209,27259 TEST=none Review URL: http://codereview.chromium.org/1134002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43256 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/profile_sync_service.cc')
-rw-r--r--chrome/browser/sync/profile_sync_service.cc41
1 files changed, 32 insertions, 9 deletions
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index a6d388c..ad670be 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/sync/profile_sync_service.h"
+#include <map>
#include <set>
#include "app/l10n_util.h"
@@ -22,6 +23,9 @@
#include "chrome/browser/sync/glue/data_type_controller.h"
#include "chrome/browser/sync/glue/data_type_manager.h"
#include "chrome/browser/sync/profile_sync_factory.h"
+#if defined(OS_WIN)
+#include "chrome/browser/views/options/customize_sync_window_view.h"
+#endif
#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_details.h"
#include "chrome/common/notification_service.h"
@@ -31,7 +35,6 @@
#include "chrome/common/time_format.h"
#include "grit/generated_resources.h"
#include "net/base/cookie_monster.h"
-#include "views/window/window.h"
using browser_sync::ChangeProcessor;
using browser_sync::DataTypeController;
@@ -98,6 +101,15 @@ void ProfileSyncService::RegisterDataTypeController(
data_type_controller;
}
+void ProfileSyncService::GetDataTypeControllerStates(
+ browser_sync::DataTypeController::StateMap* state_map) const {
+ browser_sync::DataTypeController::TypeMap::const_iterator iter
+ = data_type_controllers_.begin();
+ for ( ; iter != data_type_controllers_.end(); ++iter ) {
+ (*state_map)[iter->first] = iter->second.get()->state();
+ }
+}
+
void ProfileSyncService::InitSettings() {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
@@ -132,6 +144,11 @@ void ProfileSyncService::RegisterPreferences() {
pref_service->RegisterInt64Pref(prefs::kSyncLastSyncedTime, 0);
pref_service->RegisterBooleanPref(prefs::kSyncHasSetupCompleted, false);
+ // If you've never synced before, all datatypes are on by default.
+ pref_service->RegisterBooleanPref(prefs::kSyncBookmarks, true);
+ pref_service->RegisterBooleanPref(prefs::kSyncPreferences, true);
+ pref_service->RegisterBooleanPref(prefs::kSyncAutofill, true);
+
// TODO(albertb): Consider getting rid of this preference once we have a UI
// for per-data type disabling.
if (bootstrap_sync_authentication_ &&
@@ -386,6 +403,14 @@ string16 ProfileSyncService::GetAuthenticatedUsername() const {
return backend_->GetAuthenticatedUsername();
}
+void ProfileSyncService::OnUserClickedCustomize() {
+ // This is coming from the gaia_login, so set configure_on_accept=false
+ // (because when the user accepts, he/she will not have signed in yet).
+#if defined(OS_WIN)
+ CustomizeSyncWindowView::Show(NULL, profile_, false);
+#endif
+}
+
void ProfileSyncService::OnUserSubmittedAuth(
const std::string& username, const std::string& password,
const std::string& captcha) {
@@ -397,14 +422,9 @@ void ProfileSyncService::OnUserSubmittedAuth(
backend_->Authenticate(username, password, captcha);
}
-void ProfileSyncService::OnUserAcceptedMergeAndSync() {
- // TODO(skrul): Remove this.
- NOTREACHED();
-}
-
void ProfileSyncService::OnUserCancelledDialog() {
if (!profile_->GetPrefs()->GetBoolean(prefs::kSyncHasSetupCompleted)) {
- // A sync dialog was aborted before authentication or merge acceptance.
+ // A sync dialog was aborted before authentication.
// Rollback.
DisableForUser();
}
@@ -412,11 +432,14 @@ void ProfileSyncService::OnUserCancelledDialog() {
FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged());
}
+void ProfileSyncService::ChangeDataTypes(
+ const browser_sync::DataTypeManager::TypeSet& desired_types) {
+ data_type_manager_->Configure(desired_types);
+}
+
void ProfileSyncService::StartProcessingChangesIfReady() {
DCHECK(backend_initialized_);
- // If we're running inside Chromium OS, always allow merges and
- // consider the sync setup complete.
if (bootstrap_sync_authentication_) {
SetSyncSetupCompleted();
}