Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: chrome/browser/ui/webui/options/password_manager_handler.cc

Issue 1720403003: Ship the Credential Management API by default (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/feature_list.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_split.h" 11 #include "base/strings/string_split.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "chrome/browser/chrome_notification_types.h" 15 #include "chrome/browser/chrome_notification_types.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/sync/profile_sync_service_factory.h" 17 #include "chrome/browser/sync/profile_sync_service_factory.h"
18 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
19 #include "chrome/common/url_constants.h" 19 #include "chrome/common/url_constants.h"
20 #include "chrome/grit/generated_resources.h" 20 #include "chrome/grit/generated_resources.h"
21 #include "components/autofill/core/common/password_form.h" 21 #include "components/autofill/core/common/password_form.h"
22 #include "components/browser_sync/browser/profile_sync_service.h" 22 #include "components/browser_sync/browser/profile_sync_service.h"
23 #include "components/password_manager/core/browser/password_bubble_experiment.h" 23 #include "components/password_manager/core/browser/password_bubble_experiment.h"
24 #include "components/password_manager/core/browser/password_manager_constants.h" 24 #include "components/password_manager/core/browser/password_manager_constants.h"
25 #include "components/password_manager/core/browser/password_ui_utils.h" 25 #include "components/password_manager/core/browser/password_ui_utils.h"
26 #include "components/password_manager/core/common/experiments.h" 26 #include "components/password_manager/core/common/experiments.h"
27 #include "components/prefs/pref_service.h" 27 #include "components/prefs/pref_service.h"
28 #include "components/strings/grit/components_strings.h" 28 #include "components/strings/grit/components_strings.h"
29 #include "components/url_formatter/url_formatter.h" 29 #include "components/url_formatter/url_formatter.h"
30 #include "content/public/browser/notification_details.h" 30 #include "content/public/browser/notification_details.h"
31 #include "content/public/browser/notification_source.h" 31 #include "content/public/browser/notification_source.h"
32 #include "content/public/browser/user_metrics.h" 32 #include "content/public/browser/user_metrics.h"
33 #include "content/public/browser/web_contents.h" 33 #include "content/public/browser/web_contents.h"
34 #include "content/public/browser/web_ui.h" 34 #include "content/public/browser/web_ui.h"
35 #include "content/public/common/content_switches.h" 35 #include "content/public/common/content_features.h"
36 #include "content/public/common/origin_util.h" 36 #include "content/public/common/origin_util.h"
37 #include "ui/base/l10n/l10n_util.h" 37 #include "ui/base/l10n/l10n_util.h"
38 38
39 #if defined(OS_WIN) && defined(USE_ASH) 39 #if defined(OS_WIN) && defined(USE_ASH)
40 #include "chrome/browser/ui/ash/ash_util.h" 40 #include "chrome/browser/ui/ash/ash_util.h"
41 #endif 41 #endif
42 42
43 namespace options { 43 namespace options {
44 44
45 namespace { 45 namespace {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 // interface. This is because we cannot pop native Win32 dialogs from the 142 // interface. This is because we cannot pop native Win32 dialogs from the
143 // Metro process. 143 // Metro process.
144 // TODO(wfh): Revisit this if Metro usage grows. 144 // TODO(wfh): Revisit this if Metro usage grows.
145 if (chrome::IsNativeWindowInAsh(GetNativeWindow())) 145 if (chrome::IsNativeWindowInAsh(GetNativeWindow()))
146 disable_show_passwords = true; 146 disable_show_passwords = true;
147 #endif 147 #endif
148 148
149 localized_strings->SetBoolean("disableShowPasswords", disable_show_passwords); 149 localized_strings->SetBoolean("disableShowPasswords", disable_show_passwords);
150 localized_strings->SetBoolean( 150 localized_strings->SetBoolean(
151 "enableCredentialManagerAPI", 151 "enableCredentialManagerAPI",
152 base::CommandLine::ForCurrentProcess()->HasSwitch( 152 base::FeatureList::IsEnabled(features::kCredentialManagementAPI));
153 switches::kEnableCredentialManagerAPI));
154 } 153 }
155 154
156 void PasswordManagerHandler::RegisterMessages() { 155 void PasswordManagerHandler::RegisterMessages() {
157 web_ui()->RegisterMessageCallback( 156 web_ui()->RegisterMessageCallback(
158 "updatePasswordLists", 157 "updatePasswordLists",
159 base::Bind(&PasswordManagerHandler::HandleUpdatePasswordLists, 158 base::Bind(&PasswordManagerHandler::HandleUpdatePasswordLists,
160 base::Unretained(this))); 159 base::Unretained(this)));
161 web_ui()->RegisterMessageCallback( 160 web_ui()->RegisterMessageCallback(
162 "removeSavedPassword", 161 "removeSavedPassword",
163 base::Bind(&PasswordManagerHandler::HandleRemoveSavedPassword, 162 base::Bind(&PasswordManagerHandler::HandleRemoveSavedPassword,
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue); 262 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue);
264 CopyOriginInfoOfPasswordForm(*exception, languages_, entry.get()); 263 CopyOriginInfoOfPasswordForm(*exception, languages_, entry.get());
265 entries.Append(entry.release()); 264 entries.Append(entry.release());
266 } 265 }
267 266
268 web_ui()->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList", 267 web_ui()->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList",
269 entries); 268 entries);
270 } 269 }
271 270
272 } // namespace options 271 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698