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..a0946c531d1155c85064886bc3085faab0bd23cf 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,12 +103,58 @@ 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) { |
| + 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 |
| */ |
| SyncPrivateApi.startSignIn = function() { |
| - chrome.send('SyncSetupStartSignIn'); |
| + chrome.send('syncSetupStartSignIn'); |
| }; |
| /** |
| @@ -113,7 +163,7 @@ cr.define('settings', function() { |
| * @private |
| */ |
| SyncPrivateApi.disconnect = function(deleteProfile) { |
| - chrome.send('SyncSetupStopSyncing', [deleteProfile]); |
| + chrome.send('syncSetupStopSyncing', [deleteProfile]); |
| }; |
| /** |
| @@ -122,7 +172,7 @@ cr.define('settings', function() { |
| * @private |
| */ |
| SyncPrivateApi.showSetupUI = function() { |
| - chrome.send('SyncSetupShowSetupUI'); |
| + chrome.send('syncSetupShowSetupUI'); |
| chrome.send('coreOptionsUserMetricsAction', ['Options_ShowSyncAdvanced']); |
| }; |
| @@ -132,7 +182,7 @@ cr.define('settings', function() { |
| * sync UI, this one will be shown instead. |
| */ |
| SyncPrivateApi.didNavigateToSyncPage = function() { |
| - chrome.send('SyncSetupShowSetupUI'); |
| + chrome.send('syncSetupShowSetupUI'); |
| }; |
| /** |
| @@ -141,7 +191,7 @@ cr.define('settings', function() { |
| */ |
| SyncPrivateApi.didNavigateAwayFromSyncPage = function() { |
| SyncPrivateApi.setPageStatusCallback_ = null; |
| - chrome.send('SyncSetupDidClosePage'); |
| + chrome.send('syncSetupDidClosePage'); |
| }; |
| /** |
| @@ -169,7 +219,7 @@ cr.define('settings', function() { |
| */ |
| SyncPrivateApi.setSyncPrefs = function(syncPrefs, callback) { |
| SyncPrivateApi.setPageStatusCallback_ = callback; |
| - chrome.send('SyncSetupConfigure', [JSON.stringify(syncPrefs)]); |
| + chrome.send('syncSetupConfigure', [JSON.stringify(syncPrefs)]); |
| }; |
| /** |
| @@ -190,7 +240,7 @@ cr.define('settings', function() { |
| */ |
| SyncPrivateApi.getSyncStatus = function(callback) { |
| SyncPrivateApi.syncStatusCallback_ = callback; |
| - chrome.send('SyncSetupGetSyncStatus'); |
| + chrome.send('syncSetupGetSyncStatus'); |
| }; |
| /** |
| @@ -207,7 +257,7 @@ cr.define('settings', function() { |
| * Sends a request from JS to C++ to open the multi-profile User Manager. |
| */ |
| SyncPrivateApi.manageOtherPeople = function() { |
| - chrome.send('SyncSetupManageOtherPeople'); |
| + chrome.send('syncSetupManageOtherPeople'); |
|
Dan Beam
2016/01/07 02:41:20
arguably do in a separate patch
tommycli
2016/01/07 22:08:23
Done.
|
| }; |
| /** |