Index: chrome/browser/resources/settings/privacy_page/privacy_page.js |
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_page.js b/chrome/browser/resources/settings/privacy_page/privacy_page.js |
index 00b0dd17e1868f4b1d697082105af64e4ad9441d..b43b16a3bb5eaecd29f7737712c58e6d90907a2b 100644 |
--- a/chrome/browser/resources/settings/privacy_page/privacy_page.js |
+++ b/chrome/browser/resources/settings/privacy_page/privacy_page.js |
@@ -28,17 +28,41 @@ Polymer({ |
}, |
/** @private */ |
- showClearBrowsingDataDialog_: Boolean, |
+ showClearBrowsingDataDialog_: { |
+ computed: 'computeShowClearBrowsingDataDialog_(currentRoute)', |
+ type: Boolean, |
+ }, |
}, |
ready: function() { |
this.ContentSettingsTypes = settings.ContentSettingsTypes; |
}, |
+ /** @suppress {missingProperties} */ |
+ attached: function() { |
+ if (this.showClearBrowsingDataDialog_) { |
michaelpg
2016/06/28 19:53:23
should this "if" be inside the "then" to prevent s
Dan Beam
2016/06/28 20:38:19
Done.
|
+ settings.main.rendered.then(function() { |
+ var dialog = this.$$('settings-clear-browsing-data-dialog').$.dialog; |
+ // TODO(dbeam): cast to a CrDialogElement when it compiles. |
+ dialog.refit(); |
+ }.bind(this)); |
+ } |
+ }, |
+ |
+ /** |
+ * @return {boolean} Whether the Clear Browsing Data dialog should be showing. |
+ * @private |
+ */ |
+ computeShowClearBrowsingDataDialog_: function() { |
+ var route = this.currentRoute; |
+ return route && route.dialog == 'clear-browsing-data'; |
+ }, |
+ |
/** @private */ |
onManageCertificatesTap_: function() { |
<if expr="use_nss_certs"> |
- this.$.pages.setSubpageChain(['manage-certificates']); |
+ var pages = /** @type {!SettingsAnimatedPagesElement} */(this.$.pages); |
+ pages.setSubpageChain(['manage-certificates']); |
</if> |
<if expr="is_win or is_macosx"> |
settings.PrivacyPageBrowserProxyImpl.getInstance(). |
@@ -48,12 +72,18 @@ Polymer({ |
/** @private */ |
onSiteSettingsTap_: function() { |
- this.$.pages.setSubpageChain(['site-settings']); |
+ var pages = /** @type {!SettingsAnimatedPagesElement} */(this.$.pages); |
+ pages.setSubpageChain(['site-settings']); |
}, |
/** @private */ |
onClearBrowsingDataTap_: function() { |
- this.showClearBrowsingDataDialog_ = true; |
+ this.currentRoute = { |
+ page: this.currentRoute.page, |
+ section: this.currentRoute.section, |
+ subpage: this.currentRoute.subpage, |
+ dialog: 'clear-browsing-data', |
+ }; |
}, |
/** |
@@ -61,7 +91,14 @@ Polymer({ |
* @private |
*/ |
onIronOverlayClosed_: function(event) { |
- if (Polymer.dom(event).rootTarget.tagName == 'CR-DIALOG') |
- this.showClearBrowsingDataDialog_ = false; |
+ if (Polymer.dom(event).rootTarget.tagName != 'CR-DIALOG') |
+ return; |
+ |
+ this.currentRoute = { |
+ page: this.currentRoute.page, |
+ section: this.currentRoute.section, |
+ subpage: this.currentRoute.subpage, |
+ // Drop dialog key. |
+ }; |
}, |
}); |