Chromium Code Reviews| Index: chrome/browser/resources/settings/people_page/sync_private_api.js |
| diff --git a/chrome/browser/resources/settings/people_page/sync_private_api.js b/chrome/browser/resources/settings/people_page/sync_private_api.js |
| index 05547fb3399354e872ef7c2c8d68a5f4084c5093..8f3e64e4210bb0743e5425009e622f6a22cbb65d 100644 |
| --- a/chrome/browser/resources/settings/people_page/sync_private_api.js |
| +++ b/chrome/browser/resources/settings/people_page/sync_private_api.js |
| @@ -59,9 +59,7 @@ settings.SyncPrefs; |
| * childUser: (boolean|undefined), |
| * hasError: (boolean|undefined), |
| * hasUnrecoverableError: (boolean|undefined), |
| - * iconURL: (string|undefined), |
| * managed: (boolean|undefined), |
| - * name: (string|undefined), |
| * setupCompleted: (boolean|undefined), |
| * setupInProgress: (boolean|undefined), |
| * signedIn: (boolean|undefined), |
| @@ -92,6 +90,12 @@ cr.define('settings', function() { |
| */ |
| function SyncPrivateApi() {} |
| + /** @private {?function(!string, !string)} */ |
| + SyncPrivateApi.getProfileInfoCallback_ = null; |
| + |
| + /** @private {?function(!Array<string>)} */ |
| + SyncPrivateApi.getAvailableIconsCallback_ = null; |
| + |
| /** @private {?function(settings.SyncPrefs)} */ |
| SyncPrivateApi.syncPrefsCallback_ = null; |
| @@ -99,6 +103,52 @@ cr.define('settings', function() { |
| SyncPrivateApi.setPageStatusCallback_ = null; |
| /** |
| + * Called from JavaScript. Gets the current profile name and icon. |
| + * @param {?function(!string, !string)} callback |
| + */ |
| + SyncPrivateApi.getProfileInfo = function(callback) { |
| + SyncPrivateApi.getProfileInfoCallback_ = callback; |
| + chrome.send('GetProfileInfo'); |
| + }; |
| + |
| + /** |
| + * Called from C++ as a response to getIconsAndNames. |
| + * @param {!string} name The current profile name. |
| + * @param {!string} iconURL The current profile icon's URL. Can be a data URL. |
| + */ |
| + SyncPrivateApi.receiveProfileInfo = function(name, iconURL) { |
|
Dan Beam
2015/12/28 23:28:57
nit: prefer iconUrl, as far as I know
tommycli
2016/01/04 21:40:13
Done.
|
| + if (SyncPrivateApi.getProfileInfoCallback_) |
| + SyncPrivateApi.getProfileInfoCallback_(name, iconURL); |
| + }; |
| + |
| + /** |
| + * Called from JavaScript. Gets the available profile icons to choose from. |
| + * @param {!function(!Array<string>)} callback |
| + */ |
| + SyncPrivateApi.getAvailableIcons = function(callback) { |
| + SyncPrivateApi.getAvailableIconsCallback_ = callback; |
| + chrome.send('requestDefaultProfileIcons'); |
| + }; |
| + |
| + /** |
| + * Called from C++ as a response to getAvailableIcons. |
| + * @param {!Array<string>} iconURLs An array of icon URLs. |
| + */ |
| + SyncPrivateApi.receiveAvailableIcons = function(iconURLs) { |
| + if (SyncPrivateApi.getAvailableIconsCallback_) |
| + SyncPrivateApi.getAvailableIconsCallback_(iconURLs); |
| + }; |
| + |
| + /** |
| + * Called from JavaScript. Sets the profile icon and name. |
| + * @param {!string} iconURL The new profile URL. |
| + * @param {!string} name The new profile name. |
| + */ |
| + SyncPrivateApi.setProfileIconAndName = function(iconURL, name) { |
| + chrome.send('setProfileIconAndName', [iconURL, name]); |
| + }; |
| + |
| + /** |
| * Starts the signin process for the user. Does nothing if the user is |
| * already signed in. |
| * @private |