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 * Example: | 10 * Example: |
(...skipping 13 matching lines...) Expand all Loading... | |
24 * Preferences state. | 24 * Preferences state. |
25 */ | 25 */ |
26 prefs: { | 26 prefs: { |
27 type: Object, | 27 type: Object, |
28 notify: true, | 28 notify: true, |
29 }, | 29 }, |
30 | 30 |
31 /** | 31 /** |
32 * The origin that this widget is showing details for. | 32 * The origin that this widget is showing details for. |
33 */ | 33 */ |
34 origin: String, | 34 origin: { |
35 type: String, | |
36 observer: 'onOriginChanged_', | |
37 }, | |
35 | 38 |
36 /** | 39 /** |
37 * The amount of data stored for the origin. | 40 * The amount of data stored for the origin. |
38 */ | 41 */ |
39 storedData_: { | 42 storedData_: { |
40 type: String, | 43 type: String, |
41 observer: 'onStoredDataChanged_', | 44 value: '', |
42 }, | 45 }, |
43 }, | 46 }, |
44 | 47 |
45 ready: function() { | 48 ready: function() { |
46 this.$.cookies.category = settings.ContentSettingsTypes.COOKIES; | 49 this.$.cookies.category = settings.ContentSettingsTypes.COOKIES; |
47 this.$.javascript.category = settings.ContentSettingsTypes.JAVASCRIPT; | 50 this.$.javascript.category = settings.ContentSettingsTypes.JAVASCRIPT; |
48 this.$.popups.category = settings.ContentSettingsTypes.POPUPS; | 51 this.$.popups.category = settings.ContentSettingsTypes.POPUPS; |
49 this.$.geolocation.category = settings.ContentSettingsTypes.GEOLOCATION; | 52 this.$.geolocation.category = settings.ContentSettingsTypes.GEOLOCATION; |
50 this.$.notification.category = settings.ContentSettingsTypes.NOTIFICATIONS; | 53 this.$.notification.category = settings.ContentSettingsTypes.NOTIFICATIONS; |
51 this.$.fullscreen.category = settings.ContentSettingsTypes.FULLSCREEN; | 54 this.$.fullscreen.category = settings.ContentSettingsTypes.FULLSCREEN; |
52 this.$.camera.category = settings.ContentSettingsTypes.CAMERA; | 55 this.$.camera.category = settings.ContentSettingsTypes.CAMERA; |
53 this.$.mic.category = settings.ContentSettingsTypes.MIC; | 56 this.$.mic.category = settings.ContentSettingsTypes.MIC; |
54 | |
55 this.storedData_ = '1337 MB'; // TODO(finnur): Fetch actual data. | |
56 }, | 57 }, |
57 | 58 |
58 onStoredDataChanged_: function() { | 59 /** |
59 this.$.usage.hidden = false; | 60 * Handler for when the origin changes. |
60 this.$.storage.hidden = false; | 61 */ |
62 onOriginChanged_: function() { | |
63 var urlParser = document.createElement('a'); | |
michaelpg
2016/01/27 06:37:47
1. Perhaps use `new URL(this.origin)` if it's equi
Finnur
2016/01/27 10:27:26
Thanks for investigating!
Switched to the URL obj
| |
64 urlParser.href = this.origin; | |
65 this.$.usageApi.fetchUsageTotal(urlParser.host); | |
61 }, | 66 }, |
62 | 67 |
68 /** | |
69 * Clears all data stored for the current origin. | |
70 */ | |
63 onClearStorage_: function() { | 71 onClearStorage_: function() { |
64 // TODO(finnur): Implement. | 72 // TODO(finnur): Implement. |
65 }, | 73 }, |
66 | 74 |
75 /** | |
76 * Resets all permissions and clears all data stored for the current origin. | |
77 */ | |
67 onClearAndReset_: function() { | 78 onClearAndReset_: function() { |
68 Array.prototype.forEach.call( | 79 Array.prototype.forEach.call( |
69 this.root.querySelectorAll('site-details-permission'), | 80 this.root.querySelectorAll('site-details-permission'), |
70 function(element) { element.resetPermission(); }); | 81 function(element) { element.resetPermission(); }); |
71 | 82 |
72 this.onClearStorage_(); | 83 this.onClearStorage_(); |
73 }, | 84 }, |
74 }); | 85 }); |
OLD | NEW |