diff options
author | csilv@chromium.org <csilv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-10 04:06:48 +0000 |
---|---|---|
committer | csilv@chromium.org <csilv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-10 04:06:48 +0000 |
commit | 5c388aecee8ef2ea71362e49e84466f1c2c3b41c (patch) | |
tree | afc846965e2563a9db476ff150d4bc55b5e7d642 | |
parent | 648a09f7e21ae155958066287da7461e4d649dff (diff) | |
download | chromium_src-5c388aecee8ef2ea71362e49e84466f1c2c3b41c.zip chromium_src-5c388aecee8ef2ea71362e49e84466f1c2c3b41c.tar.gz chromium_src-5c388aecee8ef2ea71362e49e84466f1c2c3b41c.tar.bz2 |
[uber page] Move password manager and autofill settings from PersonalOptions to AdvanceOptions.
BUG=107485
TEST=Verify that password manager and autofill settings work correctly from Under the Hood page.
Review URL: http://codereview.chromium.org/9114024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117002 0039d316-1c4b-4281-b951-d872f2087c98
11 files changed, 130 insertions, 135 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 8252886..f1dcc30 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -8229,12 +8229,28 @@ Would you like to start <ph name="CONTROL_PANEL_APPLET_NAME">$1<ex>Add/Remove Pr Offer to translate pages that aren't in a language I read </message> + <if expr="not pp_ifdef('use_titlecase')"> + <message name="IDS_OPTIONS_PASSWORDS_AND_FORMS_GROUP_NAME" desc="The title of the 'Passwords and forms' group"> + Passwords and forms + </message> + </if> + <if expr="pp_ifdef('use_titlecase')"> + <message name="IDS_OPTIONS_PASSWORDS_AND_FORMS_GROUP_NAME" desc="In Title Case: The title of the 'Passwords and Forms' group"> + Passwords and Forms + </message> + </if> + <message name="IDS_OPTIONS_PASSWORD_MANAGER_ENABLE" desc="The label of the password manager checkbox"> + Offer to save passwords I enter on the web. + </message> <message name="IDS_OPTIONS_PASSWORDS_ASKTOSAVE" desc="The label of the 'Ask me to save passwords' radio button"> Offer to save passwords </message> <message name="IDS_OPTIONS_PASSWORDS_NEVERSAVE" desc="The label of the 'Never save passwords' radio button"> Never save passwords </message> + <message name="IDS_OPTIONS_PASSWORDS_MANAGE_PASSWORDS_LINK" desc="The label of the 'Manage saved passwords' link"> + Manage saved passwords + </message> <if expr="pp_ifdef('use_titlecase')"> <message name="IDS_OPTIONS_PASSWORDS_MANAGE_PASSWORDS" desc="In Title Case: The label of the 'Manage saved passwords' button"> Manage Saved Passwords... @@ -8271,7 +8287,7 @@ Would you like to start <ph name="CONTROL_PANEL_APPLET_NAME">$1<ex>Add/Remove Pr Do you want Chrome to save this credit card information for completing web forms? </message> <message name="IDS_OPTIONS_AUTOFILL_ENABLE" desc="The label of the 'Ask me to enable Autofill' radio button"> - Enable Autofill to fill out web forms in a single click + Enable Autofill to fill out web forms in a single click. </message> <message name="IDS_AUTOFILL_CC_INFOBAR_ACCEPT" desc="Text to show for the Autofill credit card request infobar accept button."> Save info @@ -8291,6 +8307,9 @@ Would you like to start <ph name="CONTROL_PANEL_APPLET_NAME">$1<ex>Add/Remove Pr <message name="IDS_AUTOFILL_EDIT_PROFILE_BUTTON" desc="The label of the button that edits the currently selected Autofill profile."> Edit... </message> + <message name="IDS_OPTIONS_MANAGE_AUTOFILL_SETTINGS_LINK" desc="The label of the 'Manage Autofill settings' link"> + Manage Autofill settings + </message> <if expr="not pp_ifdef('use_titlecase')"> <message name="IDS_OPTIONS_MANAGE_AUTOFILL_SETTINGS" desc="The label of the 'Manage Autofill settings' button"> Manage Autofill settings... diff --git a/chrome/browser/resources/options2/advanced_options.css b/chrome/browser/resources/options2/advanced_options.css index bf53be2..2fe5e4b 100644 --- a/chrome/browser/resources/options2/advanced_options.css +++ b/chrome/browser/resources/options2/advanced_options.css @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 The Chromium Authors. All rights reserved. + * Copyright (c) 2012 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -31,3 +31,12 @@ #privacyClearDataButton { margin-left: 10px; } + +/* This is necessary because the fix for correctly wrapping labels + * (crbug.com/109334) requires labels to be display: block; however, this label + * has a buttom inline after it. + */ +#autofill-label, +#password-manager-label { + display: inline; +} diff --git a/chrome/browser/resources/options2/advanced_options.html b/chrome/browser/resources/options2/advanced_options.html index a5199a3..af1cfac 100644 --- a/chrome/browser/resources/options2/advanced_options.html +++ b/chrome/browser/resources/options2/advanced_options.html @@ -69,6 +69,34 @@ </if> </div> </section> + <section id="passwords-and-autofill-section"> + <h3 i18n-content="passwordsAndAutofillGroupName"></h3> + <div class="checkbox"> + <input id="autofill-enabled" pref="autofill.enabled" + metric="Options_FormAutofill" type="checkbox"> + <label id="autofill-label" for="autofill-enabled" + i18n-content="autofillEnabled"></label> + <button id="autofill-settings" class="link-button" + pref="autofill.enabled" + i18n-content="manageAutofillSettings"></button> + </div> + <div class="checkbox"> + <input id="password-manager-enabled" + pref="profile.password_manager_enabled" + metric="Options_PasswordManager" type="checkbox"> + <label id="password-manager-label" for="password-manager-enabled" + i18n-content="passwordManagerEnabled"></label> + <button id="manage-passwords" class="link-button" + i18n-content="managePasswords" + pref="profile.password_manager_enabled"></button> + </div> + <div id="mac-passwords-warning" i18n-content="macPasswordsWarning" hidden> + </div> + <!-- This makes the managed-banner appear when the "pref" is configured by + the IT administrator. --> + <input name="password_allow_show_hidden" type="text" + pref="profile.password_manager_allow_show_passwords" hidden> + </section> <section> <h3 i18n-content="advancedSectionTitleContent"></h3> <div> diff --git a/chrome/browser/resources/options2/advanced_options.js b/chrome/browser/resources/options2/advanced_options.js index 846202d..5f47996 100644 --- a/chrome/browser/resources/options2/advanced_options.js +++ b/chrome/browser/resources/options2/advanced_options.js @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -49,6 +49,40 @@ var OptionsPage = options.OptionsPage; }; } + // Passwords and Forms. + $('autofill-settings').onclick = function(event) { + OptionsPage.navigateToPage('autofill'); + chrome.send('coreOptionsUserMetricsAction', + ['Options_ShowAutofillSettings']); + }; + $('manage-passwords').onclick = function(event) { + OptionsPage.navigateToPage('passwords'); + OptionsPage.showTab($('passwords-nav-tab')); + chrome.send('coreOptionsUserMetricsAction', + ['Options_ShowPasswordManager']); + }; + if (AdvancedOptions.GuestModeActive()) { + // Disable and turn off Autofill in guest mode. + var autofillEnabled = $('autofill-enabled'); + autofillEnabled.disabled = true; + autofillEnabled.checked = false; + cr.dispatchSimpleEvent(autofillEnabled, 'change'); + $('autofill-settings').disabled = true; + + // Disable and turn off Password Manager in guest mode. + var passwordManagerEnabled = $('password-manager-enabled'); + passwordManagerEnabled.disabled = true; + passwordManagerEnabled.checked = false; + cr.dispatchSimpleEvent(passwordManagerEnabled, 'change'); + $('manage-passwords').disabled = true; + + // Hide the entire section on ChromeOS + if (cr.isChromeOS) + $('passwords-and-autofill-section').hidden = true; + } + $('mac-passwords-warning').hidden = + !(localStrings.getString('macPasswordsWarning')); + if (!cr.isChromeOS) { $('autoOpenFileTypesResetToDefault').onclick = function(event) { chrome.send('autoOpenFileTypesAction'); @@ -154,6 +188,15 @@ var OptionsPage = options.OptionsPage; } } + /** + * Returns whether the browser in guest mode. Some features are disabled or + * hidden in guest mode. + * @return {boolean} True if guest mode is currently active. + */ + AdvancedOptions.GuestModeActive = function() { + return cr.commandLine && cr.commandLine.options['--bwsi']; + }; + // Set the font size selected item. AdvancedOptions.SetFontSize = function(font_size_value) { var selectCtl = $('defaultFontSize'); diff --git a/chrome/browser/resources/options2/options.js b/chrome/browser/resources/options2/options.js index a96eb9f..14a6078 100644 --- a/chrome/browser/resources/options2/options.js +++ b/chrome/browser/resources/options2/options.js @@ -72,12 +72,6 @@ function load() { BrowserOptions.getInstance(), [$('advancedOptionsButton')]); OptionsPage.register(PersonalOptions.getInstance()); - OptionsPage.registerSubPage(AutofillOptions.getInstance(), - PersonalOptions.getInstance(), - [$('autofill-settings')]); - OptionsPage.registerSubPage(PasswordManager.getInstance(), - PersonalOptions.getInstance(), - [$('manage-passwords')]); if (cr.isChromeOS) { OptionsPage.register(SystemOptions.getInstance()); OptionsPage.registerSubPage(AboutPage.getInstance(), @@ -114,6 +108,12 @@ function load() { } OptionsPage.register(InternetOptions.getInstance()); } + OptionsPage.registerSubPage(AutofillOptions.getInstance(), + AdvancedOptions.getInstance(), + [$('autofill-settings')]); + OptionsPage.registerSubPage(PasswordManager.getInstance(), + AdvancedOptions.getInstance(), + [$('manage-passwords')]); OptionsPage.registerSubPage(ContentSettings.getInstance(), AdvancedOptions.getInstance(), [$('privacyContentSettingsButton')]); diff --git a/chrome/browser/resources/options2/password_manager.js b/chrome/browser/resources/options2/password_manager.js index 273d2c0..b69dc8d 100644 --- a/chrome/browser/resources/options2/password_manager.js +++ b/chrome/browser/resources/options2/password_manager.js @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -67,7 +67,7 @@ cr.define('options', function() { /** @inheritDoc */ canShowPage: function() { - return !PersonalOptions.disablePasswordManagement(); + return !AdvancedOptions.GuestModeActive(); }, /** @inheritDoc */ diff --git a/chrome/browser/resources/options2/personal_options.html b/chrome/browser/resources/options2/personal_options.html index 2bfb62b..f3a2529 100644 --- a/chrome/browser/resources/options2/personal_options.html +++ b/chrome/browser/resources/options2/personal_options.html @@ -20,49 +20,6 @@ </div> </section> </if> - <section> - <h3 i18n-content="passwords"></h3> - <div> - <div class="radio"> - <label> - <input id="passwords-offersave" type="radio" name="passwords_radio" - value="true" pref="profile.password_manager_enabled" - metric="Options_PasswordManager"> - <span i18n-content="passwordsAskToSave"></span> - </label> - </div> - <div class="radio"> - <label> - <input id="passwords-neversave" type="radio" name="passwords_radio" - value="false" pref="profile.password_manager_enabled" - metric="Options_PasswordManager"> - <span i18n-content="passwordsNeverSave"></span> - </label> - </div> - <div><button id="manage-passwords" i18n-content="manage_passwords" - pref="profile.password_manager_enabled"></button></div> - <div id="mac-passwords-warning" i18n-content="macPasswordsWarning" - hidden></div> - <!-- This makes the managed-banner appear when the "pref" is - configured by the IT administrator. --> - <input name="password_allow_show_hidden" type="text" - pref="profile.password_manager_allow_show_passwords" hidden> - </div> - </section> - <section id="autofill-section"> - <h3 i18n-content="autofill"></h3> - <div> - <div class="checkbox"> - <label> - <input id="autofill-enabled" pref="autofill.enabled" - metric="Options_FormAutofill" type="checkbox"> - <span i18n-content="autofillEnabled"></span> - </label> - </div> - <button id="autofill-settings" pref="autofill.enabled" - i18n-content="manageAutofillSettings"></button> - </div> - </section> <if expr="not pp_ifdef('chromeos')"> <section> <h3 i18n-content="browsingData"></h3> diff --git a/chrome/browser/resources/options2/personal_options.js b/chrome/browser/resources/options2/personal_options.js index 176dccf..07ae390 100644 --- a/chrome/browser/resources/options2/personal_options.js +++ b/chrome/browser/resources/options2/personal_options.js @@ -54,25 +54,6 @@ cr.define('options', function() { ManageProfileOverlay.showDeleteDialog(selectedProfile); }; - // Passwords. - $('manage-passwords').onclick = function(event) { - OptionsPage.navigateToPage('passwords'); - OptionsPage.showTab($('passwords-nav-tab')); - chrome.send('coreOptionsUserMetricsAction', - ['Options_ShowPasswordManager']); - }; - - // Autofill. - $('autofill-settings').onclick = function(event) { - OptionsPage.navigateToPage('autofill'); - chrome.send('coreOptionsUserMetricsAction', - ['Options_ShowAutofillSettings']); - }; - if (cr.isChromeOS && cr.commandLine && cr.commandLine.options['--bwsi']) { - // Hide Autofill options for the guest user. - $('autofill-section').hidden = true; - } - // Appearance. $('themes-reset').onclick = function(event) { chrome.send('themesReset'); @@ -106,28 +87,6 @@ cr.define('options', function() { $('change-picture-button').disabled = true; } } - - if (PersonalOptions.disablePasswordManagement()) { - // Disable the Password Manager in guest mode. - $('passwords-offersave').disabled = true; - $('passwords-neversave').disabled = true; - $('passwords-offersave').value = false; - $('passwords-neversave').value = true; - $('manage-passwords').disabled = true; - } - - $('mac-passwords-warning').hidden = - !(localStrings.getString('macPasswordsWarning')); - - if (PersonalOptions.disableAutofillManagement()) { - $('autofill-settings').disabled = true; - - // Disable and turn off autofill. - var autofillEnabled = $('autofill-enabled'); - autofillEnabled.disabled = true; - autofillEnabled.checked = false; - cr.dispatchSimpleEvent(autofillEnabled, 'change'); - } }, /** @@ -216,23 +175,6 @@ cr.define('options', function() { }, }; - /** - * Returns whether the user should be able to manage (view and edit) their - * stored passwords. Password management is disabled in guest mode. - * @return {boolean} True if password management should be disabled. - */ - PersonalOptions.disablePasswordManagement = function() { - return cr.commandLine && cr.commandLine.options['--bwsi']; - }; - - /** - * Returns whether the user should be able to manage autofill settings. - * @return {boolean} True if password management should be disabled. - */ - PersonalOptions.disableAutofillManagement = function() { - return cr.commandLine && cr.commandLine.options['--bwsi']; - }; - if (cr.isChromeOS) { /** * Returns username (canonical email) of the user logged in (ChromeOS only). diff --git a/chrome/browser/resources/shared/css/button.css b/chrome/browser/resources/shared/css/button.css index a345bb1..ea5dcd4 100644 --- a/chrome/browser/resources/shared/css/button.css +++ b/chrome/browser/resources/shared/css/button.css @@ -1,4 +1,4 @@ -/* Copyright (c) 2011 The Chromium Authors. All rights reserved. +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -81,6 +81,7 @@ input[type='search']:not(.custom-appearance):focus { color: rgb(63, 110, 194); cursor: pointer; margin: 0; + padding: 0 4px !important; text-decoration: underline; } diff --git a/chrome/browser/ui/webui/options2/advanced_options_handler2.cc b/chrome/browser/ui/webui/options2/advanced_options_handler2.cc index 16ee0dd..e433f19 100644 --- a/chrome/browser/ui/webui/options2/advanced_options_handler2.cc +++ b/chrome/browser/ui/webui/options2/advanced_options_handler2.cc @@ -22,6 +22,7 @@ #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" #include "chrome/browser/printing/cloud_print/cloud_print_url.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/service/service_process_control.h" #include "chrome/browser/ui/options/options_util.h" #include "chrome/common/chrome_notification_types.h" @@ -177,6 +178,16 @@ void AdvancedOptionsHandler::GetLocalizedValues( { "backgroundModeCheckbox", IDS_OPTIONS_BACKGROUND_ENABLE_BACKGROUND_MODE }, #endif + { "passwordsAndAutofillGroupName", + IDS_OPTIONS_PASSWORDS_AND_FORMS_GROUP_NAME }, + { "passwordManagerEnabled", + IDS_OPTIONS_PASSWORD_MANAGER_ENABLE }, + { "managePasswords", + IDS_OPTIONS_PASSWORDS_MANAGE_PASSWORDS_LINK }, + { "autofillEnabled", + IDS_OPTIONS_AUTOFILL_ENABLE }, + { "manageAutofillSettings", + IDS_OPTIONS_MANAGE_AUTOFILL_SETTINGS_LINK }, }; RegisterStrings(localized_strings, resources, arraysize(resources)); @@ -193,6 +204,13 @@ void AdvancedOptionsHandler::GetLocalizedValues( google_util::AppendGoogleLocaleParam( GURL(chrome::kCloudPrintLearnMoreURL)).spec()); #endif +#if defined(OS_MACOSX) + ProfileManager* profile_manager = g_browser_process->profile_manager(); + if (profile_manager->GetNumberOfProfiles() > 1) { + localized_strings->SetString("macPasswordsWarning", + l10n_util::GetStringUTF16(IDS_OPTIONS_PASSWORDS_MAC_WARNING)); + } +#endif } void AdvancedOptionsHandler::RegisterCloudPrintStrings( diff --git a/chrome/browser/ui/webui/options2/personal_options_handler2.cc b/chrome/browser/ui/webui/options2/personal_options_handler2.cc index 0883b0f..367aecb 100644 --- a/chrome/browser/ui/webui/options2/personal_options_handler2.cc +++ b/chrome/browser/ui/webui/options2/personal_options_handler2.cc @@ -65,31 +65,9 @@ void PersonalOptionsHandler::GetLocalizedValues( RegisterTitle(localized_strings, "personalPage", IDS_OPTIONS_CONTENT_TAB_LABEL); - localized_strings->SetString("passwords", - l10n_util::GetStringUTF16(IDS_OPTIONS_PASSWORDS_GROUP_NAME)); - localized_strings->SetString("passwordsAskToSave", - l10n_util::GetStringUTF16(IDS_OPTIONS_PASSWORDS_ASKTOSAVE)); - localized_strings->SetString("passwordsNeverSave", - l10n_util::GetStringUTF16(IDS_OPTIONS_PASSWORDS_NEVERSAVE)); - localized_strings->SetString("manage_passwords", - l10n_util::GetStringUTF16(IDS_OPTIONS_PASSWORDS_MANAGE_PASSWORDS)); -#if defined(OS_MACOSX) - ProfileManager* profile_manager = g_browser_process->profile_manager(); - if (profile_manager->GetNumberOfProfiles() > 1) { - localized_strings->SetString("macPasswordsWarning", - l10n_util::GetStringUTF16(IDS_OPTIONS_PASSWORDS_MAC_WARNING)); - } -#endif localized_strings->SetString("autologinEnabled", l10n_util::GetStringUTF16(IDS_OPTIONS_PASSWORDS_AUTOLOGIN)); - localized_strings->SetString("autofill", - l10n_util::GetStringUTF16(IDS_AUTOFILL_SETTING_WINDOWS_GROUP_NAME)); - localized_strings->SetString("autofillEnabled", - l10n_util::GetStringUTF16(IDS_OPTIONS_AUTOFILL_ENABLE)); - localized_strings->SetString("manageAutofillSettings", - l10n_util::GetStringUTF16(IDS_OPTIONS_MANAGE_AUTOFILL_SETTINGS)); - localized_strings->SetString("browsingData", l10n_util::GetStringUTF16(IDS_OPTIONS_BROWSING_DATA_GROUP_NAME)); localized_strings->SetString("importData", |