Chromium Code Reviews| Index: chrome/browser/ui/webui/settings/passwords_handler.cc |
| diff --git a/chrome/browser/ui/webui/settings/passwords_handler.cc b/chrome/browser/ui/webui/settings/passwords_handler.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..95b000a72900ccbc32b3b570d7dbfe5e490e75a8 |
| --- /dev/null |
| +++ b/chrome/browser/ui/webui/settings/passwords_handler.cc |
| @@ -0,0 +1,36 @@ |
| +// Copyright 2015 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. |
| + |
| +#include "chrome/browser/ui/webui/settings/passwords_handler.h" |
| + |
| +#include "base/bind.h" |
| +#include "base/prefs/pref_service.h" |
| +#include "chrome/browser/profiles/profile.h" |
| +#include "components/password_manager/core/common/password_manager_pref_names.h" |
| +#include "content/public/browser/web_ui.h" |
| + |
| +namespace settings { |
| + |
| +PasswordsHandler::PasswordsHandler(content::WebUI* webui) |
| + : profile_(Profile::FromWebUI(webui)) {} |
| + |
| +PasswordsHandler::~PasswordsHandler() {} |
| + |
| +void PasswordsHandler::RegisterMessages() { |
| + web_ui()->RegisterMessageCallback( |
| + "setPasswordSaving", base::Bind(&PasswordsHandler::HandleSetPaswordSaving, |
| + base::Unretained(this))); |
| +} |
| + |
| +void PasswordsHandler::HandleSetPaswordSaving(const base::ListValue* args) { |
| + CHECK_EQ(1U, args->GetSize()); |
| + bool enabled = false; |
| + CHECK(args->GetBoolean(0, &enabled)); |
| + |
| + PrefService* prefs = profile_->GetPrefs(); |
| + prefs->SetBoolean(password_manager::prefs::kPasswordManagerSavingEnabled, |
|
dschuyler
2015/11/20 20:02:50
Can this be exposed with settingsPrivate rather
th
|
| + enabled); |
| +} |
| + |
| +} // namespace settings |