Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: chrome/browser/ui/webui/options2/password_manager_handler2.cc

Issue 9693032: [uber page] Split up initialization of handlers from initialization of webui pages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: copyright bumps Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 }; 70 };
71 71
72 RegisterStrings(localized_strings, resources, arraysize(resources)); 72 RegisterStrings(localized_strings, resources, arraysize(resources));
73 RegisterTitle(localized_strings, "passwordsPage", 73 RegisterTitle(localized_strings, "passwordsPage",
74 IDS_PASSWORDS_EXCEPTIONS_WINDOW_TITLE); 74 IDS_PASSWORDS_EXCEPTIONS_WINDOW_TITLE);
75 75
76 localized_strings->SetString("passwordManagerLearnMoreURL", 76 localized_strings->SetString("passwordManagerLearnMoreURL",
77 chrome::kPasswordManagerLearnMoreURL); 77 chrome::kPasswordManagerLearnMoreURL);
78 } 78 }
79 79
80 void PasswordManagerHandler::Initialize() { 80 void PasswordManagerHandler::InitializeHandler() {
81 // Due to the way that handlers are (re)initialized under certain types of 81 // Due to the way that handlers are (re)initialized under certain types of
82 // navigation, we may already be initialized. (See bugs 88986 and 86448.) 82 // navigation, we may already be initialized. (See bugs 88986 and 86448.)
83 // If this is the case, return immediately. This is a hack. 83 // If this is the case, return immediately. This is a hack.
84 // TODO(mdm): remove this hack once it is no longer necessary. 84 // TODO(mdm): remove this hack once it is no longer necessary.
85 if (!show_passwords_.GetPrefName().empty()) 85 if (!show_passwords_.GetPrefName().empty())
86 return; 86 return;
87 87
88 show_passwords_.Init(prefs::kPasswordManagerAllowShowPasswords, 88 show_passwords_.Init(prefs::kPasswordManagerAllowShowPasswords,
89 Profile::FromWebUI(web_ui())->GetPrefs(), this); 89 Profile::FromWebUI(web_ui())->GetPrefs(), this);
90 // We should not cache web_ui()->GetProfile(). See crosbug.com/6304. 90 // We should not cache web_ui()->GetProfile(). See crosbug.com/6304.
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 for (size_t i = 0; i < password_exception_list_.size(); ++i) 188 for (size_t i = 0; i < password_exception_list_.size(); ++i)
189 store->RemoveLogin(*password_exception_list_[i]); 189 store->RemoveLogin(*password_exception_list_[i]);
190 } 190 }
191 191
192 void PasswordManagerHandler::SetPasswordList() { 192 void PasswordManagerHandler::SetPasswordList() {
193 // Due to the way that handlers are (re)initialized under certain types of 193 // Due to the way that handlers are (re)initialized under certain types of
194 // navigation, we may not be initialized yet. (See bugs 88986 and 86448.) 194 // navigation, we may not be initialized yet. (See bugs 88986 and 86448.)
195 // If this is the case, initialize on demand. This is a hack. 195 // If this is the case, initialize on demand. This is a hack.
196 // TODO(mdm): remove this hack once it is no longer necessary. 196 // TODO(mdm): remove this hack once it is no longer necessary.
197 if (show_passwords_.GetPrefName().empty()) 197 if (show_passwords_.GetPrefName().empty())
198 Initialize(); 198 InitializeHandler();
199 199
200 ListValue entries; 200 ListValue entries;
201 bool show_passwords = *show_passwords_; 201 bool show_passwords = *show_passwords_;
202 string16 empty; 202 string16 empty;
203 for (size_t i = 0; i < password_list_.size(); ++i) { 203 for (size_t i = 0; i < password_list_.size(); ++i) {
204 ListValue* entry = new ListValue(); 204 ListValue* entry = new ListValue();
205 entry->Append(new StringValue(net::FormatUrl(password_list_[i]->origin, 205 entry->Append(new StringValue(net::FormatUrl(password_list_[i]->origin,
206 languages_))); 206 languages_)));
207 entry->Append(new StringValue(password_list_[i]->username_value)); 207 entry->Append(new StringValue(password_list_[i]->username_value));
208 entry->Append(new StringValue( 208 entry->Append(new StringValue(
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 const std::vector<webkit::forms::PasswordForm*>& result) { 285 const std::vector<webkit::forms::PasswordForm*>& result) {
286 DCHECK_EQ(pending_login_query_, handle); 286 DCHECK_EQ(pending_login_query_, handle);
287 pending_login_query_ = 0; 287 pending_login_query_ = 0;
288 page_->password_exception_list_.reset(); 288 page_->password_exception_list_.reset();
289 page_->password_exception_list_.insert(page_->password_exception_list_.end(), 289 page_->password_exception_list_.insert(page_->password_exception_list_.end(),
290 result.begin(), result.end()); 290 result.begin(), result.end());
291 page_->SetPasswordExceptionList(); 291 page_->SetPasswordExceptionList();
292 } 292 }
293 293
294 } // namespace options2 294 } // namespace options2
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698