| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/options/password_manager_handler.h" | 5 #include "chrome/browser/ui/webui/options/password_manager_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 void PasswordManagerHandler::OnLoginsChanged() { | 102 void PasswordManagerHandler::OnLoginsChanged() { |
| 103 UpdatePasswordLists(NULL); | 103 UpdatePasswordLists(NULL); |
| 104 } | 104 } |
| 105 | 105 |
| 106 PasswordStore* PasswordManagerHandler::GetPasswordStore() { | 106 PasswordStore* PasswordManagerHandler::GetPasswordStore() { |
| 107 return PasswordStoreFactory::GetForProfile( | 107 return PasswordStoreFactory::GetForProfile( |
| 108 Profile::FromWebUI(web_ui()), | 108 Profile::FromWebUI(web_ui()), |
| 109 Profile::EXPLICIT_ACCESS); | 109 Profile::EXPLICIT_ACCESS); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void PasswordManagerHandler::Observe( | 112 void PasswordManagerHandler::OnPreferenceChanged(PrefServiceBase* service, |
| 113 int type, | 113 const std::string& pref_name) { |
| 114 const content::NotificationSource& source, | 114 DCHECK_EQ(std::string(prefs::kPasswordManagerAllowShowPasswords), pref_name); |
| 115 const content::NotificationDetails& details) { | 115 UpdatePasswordLists(NULL); |
| 116 if (type == chrome::NOTIFICATION_PREF_CHANGED) { | |
| 117 std::string* pref_name = content::Details<std::string>(details).ptr(); | |
| 118 if (*pref_name == prefs::kPasswordManagerAllowShowPasswords) { | |
| 119 UpdatePasswordLists(NULL); | |
| 120 } | |
| 121 } | |
| 122 | |
| 123 OptionsPageUIHandler::Observe(type, source, details); | |
| 124 } | 116 } |
| 125 | 117 |
| 126 void PasswordManagerHandler::UpdatePasswordLists(const ListValue* args) { | 118 void PasswordManagerHandler::UpdatePasswordLists(const ListValue* args) { |
| 127 // Reset the current lists. | 119 // Reset the current lists. |
| 128 password_list_.clear(); | 120 password_list_.clear(); |
| 129 password_exception_list_.clear(); | 121 password_exception_list_.clear(); |
| 130 | 122 |
| 131 languages_ = Profile::FromWebUI(web_ui())->GetPrefs()-> | 123 languages_ = Profile::FromWebUI(web_ui())->GetPrefs()-> |
| 132 GetString(prefs::kAcceptLanguages); | 124 GetString(prefs::kAcceptLanguages); |
| 133 populater_.Populate(); | 125 populater_.Populate(); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 const std::vector<content::PasswordForm*>& result) { | 265 const std::vector<content::PasswordForm*>& result) { |
| 274 DCHECK_EQ(pending_login_query_, handle); | 266 DCHECK_EQ(pending_login_query_, handle); |
| 275 pending_login_query_ = 0; | 267 pending_login_query_ = 0; |
| 276 page_->password_exception_list_.clear(); | 268 page_->password_exception_list_.clear(); |
| 277 page_->password_exception_list_.insert(page_->password_exception_list_.end(), | 269 page_->password_exception_list_.insert(page_->password_exception_list_.end(), |
| 278 result.begin(), result.end()); | 270 result.begin(), result.end()); |
| 279 page_->SetPasswordExceptionList(); | 271 page_->SetPasswordExceptionList(); |
| 280 } | 272 } |
| 281 | 273 |
| 282 } // namespace options | 274 } // namespace options |
| OLD | NEW |