| 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" |
| 11 #include "chrome/browser/password_manager/password_store_factory.h" |
| 11 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/common/chrome_notification_types.h" | 14 #include "chrome/common/chrome_notification_types.h" |
| 14 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
| 15 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
| 16 #include "content/public/browser/notification_details.h" | 17 #include "content/public/browser/notification_details.h" |
| 17 #include "content/public/browser/notification_source.h" | 18 #include "content/public/browser/notification_source.h" |
| 18 #include "content/public/browser/web_ui.h" | 19 #include "content/public/browser/web_ui.h" |
| 19 #include "grit/chromium_strings.h" | 20 #include "grit/chromium_strings.h" |
| 20 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 web_ui()->RegisterMessageCallback("removeAllPasswordExceptions", | 107 web_ui()->RegisterMessageCallback("removeAllPasswordExceptions", |
| 107 base::Bind(&PasswordManagerHandler::RemoveAllPasswordExceptions, | 108 base::Bind(&PasswordManagerHandler::RemoveAllPasswordExceptions, |
| 108 base::Unretained(this))); | 109 base::Unretained(this))); |
| 109 } | 110 } |
| 110 | 111 |
| 111 void PasswordManagerHandler::OnLoginsChanged() { | 112 void PasswordManagerHandler::OnLoginsChanged() { |
| 112 UpdatePasswordLists(NULL); | 113 UpdatePasswordLists(NULL); |
| 113 } | 114 } |
| 114 | 115 |
| 115 PasswordStore* PasswordManagerHandler::GetPasswordStore() { | 116 PasswordStore* PasswordManagerHandler::GetPasswordStore() { |
| 116 return Profile::FromWebUI(web_ui())-> | 117 return PasswordStoreFactory::GetForProfile( |
| 117 GetPasswordStore(Profile::EXPLICIT_ACCESS); | 118 Profile::FromWebUI(web_ui()), |
| 119 Profile::EXPLICIT_ACCESS); |
| 118 } | 120 } |
| 119 | 121 |
| 120 void PasswordManagerHandler::Observe( | 122 void PasswordManagerHandler::Observe( |
| 121 int type, | 123 int type, |
| 122 const content::NotificationSource& source, | 124 const content::NotificationSource& source, |
| 123 const content::NotificationDetails& details) { | 125 const content::NotificationDetails& details) { |
| 124 if (type == chrome::NOTIFICATION_PREF_CHANGED) { | 126 if (type == chrome::NOTIFICATION_PREF_CHANGED) { |
| 125 std::string* pref_name = content::Details<std::string>(details).ptr(); | 127 std::string* pref_name = content::Details<std::string>(details).ptr(); |
| 126 if (*pref_name == prefs::kPasswordManagerAllowShowPasswords) { | 128 if (*pref_name == prefs::kPasswordManagerAllowShowPasswords) { |
| 127 UpdatePasswordLists(NULL); | 129 UpdatePasswordLists(NULL); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 OnPasswordStoreRequestDone( | 281 OnPasswordStoreRequestDone( |
| 280 CancelableRequestProvider::Handle handle, | 282 CancelableRequestProvider::Handle handle, |
| 281 const std::vector<webkit::forms::PasswordForm*>& result) { | 283 const std::vector<webkit::forms::PasswordForm*>& result) { |
| 282 DCHECK_EQ(pending_login_query_, handle); | 284 DCHECK_EQ(pending_login_query_, handle); |
| 283 pending_login_query_ = 0; | 285 pending_login_query_ = 0; |
| 284 page_->password_exception_list_.reset(); | 286 page_->password_exception_list_.reset(); |
| 285 page_->password_exception_list_.insert(page_->password_exception_list_.end(), | 287 page_->password_exception_list_.insert(page_->password_exception_list_.end(), |
| 286 result.begin(), result.end()); | 288 result.begin(), result.end()); |
| 287 page_->SetPasswordExceptionList(); | 289 page_->SetPasswordExceptionList(); |
| 288 } | 290 } |
| OLD | NEW |