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

Unified Diff: chrome/browser/resources/settings/passwords_and_forms_page/passwords_private_api.js

Issue 1591053002: Add a password handler to get the list of passwords in md-settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/settings/passwords_and_forms_page/passwords_private_api.js
diff --git a/chrome/browser/resources/settings/passwords_and_forms_page/passwords_private_api.js b/chrome/browser/resources/settings/passwords_and_forms_page/passwords_private_api.js
new file mode 100644
index 0000000000000000000000000000000000000000..6f8da7254b439da5eab8ca5e9f9947689702687d
--- /dev/null
+++ b/chrome/browser/resources/settings/passwords_and_forms_page/passwords_private_api.js
@@ -0,0 +1,55 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('settings.PasswordsPrivateApi', function() {
+ /**
+ * Encapsulates the calls between JS and C++ to update the list of passwords.
+ * @param {function(!Array<!Object>)} passwordListCallback Called with the
michaelpg 2016/01/22 20:54:17 can you add a typedef, e.g. "settings.PasswordsPri
hcarmona 2016/01/26 23:21:43 Acknowledged.
+ * list of passwords. Overrides previous callback and may be called
+ * multiple times.
+ * @param {function(!Array<!Object>)} exceptionListCallback Called with the
+ * list of exceptions. Overrides previous callback and may be called
+ * multiple times.
+ */
+ function updatePasswordLists(passwordListCallback,
+ exceptionListCallback) {
michaelpg 2016/01/22 20:54:17 fix spacing
hcarmona 2016/01/26 23:21:43 Acknowledged.
+ settings.PasswordsPrivateApi.setSavedPasswordsList = passwordListCallback;
+ settings.PasswordsPrivateApi.setPasswordExceptionsList =
+ exceptionListCallback;
+ chrome.send('updatePasswordLists');
+ };
+
+ /**
+ * Callback for displaying a password.
+ * This is a no-op until it's been overridden.
+ * @param {number} index
+ * @param {string} password
+ */
+ function showPassword(index, password) {
+ // TODO(hcarmona): Add function that will set this and call chrome.send to
+ // show the password when requested.
+ };
+
+ /**
+ * Callback for updating the list of passwords.
+ * This is a no-op until it's been overridden.
+ * @param {!Array<!Object>} passwordList The list of passwords that was
+ * retrieved by calling the private APIs.
+ */
+ function setSavedPasswordsList(passwordList) {};
+
+
+ /**
+ * Callback for updating the list of site exceptions.
+ * This is a no-op until it's been overridden.
+ * @param {!Array<!Object>} exceptionList The list of sites that passwords
+ * will not be saved for.
+ */
+ function setPasswordExceptionsList(exceptionList) {};
+
+ return { updatePasswordLists: updatePasswordLists,
michaelpg 2016/01/22 20:54:17 nit: no spacing inside object literal {}
hcarmona 2016/01/26 23:21:43 Acknowledged.
+ showPassword: showPassword,
+ setSavedPasswordsList: setSavedPasswordsList,
+ setPasswordExceptionsList: setPasswordExceptionsList, };
+});

Powered by Google App Engine
This is Rietveld 408576698