OLD | NEW |
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-privacy-page' is the settings page containing privacy and | 7 * 'settings-privacy-page' is the settings page containing privacy and |
8 * security settings. | 8 * security settings. |
9 */ | 9 */ |
10 Polymer({ | 10 Polymer({ |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 /** | 22 /** |
23 * The current active route. | 23 * The current active route. |
24 */ | 24 */ |
25 currentRoute: { | 25 currentRoute: { |
26 type: Object, | 26 type: Object, |
27 notify: true, | 27 notify: true, |
28 }, | 28 }, |
29 | 29 |
30 /** @private */ | 30 /** @private */ |
31 showClearBrowsingDataDialog_: Boolean, | 31 showClearBrowsingDataDialog_: { |
| 32 computed: 'computeShowClearBrowsingDataDialog_(currentRoute)', |
| 33 type: Boolean, |
| 34 }, |
32 }, | 35 }, |
33 | 36 |
34 ready: function() { | 37 ready: function() { |
35 this.ContentSettingsTypes = settings.ContentSettingsTypes; | 38 this.ContentSettingsTypes = settings.ContentSettingsTypes; |
36 }, | 39 }, |
37 | 40 |
| 41 /** @suppress {missingProperties} */ |
| 42 attached: function() { |
| 43 settings.main.rendered.then(function() { |
| 44 if (this.showClearBrowsingDataDialog_) { |
| 45 var dialog = this.$$('settings-clear-browsing-data-dialog').$.dialog; |
| 46 // TODO(dbeam): cast to a CrDialogElement when it compiles. |
| 47 dialog.refit(); |
| 48 } |
| 49 }.bind(this)); |
| 50 }, |
| 51 |
| 52 /** |
| 53 * @return {boolean} Whether the Clear Browsing Data dialog should be showing. |
| 54 * @private |
| 55 */ |
| 56 computeShowClearBrowsingDataDialog_: function() { |
| 57 var route = this.currentRoute; |
| 58 return route && route.dialog == 'clear-browsing-data'; |
| 59 }, |
| 60 |
38 /** @private */ | 61 /** @private */ |
39 onManageCertificatesTap_: function() { | 62 onManageCertificatesTap_: function() { |
40 <if expr="use_nss_certs"> | 63 <if expr="use_nss_certs"> |
41 this.$.pages.setSubpageChain(['manage-certificates']); | 64 var pages = /** @type {!SettingsAnimatedPagesElement} */(this.$.pages); |
| 65 pages.setSubpageChain(['manage-certificates']); |
42 </if> | 66 </if> |
43 <if expr="is_win or is_macosx"> | 67 <if expr="is_win or is_macosx"> |
44 settings.PrivacyPageBrowserProxyImpl.getInstance(). | 68 settings.PrivacyPageBrowserProxyImpl.getInstance(). |
45 showManageSSLCertificates(); | 69 showManageSSLCertificates(); |
46 </if> | 70 </if> |
47 }, | 71 }, |
48 | 72 |
49 /** @private */ | 73 /** @private */ |
50 onSiteSettingsTap_: function() { | 74 onSiteSettingsTap_: function() { |
51 this.$.pages.setSubpageChain(['site-settings']); | 75 var pages = /** @type {!SettingsAnimatedPagesElement} */(this.$.pages); |
| 76 pages.setSubpageChain(['site-settings']); |
52 }, | 77 }, |
53 | 78 |
54 /** @private */ | 79 /** @private */ |
55 onClearBrowsingDataTap_: function() { | 80 onClearBrowsingDataTap_: function() { |
56 this.showClearBrowsingDataDialog_ = true; | 81 this.currentRoute = { |
| 82 page: this.currentRoute.page, |
| 83 section: this.currentRoute.section, |
| 84 subpage: this.currentRoute.subpage, |
| 85 dialog: 'clear-browsing-data', |
| 86 }; |
57 }, | 87 }, |
58 | 88 |
59 /** | 89 /** |
60 * @param {!Event} event | 90 * @param {!Event} event |
61 * @private | 91 * @private |
62 */ | 92 */ |
63 onIronOverlayClosed_: function(event) { | 93 onIronOverlayClosed_: function(event) { |
64 if (Polymer.dom(event).rootTarget.tagName == 'CR-DIALOG') | 94 if (Polymer.dom(event).rootTarget.tagName != 'CR-DIALOG') |
65 this.showClearBrowsingDataDialog_ = false; | 95 return; |
| 96 |
| 97 this.currentRoute = { |
| 98 page: this.currentRoute.page, |
| 99 section: this.currentRoute.section, |
| 100 subpage: this.currentRoute.subpage, |
| 101 // Drop dialog key. |
| 102 }; |
66 }, | 103 }, |
67 }); | 104 }); |
OLD | NEW |