| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 cr.exportPath('settings'); | 5 cr.exportPath('settings'); |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * The state of sync. This is the data structure sent back and forth between | 8 * The state of sync. This is the data structure sent back and forth between |
| 9 * C++ and JS. Its naming and structure is not optimal, but changing it would | 9 * C++ and JS. Its naming and structure is not optimal, but changing it would |
| 10 * require changes to the C++ handler, which is already functional. | 10 * require changes to the C++ handler, which is already functional. |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 /** | 114 /** |
| 115 * Called from C++ as a response to getIconsAndNames. | 115 * Called from C++ as a response to getIconsAndNames. |
| 116 * @param {!string} name The current profile name. | 116 * @param {!string} name The current profile name. |
| 117 * @param {!string} iconUrl The current profile icon's URL. Can be a data URL. | 117 * @param {!string} iconUrl The current profile icon's URL. Can be a data URL. |
| 118 */ | 118 */ |
| 119 SyncPrivateApi.receiveProfileInfo = function(name, iconUrl) { | 119 SyncPrivateApi.receiveProfileInfo = function(name, iconUrl) { |
| 120 if (SyncPrivateApi.getProfileInfoCallback_) | 120 if (SyncPrivateApi.getProfileInfoCallback_) |
| 121 SyncPrivateApi.getProfileInfoCallback_(name, iconUrl); | 121 SyncPrivateApi.getProfileInfoCallback_(name, iconUrl); |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 <if expr="not chromeos"> |
| 124 /** | 125 /** |
| 125 * Called from JavaScript. Gets the available profile icons to choose from. | 126 * Called from JavaScript. Gets the available profile icons to choose from. |
| 126 * @param {!function(!Array<string>)} callback | 127 * @param {!function(!Array<string>)} callback |
| 127 */ | 128 */ |
| 128 SyncPrivateApi.getAvailableIcons = function(callback) { | 129 SyncPrivateApi.getAvailableIcons = function(callback) { |
| 129 SyncPrivateApi.getAvailableIconsCallback_ = callback; | 130 SyncPrivateApi.getAvailableIconsCallback_ = callback; |
| 130 chrome.send('requestDefaultProfileIcons'); | 131 chrome.send('requestDefaultProfileIcons'); |
| 131 }; | 132 }; |
| 132 | 133 |
| 133 /** | 134 /** |
| 134 * Called from C++ as a response to getAvailableIcons. | 135 * Called from C++ as a response to getAvailableIcons. |
| 135 * @param {!Array<string>} iconUrls An array of icon URLs. | 136 * @param {!Array<string>} iconUrls An array of icon URLs. |
| 136 */ | 137 */ |
| 137 SyncPrivateApi.receiveAvailableIcons = function(iconUrls) { | 138 SyncPrivateApi.receiveAvailableIcons = function(iconUrls) { |
| 138 if (SyncPrivateApi.getAvailableIconsCallback_) | 139 if (SyncPrivateApi.getAvailableIconsCallback_) |
| 139 SyncPrivateApi.getAvailableIconsCallback_(iconUrls); | 140 SyncPrivateApi.getAvailableIconsCallback_(iconUrls); |
| 140 }; | 141 }; |
| 141 | 142 |
| 142 /** | 143 /** |
| 143 * Called from JavaScript. Sets the profile icon and name. | 144 * Called from JavaScript. Sets the profile icon and name. |
| 144 * @param {!string} iconUrl The new profile URL. | 145 * @param {!string} iconUrl The new profile URL. |
| 145 * @param {!string} name The new profile name. | 146 * @param {!string} name The new profile name. |
| 146 */ | 147 */ |
| 147 SyncPrivateApi.setProfileIconAndName = function(iconUrl, name) { | 148 SyncPrivateApi.setProfileIconAndName = function(iconUrl, name) { |
| 148 chrome.send('setProfileIconAndName', [iconUrl, name]); | 149 chrome.send('setProfileIconAndName', [iconUrl, name]); |
| 149 }; | 150 }; |
| 151 </if> |
| 150 | 152 |
| 151 /** | 153 /** |
| 152 * Starts the signin process for the user. Does nothing if the user is | 154 * Starts the signin process for the user. Does nothing if the user is |
| 153 * already signed in. | 155 * already signed in. |
| 154 * @private | 156 * @private |
| 155 */ | 157 */ |
| 156 SyncPrivateApi.startSignIn = function() { | 158 SyncPrivateApi.startSignIn = function() { |
| 157 chrome.send('SyncSetupStartSignIn'); | 159 chrome.send('SyncSetupStartSignIn'); |
| 158 }; | 160 }; |
| 159 | 161 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 break; | 285 break; |
| 284 default: | 286 default: |
| 285 // Other statuses (i.e. "spinner") are ignored. | 287 // Other statuses (i.e. "spinner") are ignored. |
| 286 } | 288 } |
| 287 }; | 289 }; |
| 288 | 290 |
| 289 return { | 291 return { |
| 290 SyncPrivateApi: SyncPrivateApi, | 292 SyncPrivateApi: SyncPrivateApi, |
| 291 }; | 293 }; |
| 292 }); | 294 }); |
| OLD | NEW |