diff options
author | dantasse@chromium.org <dantasse@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-05 16:29:39 +0000 |
---|---|---|
committer | dantasse@chromium.org <dantasse@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-05 16:29:39 +0000 |
commit | 3d9a7f25400663330e71f022ef924a4f3ce5e710 (patch) | |
tree | 35b769ca770134b6f165e19558ed5956bf5a5605 | |
parent | c2ed64c1ab691d0fb25bace59950a9055c166a14 (diff) | |
download | chromium_src-3d9a7f25400663330e71f022ef924a4f3ce5e710.zip chromium_src-3d9a7f25400663330e71f022ef924a4f3ce5e710.tar.gz chromium_src-3d9a7f25400663330e71f022ef924a4f3ce5e710.tar.bz2 |
Turn on autofill and prefs sync by default
BUG: 34209
TEST: behavior should be the same as if you had set the --enable-sync-preferences and --enable-sync-autofill flags.
Review URL: http://codereview.chromium.org/1551014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43618 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/gtk/options/content_page_gtk.cc | 10 | ||||
-rw-r--r-- | chrome/browser/sync/profile_sync_factory_impl.cc | 11 | ||||
-rw-r--r-- | chrome/browser/sync/profile_sync_factory_impl_unittest.cc | 26 | ||||
-rw-r--r-- | chrome/browser/sync/sync_setup_flow.cc | 5 | ||||
-rw-r--r-- | chrome/browser/views/options/content_page_view.cc | 20 |
5 files changed, 27 insertions, 45 deletions
diff --git a/chrome/browser/gtk/options/content_page_gtk.cc b/chrome/browser/gtk/options/content_page_gtk.cc index f76a31f..4e40bfc 100644 --- a/chrome/browser/gtk/options/content_page_gtk.cc +++ b/chrome/browser/gtk/options/content_page_gtk.cc @@ -391,14 +391,8 @@ GtkWidget* ContentPageGtk::InitSyncGroup() { sync_customize_button_ = gtk_button_new_with_label(""); g_signal_connect(sync_customize_button_, "clicked", G_CALLBACK(OnSyncCustomizeButtonClickedThunk), this); - // TODO (sync) Remove this big "if" when multi-datatype sync is live. - if (CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableSyncPreferences) || - CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableSyncAutofill)) { - gtk_box_pack_start(GTK_BOX(button_hbox), sync_customize_button_, FALSE, - FALSE, 0); - } + gtk_box_pack_start(GTK_BOX(button_hbox), sync_customize_button_, FALSE, + FALSE, 0); return vbox; } diff --git a/chrome/browser/sync/profile_sync_factory_impl.cc b/chrome/browser/sync/profile_sync_factory_impl.cc index 36e3614..3e2367a 100644 --- a/chrome/browser/sync/profile_sync_factory_impl.cc +++ b/chrome/browser/sync/profile_sync_factory_impl.cc @@ -60,9 +60,8 @@ ProfileSyncService* ProfileSyncFactoryImpl::CreateProfileSyncService() { profile_, browser_defaults::kBootstrapSyncAuthentication); - // Autofill sync is disabled by default. Register only if - // explicitly enabled. - if (command_line_->HasSwitch(switches::kEnableSyncAutofill)) { + // Autofill sync is enabled by default. Register unless explicitly disabled. + if (!command_line_->HasSwitch(switches::kDisableSyncAutofill)) { pss->RegisterDataTypeController( new AutofillDataTypeController(this, profile_, pss)); } @@ -74,9 +73,9 @@ ProfileSyncService* ProfileSyncFactoryImpl::CreateProfileSyncService() { new BookmarkDataTypeController(this, profile_, pss)); } - // Preference sync is disabled by default. Register only if - // explicitly enabled. - if (command_line_->HasSwitch(switches::kEnableSyncPreferences)) { + // Preference sync is enabled by default. Register unless explicitly + // disabled. + if (!command_line_->HasSwitch(switches::kDisableSyncPreferences)) { pss->RegisterDataTypeController( new PreferenceDataTypeController(this, pss)); } diff --git a/chrome/browser/sync/profile_sync_factory_impl_unittest.cc b/chrome/browser/sync/profile_sync_factory_impl_unittest.cc index d13f8a4..4df2485 100644 --- a/chrome/browser/sync/profile_sync_factory_impl_unittest.cc +++ b/chrome/browser/sync/profile_sync_factory_impl_unittest.cc @@ -43,12 +43,14 @@ TEST_F(ProfileSyncFactoryImplTest, CreatePSSDefault) { DataTypeController::StateMap controller_states; DataTypeController::StateMap* controller_states_ptr = &controller_states; pss->GetDataTypeControllerStates(controller_states_ptr); - EXPECT_EQ(1U, controller_states_ptr->size()); + EXPECT_EQ(3U, controller_states_ptr->size()); EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS)); + EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES)); + EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL)); } -TEST_F(ProfileSyncFactoryImplTest, CreatePSSEnableAutofill) { - command_line_->AppendSwitch(switches::kEnableSyncAutofill); +TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableAutofill) { + command_line_->AppendSwitch(switches::kDisableSyncAutofill); scoped_ptr<ProfileSyncService> pss; pss.reset(profile_sync_service_factory_->CreateProfileSyncService()); DataTypeController::StateMap controller_states; @@ -56,7 +58,8 @@ TEST_F(ProfileSyncFactoryImplTest, CreatePSSEnableAutofill) { pss->GetDataTypeControllerStates(controller_states_ptr); EXPECT_EQ(2U, controller_states_ptr->size()); EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS)); - EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL)); + EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES)); + EXPECT_EQ(0U, controller_states_ptr->count(syncable::AUTOFILL)); } TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableBookmarks) { @@ -66,12 +69,14 @@ TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableBookmarks) { DataTypeController::StateMap controller_states; DataTypeController::StateMap* controller_states_ptr = &controller_states; pss->GetDataTypeControllerStates(controller_states_ptr); - EXPECT_EQ(0U, controller_states_ptr->size()); + EXPECT_EQ(2U, controller_states_ptr->size()); EXPECT_EQ(0U, controller_states_ptr->count(syncable::BOOKMARKS)); + EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES)); + EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL)); } -TEST_F(ProfileSyncFactoryImplTest, CreatePSSEnablePreferences) { - command_line_->AppendSwitch(switches::kEnableSyncPreferences); +TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisablePreferences) { + command_line_->AppendSwitch(switches::kDisableSyncPreferences); scoped_ptr<ProfileSyncService> pss; pss.reset(profile_sync_service_factory_->CreateProfileSyncService()); DataTypeController::StateMap controller_states; @@ -79,7 +84,8 @@ TEST_F(ProfileSyncFactoryImplTest, CreatePSSEnablePreferences) { pss->GetDataTypeControllerStates(controller_states_ptr); EXPECT_EQ(2U, controller_states_ptr->size()); EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS)); - EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES)); + EXPECT_EQ(0U, controller_states_ptr->count(syncable::PREFERENCES)); + EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL)); } TEST_F(ProfileSyncFactoryImplTest, CreatePSSEnableThemes) { @@ -89,7 +95,9 @@ TEST_F(ProfileSyncFactoryImplTest, CreatePSSEnableThemes) { DataTypeController::StateMap controller_states; DataTypeController::StateMap* controller_states_ptr = &controller_states; pss->GetDataTypeControllerStates(controller_states_ptr); - EXPECT_EQ(2U, controller_states_ptr->size()); + EXPECT_EQ(4U, controller_states_ptr->size()); EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS)); + EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES)); + EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL)); EXPECT_EQ(1U, controller_states_ptr->count(syncable::THEMES)); } diff --git a/chrome/browser/sync/sync_setup_flow.cc b/chrome/browser/sync/sync_setup_flow.cc index 5ddf892..1ccc8a3 100644 --- a/chrome/browser/sync/sync_setup_flow.cc +++ b/chrome/browser/sync/sync_setup_flow.cc @@ -261,11 +261,8 @@ void SyncSetupFlow::GetArgsForGaiaLogin(const ProfileSyncService* service, args->SetString(L"captchaUrl", error.captcha().image_url.spec()); - // TODO(dantasse) Remove this when multi-datatype sync is live. #if defined(OS_WIN) || defined(OS_LINUX) - syncable::ModelTypeSet registered_datatypes; - service->GetRegisteredDataTypes(®istered_datatypes); - args->SetBoolean(L"showCustomize", registered_datatypes.size() > 1); + args->SetBoolean(L"showCustomize", true); #else args->SetBoolean(L"showCustomize", false); #endif diff --git a/chrome/browser/views/options/content_page_view.cc b/chrome/browser/views/options/content_page_view.cc index db0ef0c..e6cf2ef 100644 --- a/chrome/browser/views/options/content_page_view.cc +++ b/chrome/browser/views/options/content_page_view.cc @@ -152,14 +152,11 @@ void ContentPageView::ButtonPressed( sync_service_->EnableForUser(); ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_OPTIONS); } - } -#if defined(OS_WIN) - else if (sender == sync_customize_button_) { + } else if (sender == sync_customize_button_) { // sync_customize_button_ should be invisible if sync is not yet set up. DCHECK(sync_service_->HasSyncSetupCompleted()); CustomizeSyncWindowView::Show(GetWindow()->GetNativeWindow(), profile()); } -#endif } void ContentPageView::LinkActivated(views::Link* source, int event_flags) { @@ -440,9 +437,7 @@ void ContentPageView::InitSyncGroup() { sync_action_link_->SetController(this); sync_start_stop_button_ = new views::NativeButton(this, std::wstring()); -#if defined(OS_WIN) sync_customize_button_ = new views::NativeButton(this, std::wstring()); -#endif using views::GridLayout; using views::ColumnSet; @@ -466,16 +461,7 @@ void ContentPageView::InitSyncGroup() { layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); layout->StartRow(0, single_column_view_set_id); layout->AddView(sync_start_stop_button_); - - // TODO (dantasse) Remove this big "if" when multi-datatype sync is live. -#if defined(OS_WIN) - if (CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableSyncPreferences) || - CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableSyncAutofill)) { - layout->AddView(sync_customize_button_); - } -#endif + layout->AddView(sync_customize_button_); sync_group_ = new OptionsGroupView(contents, l10n_util::GetString(IDS_SYNC_OPTIONS_GROUP_NAME), std::wstring(), true); @@ -503,10 +489,8 @@ void ContentPageView::UpdateSyncControls() { sync_status_label_->SetText(status_label); sync_start_stop_button_->SetEnabled(!sync_service_->WizardIsVisible()); sync_start_stop_button_->SetLabel(button_label); -#if defined(OS_WIN) sync_customize_button_->SetLabel(customize_button_label); sync_customize_button_->SetVisible(sync_setup_completed); -#endif sync_action_link_->SetText(link_label); sync_action_link_->SetVisible(!link_label.empty()); |