OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/ui/webui/settings/passwords_handler.h" | |
6 | |
7 #include "base/bind.h" | |
8 #include "base/prefs/pref_service.h" | |
9 #include "chrome/browser/profiles/profile.h" | |
10 #include "components/password_manager/core/common/password_manager_pref_names.h" | |
11 #include "content/public/browser/web_ui.h" | |
12 | |
13 namespace settings { | |
14 | |
15 PasswordsHandler::PasswordsHandler(content::WebUI* webui) | |
16 : profile_(Profile::FromWebUI(webui)) {} | |
17 | |
18 PasswordsHandler::~PasswordsHandler() {} | |
19 | |
20 void PasswordsHandler::RegisterMessages() { | |
21 web_ui()->RegisterMessageCallback( | |
22 "setPasswordSaving", base::Bind(&PasswordsHandler::HandleSetPaswordSaving, | |
23 base::Unretained(this))); | |
24 } | |
25 | |
26 void PasswordsHandler::HandleSetPaswordSaving(const base::ListValue* args) { | |
27 CHECK_EQ(1U, args->GetSize()); | |
28 bool enabled = false; | |
29 CHECK(args->GetBoolean(0, &enabled)); | |
30 | |
31 PrefService* prefs = profile_->GetPrefs(); | |
32 prefs->SetBoolean(password_manager::prefs::kPasswordManagerSavingEnabled, | |
dschuyler
2015/11/20 20:02:50
Can this be exposed with settingsPrivate rather
th
| |
33 enabled); | |
34 } | |
35 | |
36 } // namespace settings | |
OLD | NEW |