Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * @fileoverview | |
| 7 * 'site-details' show the details (permissions and usage) for a given origin | |
| 8 * under Site Settings. | |
| 9 * | |
| 10 * Example: | |
| 11 * | |
| 12 * <site-details prefs="{{prefs}}" origin="{{origin}}"> | |
| 13 * </site-details> | |
| 14 * ... other pages ... | |
| 15 * | |
| 16 * @group Chrome Settings Elements | |
| 17 * @element site-details | |
| 18 */ | |
| 19 Polymer({ | |
| 20 is: 'site-details', | |
| 21 | |
| 22 properties: { | |
| 23 /** | |
| 24 * Preferences state. | |
| 25 */ | |
| 26 prefs: { | |
| 27 type: Object, | |
| 28 notify: true, | |
| 29 }, | |
| 30 | |
| 31 /** | |
| 32 * The origin that this widget is showing details for. | |
| 33 */ | |
| 34 origin: { | |
| 35 type: String, | |
| 36 observer: 'onOriginChanged_', | |
| 37 }, | |
| 38 | |
| 39 /** | |
| 40 * The amount of data stored for the origin. | |
| 41 */ | |
| 42 storedData: { | |
| 43 type: String, | |
| 44 value: '1337 MB', // TODO(finnur): Fetch actual data. | |
| 45 }, | |
| 46 }, | |
| 47 | |
| 48 ready: function() { | |
| 49 this.$.cookies.category = settings.ContentSettingsTypes.COOKIES; | |
| 50 this.$.javascript.category = settings.ContentSettingsTypes.JAVASCRIPT; | |
| 51 this.$.popups.category = settings.ContentSettingsTypes.POPUPS; | |
| 52 this.$.geolocation.category = settings.ContentSettingsTypes.GEOLOCATION; | |
| 53 this.$.notification.category = settings.ContentSettingsTypes.NOTIFICATION; | |
| 54 this.$.fullscreen.category = settings.ContentSettingsTypes.FULLSCREEN; | |
| 55 this.$.camera.category = settings.ContentSettingsTypes.CAMERA; | |
| 56 this.$.mic.category = settings.ContentSettingsTypes.MIC; | |
| 57 | |
| 58 if (this.storedData !== undefined) { | |
|
michaelpg
2015/11/09 18:26:30
i'd prefer doing this in an observer, unless there
Finnur
2015/11/10 16:00:51
Sure! Done.
I suspect a chrome.send call is requi
| |
| 59 this.$.usage.hidden = false; | |
|
michaelpg
2015/11/09 18:26:30
if they're logically grouped together, wrap them b
Finnur
2015/11/10 16:00:51
Usage is a header that, at the moment, only contai
| |
| 60 this.$.storage.hidden = false; | |
| 61 } | |
| 62 }, | |
| 63 | |
| 64 onOriginChanged_: function() { | |
| 65 this.$.cookies.origin = this.origin; | |
|
michaelpg
2015/11/09 18:26:30
what if origin is set before ready? why not set th
Finnur
2015/11/10 16:00:51
There was something that was not working before wh
| |
| 66 this.$.javascript.origin = this.origin; | |
| 67 this.$.popups.origin = this.origin; | |
| 68 this.$.geolocation.origin = this.origin; | |
| 69 this.$.notification.origin = this.origin; | |
| 70 this.$.fullscreen.origin = this.origin; | |
| 71 this.$.camera.origin = this.origin; | |
| 72 this.$.mic.origin = this.origin; | |
| 73 }, | |
| 74 | |
| 75 onClearStorage_: function() { | |
| 76 // TODO(finnur): Implement. | |
| 77 }, | |
| 78 | |
| 79 onClearAndReset_: function() { | |
| 80 this.$.cookies.resetPermission(); | |
|
michaelpg
2015/11/09 18:26:30
consider:
Array.prototype.forEach.call(
this.
Finnur
2015/11/10 16:00:51
Neat trick, but I can't get it to work. No matter
michaelpg
2015/11/10 18:24:13
Sorry, should be done on "this.root" (the local DO
Finnur
2015/11/11 11:37:37
Sold!
| |
| 81 this.$.javascript.resetPermission(); | |
| 82 this.$.popups.resetPermission(); | |
| 83 this.$.geolocation.resetPermission(); | |
| 84 this.$.notification.resetPermission(); | |
| 85 this.$.fullscreen.resetPermission(); | |
| 86 this.$.camera.resetPermission(); | |
| 87 this.$.mic.resetPermission(); | |
| 88 | |
| 89 this.onClearStorage_(); | |
| 90 }, | |
| 91 }); | |
| OLD | NEW |