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" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 }; | 69 }; |
70 | 70 |
71 RegisterStrings(localized_strings, resources, arraysize(resources)); | 71 RegisterStrings(localized_strings, resources, arraysize(resources)); |
72 RegisterTitle(localized_strings, "passwordsPage", | 72 RegisterTitle(localized_strings, "passwordsPage", |
73 IDS_PASSWORDS_EXCEPTIONS_WINDOW_TITLE); | 73 IDS_PASSWORDS_EXCEPTIONS_WINDOW_TITLE); |
74 | 74 |
75 localized_strings->SetString("passwordManagerLearnMoreURL", | 75 localized_strings->SetString("passwordManagerLearnMoreURL", |
76 chrome::kPasswordManagerLearnMoreURL); | 76 chrome::kPasswordManagerLearnMoreURL); |
77 } | 77 } |
78 | 78 |
79 void PasswordManagerHandler::Initialize() { | 79 void PasswordManagerHandler::InitializeHandler() { |
80 // Due to the way that handlers are (re)initialized under certain types of | 80 // Due to the way that handlers are (re)initialized under certain types of |
81 // navigation, we may already be initialized. (See bugs 88986 and 86448.) | 81 // navigation, we may already be initialized. (See bugs 88986 and 86448.) |
82 // If this is the case, return immediately. This is a hack. | 82 // If this is the case, return immediately. This is a hack. |
83 // TODO(mdm): remove this hack once it is no longer necessary. | 83 // TODO(mdm): remove this hack once it is no longer necessary. |
84 if (!show_passwords_.GetPrefName().empty()) | 84 if (!show_passwords_.GetPrefName().empty()) |
85 return; | 85 return; |
86 | 86 |
87 show_passwords_.Init(prefs::kPasswordManagerAllowShowPasswords, | 87 show_passwords_.Init(prefs::kPasswordManagerAllowShowPasswords, |
88 Profile::FromWebUI(web_ui())->GetPrefs(), this); | 88 Profile::FromWebUI(web_ui())->GetPrefs(), this); |
89 // We should not cache web_ui()->GetProfile(). See crosbug.com/6304. | 89 // We should not cache web_ui()->GetProfile(). See crosbug.com/6304. |
(...skipping 96 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
291 | 291 |
292 } // namespace options2 | 292 } // namespace options2 |
OLD | NEW |