| 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/options2/password_manager_handler2.h" | 5 #include "chrome/browser/ui/webui/options2/password_manager_handler2.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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 web_ui()->RegisterMessageCallback("removeAllPasswordExceptions", | 109 web_ui()->RegisterMessageCallback("removeAllPasswordExceptions", |
| 109 base::Bind(&PasswordManagerHandler::RemoveAllPasswordExceptions, | 110 base::Bind(&PasswordManagerHandler::RemoveAllPasswordExceptions, |
| 110 base::Unretained(this))); | 111 base::Unretained(this))); |
| 111 } | 112 } |
| 112 | 113 |
| 113 void PasswordManagerHandler::OnLoginsChanged() { | 114 void PasswordManagerHandler::OnLoginsChanged() { |
| 114 UpdatePasswordLists(NULL); | 115 UpdatePasswordLists(NULL); |
| 115 } | 116 } |
| 116 | 117 |
| 117 PasswordStore* PasswordManagerHandler::GetPasswordStore() { | 118 PasswordStore* PasswordManagerHandler::GetPasswordStore() { |
| 118 return Profile::FromWebUI(web_ui())-> | 119 return PasswordStoreFactory::GetForProfile( |
| 119 GetPasswordStore(Profile::EXPLICIT_ACCESS); | 120 Profile::FromWebUI(web_ui()), |
| 121 Profile::EXPLICIT_ACCESS); |
| 120 } | 122 } |
| 121 | 123 |
| 122 void PasswordManagerHandler::Observe( | 124 void PasswordManagerHandler::Observe( |
| 123 int type, | 125 int type, |
| 124 const content::NotificationSource& source, | 126 const content::NotificationSource& source, |
| 125 const content::NotificationDetails& details) { | 127 const content::NotificationDetails& details) { |
| 126 if (type == chrome::NOTIFICATION_PREF_CHANGED) { | 128 if (type == chrome::NOTIFICATION_PREF_CHANGED) { |
| 127 std::string* pref_name = content::Details<std::string>(details).ptr(); | 129 std::string* pref_name = content::Details<std::string>(details).ptr(); |
| 128 if (*pref_name == prefs::kPasswordManagerAllowShowPasswords) { | 130 if (*pref_name == prefs::kPasswordManagerAllowShowPasswords) { |
| 129 UpdatePasswordLists(NULL); | 131 UpdatePasswordLists(NULL); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 const std::vector<webkit::forms::PasswordForm*>& result) { | 285 const std::vector<webkit::forms::PasswordForm*>& result) { |
| 284 DCHECK_EQ(pending_login_query_, handle); | 286 DCHECK_EQ(pending_login_query_, handle); |
| 285 pending_login_query_ = 0; | 287 pending_login_query_ = 0; |
| 286 page_->password_exception_list_.reset(); | 288 page_->password_exception_list_.reset(); |
| 287 page_->password_exception_list_.insert(page_->password_exception_list_.end(), | 289 page_->password_exception_list_.insert(page_->password_exception_list_.end(), |
| 288 result.begin(), result.end()); | 290 result.begin(), result.end()); |
| 289 page_->SetPasswordExceptionList(); | 291 page_->SetPasswordExceptionList(); |
| 290 } | 292 } |
| 291 | 293 |
| 292 } // namespace options2 | 294 } // namespace options2 |
| OLD | NEW |