OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 web_ui()->RegisterMessageCallback( | 140 web_ui()->RegisterMessageCallback( |
141 "requestShowPassword", | 141 "requestShowPassword", |
142 base::Bind(&PasswordManagerHandler::HandleRequestShowPassword, | 142 base::Bind(&PasswordManagerHandler::HandleRequestShowPassword, |
143 base::Unretained(this))); | 143 base::Unretained(this))); |
144 } | 144 } |
145 | 145 |
146 void PasswordManagerHandler::InitializeHandler() { | 146 void PasswordManagerHandler::InitializeHandler() { |
147 password_manager_presenter_.Initialize(); | 147 password_manager_presenter_.Initialize(); |
148 } | 148 } |
149 | 149 |
150 void PasswordManagerHandler::InitializePage() { | |
151 base::FundamentalValue visible( | |
152 password_manager::ManageAccountLinkExperimentEnabled()); | |
153 web_ui()->CallJavascriptFunction( | |
154 "PasswordManager.setManageAccountLinkVisibility", visible); | |
155 } | |
156 | |
157 void PasswordManagerHandler::HandleRemoveSavedPassword( | 150 void PasswordManagerHandler::HandleRemoveSavedPassword( |
158 const base::ListValue* args) { | 151 const base::ListValue* args) { |
159 std::string string_value = base::UTF16ToUTF8(ExtractStringValue(args)); | 152 std::string string_value = base::UTF16ToUTF8(ExtractStringValue(args)); |
160 int index; | 153 int index; |
161 if (base::StringToInt(string_value, &index) && index >= 0) { | 154 if (base::StringToInt(string_value, &index) && index >= 0) { |
162 password_manager_presenter_.RemoveSavedPassword(static_cast<size_t>(index)); | 155 password_manager_presenter_.RemoveSavedPassword(static_cast<size_t>(index)); |
163 } | 156 } |
164 } | 157 } |
165 | 158 |
166 void PasswordManagerHandler::HandleRemovePasswordException( | 159 void PasswordManagerHandler::HandleRemovePasswordException( |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 for (size_t i = 0; i < password_exception_list.size(); ++i) { | 229 for (size_t i = 0; i < password_exception_list.size(); ++i) { |
237 entries.AppendString(password_manager::GetHumanReadableOrigin( | 230 entries.AppendString(password_manager::GetHumanReadableOrigin( |
238 *password_exception_list[i], languages_)); | 231 *password_exception_list[i], languages_)); |
239 } | 232 } |
240 | 233 |
241 web_ui()->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList", | 234 web_ui()->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList", |
242 entries); | 235 entries); |
243 } | 236 } |
244 | 237 |
245 } // namespace options | 238 } // namespace options |
OLD | NEW |