diff options
author | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-21 19:59:58 +0000 |
---|---|---|
committer | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-21 19:59:58 +0000 |
commit | 030018c6821a1fed2748e0128ad438f5759b21f9 (patch) | |
tree | d1e2c29f326d41ddc6ee575849bdbcd908676301 | |
parent | eebec14f15c67492199839f2a070bc7d98705968 (diff) | |
download | chromium_src-030018c6821a1fed2748e0128ad438f5759b21f9.zip chromium_src-030018c6821a1fed2748e0128ad438f5759b21f9.tar.gz chromium_src-030018c6821a1fed2748e0128ad438f5759b21f9.tar.bz2 |
Disable AutoFill.
Based on prior disable http://src.chromium.org/viewvc/chrome?view=rev&revision=41786.
Nib change: removed "Edit->AutoFill Form" menu item.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/1717005
git-svn-id: svn://svn.chromium.org/chrome/branches/375/src@45224 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/nibs/MainMenu.xib | 50 | ||||
-rw-r--r-- | chrome/browser/autocomplete_history_manager.cc | 19 | ||||
-rw-r--r-- | chrome/browser/autocomplete_history_manager.h | 2 | ||||
-rw-r--r-- | chrome/browser/autofill/autofill_manager.cc | 15 | ||||
-rw-r--r-- | chrome/browser/browser_prefs.cc | 2 | ||||
-rw-r--r-- | chrome/browser/cocoa/preferences_window_controller.mm | 33 | ||||
-rw-r--r-- | chrome/browser/gtk/options/content_page_gtk.cc | 28 | ||||
-rw-r--r-- | chrome/browser/views/options/content_page_view.cc | 26 | ||||
-rw-r--r-- | chrome/common/chrome_switches.cc | 3 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 1 |
10 files changed, 104 insertions, 75 deletions
diff --git a/chrome/app/nibs/MainMenu.xib b/chrome/app/nibs/MainMenu.xib index c4d0598..c9874f9 100644 --- a/chrome/app/nibs/MainMenu.xib +++ b/chrome/app/nibs/MainMenu.xib @@ -3,7 +3,7 @@ <data> <int key="IBDocument.SystemTarget">1050</int> <string key="IBDocument.SystemVersion">9L31a</string> - <string key="IBDocument.InterfaceBuilderVersion">677</string> + <string key="IBDocument.InterfaceBuilderVersion">680</string> <string key="IBDocument.AppKitVersion">949.54</string> <string key="IBDocument.HIToolboxVersion">353.00</string> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> @@ -494,26 +494,6 @@ <reference key="NSOnImage" ref="353210768"/> <reference key="NSMixedImage" ref="549394948"/> </object> - <object class="NSMenuItem" id="610384735"> - <reference key="NSMenu" ref="789758025"/> - <bool key="NSIsDisabled">YES</bool> - <bool key="NSIsSeparator">YES</bool> - <string key="NSTitle"/> - <string key="NSKeyEquiv"/> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="353210768"/> - <reference key="NSMixedImage" ref="549394948"/> - </object> - <object class="NSMenuItem" id="872582728"> - <reference key="NSMenu" ref="789758025"/> - <string key="NSTitle">^IDS_AUTOFILL_FORM_MAC</string> - <string key="NSKeyEquiv">A</string> - <int key="NSKeyEquivModMask">1048576</int> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="353210768"/> - <reference key="NSMixedImage" ref="549394948"/> - <int key="NSTag">40024</int> - </object> <object class="NSMenuItem" id="212016141"> <reference key="NSMenu" ref="789758025"/> <bool key="NSIsDisabled">YES</bool> @@ -1777,14 +1757,6 @@ <object class="IBActionConnection" key="connection"> <string key="label">commandDispatch:</string> <reference key="source" ref="1014"/> - <reference key="destination" ref="872582728"/> - </object> - <int key="connectionID">680</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">commandDispatch:</string> - <reference key="source" ref="1014"/> <reference key="destination" ref="442256518"/> </object> <int key="connectionID">681</int> @@ -1964,8 +1936,6 @@ <reference ref="972420730"/> <reference ref="442256518"/> <reference ref="688066565"/> - <reference ref="610384735"/> - <reference ref="872582728"/> </object> <reference key="parent" ref="952259628"/> </object> @@ -2647,16 +2617,6 @@ <reference key="object" ref="902861825"/> <reference key="parent" ref="466310130"/> </object> - <object class="IBObjectRecord"> - <int key="objectID">678</int> - <reference key="object" ref="610384735"/> - <reference key="parent" ref="789758025"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">679</int> - <reference key="object" ref="872582728"/> - <reference key="parent" ref="789758025"/> - </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> @@ -2853,10 +2813,6 @@ <string>672.IBPluginDependency</string> <string>674.IBPluginDependency</string> <string>676.IBPluginDependency</string> - <string>678.IBPluginDependency</string> - <string>678.ImportedFromIB2</string> - <string>679.IBPluginDependency</string> - <string>679.ImportedFromIB2</string> <string>72.IBPluginDependency</string> <string>72.ImportedFromIB2</string> <string>73.IBPluginDependency</string> @@ -3088,10 +3044,6 @@ <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <reference ref="9"/> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <reference ref="9"/> <string>{{310, 134}, {353, 303}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> diff --git a/chrome/browser/autocomplete_history_manager.cc b/chrome/browser/autocomplete_history_manager.cc index 7626f9c..e63198c 100644 --- a/chrome/browser/autocomplete_history_manager.cc +++ b/chrome/browser/autocomplete_history_manager.cc @@ -6,11 +6,13 @@ #include <vector> +#include "base/command_line.h" #include "base/string_util.h" #include "chrome/browser/pref_service.h" #include "chrome/browser/profile.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/tab_contents/tab_contents.h" +#include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "webkit/glue/form_data.h" @@ -24,8 +26,14 @@ AutocompleteHistoryManager::AutocompleteHistoryManager( TabContents* tab_contents) : tab_contents_(tab_contents), pending_query_handle_(0), query_id_(0) { - form_autofill_enabled_.Init(prefs::kAutoFillEnabled, - profile()->GetPrefs(), NULL); + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableAutoFill)) { + form_autofill_enabled_.Init(prefs::kAutoFillEnabled, + profile()->GetPrefs(), NULL); + } else { + form_autofill_enabled_.Init(prefs::kFormAutofillEnabled, + profile()->GetPrefs(), NULL); + } } AutocompleteHistoryManager::~AutocompleteHistoryManager() { @@ -101,6 +109,13 @@ void AutocompleteHistoryManager::OnWebDataServiceRequestDone( } } +// static +void AutocompleteHistoryManager::RegisterUserPrefs(PrefService* prefs) { + if (!CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableAutoFill)) + prefs->RegisterBooleanPref(prefs::kFormAutofillEnabled, true); +} + void AutocompleteHistoryManager::StoreFormEntriesInWebDatabase( const FormData& form) { if (!*form_autofill_enabled_) diff --git a/chrome/browser/autocomplete_history_manager.h b/chrome/browser/autocomplete_history_manager.h index 2f8fe5e..98ab624 100644 --- a/chrome/browser/autocomplete_history_manager.h +++ b/chrome/browser/autocomplete_history_manager.h @@ -41,6 +41,8 @@ class AutocompleteHistoryManager virtual void OnWebDataServiceRequestDone(WebDataService::Handle h, const WDTypedResult* result); + static void RegisterUserPrefs(PrefService* prefs); + private: void CancelPendingQuery(); void StoreFormEntriesInWebDatabase(const webkit_glue::FormData& form); diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc index bcac2ed..8decc93 100644 --- a/chrome/browser/autofill/autofill_manager.cc +++ b/chrome/browser/autofill/autofill_manager.cc @@ -62,9 +62,15 @@ void AutoFillManager::RegisterBrowserPrefs(PrefService* prefs) { // static void AutoFillManager::RegisterUserPrefs(PrefService* prefs) { - prefs->RegisterBooleanPref(prefs::kAutoFillInfoBarShown, false); - prefs->RegisterBooleanPref(prefs::kAutoFillEnabled, true); - prefs->RegisterBooleanPref(prefs::kAutoFillAuxiliaryProfilesEnabled, false); + if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAutoFill)) { + prefs->RegisterBooleanPref(prefs::kAutoFillInfoBarShown, false); + prefs->RegisterBooleanPref(prefs::kAutoFillEnabled, true); + prefs->RegisterBooleanPref(prefs::kAutoFillAuxiliaryProfilesEnabled, false); + } else { + prefs->RegisterBooleanPref(prefs::kAutoFillInfoBarShown, true); + prefs->RegisterBooleanPref(prefs::kAutoFillEnabled, false); + prefs->RegisterBooleanPref(prefs::kAutoFillAuxiliaryProfilesEnabled, false); + } prefs->RegisterStringPref(prefs::kAutoFillDefaultProfile, std::wstring()); prefs->RegisterStringPref(prefs::kAutoFillDefaultCreditCard, std::wstring()); @@ -436,6 +442,9 @@ void AutoFillManager::UploadFormData() { } bool AutoFillManager::IsAutoFillEnabled() { + if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAutoFill)) + return false; + PrefService* prefs = tab_contents_->profile()->GetPrefs(); // Migrate obsolete AutoFill pref. diff --git a/chrome/browser/browser_prefs.cc b/chrome/browser/browser_prefs.cc index 4f08d71..5b67c3c 100644 --- a/chrome/browser/browser_prefs.cc +++ b/chrome/browser/browser_prefs.cc @@ -4,6 +4,7 @@ #include "chrome/browser/browser_prefs.h" +#include "chrome/browser/autocomplete_history_manager.h" #include "chrome/browser/autofill/autofill_manager.h" #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/browser.h" @@ -116,6 +117,7 @@ void RegisterUserPrefs(PrefService* user_prefs) { #if defined(OS_CHROMEOS) chromeos::Preferences::RegisterUserPrefs(user_prefs); #endif + AutocompleteHistoryManager::RegisterUserPrefs(user_prefs); } } // namespace browser diff --git a/chrome/browser/cocoa/preferences_window_controller.mm b/chrome/browser/cocoa/preferences_window_controller.mm index 3f8a6ac..8992b77 100644 --- a/chrome/browser/cocoa/preferences_window_controller.mm +++ b/chrome/browser/cocoa/preferences_window_controller.mm @@ -8,6 +8,7 @@ #include "app/l10n_util.h" #include "app/l10n_util_mac.h" +#include "base/command_line.h" #include "base/logging.h" #include "base/mac_util.h" #include "base/string16.h" @@ -42,6 +43,7 @@ #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/sync_ui_util.h" #include "chrome/browser/tab_contents/tab_contents.h" +#include "chrome/common/chrome_switches.h" #include "chrome/common/notification_details.h" #include "chrome/common/notification_observer.h" #include "chrome/common/notification_type.h" @@ -543,12 +545,6 @@ void PersonalDataManagerObserver::ShowAutoFillDialog( green:0x9a/255.0 blue:0x9a/255.0 alpha:1.0] retain]); - - // Disable the |autoFillSettingsButton_| if we have no - // |personalDataManager|. - PersonalDataManager* personalDataManager = - profile_->GetPersonalDataManager(); - [autoFillSettingsButton_ setHidden:(personalDataManager == NULL)]; } return self; } @@ -731,6 +727,15 @@ void PersonalDataManagerObserver::ShowAutoFillDialog( [underTheHoodContentView_ scrollPoint: NSMakePoint(0, underTheHoodContentSize.height)]; + // Disable the |autoFillSettingsButton_| if we have no + // |personalDataManager|. + bool autofillEnabled = CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableAutoFill); + PersonalDataManager* personalDataManager = + profile_->GetPersonalDataManager(); + [autoFillSettingsButton_ setHidden: + (personalDataManager == NULL || !autofillEnabled)]; + [self switchToPage:initialPage_ animate:NO]; // TODO(pinkerton): save/restore position based on prefs. @@ -775,7 +780,14 @@ void PersonalDataManagerObserver::ShowAutoFillDialog( // Personal Stuff panel askSavePasswords_.Init(prefs::kPasswordManagerEnabled, prefs_, observer_.get()); - formAutofill_.Init(prefs::kAutoFillEnabled, prefs_, observer_.get()); + + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableAutoFill)) { + formAutofill_.Init(prefs::kAutoFillEnabled, prefs_, observer_.get()); + } else { + formAutofill_.Init(prefs::kFormAutofillEnabled, prefs_, observer_.get()); + } + currentTheme_.Init(prefs::kCurrentThemeID, prefs_, observer_.get()); // Under the hood panel @@ -1218,6 +1230,13 @@ const int kDisabledIndex = 1; [self setPasswordManagerEnabledIndex:askSavePasswords_.GetValue() ? kEnabledIndex : kDisabledIndex]; } + std::wstring autofill_pref; + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableAutoFill)) { + autofill_pref = prefs::kAutoFillEnabled; + } else { + autofill_pref = prefs::kFormAutofillEnabled; + } if (*prefName == prefs::kAutoFillEnabled) { [self setFormAutofillEnabledIndex:formAutofill_.GetValue() ? kEnabledIndex : kDisabledIndex]; diff --git a/chrome/browser/gtk/options/content_page_gtk.cc b/chrome/browser/gtk/options/content_page_gtk.cc index 0e69244..8711e7a 100644 --- a/chrome/browser/gtk/options/content_page_gtk.cc +++ b/chrome/browser/gtk/options/content_page_gtk.cc @@ -106,8 +106,14 @@ ContentPageGtk::ContentPageGtk(Profile* profile) // Add preferences observers. ask_to_save_passwords_.Init(prefs::kPasswordManagerEnabled, profile->GetPrefs(), this); - enable_form_autofill_.Init(prefs::kAutoFillEnabled, - profile->GetPrefs(), this); + + if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAutoFill)) { + enable_form_autofill_.Init(prefs::kAutoFillEnabled, + profile->GetPrefs(), this); + } else { + enable_form_autofill_.Init(prefs::kFormAutofillEnabled, + profile->GetPrefs(), this); + } if (browser_defaults::kCanToggleSystemTitleBar) { use_custom_chrome_frame_.Init(prefs::kUseCustomChromeFrame, @@ -274,14 +280,16 @@ GtkWidget* ContentPageGtk::InitFormAutoFillGroup() { gtk_container_add(GTK_CONTAINER(vbox), button_hbox); // AutoFill button. - autofill_button_ = gtk_button_new_with_label( - l10n_util::GetStringUTF8(IDS_OPTIONS_AUTOFILL_SETTINGS).c_str()); - if (!profile()->GetPrefs()->GetBoolean(prefs::kAutoFillEnabled)) - gtk_widget_set_sensitive(autofill_button_, FALSE); - - g_signal_connect(G_OBJECT(autofill_button_), "clicked", - G_CALLBACK(OnAutoFillButtonClickedThunk), this); - gtk_box_pack_start(GTK_BOX(button_hbox), autofill_button_, FALSE, FALSE, 0); + if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAutoFill)) { + GtkWidget* autofill_button = gtk_button_new_with_label( + l10n_util::GetStringUTF8(IDS_OPTIONS_AUTOFILL_SETTINGS).c_str()); + if (!personal_data_) + gtk_widget_set_sensitive(autofill_button, FALSE); + + g_signal_connect(G_OBJECT(autofill_button), "clicked", + G_CALLBACK(OnAutoFillButtonClicked), this); + gtk_box_pack_start(GTK_BOX(button_hbox), autofill_button, FALSE, FALSE, 0); + } return vbox; } diff --git a/chrome/browser/views/options/content_page_view.cc b/chrome/browser/views/options/content_page_view.cc index e6cf2ef..6e19a88 100644 --- a/chrome/browser/views/options/content_page_view.cc +++ b/chrome/browser/views/options/content_page_view.cc @@ -217,8 +217,16 @@ void ContentPageView::InitControlLayout() { // Init member prefs so we can update the controls if prefs change. ask_to_save_passwords_.Init(prefs::kPasswordManagerEnabled, profile()->GetPrefs(), this); - ask_to_save_form_autofill_.Init(prefs::kAutoFillEnabled, - profile()->GetPrefs(), this); + + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableAutoFill)) { + ask_to_save_form_autofill_.Init(prefs::kAutoFillEnabled, + profile()->GetPrefs(), this); + } else { + ask_to_save_form_autofill_.Init(prefs::kFormAutofillEnabled, + profile()->GetPrefs(), this); + } + is_using_default_theme_.Init(prefs::kCurrentThemeID, profile()->GetPrefs(), this); } @@ -231,6 +239,13 @@ void ContentPageView::NotifyPrefChanged(const std::wstring* pref_name) { passwords_neversave_radio_->SetChecked(true); } } + std::wstring autofill_pref; + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableAutoFill)) { + autofill_pref = prefs::kAutoFillEnabled; + } else { + autofill_pref = prefs::kFormAutofillEnabled; + } if (!pref_name || *pref_name == prefs::kAutoFillEnabled) { if (ask_to_save_form_autofill_.GetValue()) { form_autofill_enable_radio_->SetChecked(true); @@ -336,7 +351,6 @@ void ContentPageView::InitFormAutofillGroup() { if (!profile()->GetPersonalDataManager()) change_autofill_settings_button_->SetEnabled(false); - using views::GridLayout; using views::ColumnSet; @@ -360,7 +374,11 @@ void ContentPageView::InitFormAutofillGroup() { layout->AddView(form_autofill_disable_radio_); layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); layout->StartRow(0, leading_column_view_set_id); - layout->AddView(change_autofill_settings_button_); + + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableAutoFill)) { + layout->AddView(change_autofill_settings_button_); + } form_autofill_group_ = new OptionsGroupView( contents, l10n_util::GetString(IDS_AUTOFILL_SETTING_WINDOWS_GROUP_NAME), diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 7cd975b..ad4d661 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -238,6 +238,9 @@ const char kEnableAeroPeekTabs[] = "enable-aero-peek-tabs"; // for more background. extern const char kEnableAuthNegotiatePort[] = "enable-auth-negotiate-port"; +// Enable AutoFill++. +const char kEnableAutoFill[] = "enable-autofill"; + // Enables the benchmarking extensions. const char kEnableBenchmarking[] = "enable-benchmarking"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 63ec321..6f45b57 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -82,6 +82,7 @@ extern const char kDomAutomationController[]; extern const char kDumpHistogramsOnExit[]; extern const char kEnableAeroPeekTabs[]; extern const char kEnableAuthNegotiatePort[]; +extern const char kEnableAutoFill[]; extern const char kEnableBenchmarking[]; extern const char kEnableExperimentalExtensionApis[]; extern const char kEnableExperimentalWebGL[]; |