Chromium Code Reviews| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 // Using originForDisplay avoids the [*.] prefix that some exceptions use. | 68 // Using originForDisplay avoids the [*.] prefix that some exceptions use. |
| 69 var url = new URL(this.ensureUrlHasScheme(this.site.originForDisplay)); | 69 var url = new URL(this.ensureUrlHasScheme(this.site.originForDisplay)); |
| 70 this.$.usageApi.fetchUsageTotal(url.hostname); | 70 this.$.usageApi.fetchUsageTotal(url.hostname); |
| 71 } | 71 } |
| 72 }, | 72 }, |
| 73 | 73 |
| 74 /** | 74 /** |
| 75 * Clears all data stored for the current origin. | 75 * Clears all data stored for the current origin. |
| 76 */ | 76 */ |
| 77 onClearStorage_: function() { | 77 onClearStorage_: function() { |
| 78 this.$.usageApi.clearUsage(this.site.origin, this.storageType_); | 78 this.$.usageApi.clearUsage( |
| 79 this.toUrl(this.site.origin).href, this.storageType_); | |
|
Finnur
2016/09/20 11:37:27
I found while testing this, that if patterns are e
| |
| 79 }, | 80 }, |
| 80 | 81 |
| 81 /** | 82 /** |
| 82 * Called when usage has been deleted for an origin. | 83 * Called when usage has been deleted for an origin. |
| 83 */ | 84 */ |
| 84 onUsageDeleted: function(event) { | 85 onUsageDeleted: function(event) { |
| 85 if (event.detail.origin == this.site.origin) { | 86 if (event.detail.origin == this.toUrl(this.site.origin).href) { |
|
Finnur
2016/09/20 11:37:27
And when the delete-complete event comes in, we ne
| |
| 86 this.storedData_ = ''; | 87 this.storedData_ = ''; |
| 87 this.navigateBackIfNoData_(); | 88 this.navigateBackIfNoData_(); |
| 88 } | 89 } |
| 89 }, | 90 }, |
| 90 | 91 |
| 91 /** | 92 /** |
| 92 * Resets all permissions and clears all data stored for the current origin. | 93 * Resets all permissions and clears all data stored for the current origin. |
| 93 */ | 94 */ |
| 94 onClearAndReset_: function() { | 95 onClearAndReset_: function() { |
| 95 Array.prototype.forEach.call( | 96 Array.prototype.forEach.call( |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 112 | 113 |
| 113 /** | 114 /** |
| 114 * Returns true if one or more permission is showing. | 115 * Returns true if one or more permission is showing. |
| 115 */ | 116 */ |
| 116 permissionShowing_: function() { | 117 permissionShowing_: function() { |
| 117 return Array.prototype.some.call( | 118 return Array.prototype.some.call( |
| 118 this.root.querySelectorAll('site-details-permission'), | 119 this.root.querySelectorAll('site-details-permission'), |
| 119 function(element) { return element.offsetHeight > 0; }); | 120 function(element) { return element.offsetHeight > 0; }); |
| 120 }, | 121 }, |
| 121 }); | 122 }); |
| OLD | NEW |