Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Unified Diff: chrome/browser/ui/webui/settings/passwords_handler.cc

Issue 1457713007: Update the "Passwords and Forms" section so that they can be toggled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698