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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 }; | 68 }; |
69 | 69 |
70 RegisterStrings(localized_strings, resources, arraysize(resources)); | 70 RegisterStrings(localized_strings, resources, arraysize(resources)); |
71 RegisterTitle(localized_strings, "passwordsPage", | 71 RegisterTitle(localized_strings, "passwordsPage", |
72 IDS_PASSWORDS_EXCEPTIONS_WINDOW_TITLE); | 72 IDS_PASSWORDS_EXCEPTIONS_WINDOW_TITLE); |
73 | 73 |
74 localized_strings->SetString("passwordManagerLearnMoreURL", | 74 localized_strings->SetString("passwordManagerLearnMoreURL", |
75 chrome::kPasswordManagerLearnMoreURL); | 75 chrome::kPasswordManagerLearnMoreURL); |
76 } | 76 } |
77 | 77 |
78 void PasswordManagerHandler::Initialize() { | 78 void PasswordManagerHandler::InitializeHandler() { |
79 // Due to the way that handlers are (re)initialized under certain types of | 79 // Due to the way that handlers are (re)initialized under certain types of |
80 // navigation, we may already be initialized. (See bugs 88986 and 86448.) | 80 // navigation, we may already be initialized. (See bugs 88986 and 86448.) |
81 // If this is the case, return immediately. This is a hack. | 81 // If this is the case, return immediately. This is a hack. |
82 // TODO(mdm): remove this hack once it is no longer necessary. | 82 // TODO(mdm): remove this hack once it is no longer necessary. |
83 if (!show_passwords_.GetPrefName().empty()) | 83 if (!show_passwords_.GetPrefName().empty()) |
84 return; | 84 return; |
85 | 85 |
86 show_passwords_.Init(prefs::kPasswordManagerAllowShowPasswords, | 86 show_passwords_.Init(prefs::kPasswordManagerAllowShowPasswords, |
87 Profile::FromWebUI(web_ui())->GetPrefs(), this); | 87 Profile::FromWebUI(web_ui())->GetPrefs(), this); |
88 // We should not cache web_ui()->GetProfile(). See crosbug.com/6304. | 88 // We should not cache web_ui()->GetProfile(). See crosbug.com/6304. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 for (size_t i = 0; i < password_exception_list_.size(); ++i) | 186 for (size_t i = 0; i < password_exception_list_.size(); ++i) |
187 store->RemoveLogin(*password_exception_list_[i]); | 187 store->RemoveLogin(*password_exception_list_[i]); |
188 } | 188 } |
189 | 189 |
190 void PasswordManagerHandler::SetPasswordList() { | 190 void PasswordManagerHandler::SetPasswordList() { |
191 // Due to the way that handlers are (re)initialized under certain types of | 191 // Due to the way that handlers are (re)initialized under certain types of |
192 // navigation, we may not be initialized yet. (See bugs 88986 and 86448.) | 192 // navigation, we may not be initialized yet. (See bugs 88986 and 86448.) |
193 // If this is the case, initialize on demand. This is a hack. | 193 // If this is the case, initialize on demand. This is a hack. |
194 // TODO(mdm): remove this hack once it is no longer necessary. | 194 // TODO(mdm): remove this hack once it is no longer necessary. |
195 if (show_passwords_.GetPrefName().empty()) | 195 if (show_passwords_.GetPrefName().empty()) |
196 Initialize(); | 196 InitializeHandler(); |
197 | 197 |
198 ListValue entries; | 198 ListValue entries; |
199 bool show_passwords = *show_passwords_; | 199 bool show_passwords = *show_passwords_; |
200 string16 empty; | 200 string16 empty; |
201 for (size_t i = 0; i < password_list_.size(); ++i) { | 201 for (size_t i = 0; i < password_list_.size(); ++i) { |
202 ListValue* entry = new ListValue(); | 202 ListValue* entry = new ListValue(); |
203 entry->Append(new StringValue(net::FormatUrl(password_list_[i]->origin, | 203 entry->Append(new StringValue(net::FormatUrl(password_list_[i]->origin, |
204 languages_))); | 204 languages_))); |
205 entry->Append(new StringValue(password_list_[i]->username_value)); | 205 entry->Append(new StringValue(password_list_[i]->username_value)); |
206 entry->Append(new StringValue( | 206 entry->Append(new StringValue( |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 OnPasswordStoreRequestDone( | 281 OnPasswordStoreRequestDone( |
282 CancelableRequestProvider::Handle handle, | 282 CancelableRequestProvider::Handle handle, |
283 const std::vector<webkit::forms::PasswordForm*>& result) { | 283 const std::vector<webkit::forms::PasswordForm*>& result) { |
284 DCHECK_EQ(pending_login_query_, handle); | 284 DCHECK_EQ(pending_login_query_, handle); |
285 pending_login_query_ = 0; | 285 pending_login_query_ = 0; |
286 page_->password_exception_list_.reset(); | 286 page_->password_exception_list_.reset(); |
287 page_->password_exception_list_.insert(page_->password_exception_list_.end(), | 287 page_->password_exception_list_.insert(page_->password_exception_list_.end(), |
288 result.begin(), result.end()); | 288 result.begin(), result.end()); |
289 page_->SetPasswordExceptionList(); | 289 page_->SetPasswordExceptionList(); |
290 } | 290 } |
OLD | NEW |