| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 /** | 5 /** |
| 6 * @fileoverview A helper object used from the the People section to get the | 6 * @fileoverview A helper object used from the the People section to get the |
| 7 * status of the sync backend and user preferences on what data to sync. Used | 7 * status of the sync backend and user preferences on what data to sync. Used |
| 8 * for both Chrome browser and ChromeOS. | 8 * for both Chrome browser and ChromeOS. |
| 9 */ | 9 */ |
| 10 cr.exportPath('settings'); | 10 cr.exportPath('settings'); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 TIMEOUT: 'timeout', // Preferences loading has timed out. | 101 TIMEOUT: 'timeout', // Preferences loading has timed out. |
| 102 DONE: 'done', // Sync subpage can be closed now. | 102 DONE: 'done', // Sync subpage can be closed now. |
| 103 PASSPHRASE_FAILED: 'passphraseFailed', // Error in the passphrase. | 103 PASSPHRASE_FAILED: 'passphraseFailed', // Error in the passphrase. |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 cr.define('settings', function() { | 106 cr.define('settings', function() { |
| 107 /** @interface */ | 107 /** @interface */ |
| 108 function SyncBrowserProxy() {} | 108 function SyncBrowserProxy() {} |
| 109 | 109 |
| 110 SyncBrowserProxy.prototype = { | 110 SyncBrowserProxy.prototype = { |
| 111 // <if expr="not chromeos"> | 111 // <if expr="not chromeos"> |
| 112 /** | 112 /** |
| 113 * Starts the signin process for the user. Does nothing if the user is | 113 * Starts the signin process for the user. Does nothing if the user is |
| 114 * already signed in. | 114 * already signed in. |
| 115 */ | 115 */ |
| 116 startSignIn: function() {}, | 116 startSignIn: function() {}, |
| 117 | 117 |
| 118 /** | 118 /** |
| 119 * Signs out the signed-in user. | 119 * Signs out the signed-in user. |
| 120 * @param {boolean} deleteProfile | 120 * @param {boolean} deleteProfile |
| 121 */ | 121 */ |
| 122 signOut: function(deleteProfile) {}, | 122 signOut: function(deleteProfile) {}, |
| 123 | 123 |
| 124 /** | 124 /** |
| 125 * Opens the multi-profile user manager. | 125 * Opens the multi-profile user manager. |
| 126 */ | 126 */ |
| 127 manageOtherPeople: function() {}, | 127 manageOtherPeople: function() {}, |
| 128 // </if> | 128 // </if> |
| 129 | 129 |
| 130 // <if expr="chromeos"> | 130 // <if expr="chromeos"> |
| 131 /** | 131 /** |
| 132 * Signs the user out. | 132 * Signs the user out. |
| 133 */ | 133 */ |
| 134 attemptUserExit: function() {}, | 134 attemptUserExit: function() {}, |
| 135 // </if> | 135 // </if> |
| 136 | 136 |
| 137 /** | 137 /** |
| 138 * Gets the current sync status. | 138 * Gets the current sync status. |
| 139 * @return {!Promise<!settings.SyncStatus>} | 139 * @return {!Promise<!settings.SyncStatus>} |
| 140 */ | 140 */ |
| 141 getSyncStatus: function() {}, | 141 getSyncStatus: function() {}, |
| 142 | 142 |
| 143 /** | 143 /** |
| 144 * Function to invoke when the sync page has been navigated to. This | 144 * Function to invoke when the sync page has been navigated to. This |
| 145 * registers the UI as the "active" sync UI so that if the user tries to | 145 * registers the UI as the "active" sync UI so that if the user tries to |
| (...skipping 28 matching lines...) Expand all Loading... |
| 174 }; | 174 }; |
| 175 | 175 |
| 176 /** | 176 /** |
| 177 * @constructor | 177 * @constructor |
| 178 * @implements {settings.SyncBrowserProxy} | 178 * @implements {settings.SyncBrowserProxy} |
| 179 */ | 179 */ |
| 180 function SyncBrowserProxyImpl() {} | 180 function SyncBrowserProxyImpl() {} |
| 181 cr.addSingletonGetter(SyncBrowserProxyImpl); | 181 cr.addSingletonGetter(SyncBrowserProxyImpl); |
| 182 | 182 |
| 183 SyncBrowserProxyImpl.prototype = { | 183 SyncBrowserProxyImpl.prototype = { |
| 184 // <if expr="not chromeos"> | 184 // <if expr="not chromeos"> |
| 185 /** @override */ | 185 /** @override */ |
| 186 startSignIn: function() { | 186 startSignIn: function() { |
| 187 chrome.send('SyncSetupStartSignIn'); | 187 chrome.send('SyncSetupStartSignIn'); |
| 188 }, | 188 }, |
| 189 | 189 |
| 190 /** @override */ | 190 /** @override */ |
| 191 signOut: function(deleteProfile) { | 191 signOut: function(deleteProfile) { |
| 192 chrome.send('SyncSetupStopSyncing', [deleteProfile]); | 192 chrome.send('SyncSetupStopSyncing', [deleteProfile]); |
| 193 }, | 193 }, |
| 194 | 194 |
| 195 /** @override */ | 195 /** @override */ |
| 196 manageOtherPeople: function() { | 196 manageOtherPeople: function() { |
| 197 chrome.send('SyncSetupManageOtherPeople'); | 197 chrome.send('SyncSetupManageOtherPeople'); |
| 198 }, | 198 }, |
| 199 // </if> | 199 // </if> |
| 200 // <if expr="chromeos"> | 200 // <if expr="chromeos"> |
| 201 /** @override */ | 201 /** @override */ |
| 202 attemptUserExit: function() { | 202 attemptUserExit: function() { |
| 203 return chrome.send('AttemptUserExit'); | 203 return chrome.send('AttemptUserExit'); |
| 204 }, | 204 }, |
| 205 // </if> | 205 // </if> |
| 206 | 206 |
| 207 /** @override */ | 207 /** @override */ |
| 208 getSyncStatus: function() { | 208 getSyncStatus: function() { |
| 209 return cr.sendWithPromise('SyncSetupGetSyncStatus'); | 209 return cr.sendWithPromise('SyncSetupGetSyncStatus'); |
| 210 }, | 210 }, |
| 211 | 211 |
| 212 /** @override */ | 212 /** @override */ |
| 213 didNavigateToSyncPage: function() { | 213 didNavigateToSyncPage: function() { |
| 214 chrome.send('SyncSetupShowSetupUI'); | 214 chrome.send('SyncSetupShowSetupUI'); |
| 215 }, | 215 }, |
| 216 | 216 |
| 217 /** @override */ | 217 /** @override */ |
| 218 didNavigateAwayFromSyncPage: function() { | 218 didNavigateAwayFromSyncPage: function() { |
| 219 chrome.send('SyncSetupDidClosePage'); | 219 chrome.send('SyncSetupDidClosePage'); |
| 220 }, | 220 }, |
| 221 | 221 |
| 222 /** @override */ | 222 /** @override */ |
| 223 setSyncDatatypes: function(syncPrefs) { | 223 setSyncDatatypes: function(syncPrefs) { |
| 224 return cr.sendWithPromise('SyncSetupSetDatatypes', | 224 return cr.sendWithPromise( |
| 225 JSON.stringify(syncPrefs)); | 225 'SyncSetupSetDatatypes', JSON.stringify(syncPrefs)); |
| 226 }, | 226 }, |
| 227 | 227 |
| 228 /** @override */ | 228 /** @override */ |
| 229 setSyncEncryption: function(syncPrefs) { | 229 setSyncEncryption: function(syncPrefs) { |
| 230 return cr.sendWithPromise('SyncSetupSetEncryption', | 230 return cr.sendWithPromise( |
| 231 JSON.stringify(syncPrefs)); | 231 'SyncSetupSetEncryption', JSON.stringify(syncPrefs)); |
| 232 }, | 232 }, |
| 233 | 233 |
| 234 /** @override */ | 234 /** @override */ |
| 235 openActivityControlsUrl: function() { | 235 openActivityControlsUrl: function() { |
| 236 chrome.metricsPrivate.recordUserAction( | 236 chrome.metricsPrivate.recordUserAction( |
| 237 'Signin_AccountSettings_GoogleActivityControlsClicked'); | 237 'Signin_AccountSettings_GoogleActivityControlsClicked'); |
| 238 } | 238 } |
| 239 }; | 239 }; |
| 240 | 240 |
| 241 return { | 241 return { |
| 242 SyncBrowserProxy: SyncBrowserProxy, | 242 SyncBrowserProxy: SyncBrowserProxy, |
| 243 SyncBrowserProxyImpl: SyncBrowserProxyImpl, | 243 SyncBrowserProxyImpl: SyncBrowserProxyImpl, |
| 244 }; | 244 }; |
| 245 }); | 245 }); |
| OLD | NEW |