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

Side by Side Diff: chrome/browser/ui/webui/options/password_manager_handler.cc

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/password_manager_handler.h ('k') | chrome/browser/ui/webui/options/preferences_browsertest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698