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 <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "components/password_manager/core/common/experiments.h" | 37 #include "components/password_manager/core/common/experiments.h" |
38 #include "components/password_manager/core/common/password_manager_features.h" | 38 #include "components/password_manager/core/common/password_manager_features.h" |
39 #include "components/prefs/pref_service.h" | 39 #include "components/prefs/pref_service.h" |
40 #include "components/strings/grit/components_strings.h" | 40 #include "components/strings/grit/components_strings.h" |
41 #include "components/url_formatter/url_formatter.h" | 41 #include "components/url_formatter/url_formatter.h" |
42 #include "content/public/browser/browser_thread.h" | 42 #include "content/public/browser/browser_thread.h" |
43 #include "content/public/browser/notification_details.h" | 43 #include "content/public/browser/notification_details.h" |
44 #include "content/public/browser/notification_source.h" | 44 #include "content/public/browser/notification_source.h" |
45 #include "content/public/browser/web_contents.h" | 45 #include "content/public/browser/web_contents.h" |
46 #include "content/public/browser/web_ui.h" | 46 #include "content/public/browser/web_ui.h" |
47 #include "content/public/common/content_features.h" | |
48 #include "content/public/common/origin_util.h" | 47 #include "content/public/common/origin_util.h" |
49 #include "ui/base/l10n/l10n_util.h" | 48 #include "ui/base/l10n/l10n_util.h" |
50 | 49 |
51 namespace options { | 50 namespace options { |
52 | 51 |
53 namespace { | 52 namespace { |
54 // The following constants should be synchronized with the constants in | 53 // The following constants should be synchronized with the constants in |
55 // chrome/browser/resources/options/password_manager_list.js. | 54 // chrome/browser/resources/options/password_manager_list.js. |
56 const char kUrlField[] = "url"; | 55 const char kUrlField[] = "url"; |
57 const char kShownOriginField[] = "shownOrigin"; | 56 const char kShownOriginField[] = "shownOrigin"; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 #if defined(OS_WIN) && defined(USE_ASH) | 157 #if defined(OS_WIN) && defined(USE_ASH) |
159 // We disable the ability to show passwords when running in Windows Metro | 158 // We disable the ability to show passwords when running in Windows Metro |
160 // interface. This is because we cannot pop native Win32 dialogs from the | 159 // interface. This is because we cannot pop native Win32 dialogs from the |
161 // Metro process. | 160 // Metro process. |
162 // TODO(wfh): Revisit this if Metro usage grows. | 161 // TODO(wfh): Revisit this if Metro usage grows. |
163 if (chrome::IsNativeWindowInAsh(GetNativeWindow())) | 162 if (chrome::IsNativeWindowInAsh(GetNativeWindow())) |
164 disable_show_passwords = true; | 163 disable_show_passwords = true; |
165 #endif | 164 #endif |
166 | 165 |
167 localized_strings->SetBoolean("disableShowPasswords", disable_show_passwords); | 166 localized_strings->SetBoolean("disableShowPasswords", disable_show_passwords); |
168 localized_strings->SetBoolean( | |
169 "enableCredentialManagerAPI", | |
170 base::FeatureList::IsEnabled(features::kCredentialManagementAPI)); | |
171 } | 167 } |
172 | 168 |
173 void PasswordManagerHandler::RegisterMessages() { | 169 void PasswordManagerHandler::RegisterMessages() { |
174 web_ui()->RegisterMessageCallback( | 170 web_ui()->RegisterMessageCallback( |
175 "updatePasswordLists", | 171 "updatePasswordLists", |
176 base::Bind(&PasswordManagerHandler::HandleUpdatePasswordLists, | 172 base::Bind(&PasswordManagerHandler::HandleUpdatePasswordLists, |
177 base::Unretained(this))); | 173 base::Unretained(this))); |
178 web_ui()->RegisterMessageCallback( | 174 web_ui()->RegisterMessageCallback( |
179 "removeSavedPassword", | 175 "removeSavedPassword", |
180 base::Bind(&PasswordManagerHandler::HandleRemoveSavedPassword, | 176 base::Bind(&PasswordManagerHandler::HandleRemoveSavedPassword, |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 password_manager_presenter_->GetAllPasswords(); | 393 password_manager_presenter_->GetAllPasswords(); |
398 UMA_HISTOGRAM_COUNTS("PasswordManager.ExportedPasswordsPerUserInCSV", | 394 UMA_HISTOGRAM_COUNTS("PasswordManager.ExportedPasswordsPerUserInCSV", |
399 password_list.size()); | 395 password_list.size()); |
400 password_manager::PasswordExporter::Export( | 396 password_manager::PasswordExporter::Export( |
401 path, password_list, content::BrowserThread::GetTaskRunnerForThread( | 397 path, password_list, content::BrowserThread::GetTaskRunnerForThread( |
402 content::BrowserThread::FILE) | 398 content::BrowserThread::FILE) |
403 .get()); | 399 .get()); |
404 } | 400 } |
405 | 401 |
406 } // namespace options | 402 } // namespace options |
OLD | NEW |