| 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 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #if defined(OS_WIN) && defined(USE_ASH) |
| 15 #include "chrome/browser/ui/ash/ash_util.h" |
| 16 #endif |
| 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" |
| 22 #include "content/public/browser/web_ui.h" | 25 #include "content/public/browser/web_ui.h" |
| 23 #include "grit/chromium_strings.h" | 26 #include "grit/chromium_strings.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 { "passwordsNoExceptionsDescription", | 65 { "passwordsNoExceptionsDescription", |
| 63 IDS_PASSWORDS_PAGE_VIEW_NO_EXCEPTIONS_DESCRIPTION }, | 66 IDS_PASSWORDS_PAGE_VIEW_NO_EXCEPTIONS_DESCRIPTION }, |
| 64 }; | 67 }; |
| 65 | 68 |
| 66 RegisterStrings(localized_strings, resources, arraysize(resources)); | 69 RegisterStrings(localized_strings, resources, arraysize(resources)); |
| 67 RegisterTitle(localized_strings, "passwordsPage", | 70 RegisterTitle(localized_strings, "passwordsPage", |
| 68 IDS_PASSWORDS_EXCEPTIONS_WINDOW_TITLE); | 71 IDS_PASSWORDS_EXCEPTIONS_WINDOW_TITLE); |
| 69 | 72 |
| 70 localized_strings->SetString("passwordManagerLearnMoreURL", | 73 localized_strings->SetString("passwordManagerLearnMoreURL", |
| 71 chrome::kPasswordManagerLearnMoreURL); | 74 chrome::kPasswordManagerLearnMoreURL); |
| 75 bool disable_show_passwords = false; |
| 76 |
| 77 #if defined(OS_WIN) && defined(USE_ASH) |
| 78 // We disable the ability to show passwords when running in Windows Metro |
| 79 // interface. This is because we cannot pop native Win32 dialogs from the |
| 80 // Metro process. |
| 81 // TODO(wfh): Revisit this if Metro usage grows. |
| 82 if (chrome::IsNativeWindowInAsh(GetNativeWindow())) |
| 83 disable_show_passwords = true; |
| 84 #endif |
| 85 |
| 86 localized_strings->SetBoolean("disableShowPasswords", disable_show_passwords); |
| 72 } | 87 } |
| 73 | 88 |
| 74 void PasswordManagerHandler::RegisterMessages() { | 89 void PasswordManagerHandler::RegisterMessages() { |
| 75 web_ui()->RegisterMessageCallback( | 90 web_ui()->RegisterMessageCallback( |
| 76 "updatePasswordLists", | 91 "updatePasswordLists", |
| 77 base::Bind(&PasswordManagerHandler::HandleUpdatePasswordLists, | 92 base::Bind(&PasswordManagerHandler::HandleUpdatePasswordLists, |
| 78 base::Unretained(this))); | 93 base::Unretained(this))); |
| 79 web_ui()->RegisterMessageCallback( | 94 web_ui()->RegisterMessageCallback( |
| 80 "removeSavedPassword", | 95 "removeSavedPassword", |
| 81 base::Bind(&PasswordManagerHandler::HandleRemoveSavedPassword, | 96 base::Bind(&PasswordManagerHandler::HandleRemoveSavedPassword, |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 for (size_t i = 0; i < password_exception_list.size(); ++i) { | 180 for (size_t i = 0; i < password_exception_list.size(); ++i) { |
| 166 entries.Append(new StringValue( | 181 entries.Append(new StringValue( |
| 167 net::FormatUrl(password_exception_list[i]->origin, languages_))); | 182 net::FormatUrl(password_exception_list[i]->origin, languages_))); |
| 168 } | 183 } |
| 169 | 184 |
| 170 web_ui()->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList", | 185 web_ui()->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList", |
| 171 entries); | 186 entries); |
| 172 } | 187 } |
| 173 | 188 |
| 174 } // namespace options | 189 } // namespace options |
| OLD | NEW |