Chromium Code Reviews| 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..27528ce29c281cdcdf3b80aee85b3a61c96048da |
| --- /dev/null |
| +++ b/chrome/browser/resources/settings/passwords_and_forms_page/passwords_private_api.js |
| @@ -0,0 +1,50 @@ |
| +// 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 |
| + * list of passwords. |
| + * @param {function(!Array<!Object>)} exceptionListCallback Called with the |
| + * list of exceptions. |
| + */ |
| + updatePasswordLists = function(passwordListCallback, |
|
michaelpg
2016/01/20 21:20:56
missing "var" here and elsewhere
or, just "functio
hcarmona
2016/01/20 23:13:53
Done.
|
| + exceptionListCallback) { |
| + settings.PasswordsPrivateApi.setSavedPasswordsList = passwordListCallback; |
| + settings.PasswordsPrivateApi.setPasswordExceptionsList = |
| + exceptionListCallback; |
| + chrome.send('updatePasswordLists'); |
| + }; |
| + |
| + /** |
| + * Callback for displaying a password. |
| + * @param {number} index |
| + * @param {string} password |
| + */ |
| + showPassword = function(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. |
| + * @param {!Array<!Object>} passwordList The list of passwords that was |
| + * retrieved by calling the private APIs. |
| + */ |
| + setSavedPasswordsList = function(passwordList) {}; |
| + |
| + |
| + /** |
| + * Callback for updating the list of site exceptions. |
| + * @param {!Array<!Object>} exceptionList The list of sites that passwords |
| + * will not be saved for. |
| + */ |
| + setPasswordExceptionsList = function(exceptionList) {}; |
| + |
| + return { updatePasswordLists: updatePasswordLists, |
| + showPassword: showPassword, |
| + setSavedPasswordsList: setSavedPasswordsList, |
| + setPasswordExceptionsList: setPasswordExceptionsList, }; |
| +}); |