| 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 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
| 15 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
| 16 #include "components/autofill/core/common/password_form.h" | 16 #include "components/autofill/core/common/password_form.h" |
| 17 #include "content/public/browser/notification_details.h" | 17 #include "content/public/browser/notification_details.h" |
| 18 #include "content/public/browser/notification_source.h" | 18 #include "content/public/browser/notification_source.h" |
| 19 #include "content/public/browser/user_metrics.h" | 19 #include "content/public/browser/user_metrics.h" |
| 20 #include "content/public/browser/web_contents.h" |
| 21 #include "content/public/browser/web_contents_view.h" |
| 20 #include "content/public/browser/web_ui.h" | 22 #include "content/public/browser/web_ui.h" |
| 21 #include "grit/chromium_strings.h" | 23 #include "grit/chromium_strings.h" |
| 22 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
| 23 #include "net/base/net_util.h" | 25 #include "net/base/net_util.h" |
| 24 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
| 25 | 27 |
| 26 namespace options { | 28 namespace options { |
| 27 | 29 |
| 28 PasswordManagerHandler::PasswordManagerHandler() | 30 PasswordManagerHandler::PasswordManagerHandler() |
| 29 : password_manager_presenter_(this) {} | 31 : password_manager_presenter_(this) {} |
| 30 | 32 |
| 31 PasswordManagerHandler::~PasswordManagerHandler() {} | 33 PasswordManagerHandler::~PasswordManagerHandler() {} |
| 32 | 34 |
| 33 Profile* PasswordManagerHandler::GetProfile() { | 35 Profile* PasswordManagerHandler::GetProfile() { |
| 34 return Profile::FromWebUI(web_ui()); | 36 return Profile::FromWebUI(web_ui()); |
| 35 } | 37 } |
| 36 | 38 |
| 39 #if !defined(OS_ANDROID) |
| 40 gfx::NativeWindow PasswordManagerHandler::GetNativeWindow() { |
| 41 return web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(); |
| 42 } |
| 43 #endif |
| 44 |
| 37 void PasswordManagerHandler::GetLocalizedValues( | 45 void PasswordManagerHandler::GetLocalizedValues( |
| 38 DictionaryValue* localized_strings) { | 46 DictionaryValue* localized_strings) { |
| 39 DCHECK(localized_strings); | 47 DCHECK(localized_strings); |
| 40 | 48 |
| 41 static const OptionsStringResource resources[] = { | 49 static const OptionsStringResource resources[] = { |
| 42 { "savedPasswordsTitle", | 50 { "savedPasswordsTitle", |
| 43 IDS_PASSWORDS_SHOW_PASSWORDS_TAB_TITLE }, | 51 IDS_PASSWORDS_SHOW_PASSWORDS_TAB_TITLE }, |
| 44 { "passwordExceptionsTitle", | 52 { "passwordExceptionsTitle", |
| 45 IDS_PASSWORDS_EXCEPTIONS_TAB_TITLE }, | 53 IDS_PASSWORDS_EXCEPTIONS_TAB_TITLE }, |
| 46 { "passwordSearchPlaceholder", | 54 { "passwordSearchPlaceholder", |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 for (size_t i = 0; i < password_exception_list.size(); ++i) { | 164 for (size_t i = 0; i < password_exception_list.size(); ++i) { |
| 157 entries.Append(new StringValue( | 165 entries.Append(new StringValue( |
| 158 net::FormatUrl(password_exception_list[i]->origin, languages_))); | 166 net::FormatUrl(password_exception_list[i]->origin, languages_))); |
| 159 } | 167 } |
| 160 | 168 |
| 161 web_ui()->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList", | 169 web_ui()->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList", |
| 162 entries); | 170 entries); |
| 163 } | 171 } |
| 164 | 172 |
| 165 } // namespace options | 173 } // namespace options |
| OLD | NEW |