Chromium Code Reviews| Index: chrome/browser/resources/settings/site_settings/site_details.js |
| diff --git a/chrome/browser/resources/settings/site_settings/site_details.js b/chrome/browser/resources/settings/site_settings/site_details.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..75eeaaf09a325ef57074afa027376d14ba314e70 |
| --- /dev/null |
| +++ b/chrome/browser/resources/settings/site_settings/site_details.js |
| @@ -0,0 +1,91 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +/** |
| + * @fileoverview |
| + * 'site-details' show the details (permissions and usage) for a given origin |
| + * under Site Settings. |
| + * |
| + * Example: |
| + * |
| + * <site-details prefs="{{prefs}}" origin="{{origin}}"> |
| + * </site-details> |
| + * ... other pages ... |
| + * |
| + * @group Chrome Settings Elements |
| + * @element site-details |
| + */ |
| +Polymer({ |
| + is: 'site-details', |
| + |
| + properties: { |
| + /** |
| + * Preferences state. |
| + */ |
| + prefs: { |
| + type: Object, |
| + notify: true, |
| + }, |
| + |
| + /** |
| + * The origin that this widget is showing details for. |
| + */ |
| + origin: { |
| + type: String, |
| + observer: 'onOriginChanged_', |
| + }, |
| + |
| + /** |
| + * The amount of data stored for the origin. |
| + */ |
| + storedData: { |
| + type: String, |
| + value: '1337 MB', // TODO(finnur): Fetch actual data. |
| + }, |
| + }, |
| + |
| + ready: function() { |
| + this.$.cookies.category = settings.ContentSettingsTypes.COOKIES; |
| + this.$.javascript.category = settings.ContentSettingsTypes.JAVASCRIPT; |
| + this.$.popups.category = settings.ContentSettingsTypes.POPUPS; |
| + this.$.geolocation.category = settings.ContentSettingsTypes.GEOLOCATION; |
| + this.$.notification.category = settings.ContentSettingsTypes.NOTIFICATION; |
| + this.$.fullscreen.category = settings.ContentSettingsTypes.FULLSCREEN; |
| + this.$.camera.category = settings.ContentSettingsTypes.CAMERA; |
| + this.$.mic.category = settings.ContentSettingsTypes.MIC; |
| + |
| + 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
|
| + 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
|
| + this.$.storage.hidden = false; |
| + } |
| + }, |
| + |
| + onOriginChanged_: function() { |
| + 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
|
| + this.$.javascript.origin = this.origin; |
| + this.$.popups.origin = this.origin; |
| + this.$.geolocation.origin = this.origin; |
| + this.$.notification.origin = this.origin; |
| + this.$.fullscreen.origin = this.origin; |
| + this.$.camera.origin = this.origin; |
| + this.$.mic.origin = this.origin; |
| + }, |
| + |
| + onClearStorage_: function() { |
| + // TODO(finnur): Implement. |
| + }, |
| + |
| + onClearAndReset_: function() { |
| + 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!
|
| + this.$.javascript.resetPermission(); |
| + this.$.popups.resetPermission(); |
| + this.$.geolocation.resetPermission(); |
| + this.$.notification.resetPermission(); |
| + this.$.fullscreen.resetPermission(); |
| + this.$.camera.resetPermission(); |
| + this.$.mic.resetPermission(); |
| + |
| + this.onClearStorage_(); |
| + }, |
| +}); |