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

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

Issue 2498013003: MD Settings: Suppress the signout dialog if user is not signed in. (Closed)
Patch Set: solve flakiness Created 4 years, 1 month 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
« no previous file with comments | « no previous file | chrome/test/data/webui/settings/people_page_test.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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',
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 'easy-unlock-enabled-status', 135 'easy-unlock-enabled-status',
136 this.handleEasyUnlockEnabledStatusChanged_.bind(this)); 136 this.handleEasyUnlockEnabledStatusChanged_.bind(this));
137 this.easyUnlockBrowserProxy_.getEnabledStatus().then( 137 this.easyUnlockBrowserProxy_.getEnabledStatus().then(
138 this.handleEasyUnlockEnabledStatusChanged_.bind(this)); 138 this.handleEasyUnlockEnabledStatusChanged_.bind(this));
139 } 139 }
140 </if> 140 </if>
141 }, 141 },
142 142
143 /** @protected */ 143 /** @protected */
144 currentRouteChanged: function() { 144 currentRouteChanged: function() {
145 if (settings.getCurrentRoute() == settings.Route.SIGN_OUT) 145 if (settings.getCurrentRoute() == settings.Route.SIGN_OUT) {
146 this.$.disconnectDialog.showModal(); 146 // If the sync status has not been fetched yet, optimistically display
147 else if (this.$.disconnectDialog.open) 147 // the disconnect dialog. There is another check when the sync status is
148 // fetched. The dialog will be closed then the user is not signed in.
149 if (this.syncStatus && !this.syncStatus.signedIn)
150 settings.navigateToPreviousRoute();
151 else
152 this.$.disconnectDialog.showModal();
153 } else if (this.$.disconnectDialog.open) {
148 this.$.disconnectDialog.close(); 154 this.$.disconnectDialog.close();
155 }
149 }, 156 },
150 157
151 <if expr="chromeos"> 158 <if expr="chromeos">
152 /** @private */ 159 /** @private */
153 getPasswordState_: function(hasPin, enableScreenLock) { 160 getPasswordState_: function(hasPin, enableScreenLock) {
154 if (!enableScreenLock) 161 if (!enableScreenLock)
155 return this.i18n('lockScreenNone'); 162 return this.i18n('lockScreenNone');
156 if (hasPin) 163 if (hasPin)
157 return this.i18n('lockScreenPinOrPassword'); 164 return this.i18n('lockScreenPinOrPassword');
158 return this.i18n('lockScreenPasswordOnly'); 165 return this.i18n('lockScreenPasswordOnly');
(...skipping 18 matching lines...) Expand all
177 handleProfileManagesSupervisedUsers_: function(managesSupervisedUsers) { 184 handleProfileManagesSupervisedUsers_: function(managesSupervisedUsers) {
178 this.profileManagesSupervisedUsers_ = managesSupervisedUsers; 185 this.profileManagesSupervisedUsers_ = managesSupervisedUsers;
179 }, 186 },
180 187
181 /** 188 /**
182 * Handler for when the sync state is pushed from the browser. 189 * Handler for when the sync state is pushed from the browser.
183 * @param {?settings.SyncStatus} syncStatus 190 * @param {?settings.SyncStatus} syncStatus
184 * @private 191 * @private
185 */ 192 */
186 handleSyncStatus_: function(syncStatus) { 193 handleSyncStatus_: function(syncStatus) {
187 if (!this.syncStatus && syncStatus && !syncStatus.signedIn) { 194 if (!this.syncStatus && syncStatus && !syncStatus.signedIn)
188 chrome.metricsPrivate.recordUserAction('Signin_Impression_FromSettings'); 195 chrome.metricsPrivate.recordUserAction('Signin_Impression_FromSettings');
189 } 196
197 if (!syncStatus.signedIn && this.$.disconnectDialog.open)
198 this.$.disconnectDialog.close();
199
190 this.syncStatus = syncStatus; 200 this.syncStatus = syncStatus;
191 }, 201 },
192 202
193 <if expr="chromeos"> 203 <if expr="chromeos">
194 /** 204 /**
195 * Handler for when the Easy Unlock enabled status has changed. 205 * Handler for when the Easy Unlock enabled status has changed.
196 * @private 206 * @private
197 */ 207 */
198 handleEasyUnlockEnabledStatusChanged_: function(easyUnlockEnabled) { 208 handleEasyUnlockEnabledStatusChanged_: function(easyUnlockEnabled) {
199 this.easyUnlockEnabled_ = easyUnlockEnabled; 209 this.easyUnlockEnabled_ = easyUnlockEnabled;
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 420
411 /** 421 /**
412 * @param {!settings.SyncStatus} syncStatus 422 * @param {!settings.SyncStatus} syncStatus
413 * @return {boolean} Whether to show the "Sign in to Chrome" button. 423 * @return {boolean} Whether to show the "Sign in to Chrome" button.
414 * @private 424 * @private
415 */ 425 */
416 showSignin_: function(syncStatus) { 426 showSignin_: function(syncStatus) {
417 return !!syncStatus.signinAllowed && !syncStatus.signedIn; 427 return !!syncStatus.signinAllowed && !syncStatus.signedIn;
418 }, 428 },
419 }); 429 });
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/webui/settings/people_page_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698