Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: chrome/browser/resources/settings/people_page/sync_browser_proxy.js

Issue 2617663002: WIP: run clang-format-js on lots of things (Closed)
Patch Set: merge Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 17 matching lines...) Expand all
28 */ 28 */
29 settings.SyncStatus; 29 settings.SyncStatus;
30 30
31 31
32 /** 32 /**
33 * Must be kept in sync with the return values of getSyncErrorAction in 33 * Must be kept in sync with the return values of getSyncErrorAction in
34 * chrome/browser/ui/webui/settings/people_handler.cc 34 * chrome/browser/ui/webui/settings/people_handler.cc
35 * @enum {string} 35 * @enum {string}
36 */ 36 */
37 settings.StatusAction = { 37 settings.StatusAction = {
38 NO_ACTION: 'noAction', // No action to take. 38 NO_ACTION: 'noAction', // No action to take.
39 REAUTHENTICATE: 'reauthenticate', // User needs to reauthenticate. 39 REAUTHENTICATE: 'reauthenticate', // User needs to reauthenticate.
40 SIGNOUT_AND_SIGNIN: 'signOutAndSignIn', // User needs to sign out and sign in. 40 SIGNOUT_AND_SIGNIN:
41 UPGRADE_CLIENT: 'upgradeClient', // User needs to upgrade the client. 41 'signOutAndSignIn', // User needs to sign out and sign in.
42 ENTER_PASSPHRASE: 'enterPassphrase', // User needs to enter passphrase. 42 UPGRADE_CLIENT: 'upgradeClient', // User needs to upgrade the client.
43 ENTER_PASSPHRASE: 'enterPassphrase', // User needs to enter passphrase.
43 }; 44 };
44 45
45 /** 46 /**
46 * The state of sync. This is the data structure sent back and forth between 47 * The state of sync. This is the data structure sent back and forth between
47 * C++ and JS. Its naming and structure is not optimal, but changing it would 48 * C++ and JS. Its naming and structure is not optimal, but changing it would
48 * require changes to the C++ handler, which is already functional. 49 * require changes to the C++ handler, which is already functional.
49 * @typedef {{ 50 * @typedef {{
50 * appsEnforced: boolean, 51 * appsEnforced: boolean,
51 * appsRegistered: boolean, 52 * appsRegistered: boolean,
52 * appsSynced: boolean, 53 * appsSynced: boolean,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 TIMEOUT: 'timeout', // Preferences loading has timed out. 99 TIMEOUT: 'timeout', // Preferences loading has timed out.
99 DONE: 'done', // Sync subpage can be closed now. 100 DONE: 'done', // Sync subpage can be closed now.
100 PASSPHRASE_FAILED: 'passphraseFailed', // Error in the passphrase. 101 PASSPHRASE_FAILED: 'passphraseFailed', // Error in the passphrase.
101 }; 102 };
102 103
103 cr.define('settings', function() { 104 cr.define('settings', function() {
104 /** @interface */ 105 /** @interface */
105 function SyncBrowserProxy() {} 106 function SyncBrowserProxy() {}
106 107
107 SyncBrowserProxy.prototype = { 108 SyncBrowserProxy.prototype = {
108 <if expr="not chromeos"> 109 /* <if expr="not chromeos"> */
109 /** 110 /**
110 * Starts the signin process for the user. Does nothing if the user is 111 * Starts the signin process for the user. Does nothing if the user is
111 * already signed in. 112 * already signed in.
112 */ 113 */
113 startSignIn: function() {}, 114 startSignIn: function() {},
114 115
115 /** 116 /**
116 * Signs out the signed-in user. 117 * Signs out the signed-in user.
117 * @param {boolean} deleteProfile 118 * @param {boolean} deleteProfile
118 */ 119 */
119 signOut: function(deleteProfile) {}, 120 signOut: function(deleteProfile) {},
120 121
121 /** 122 /**
122 * Opens the multi-profile user manager. 123 * Opens the multi-profile user manager.
123 */ 124 */
124 manageOtherPeople: function() {}, 125 manageOtherPeople: function() {},
125 </if> 126 /* </if> */
126 127
127 <if expr="chromeos"> 128 /* <if expr="chromeos"> */
128 /** 129 /**
129 * Signs the user out. 130 * Signs the user out.
130 */ 131 */
131 attemptUserExit: function() {}, 132 attemptUserExit: function() {},
132 </if> 133 /* </if> */
133 134
134 /** 135 /**
135 * Gets the current sync status. 136 * Gets the current sync status.
136 * @return {!Promise<!settings.SyncStatus>} 137 * @return {!Promise<!settings.SyncStatus>}
137 */ 138 */
138 getSyncStatus: function() {}, 139 getSyncStatus: function() {},
139 140
140 /** 141 /**
141 * Function to invoke when the sync page has been navigated to. This 142 * Function to invoke when the sync page has been navigated to. This
142 * registers the UI as the "active" sync UI so that if the user tries to 143 * registers the UI as the "active" sync UI so that if the user tries to
(...skipping 28 matching lines...) Expand all
171 }; 172 };
172 173
173 /** 174 /**
174 * @constructor 175 * @constructor
175 * @implements {settings.SyncBrowserProxy} 176 * @implements {settings.SyncBrowserProxy}
176 */ 177 */
177 function SyncBrowserProxyImpl() {} 178 function SyncBrowserProxyImpl() {}
178 cr.addSingletonGetter(SyncBrowserProxyImpl); 179 cr.addSingletonGetter(SyncBrowserProxyImpl);
179 180
180 SyncBrowserProxyImpl.prototype = { 181 SyncBrowserProxyImpl.prototype = {
181 <if expr="not chromeos"> 182 /* <if expr="not chromeos"> */
182 /** @override */ 183 /** @override */
183 startSignIn: function() { 184 startSignIn: function() {
184 chrome.send('SyncSetupStartSignIn'); 185 chrome.send('SyncSetupStartSignIn');
185 }, 186 },
186 187
187 /** @override */ 188 /** @override */
188 signOut: function(deleteProfile) { 189 signOut: function(deleteProfile) {
189 chrome.send('SyncSetupStopSyncing', [deleteProfile]); 190 chrome.send('SyncSetupStopSyncing', [deleteProfile]);
190 }, 191 },
191 192
192 /** @override */ 193 /** @override */
193 manageOtherPeople: function() { 194 manageOtherPeople: function() {
194 chrome.send('SyncSetupManageOtherPeople'); 195 chrome.send('SyncSetupManageOtherPeople');
195 }, 196 },
196 </if> 197 /* </if> */
197 <if expr="chromeos"> 198 /* <if expr="chromeos"> */
198 /** @override */ 199 /** @override */
199 attemptUserExit: function() { 200 attemptUserExit: function() {
200 return chrome.send('AttemptUserExit'); 201 return chrome.send('AttemptUserExit');
201 }, 202 },
202 </if> 203 /* </if> */
203 204
204 /** @override */ 205 /** @override */
205 getSyncStatus: function() { 206 getSyncStatus: function() {
206 return cr.sendWithPromise('SyncSetupGetSyncStatus'); 207 return cr.sendWithPromise('SyncSetupGetSyncStatus');
207 }, 208 },
208 209
209 /** @override */ 210 /** @override */
210 didNavigateToSyncPage: function() { 211 didNavigateToSyncPage: function() {
211 chrome.send('SyncSetupShowSetupUI'); 212 chrome.send('SyncSetupShowSetupUI');
212 }, 213 },
213 214
214 /** @override */ 215 /** @override */
215 didNavigateAwayFromSyncPage: function() { 216 didNavigateAwayFromSyncPage: function() {
216 chrome.send('SyncSetupDidClosePage'); 217 chrome.send('SyncSetupDidClosePage');
217 }, 218 },
218 219
219 /** @override */ 220 /** @override */
220 setSyncDatatypes: function(syncPrefs) { 221 setSyncDatatypes: function(syncPrefs) {
221 return cr.sendWithPromise('SyncSetupSetDatatypes', 222 return cr.sendWithPromise(
222 JSON.stringify(syncPrefs)); 223 'SyncSetupSetDatatypes', JSON.stringify(syncPrefs));
223 }, 224 },
224 225
225 /** @override */ 226 /** @override */
226 setSyncEncryption: function(syncPrefs) { 227 setSyncEncryption: function(syncPrefs) {
227 return cr.sendWithPromise('SyncSetupSetEncryption', 228 return cr.sendWithPromise(
228 JSON.stringify(syncPrefs)); 229 'SyncSetupSetEncryption', JSON.stringify(syncPrefs));
229 }, 230 },
230 231
231 /** @override */ 232 /** @override */
232 openActivityControlsUrl: function() { 233 openActivityControlsUrl: function() {
233 chrome.metricsPrivate.recordUserAction( 234 chrome.metricsPrivate.recordUserAction(
234 'Signin_AccountSettings_GoogleActivityControlsClicked'); 235 'Signin_AccountSettings_GoogleActivityControlsClicked');
235 window.open(loadTimeData.getString('activityControlsUrl')); 236 window.open(loadTimeData.getString('activityControlsUrl'));
236 } 237 }
237 }; 238 };
238 239
239 return { 240 return {
240 SyncBrowserProxy: SyncBrowserProxy, 241 SyncBrowserProxy: SyncBrowserProxy,
241 SyncBrowserProxyImpl: SyncBrowserProxyImpl, 242 SyncBrowserProxyImpl: SyncBrowserProxyImpl,
242 }; 243 };
243 }); 244 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698