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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 } | 115 } |
116 }, | 116 }, |
117 | 117 |
118 /** | 118 /** |
119 * Resets all permissions and clears all data stored for the current origin. | 119 * Resets all permissions and clears all data stored for the current origin. |
120 * @private | 120 * @private |
121 */ | 121 */ |
122 onClearAndReset_: function() { | 122 onClearAndReset_: function() { |
123 Array.prototype.forEach.call( | 123 Array.prototype.forEach.call( |
124 this.root.querySelectorAll('site-details-permission'), | 124 this.root.querySelectorAll('site-details-permission'), |
125 function(element) { element.resetPermission(); }); | 125 function(element) { |
| 126 element.resetPermission(); |
| 127 }); |
126 | 128 |
127 if (this.storedData_ != '') | 129 if (this.storedData_ != '') |
128 this.onClearStorage_(); | 130 this.onClearStorage_(); |
129 else | 131 else |
130 this.navigateBackIfNoData_(); | 132 this.navigateBackIfNoData_(); |
131 }, | 133 }, |
132 | 134 |
133 /** | 135 /** |
134 * Navigate back if the UI is empty (everything been cleared). | 136 * Navigate back if the UI is empty (everything been cleared). |
135 * @private | 137 * @private |
136 */ | 138 */ |
137 navigateBackIfNoData_: function() { | 139 navigateBackIfNoData_: function() { |
138 if (this.storedData_ == '' && !this.permissionShowing_()) | 140 if (this.storedData_ == '' && !this.permissionShowing_()) |
139 settings.navigateToPreviousRoute(); | 141 settings.navigateToPreviousRoute(); |
140 }, | 142 }, |
141 | 143 |
142 /** | 144 /** |
143 * Returns true if one or more permission is showing. | 145 * Returns true if one or more permission is showing. |
144 * @private | 146 * @private |
145 */ | 147 */ |
146 permissionShowing_: function() { | 148 permissionShowing_: function() { |
147 return Array.prototype.some.call( | 149 return Array.prototype.some.call( |
148 this.root.querySelectorAll('site-details-permission'), | 150 this.root.querySelectorAll('site-details-permission'), |
149 function(element) { return element.offsetHeight > 0; }); | 151 function(element) { |
| 152 return element.offsetHeight > 0; |
| 153 }); |
150 }, | 154 }, |
151 }); | 155 }); |
OLD | NEW |