| 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 * 'site-details' show the details (permissions and usage) for a given origin | 7 * 'site-details' show the details (permissions and usage) for a given origin |
| 8 * under Site Settings. | 8 * under Site Settings. |
| 9 */ | 9 */ |
| 10 Polymer({ | 10 Polymer({ |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 }, | 41 }, |
| 42 | 42 |
| 43 ready: function() { | 43 ready: function() { |
| 44 this.ContentSettingsTypes = settings.ContentSettingsTypes; | 44 this.ContentSettingsTypes = settings.ContentSettingsTypes; |
| 45 }, | 45 }, |
| 46 | 46 |
| 47 /** | 47 /** |
| 48 * Handler for when the origin changes. | 48 * Handler for when the origin changes. |
| 49 */ | 49 */ |
| 50 onSiteChanged_: function() { | 50 onSiteChanged_: function() { |
| 51 var url = new URL(this.site.origin); | 51 // Using originForDisplay avoids the [*.] prefix that some exceptions use. |
| 52 var url = new URL(this.ensureUrlHasScheme(this.site.originForDisplay)); |
| 52 this.$.usageApi.fetchUsageTotal(url.hostname); | 53 this.$.usageApi.fetchUsageTotal(url.hostname); |
| 53 }, | 54 }, |
| 54 | 55 |
| 55 /** | 56 /** |
| 56 * Clears all data stored for the current origin. | 57 * Clears all data stored for the current origin. |
| 57 */ | 58 */ |
| 58 onClearStorage_: function() { | 59 onClearStorage_: function() { |
| 59 this.$.usageApi.clearUsage(this.site.origin, this.storageType_); | 60 this.$.usageApi.clearUsage(this.site.origin, this.storageType_); |
| 60 }, | 61 }, |
| 61 | 62 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 94 |
| 94 /** | 95 /** |
| 95 * Returns true if one or more permission is showing. | 96 * Returns true if one or more permission is showing. |
| 96 */ | 97 */ |
| 97 permissionShowing_: function() { | 98 permissionShowing_: function() { |
| 98 return Array.prototype.some.call( | 99 return Array.prototype.some.call( |
| 99 this.root.querySelectorAll('site-details-permission'), | 100 this.root.querySelectorAll('site-details-permission'), |
| 100 function(element) { return element.offsetHeight > 0; }); | 101 function(element) { return element.offsetHeight > 0; }); |
| 101 }, | 102 }, |
| 102 }); | 103 }); |
| OLD | NEW |