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

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

Issue 2617823002: GRIT: put <if> and <include> behind comments in .js files to make syntactically valid JS (Closed)
Patch Set: add dep 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 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 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * 'settings-people-page' is the settings page containing sign-in settings. 7 * 'settings-people-page' is the settings page containing sign-in settings.
8 */ 8 */
9 Polymer({ 9 Polymer({
10 is: 'settings-people-page', 10 is: 'settings-people-page',
11 11
12 behaviors: [ 12 behaviors: [
13 settings.RouteObserverBehavior, 13 settings.RouteObserverBehavior,
14 I18nBehavior, 14 I18nBehavior,
15 WebUIListenerBehavior, 15 WebUIListenerBehavior,
16 <if expr="chromeos"> 16 // <if expr="chromeos">
17 LockStateBehavior, 17 LockStateBehavior,
18 </if> 18 // </if>
19 ], 19 ],
20 20
21 properties: { 21 properties: {
22 /** 22 /**
23 * Preferences state. 23 * Preferences state.
24 */ 24 */
25 prefs: { 25 prefs: {
26 type: Object, 26 type: Object,
27 notify: true, 27 notify: true,
28 }, 28 },
(...skipping 29 matching lines...) Expand all
58 /** 58 /**
59 * True if the profile deletion warning is visible. 59 * True if the profile deletion warning is visible.
60 */ 60 */
61 deleteProfileWarningVisible_: Boolean, 61 deleteProfileWarningVisible_: Boolean,
62 62
63 /** 63 /**
64 * True if the checkbox to delete the profile has been checked. 64 * True if the checkbox to delete the profile has been checked.
65 */ 65 */
66 deleteProfile_: Boolean, 66 deleteProfile_: Boolean,
67 67
68 <if expr="not chromeos"> 68 // <if expr="not chromeos">
69 /** @private */ 69 /** @private */
70 showImportDataDialog_: { 70 showImportDataDialog_: {
71 type: Boolean, 71 type: Boolean,
72 value: false, 72 value: false,
73 }, 73 },
74 </if> 74 // </if>
75 75
76 /** @private {!settings.SyncBrowserProxy} */ 76 /** @private {!settings.SyncBrowserProxy} */
77 syncBrowserProxy_: { 77 syncBrowserProxy_: {
78 type: Object, 78 type: Object,
79 value: function() { 79 value: function() {
80 return settings.SyncBrowserProxyImpl.getInstance(); 80 return settings.SyncBrowserProxyImpl.getInstance();
81 }, 81 },
82 }, 82 },
83 83
84 <if expr="chromeos"> 84 // <if expr="chromeos">
85 /** 85 /**
86 * True if quick unlock settings should be displayed on this machine. 86 * True if quick unlock settings should be displayed on this machine.
87 * @private 87 * @private
88 */ 88 */
89 quickUnlockEnabled_: { 89 quickUnlockEnabled_: {
90 type: Boolean, 90 type: Boolean,
91 value: function() { 91 value: function() {
92 return loadTimeData.getBoolean('pinUnlockEnabled'); 92 return loadTimeData.getBoolean('pinUnlockEnabled');
93 }, 93 },
94 readOnly: true, 94 readOnly: true,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 loadTimeData.getBoolean('easyUnlockProximityDetectionAllowed'); 133 loadTimeData.getBoolean('easyUnlockProximityDetectionAllowed');
134 }, 134 },
135 readOnly: true, 135 readOnly: true,
136 }, 136 },
137 137
138 /** @private */ 138 /** @private */
139 showEasyUnlockTurnOffDialog_: { 139 showEasyUnlockTurnOffDialog_: {
140 type: Boolean, 140 type: Boolean,
141 value: false, 141 value: false,
142 }, 142 },
143 </if> 143 // </if>
144 }, 144 },
145 145
146 /** @override */ 146 /** @override */
147 attached: function() { 147 attached: function() {
148 var profileInfoProxy = settings.ProfileInfoBrowserProxyImpl.getInstance(); 148 var profileInfoProxy = settings.ProfileInfoBrowserProxyImpl.getInstance();
149 profileInfoProxy.getProfileInfo().then(this.handleProfileInfo_.bind(this)); 149 profileInfoProxy.getProfileInfo().then(this.handleProfileInfo_.bind(this));
150 this.addWebUIListener('profile-info-changed', 150 this.addWebUIListener('profile-info-changed',
151 this.handleProfileInfo_.bind(this)); 151 this.handleProfileInfo_.bind(this));
152 152
153 profileInfoProxy.getProfileManagesSupervisedUsers().then( 153 profileInfoProxy.getProfileManagesSupervisedUsers().then(
154 this.handleProfileManagesSupervisedUsers_.bind(this)); 154 this.handleProfileManagesSupervisedUsers_.bind(this));
155 this.addWebUIListener('profile-manages-supervised-users-changed', 155 this.addWebUIListener('profile-manages-supervised-users-changed',
156 this.handleProfileManagesSupervisedUsers_.bind(this)); 156 this.handleProfileManagesSupervisedUsers_.bind(this));
157 157
158 this.addWebUIListener('profile-stats-count-ready', 158 this.addWebUIListener('profile-stats-count-ready',
159 this.handleProfileStatsCount_.bind(this)); 159 this.handleProfileStatsCount_.bind(this));
160 160
161 this.syncBrowserProxy_.getSyncStatus().then( 161 this.syncBrowserProxy_.getSyncStatus().then(
162 this.handleSyncStatus_.bind(this)); 162 this.handleSyncStatus_.bind(this));
163 this.addWebUIListener('sync-status-changed', 163 this.addWebUIListener('sync-status-changed',
164 this.handleSyncStatus_.bind(this)); 164 this.handleSyncStatus_.bind(this));
165 165
166 <if expr="chromeos"> 166 // <if expr="chromeos">
167 if (this.easyUnlockAllowed_) { 167 if (this.easyUnlockAllowed_) {
168 this.addWebUIListener( 168 this.addWebUIListener(
169 'easy-unlock-enabled-status', 169 'easy-unlock-enabled-status',
170 this.handleEasyUnlockEnabledStatusChanged_.bind(this)); 170 this.handleEasyUnlockEnabledStatusChanged_.bind(this));
171 this.easyUnlockBrowserProxy_.getEnabledStatus().then( 171 this.easyUnlockBrowserProxy_.getEnabledStatus().then(
172 this.handleEasyUnlockEnabledStatusChanged_.bind(this)); 172 this.handleEasyUnlockEnabledStatusChanged_.bind(this));
173 } 173 }
174 </if> 174 // </if>
175 }, 175 },
176 176
177 /** @protected */ 177 /** @protected */
178 currentRouteChanged: function() { 178 currentRouteChanged: function() {
179 this.showImportDataDialog_ = 179 this.showImportDataDialog_ =
180 settings.getCurrentRoute() == settings.Route.IMPORT_DATA; 180 settings.getCurrentRoute() == settings.Route.IMPORT_DATA;
181 181
182 if (settings.getCurrentRoute() == settings.Route.SIGN_OUT) { 182 if (settings.getCurrentRoute() == settings.Route.SIGN_OUT) {
183 // Request the latest profile stats count, but don't wait for it. 183 // Request the latest profile stats count, but don't wait for it.
184 settings.ProfileInfoBrowserProxyImpl.getInstance().getProfileStatsCount(); 184 settings.ProfileInfoBrowserProxyImpl.getInstance().getProfileStatsCount();
185 185
186 // If the sync status has not been fetched yet, optimistically display 186 // If the sync status has not been fetched yet, optimistically display
187 // the disconnect dialog. There is another check when the sync status is 187 // the disconnect dialog. There is another check when the sync status is
188 // fetched. The dialog will be closed then the user is not signed in. 188 // fetched. The dialog will be closed then the user is not signed in.
189 if (this.syncStatus && !this.syncStatus.signedIn) 189 if (this.syncStatus && !this.syncStatus.signedIn)
190 settings.navigateToPreviousRoute(); 190 settings.navigateToPreviousRoute();
191 else 191 else
192 this.$.disconnectDialog.showModal(); 192 this.$.disconnectDialog.showModal();
193 } else if (this.$.disconnectDialog.open) { 193 } else if (this.$.disconnectDialog.open) {
194 this.$.disconnectDialog.close(); 194 this.$.disconnectDialog.close();
195 } 195 }
196 }, 196 },
197 197
198 <if expr="chromeos"> 198 // <if expr="chromeos">
199 /** @private */ 199 /** @private */
200 getPasswordState_: function(hasPin, enableScreenLock) { 200 getPasswordState_: function(hasPin, enableScreenLock) {
201 if (!enableScreenLock) 201 if (!enableScreenLock)
202 return this.i18n('lockScreenNone'); 202 return this.i18n('lockScreenNone');
203 if (hasPin) 203 if (hasPin)
204 return this.i18n('lockScreenPinOrPassword'); 204 return this.i18n('lockScreenPinOrPassword');
205 return this.i18n('lockScreenPasswordOnly'); 205 return this.i18n('lockScreenPasswordOnly');
206 }, 206 },
207 </if> 207 // </if>
208 208
209 /** 209 /**
210 * Handler for when the profile's icon and name is updated. 210 * Handler for when the profile's icon and name is updated.
211 * @private 211 * @private
212 * @param {!settings.ProfileInfo} info 212 * @param {!settings.ProfileInfo} info
213 */ 213 */
214 handleProfileInfo_: function(info) { 214 handleProfileInfo_: function(info) {
215 this.profileName_ = info.name; 215 this.profileName_ = info.name;
216 this.profileIconUrl_ = info.iconUrl; 216 this.profileIconUrl_ = info.iconUrl;
217 }, 217 },
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 handleSyncStatus_: function(syncStatus) { 249 handleSyncStatus_: function(syncStatus) {
250 if (!this.syncStatus && syncStatus && !syncStatus.signedIn) 250 if (!this.syncStatus && syncStatus && !syncStatus.signedIn)
251 chrome.metricsPrivate.recordUserAction('Signin_Impression_FromSettings'); 251 chrome.metricsPrivate.recordUserAction('Signin_Impression_FromSettings');
252 252
253 if (!syncStatus.signedIn && this.$.disconnectDialog.open) 253 if (!syncStatus.signedIn && this.$.disconnectDialog.open)
254 this.$.disconnectDialog.close(); 254 this.$.disconnectDialog.close();
255 255
256 this.syncStatus = syncStatus; 256 this.syncStatus = syncStatus;
257 }, 257 },
258 258
259 <if expr="chromeos"> 259 // <if expr="chromeos">
260 /** 260 /**
261 * Handler for when the Easy Unlock enabled status has changed. 261 * Handler for when the Easy Unlock enabled status has changed.
262 * @private 262 * @private
263 */ 263 */
264 handleEasyUnlockEnabledStatusChanged_: function(easyUnlockEnabled) { 264 handleEasyUnlockEnabledStatusChanged_: function(easyUnlockEnabled) {
265 this.easyUnlockEnabled_ = easyUnlockEnabled; 265 this.easyUnlockEnabled_ = easyUnlockEnabled;
266 this.showEasyUnlockTurnOffDialog_ = 266 this.showEasyUnlockTurnOffDialog_ =
267 easyUnlockEnabled && this.showEasyUnlockTurnOffDialog_; 267 easyUnlockEnabled && this.showEasyUnlockTurnOffDialog_;
268 }, 268 },
269 </if> 269 // </if>
270 270
271 /** @private */ 271 /** @private */
272 onPictureTap_: function() { 272 onPictureTap_: function() {
273 <if expr="chromeos"> 273 // <if expr="chromeos">
274 settings.navigateTo(settings.Route.CHANGE_PICTURE); 274 settings.navigateTo(settings.Route.CHANGE_PICTURE);
275 </if> 275 // </if>
276 <if expr="not chromeos"> 276 // <if expr="not chromeos">
277 settings.navigateTo(settings.Route.MANAGE_PROFILE); 277 settings.navigateTo(settings.Route.MANAGE_PROFILE);
278 </if> 278 // </if>
279 }, 279 },
280 280
281 <if expr="not chromeos"> 281 // <if expr="not chromeos">
282 /** @private */ 282 /** @private */
283 onProfileNameTap_: function() { 283 onProfileNameTap_: function() {
284 settings.navigateTo(settings.Route.MANAGE_PROFILE); 284 settings.navigateTo(settings.Route.MANAGE_PROFILE);
285 }, 285 },
286 </if> 286 // </if>
287 287
288 /** @private */ 288 /** @private */
289 onActivityControlsTap_: function() { 289 onActivityControlsTap_: function() {
290 this.syncBrowserProxy_.openActivityControlsUrl(); 290 this.syncBrowserProxy_.openActivityControlsUrl();
291 }, 291 },
292 292
293 /** @private */ 293 /** @private */
294 onSigninTap_: function() { 294 onSigninTap_: function() {
295 this.syncBrowserProxy_.startSignIn(); 295 this.syncBrowserProxy_.startSignIn();
296 }, 296 },
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 assert(this.syncStatus.syncSystemEnabled); 334 assert(this.syncStatus.syncSystemEnabled);
335 335
336 if (!this.isSyncStatusActionable_(this.syncStatus)) 336 if (!this.isSyncStatusActionable_(this.syncStatus))
337 return; 337 return;
338 338
339 switch (this.syncStatus.statusAction) { 339 switch (this.syncStatus.statusAction) {
340 case settings.StatusAction.REAUTHENTICATE: 340 case settings.StatusAction.REAUTHENTICATE:
341 this.syncBrowserProxy_.startSignIn(); 341 this.syncBrowserProxy_.startSignIn();
342 break; 342 break;
343 case settings.StatusAction.SIGNOUT_AND_SIGNIN: 343 case settings.StatusAction.SIGNOUT_AND_SIGNIN:
344 <if expr="chromeos"> 344 // <if expr="chromeos">
345 this.syncBrowserProxy_.attemptUserExit(); 345 this.syncBrowserProxy_.attemptUserExit();
346 </if> 346 // </if>
347 <if expr="not chromeos"> 347 // <if expr="not chromeos">
348 if (this.syncStatus.domain) 348 if (this.syncStatus.domain)
349 settings.navigateTo(settings.Route.SIGN_OUT); 349 settings.navigateTo(settings.Route.SIGN_OUT);
350 else { 350 else {
351 // Silently sign the user out without deleting their profile and 351 // Silently sign the user out without deleting their profile and
352 // prompt them to sign back in. 352 // prompt them to sign back in.
353 this.syncBrowserProxy_.signOut(false); 353 this.syncBrowserProxy_.signOut(false);
354 this.syncBrowserProxy_.startSignIn(); 354 this.syncBrowserProxy_.startSignIn();
355 } 355 }
356 </if> 356 // </if>
357 break; 357 break;
358 case settings.StatusAction.UPGRADE_CLIENT: 358 case settings.StatusAction.UPGRADE_CLIENT:
359 settings.navigateTo(settings.Route.ABOUT); 359 settings.navigateTo(settings.Route.ABOUT);
360 break; 360 break;
361 case settings.StatusAction.ENTER_PASSPHRASE: 361 case settings.StatusAction.ENTER_PASSPHRASE:
362 case settings.StatusAction.NO_ACTION: 362 case settings.StatusAction.NO_ACTION:
363 default: 363 default:
364 settings.navigateTo(settings.Route.SYNC); 364 settings.navigateTo(settings.Route.SYNC);
365 } 365 }
366 }, 366 },
367 367
368 <if expr="chromeos"> 368 // <if expr="chromeos">
369 /** @private */ 369 /** @private */
370 onConfigureLockTap_: function() { 370 onConfigureLockTap_: function() {
371 settings.navigateTo(settings.Route.LOCK_SCREEN); 371 settings.navigateTo(settings.Route.LOCK_SCREEN);
372 }, 372 },
373 373
374 /** @private */ 374 /** @private */
375 onEasyUnlockSetupTap_: function() { 375 onEasyUnlockSetupTap_: function() {
376 this.easyUnlockBrowserProxy_.startTurnOnFlow(); 376 this.easyUnlockBrowserProxy_.startTurnOnFlow();
377 }, 377 },
378 378
379 /** 379 /**
380 * @param {!Event} e 380 * @param {!Event} e
381 * @private 381 * @private
382 */ 382 */
383 onEasyUnlockTurnOffTap_: function(e) { 383 onEasyUnlockTurnOffTap_: function(e) {
384 e.preventDefault(); 384 e.preventDefault();
385 this.showEasyUnlockTurnOffDialog_ = true; 385 this.showEasyUnlockTurnOffDialog_ = true;
386 }, 386 },
387 387
388 /** @private */ 388 /** @private */
389 onEasyUnlockTurnOffDialogClose_: function() { 389 onEasyUnlockTurnOffDialogClose_: function() {
390 this.showEasyUnlockTurnOffDialog_ = false; 390 this.showEasyUnlockTurnOffDialog_ = false;
391 }, 391 },
392 </if> 392 // </if>
393 393
394 /** @private */ 394 /** @private */
395 onManageOtherPeople_: function() { 395 onManageOtherPeople_: function() {
396 <if expr="not chromeos"> 396 // <if expr="not chromeos">
397 this.syncBrowserProxy_.manageOtherPeople(); 397 this.syncBrowserProxy_.manageOtherPeople();
398 </if> 398 // </if>
399 <if expr="chromeos"> 399 // <if expr="chromeos">
400 settings.navigateTo(settings.Route.ACCOUNTS); 400 settings.navigateTo(settings.Route.ACCOUNTS);
401 </if> 401 // </if>
402 }, 402 },
403 403
404 /** @private */ 404 /** @private */
405 onManageSupervisedUsers_: function() { 405 onManageSupervisedUsers_: function() {
406 window.open(loadTimeData.getString('supervisedUsersUrl')); 406 window.open(loadTimeData.getString('supervisedUsersUrl'));
407 }, 407 },
408 408
409 <if expr="not chromeos"> 409 // <if expr="not chromeos">
410 /** 410 /**
411 * @private 411 * @private
412 * @param {string} domain 412 * @param {string} domain
413 * @return {string} 413 * @return {string}
414 */ 414 */
415 getDomainHtml_: function(domain) { 415 getDomainHtml_: function(domain) {
416 var innerSpan = 416 var innerSpan =
417 '<span id="managed-by-domain-name">' + domain + '</span>'; 417 '<span id="managed-by-domain-name">' + domain + '</span>';
418 return loadTimeData.getStringF('domainManagedProfile', innerSpan); 418 return loadTimeData.getStringF('domainManagedProfile', innerSpan);
419 }, 419 },
420 420
421 /** @private */ 421 /** @private */
422 onImportDataTap_: function() { 422 onImportDataTap_: function() {
423 settings.navigateTo(settings.Route.IMPORT_DATA); 423 settings.navigateTo(settings.Route.IMPORT_DATA);
424 }, 424 },
425 425
426 /** @private */ 426 /** @private */
427 onImportDataDialogClosed_: function() { 427 onImportDataDialogClosed_: function() {
428 settings.navigateToPreviousRoute(); 428 settings.navigateToPreviousRoute();
429 }, 429 },
430 </if> 430 // </if>
431 431
432 /** 432 /**
433 * @private 433 * @private
434 * @param {string} domain 434 * @param {string} domain
435 * @return {string} 435 * @return {string}
436 */ 436 */
437 getDisconnectExplanationHtml_: function(domain) { 437 getDisconnectExplanationHtml_: function(domain) {
438 <if expr="not chromeos"> 438 // <if expr="not chromeos">
439 if (domain) { 439 if (domain) {
440 return loadTimeData.getStringF( 440 return loadTimeData.getStringF(
441 'syncDisconnectManagedProfileExplanation', 441 'syncDisconnectManagedProfileExplanation',
442 '<span id="managed-by-domain-name">' + domain + '</span>'); 442 '<span id="managed-by-domain-name">' + domain + '</span>');
443 } 443 }
444 </if> 444 // </if>
445 return loadTimeData.getString('syncDisconnectExplanation'); 445 return loadTimeData.getString('syncDisconnectExplanation');
446 }, 446 },
447 447
448 /** 448 /**
449 * @private 449 * @private
450 * @param {?settings.SyncStatus} syncStatus 450 * @param {?settings.SyncStatus} syncStatus
451 * @return {boolean} 451 * @return {boolean}
452 */ 452 */
453 isAdvancedSyncSettingsVisible_: function(syncStatus) { 453 isAdvancedSyncSettingsVisible_: function(syncStatus) {
454 return !!syncStatus && !!syncStatus.signedIn && 454 return !!syncStatus && !!syncStatus.signedIn &&
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 508
509 /** 509 /**
510 * @param {!settings.SyncStatus} syncStatus 510 * @param {!settings.SyncStatus} syncStatus
511 * @return {boolean} Whether to show the "Sign in to Chrome" button. 511 * @return {boolean} Whether to show the "Sign in to Chrome" button.
512 * @private 512 * @private
513 */ 513 */
514 showSignin_: function(syncStatus) { 514 showSignin_: function(syncStatus) {
515 return !!syncStatus.signinAllowed && !syncStatus.signedIn; 515 return !!syncStatus.signinAllowed && !syncStatus.signedIn;
516 }, 516 },
517 }); 517 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698