| Index: chrome/browser/ui/webui/options/personal_options_handler.cc
|
| diff --git a/chrome/browser/ui/webui/options/personal_options_handler.cc b/chrome/browser/ui/webui/options/personal_options_handler.cc
|
| index 705af76665c46c0d3f74862dbe72aea15ebe2e76..1c370f5377d2dd47a0461896083f972e39585860 100644
|
| --- a/chrome/browser/ui/webui/options/personal_options_handler.cc
|
| +++ b/chrome/browser/ui/webui/options/personal_options_handler.cc
|
| @@ -16,6 +16,7 @@
|
| #include "base/utf_string_conversions.h"
|
| #include "base/values.h"
|
| #include "build/build_config.h"
|
| +#include "chrome/browser/prefs/pref_service.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/profiles/profile_manager.h"
|
| #include "chrome/browser/sync/profile_sync_service.h"
|
| @@ -27,6 +28,7 @@
|
| #include "chrome/common/chrome_paths.h"
|
| #include "chrome/common/chrome_switches.h"
|
| #include "chrome/common/net/gaia/google_service_auth_error.h"
|
| +#include "chrome/common/pref_names.h"
|
| #include "chrome/common/url_constants.h"
|
| #include "content/browser/user_metrics.h"
|
| #include "content/common/notification_service.h"
|
| @@ -215,6 +217,11 @@ void PersonalOptionsHandler::Observe(NotificationType type,
|
| LoadAccountPicture(NULL);
|
| #endif
|
| } else {
|
| + if (type == NotificationType::PREF_CHANGED) {
|
| + std::string* pref_name = Details<std::string>(details).ptr();
|
| + if (*pref_name == prefs::kAutofillEnabled)
|
| + UpdateAutofillUI();
|
| + }
|
| OptionsPageUIHandler::Observe(type, source, details);
|
| }
|
| }
|
| @@ -360,6 +367,11 @@ void PersonalOptionsHandler::Initialize() {
|
| NotificationService::AllSources());
|
| ObserveThemeChanged();
|
|
|
| + // Listen for autofill status changes.
|
| + autofill_enabled_.Init(prefs::kAutofillEnabled,
|
| + web_ui_->GetProfile()->GetPrefs(), this);
|
| + UpdateAutofillUI();
|
| +
|
| ProfileSyncService* sync_service =
|
| web_ui_->GetProfile()->GetProfileSyncService();
|
| if (sync_service) {
|
| @@ -388,6 +400,15 @@ void PersonalOptionsHandler::ThemesSetGTK(const ListValue* args) {
|
| }
|
| #endif
|
|
|
| +void PersonalOptionsHandler::UpdateAutofillUI() {
|
| + // Update AutoFill button state.
|
| + bool autofill_disabled = autofill_enabled_.IsManaged() && !*autofill_enabled_;
|
| + scoped_ptr<Value> autofill_enabled_state(
|
| + Value::CreateBooleanValue(!autofill_disabled));
|
| + web_ui_->CallJavascriptFunction("PersonalOptions.setAutoFillButtonEnabled",
|
| + *autofill_enabled_state);
|
| +}
|
| +
|
| #if defined(OS_CHROMEOS)
|
| void PersonalOptionsHandler::LoadAccountPicture(const ListValue* args) {
|
| const chromeos::UserManager::User& user =
|
|
|