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/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #if defined(OS_WIN) && defined(USE_ASH) | |
13 #include "chrome/browser/ui/ash/ash_util.h" | |
Patrick Dubroy
2013/12/12 17:03:33
Includes should be in alphabetical order.
Will Harris
2013/12/12 18:31:09
Done.
| |
14 #endif | |
12 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
13 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
15 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
16 #include "components/autofill/core/common/password_form.h" | 19 #include "components/autofill/core/common/password_form.h" |
17 #include "content/public/browser/notification_details.h" | 20 #include "content/public/browser/notification_details.h" |
18 #include "content/public/browser/notification_source.h" | 21 #include "content/public/browser/notification_source.h" |
19 #include "content/public/browser/user_metrics.h" | 22 #include "content/public/browser/user_metrics.h" |
20 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
21 #include "content/public/browser/web_contents_view.h" | 24 #include "content/public/browser/web_contents_view.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 web_ui()->RegisterMessageCallback( | 90 web_ui()->RegisterMessageCallback( |
88 "requestShowPassword", | 91 "requestShowPassword", |
89 base::Bind(&PasswordManagerHandler::HandleRequestShowPassword, | 92 base::Bind(&PasswordManagerHandler::HandleRequestShowPassword, |
90 base::Unretained(this))); | 93 base::Unretained(this))); |
91 } | 94 } |
92 | 95 |
93 void PasswordManagerHandler::InitializeHandler() { | 96 void PasswordManagerHandler::InitializeHandler() { |
94 password_manager_presenter_.Initialize(); | 97 password_manager_presenter_.Initialize(); |
95 } | 98 } |
96 | 99 |
100 void PasswordManagerHandler::InitializePage() { | |
101 #if defined(OS_WIN) && defined(USE_ASH) | |
Patrick Dubroy
2013/12/12 17:03:33
I think it's easier to just pass a boolean in with
Will Harris
2013/12/12 18:31:09
Done.
| |
102 if (chrome::IsNativeWindowInAsh(GetNativeWindow())) | |
103 web_ui()->CallJavascriptFunction("PasswordManager.disableShowPassword"); | |
104 #endif | |
105 } | |
106 | |
97 void PasswordManagerHandler::HandleRemoveSavedPassword(const ListValue* args) { | 107 void PasswordManagerHandler::HandleRemoveSavedPassword(const ListValue* args) { |
98 std::string string_value = UTF16ToUTF8(ExtractStringValue(args)); | 108 std::string string_value = UTF16ToUTF8(ExtractStringValue(args)); |
99 int index; | 109 int index; |
100 if (base::StringToInt(string_value, &index) && index >= 0) { | 110 if (base::StringToInt(string_value, &index) && index >= 0) { |
101 password_manager_presenter_.RemoveSavedPassword(static_cast<size_t>(index)); | 111 password_manager_presenter_.RemoveSavedPassword(static_cast<size_t>(index)); |
102 } | 112 } |
103 } | 113 } |
104 | 114 |
105 void PasswordManagerHandler::HandleRemovePasswordException( | 115 void PasswordManagerHandler::HandleRemovePasswordException( |
106 const ListValue* args) { | 116 const ListValue* args) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 for (size_t i = 0; i < password_exception_list.size(); ++i) { | 174 for (size_t i = 0; i < password_exception_list.size(); ++i) { |
165 entries.Append(new StringValue( | 175 entries.Append(new StringValue( |
166 net::FormatUrl(password_exception_list[i]->origin, languages_))); | 176 net::FormatUrl(password_exception_list[i]->origin, languages_))); |
167 } | 177 } |
168 | 178 |
169 web_ui()->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList", | 179 web_ui()->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList", |
170 entries); | 180 entries); |
171 } | 181 } |
172 | 182 |
173 } // namespace options | 183 } // namespace options |
OLD | NEW |