Commit bd5e51eb authored by tommycli's avatar tommycli Committed by Commit bot

Reland: Settings People: Add /signOut route for Disconnect dialog.

BUG=640199
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation

Review-Url: https://codereview.chromium.org/2287593002
Cr-Commit-Position: refs/heads/master@{#415328}
parent 07b17a8e
...@@ -130,10 +130,6 @@ Polymer({ ...@@ -130,10 +130,6 @@ Polymer({
this.set('counters_.' + assert(matches[1]), text); this.set('counters_.' + assert(matches[1]), text);
}, },
open: function() {
this.$.dialog.showModal();
},
/** /**
* Handles the tap on the Clear Data button. * Handles the tap on the Clear Data button.
* @private * @private
......
...@@ -290,7 +290,7 @@ ...@@ -290,7 +290,7 @@
</if> </if>
</settings-animated-pages> </settings-animated-pages>
<dialog is="cr-dialog" id="disconnectDialog"> <dialog is="cr-dialog" id="disconnectDialog" on-close="onDisconnectClosed_">
<div class="title">$i18n{syncDisconnectTitle}</div> <div class="title">$i18n{syncDisconnectTitle}</div>
<div class="body"> <div class="body">
<div inner-h-t-m-l="[[getDisconnectExplanationHtml_(syncStatus.domain)]]"> <div inner-h-t-m-l="[[getDisconnectExplanationHtml_(syncStatus.domain)]]">
......
...@@ -10,6 +10,7 @@ Polymer({ ...@@ -10,6 +10,7 @@ Polymer({
is: 'settings-people-page', is: 'settings-people-page',
behaviors: [ behaviors: [
settings.RouteObserverBehavior,
I18nBehavior, I18nBehavior,
WebUIListenerBehavior, WebUIListenerBehavior,
<if expr="chromeos"> <if expr="chromeos">
...@@ -139,6 +140,14 @@ Polymer({ ...@@ -139,6 +140,14 @@ Polymer({
</if> </if>
}, },
/** @protected */
currentRouteChanged: function() {
if (settings.getCurrentRoute() == settings.Route.SIGN_OUT)
this.$.disconnectDialog.showModal();
else if (this.$.disconnectDialog.open)
this.$.disconnectDialog.close();
},
<if expr="chromeos"> <if expr="chromeos">
/** @private */ /** @private */
getPasswordState_: function(hasPin, enableScreenLock) { getPasswordState_: function(hasPin, enableScreenLock) {
...@@ -215,9 +224,15 @@ Polymer({ ...@@ -215,9 +224,15 @@ Polymer({
this.syncBrowserProxy_.startSignIn(); this.syncBrowserProxy_.startSignIn();
}, },
/** @private */
onDisconnectClosed_: function() {
if (settings.getCurrentRoute() == settings.Route.SIGN_OUT)
settings.navigateToPreviousRoute();
},
/** @private */ /** @private */
onDisconnectTap_: function() { onDisconnectTap_: function() {
this.$.disconnectDialog.showModal(); settings.navigateTo(settings.Route.SIGN_OUT);
}, },
/** @private */ /** @private */
......
...@@ -91,6 +91,11 @@ cr.define('settings', function() { ...@@ -91,6 +91,11 @@ cr.define('settings', function() {
r.ADVANCED = new Route('/advanced'); r.ADVANCED = new Route('/advanced');
r.ABOUT = new Route('/help'); r.ABOUT = new Route('/help');
// Navigable dialogs. These are the only non-section children of root pages.
// These are disfavored. If we add anymore, we should add explicit support.
r.SIGN_OUT = r.BASIC.createChild('/signOut');
r.CLEAR_BROWSER_DATA = r.ADVANCED.createChild('/clearBrowserData');
<if expr="chromeos"> <if expr="chromeos">
r.INTERNET = r.BASIC.createSection('/internet', 'internet'); r.INTERNET = r.BASIC.createSection('/internet', 'internet');
r.NETWORK_DETAIL = r.INTERNET.createChild('/networkDetail'); r.NETWORK_DETAIL = r.INTERNET.createChild('/networkDetail');
...@@ -128,11 +133,6 @@ cr.define('settings', function() { ...@@ -128,11 +133,6 @@ cr.define('settings', function() {
r.PRIVACY = r.ADVANCED.createSection('/privacy', 'privacy'); r.PRIVACY = r.ADVANCED.createSection('/privacy', 'privacy');
r.CERTIFICATES = r.PRIVACY.createChild('/certificates'); r.CERTIFICATES = r.PRIVACY.createChild('/certificates');
// CLEAR_BROWSER_DATA is the only navigable dialog route. It's the only child
// of a root page that's not a section. Don't add any more routes like these.
// If more navigable dialogs are needed, add explicit support in Route.
r.CLEAR_BROWSER_DATA = r.ADVANCED.createChild('/clearBrowserData');
r.SITE_SETTINGS = r.PRIVACY.createChild('/siteSettings'); r.SITE_SETTINGS = r.PRIVACY.createChild('/siteSettings');
r.SITE_SETTINGS_ALL = r.SITE_SETTINGS.createChild('all'); r.SITE_SETTINGS_ALL = r.SITE_SETTINGS.createChild('all');
r.SITE_SETTINGS_SITE_DETAILS = r.SITE_SETTINGS_SITE_DETAILS =
......
...@@ -164,12 +164,21 @@ cr.define('settings_people_page', function() { ...@@ -164,12 +164,21 @@ cr.define('settings_people_page', function() {
var disconnectConfirm = peoplePage.$.disconnectConfirm; var disconnectConfirm = peoplePage.$.disconnectConfirm;
assertTrue(!!disconnectConfirm); assertTrue(!!disconnectConfirm);
assertFalse(disconnectConfirm.hidden); assertFalse(disconnectConfirm.hidden);
// Wait for exit of dialog route.
var dialogExitPromise = new Promise(function(resolve) {
window.addEventListener('popstate', function callback() {
window.removeEventListener('popstate', callback);
resolve();
});
});
MockInteractions.tap(disconnectConfirm); MockInteractions.tap(disconnectConfirm);
return dialogExitPromise;
}).then(function() {
return browserProxy.whenCalled('signOut'); return browserProxy.whenCalled('signOut');
}).then(function(deleteProfile) { }).then(function(deleteProfile) {
Polymer.dom.flush();
assertFalse(deleteProfile); assertFalse(deleteProfile);
cr.webUIListenerCallback('sync-status-changed', { cr.webUIListenerCallback('sync-status-changed', {
...@@ -228,7 +237,7 @@ cr.define('settings_people_page', function() { ...@@ -228,7 +237,7 @@ cr.define('settings_people_page', function() {
var customizeSync = peoplePage.$$('#customize-sync'); var customizeSync = peoplePage.$$('#customize-sync');
assertTrue(!!customizeSync); assertTrue(!!customizeSync);
assertTrue(customizeSync.hasAttribute('actionable')); assertTrue(customizeSync.hasAttribute('actionable'));
}).then(function() {
cr.webUIListenerCallback('sync-status-changed', { cr.webUIListenerCallback('sync-status-changed', {
managed: true, managed: true,
signedIn: true, signedIn: true,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment