OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/callback.h" | 7 #include "base/callback.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/google/google_util.h" | 11 #include "chrome/browser/google/google_util.h" |
12 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.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/common/notification_details.h" | 17 #include "content/common/notification_details.h" |
17 #include "content/common/notification_source.h" | 18 #include "content/common/notification_source.h" |
18 #include "grit/chromium_strings.h" | 19 #include "grit/chromium_strings.h" |
19 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
20 #include "net/base/net_util.h" | 21 #include "net/base/net_util.h" |
21 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
22 #include "webkit/glue/password_form.h" | 23 #include "webkit/glue/password_form.h" |
23 | 24 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 } | 100 } |
100 | 101 |
101 void PasswordManagerHandler::OnLoginsChanged() { | 102 void PasswordManagerHandler::OnLoginsChanged() { |
102 UpdatePasswordLists(NULL); | 103 UpdatePasswordLists(NULL); |
103 } | 104 } |
104 | 105 |
105 PasswordStore* PasswordManagerHandler::GetPasswordStore() { | 106 PasswordStore* PasswordManagerHandler::GetPasswordStore() { |
106 return web_ui_->GetProfile()->GetPasswordStore(Profile::EXPLICIT_ACCESS); | 107 return web_ui_->GetProfile()->GetPasswordStore(Profile::EXPLICIT_ACCESS); |
107 } | 108 } |
108 | 109 |
109 void PasswordManagerHandler::Observe(NotificationType type, | 110 void PasswordManagerHandler::Observe(int type, |
110 const NotificationSource& source, | 111 const NotificationSource& source, |
111 const NotificationDetails& details) { | 112 const NotificationDetails& details) { |
112 if (type.value == NotificationType::PREF_CHANGED) { | 113 if (type == chrome::NOTIFICATION_PREF_CHANGED) { |
113 std::string* pref_name = Details<std::string>(details).ptr(); | 114 std::string* pref_name = Details<std::string>(details).ptr(); |
114 if (*pref_name == prefs::kPasswordManagerAllowShowPasswords) { | 115 if (*pref_name == prefs::kPasswordManagerAllowShowPasswords) { |
115 UpdatePasswordLists(NULL); | 116 UpdatePasswordLists(NULL); |
116 } | 117 } |
117 } | 118 } |
118 | 119 |
119 OptionsPageUIHandler::Observe(type, source, details); | 120 OptionsPageUIHandler::Observe(type, source, details); |
120 } | 121 } |
121 | 122 |
122 void PasswordManagerHandler::UpdatePasswordLists(const ListValue* args) { | 123 void PasswordManagerHandler::UpdatePasswordLists(const ListValue* args) { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 OnPasswordStoreRequestDone( | 261 OnPasswordStoreRequestDone( |
261 CancelableRequestProvider::Handle handle, | 262 CancelableRequestProvider::Handle handle, |
262 const std::vector<webkit_glue::PasswordForm*>& result) { | 263 const std::vector<webkit_glue::PasswordForm*>& result) { |
263 DCHECK_EQ(pending_login_query_, handle); | 264 DCHECK_EQ(pending_login_query_, handle); |
264 pending_login_query_ = 0; | 265 pending_login_query_ = 0; |
265 page_->password_exception_list_.reset(); | 266 page_->password_exception_list_.reset(); |
266 page_->password_exception_list_.insert(page_->password_exception_list_.end(), | 267 page_->password_exception_list_.insert(page_->password_exception_list_.end(), |
267 result.begin(), result.end()); | 268 result.begin(), result.end()); |
268 page_->SetPasswordExceptionList(); | 269 page_->SetPasswordExceptionList(); |
269 } | 270 } |
OLD | NEW |