| 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 12 matching lines...) Expand all Loading... |
| 23 type: Object, | 23 type: Object, |
| 24 notify: true, | 24 notify: true, |
| 25 }, | 25 }, |
| 26 | 26 |
| 27 /** | 27 /** |
| 28 * Dictionary defining page visibility. | 28 * Dictionary defining page visibility. |
| 29 * @type {!PrivacyPageVisibility} | 29 * @type {!PrivacyPageVisibility} |
| 30 */ | 30 */ |
| 31 pageVisibility: Object, | 31 pageVisibility: Object, |
| 32 | 32 |
| 33 <if expr="_google_chrome and not chromeos"> | 33 /* <if expr="_google_chrome and not chromeos"> */ |
| 34 /** @type {MetricsReporting} */ | 34 /** @type {MetricsReporting} */ |
| 35 metricsReporting_: Object, | 35 metricsReporting_: Object, |
| 36 | 36 |
| 37 showRestart_: Boolean, | 37 showRestart_: Boolean, |
| 38 </if> | 38 /* </if> */ |
| 39 | 39 |
| 40 /** @private */ | 40 /** @private */ |
| 41 safeBrowsingExtendedReportingEnabled_: Boolean, | 41 safeBrowsingExtendedReportingEnabled_: Boolean, |
| 42 | 42 |
| 43 /** @private */ | 43 /** @private */ |
| 44 showClearBrowsingDataDialog_: Boolean, | 44 showClearBrowsingDataDialog_: Boolean, |
| 45 }, | 45 }, |
| 46 | 46 |
| 47 ready: function() { | 47 ready: function() { |
| 48 this.ContentSettingsTypes = settings.ContentSettingsTypes; | 48 this.ContentSettingsTypes = settings.ContentSettingsTypes; |
| 49 | 49 |
| 50 <if expr="_google_chrome and not chromeos"> | 50 /* <if expr="_google_chrome and not chromeos"> */ |
| 51 var boundSetMetricsReporting = this.setMetricsReporting_.bind(this); | 51 var boundSetMetricsReporting = this.setMetricsReporting_.bind(this); |
| 52 this.addWebUIListener('metrics-reporting-change', boundSetMetricsReporting); | 52 this.addWebUIListener('metrics-reporting-change', boundSetMetricsReporting); |
| 53 | 53 |
| 54 var browserProxy = settings.PrivacyPageBrowserProxyImpl.getInstance(); | 54 var browserProxy = settings.PrivacyPageBrowserProxyImpl.getInstance(); |
| 55 browserProxy.getMetricsReporting().then(boundSetMetricsReporting); | 55 browserProxy.getMetricsReporting().then(boundSetMetricsReporting); |
| 56 </if> | 56 /* </if> */ |
| 57 | 57 |
| 58 var boundSetSber = this.setSafeBrowsingExtendedReporting_.bind(this); | 58 var boundSetSber = this.setSafeBrowsingExtendedReporting_.bind(this); |
| 59 this.addWebUIListener('safe-browsing-extended-reporting-change', | 59 this.addWebUIListener( |
| 60 boundSetSber); | 60 'safe-browsing-extended-reporting-change', boundSetSber); |
| 61 settings.PrivacyPageBrowserProxyImpl.getInstance() | 61 settings.PrivacyPageBrowserProxyImpl.getInstance() |
| 62 .getSafeBrowsingExtendedReporting().then(boundSetSber); | 62 .getSafeBrowsingExtendedReporting() |
| 63 .then(boundSetSber); |
| 63 }, | 64 }, |
| 64 | 65 |
| 65 /** @protected */ | 66 /** @protected */ |
| 66 currentRouteChanged: function() { | 67 currentRouteChanged: function() { |
| 67 this.showClearBrowsingDataDialog_ = | 68 this.showClearBrowsingDataDialog_ = |
| 68 settings.getCurrentRoute() == settings.Route.CLEAR_BROWSER_DATA; | 69 settings.getCurrentRoute() == settings.Route.CLEAR_BROWSER_DATA; |
| 69 }, | 70 }, |
| 70 | 71 |
| 71 /** @private */ | 72 /** @private */ |
| 72 onManageCertificatesTap_: function() { | 73 onManageCertificatesTap_: function() { |
| 73 <if expr="use_nss_certs"> | 74 /* <if expr="use_nss_certs"> */ |
| 74 settings.navigateTo(settings.Route.CERTIFICATES); | 75 settings.navigateTo(settings.Route.CERTIFICATES); |
| 75 </if> | 76 /* </if> */ |
| 76 <if expr="is_win or is_macosx"> | 77 /* <if expr="is_win or is_macosx"> */ |
| 77 settings.PrivacyPageBrowserProxyImpl.getInstance(). | 78 settings.PrivacyPageBrowserProxyImpl.getInstance() |
| 78 showManageSSLCertificates(); | 79 .showManageSSLCertificates(); |
| 79 </if> | 80 /* </if> */ |
| 80 }, | 81 }, |
| 81 | 82 |
| 82 /** | 83 /** |
| 83 * This is a workaround to connect the remove all button to the subpage. | 84 * This is a workaround to connect the remove all button to the subpage. |
| 84 * @private | 85 * @private |
| 85 */ | 86 */ |
| 86 onRemoveAllCookiesFromSite_: function() { | 87 onRemoveAllCookiesFromSite_: function() { |
| 87 var node = /** @type {?SiteDataDetailsSubpageElement} */(this.$$( | 88 var node = /** @type {?SiteDataDetailsSubpageElement} */ ( |
| 88 'site-data-details-subpage')); | 89 this.$$('site-data-details-subpage')); |
| 89 if (node) | 90 if (node) |
| 90 node.removeAll(); | 91 node.removeAll(); |
| 91 }, | 92 }, |
| 92 | 93 |
| 93 /** @private */ | 94 /** @private */ |
| 94 onSiteSettingsTap_: function() { | 95 onSiteSettingsTap_: function() { |
| 95 settings.navigateTo(settings.Route.SITE_SETTINGS); | 96 settings.navigateTo(settings.Route.SITE_SETTINGS); |
| 96 }, | 97 }, |
| 97 | 98 |
| 98 /** @private */ | 99 /** @private */ |
| 99 onClearBrowsingDataTap_: function() { | 100 onClearBrowsingDataTap_: function() { |
| 100 settings.navigateTo(settings.Route.CLEAR_BROWSER_DATA); | 101 settings.navigateTo(settings.Route.CLEAR_BROWSER_DATA); |
| 101 }, | 102 }, |
| 102 | 103 |
| 103 /** @private */ | 104 /** @private */ |
| 104 onDialogClosed_: function() { | 105 onDialogClosed_: function() { |
| 105 settings.navigateToPreviousRoute(); | 106 settings.navigateToPreviousRoute(); |
| 106 }, | 107 }, |
| 107 | 108 |
| 108 /** @private */ | 109 /** @private */ |
| 109 onHelpTap_: function() { | 110 onHelpTap_: function() { |
| 110 window.open( | 111 window.open( |
| 111 'https://support.google.com/chrome/?p=settings_manage_exceptions'); | 112 'https://support.google.com/chrome/?p=settings_manage_exceptions'); |
| 112 }, | 113 }, |
| 113 | 114 |
| 114 <if expr="_google_chrome and not chromeos"> | 115 /* <if expr="_google_chrome and not chromeos"> */ |
| 115 /** @private */ | 116 /** @private */ |
| 116 onMetricsReportingCheckboxTap_: function() { | 117 onMetricsReportingCheckboxTap_: function() { |
| 117 var browserProxy = settings.PrivacyPageBrowserProxyImpl.getInstance(); | 118 var browserProxy = settings.PrivacyPageBrowserProxyImpl.getInstance(); |
| 118 var enabled = this.$.metricsReportingCheckbox.checked; | 119 var enabled = this.$.metricsReportingCheckbox.checked; |
| 119 browserProxy.setMetricsReportingEnabled(enabled); | 120 browserProxy.setMetricsReportingEnabled(enabled); |
| 120 }, | 121 }, |
| 121 | 122 |
| 122 /** | 123 /** |
| 123 * @param {!MetricsReporting} metricsReporting | 124 * @param {!MetricsReporting} metricsReporting |
| 124 * @private | 125 * @private |
| 125 */ | 126 */ |
| 126 setMetricsReporting_: function(metricsReporting) { | 127 setMetricsReporting_: function(metricsReporting) { |
| 127 // TODO(dbeam): remember whether metrics reporting was enabled when Chrome | 128 // TODO(dbeam): remember whether metrics reporting was enabled when Chrome |
| 128 // started. | 129 // started. |
| 129 if (metricsReporting.managed) { | 130 if (metricsReporting.managed) { |
| 130 this.showRestart_ = false; | 131 this.showRestart_ = false; |
| 131 } else if (this.metricsReporting_ && | 132 } else if ( |
| 132 metricsReporting.enabled != this.metricsReporting_.enabled) { | 133 this.metricsReporting_ && |
| 134 metricsReporting.enabled != this.metricsReporting_.enabled) { |
| 133 this.showRestart_ = true; | 135 this.showRestart_ = true; |
| 134 } | 136 } |
| 135 this.metricsReporting_ = metricsReporting; | 137 this.metricsReporting_ = metricsReporting; |
| 136 }, | 138 }, |
| 137 | 139 |
| 138 /** @private */ | 140 /** @private */ |
| 139 onRestartTap_: function() { | 141 onRestartTap_: function() { |
| 140 settings.LifetimeBrowserProxyImpl.getInstance().restart(); | 142 settings.LifetimeBrowserProxyImpl.getInstance().restart(); |
| 141 }, | 143 }, |
| 142 </if> | 144 /* </if> */ |
| 143 | 145 |
| 144 /** @private */ | 146 /** @private */ |
| 145 onSafeBrowsingExtendedReportingCheckboxTap_: function() { | 147 onSafeBrowsingExtendedReportingCheckboxTap_: function() { |
| 146 var browserProxy = settings.PrivacyPageBrowserProxyImpl.getInstance(); | 148 var browserProxy = settings.PrivacyPageBrowserProxyImpl.getInstance(); |
| 147 var enabled = this.$.safeBrowsingExtendedReportingCheckbox.checked; | 149 var enabled = this.$.safeBrowsingExtendedReportingCheckbox.checked; |
| 148 browserProxy.setSafeBrowsingExtendedReportingEnabled(enabled); | 150 browserProxy.setSafeBrowsingExtendedReportingEnabled(enabled); |
| 149 }, | 151 }, |
| 150 | 152 |
| 151 /** @param {boolean} enabled Whether reporting is enabled or not. | 153 /** @param {boolean} enabled Whether reporting is enabled or not. |
| 152 * @private | 154 * @private |
| 153 */ | 155 */ |
| 154 setSafeBrowsingExtendedReporting_: function(enabled) { | 156 setSafeBrowsingExtendedReporting_: function(enabled) { |
| 155 this.safeBrowsingExtendedReportingEnabled_ = enabled; | 157 this.safeBrowsingExtendedReportingEnabled_ = enabled; |
| 156 }, | 158 }, |
| 157 | 159 |
| 158 /** | 160 /** |
| 159 * The sub-page title for the site or content settings. | 161 * The sub-page title for the site or content settings. |
| 160 * @return {string} | 162 * @return {string} |
| 161 * @private | 163 * @private |
| 162 */ | 164 */ |
| 163 siteSettingsPageTitle_: function() { | 165 siteSettingsPageTitle_: function() { |
| 164 return loadTimeData.getBoolean('enableSiteSettings') ? | 166 return loadTimeData.getBoolean('enableSiteSettings') ? |
| 165 loadTimeData.getString('siteSettings') : | 167 loadTimeData.getString('siteSettings') : |
| 166 loadTimeData.getString('contentSettings'); | 168 loadTimeData.getString('contentSettings'); |
| 167 }, | 169 }, |
| 168 | 170 |
| 169 <if expr="chromeos"> | 171 /* <if expr="chromeos"> */ |
| 170 /** @private */ | 172 /** @private */ |
| 171 onAdobeFlashStorageClicked_: function() { | 173 onAdobeFlashStorageClicked_: function() { |
| 172 window.open('https://www.macromedia.com/support/' + | 174 window.open( |
| 175 'https://www.macromedia.com/support/' + |
| 173 'documentation/en/flashplayer/help/settings_manager07.html'); | 176 'documentation/en/flashplayer/help/settings_manager07.html'); |
| 174 }, | 177 }, |
| 175 </if> | 178 /* </if> */ |
| 176 }); | 179 }); |
| OLD | NEW |