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..92fca41e98951fc52edfda2aa576078254d78ae9 |
| --- /dev/null |
| +++ b/chrome/browser/resources/settings/passwords_and_forms_page/passwords_private_api.js |
| @@ -0,0 +1,51 @@ |
| +// 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.exportPath('settings'); |
|
michaelpg
2016/01/16 07:12:48
exportPath is redundant with cr.define
hcarmona
2016/01/20 02:32:50
Done.
|
| + |
| +cr.define('settings', function() { |
| + /** |
| + * API to encapsulate messaging between JS and C++ for password management. |
| + * @constructor |
| + */ |
| + function PasswordsPrivateApi() {} |
|
michaelpg
2016/01/16 07:12:48
why is this a function/constructor?
if you just w
hcarmona
2016/01/20 02:32:50
Good to know. Updated.
|
| + |
| + /** |
| + * Encapsulate the calls between JS and C++ to update the list of passwords. |
|
michaelpg
2016/01/16 07:12:48
use indicative comments for functions (e.g., Encap
hcarmona
2016/01/20 02:32:50
Done.
|
| + * @param {function(!Array<!Object>)} passwordListCallback Called with the |
| + * list of passwords. |
| + * @param {function(!Array<!Object>)} exceptionListCallback Called with the |
| + * list of exceptions. |
| + */ |
| + PasswordsPrivateApi.updatePasswordLists = function(passwordListCallback, |
| + exceptionListCallback) { |
|
stevenjb
2016/01/19 21:34:28
API methods with multiple callback arguments are u
hcarmona
2016/01/20 02:32:50
Yes, we can do something else with this API. Not 1
|
| + PasswordsPrivateApi.setSavedPasswordsList = passwordListCallback; |
|
michaelpg
2016/01/16 07:12:48
this is really weird. can you save the callback as
hcarmona
2016/01/20 02:32:50
I'm not sure what you mean about this being "weird
dpapad
2016/01/20 17:56:07
Agree with Hector. What is the benefit of adding t
michaelpg
2016/01/20 21:20:56
You're overriding a method defined at line 40. So
hcarmona
2016/01/20 23:13:53
I've added a comment that the callbacks will be no
|
| + PasswordsPrivateApi.setPasswordExceptionsList = exceptionListCallback; |
| + chrome.send('updatePasswordLists'); |
| + }; |
| + |
| + /** |
| + * Callback for displaying a password. |
| + * @param {number} index |
| + * @param {string} password |
| + */ |
| + PasswordsPrivateApi.showPassword = function(index, password) {}; |
|
michaelpg
2016/01/16 07:12:48
do you need a TODO here?
hcarmona
2016/01/20 02:32:50
Done.
|
| + |
| + /** |
| + * Callback for updating the list of passwords. |
| + * @param {!Array<!Object>} passwordList The list of passwords that was |
| + * retrieved by calling the private APIs. |
| + */ |
| + PasswordsPrivateApi.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. |
| + */ |
| + PasswordsPrivateApi.setPasswordExceptionsList = function(exceptionList) {}; |
| + |
| + return { PasswordsPrivateApi: PasswordsPrivateApi, }; |
| +}); |