Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: chrome/browser/resources/settings/site_settings/site_details.js

Issue 1607483005: Show data usage on Site Details (MDSettings) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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_: String,
40 type: String,
41 observer: 'onStoredDataChanged_',
42 },
43 }, 43 },
44 44
45 ready: function() { 45 ready: function() {
46 this.$.cookies.category = settings.ContentSettingsTypes.COOKIES; 46 this.$.cookies.category = settings.ContentSettingsTypes.COOKIES;
47 this.$.javascript.category = settings.ContentSettingsTypes.JAVASCRIPT; 47 this.$.javascript.category = settings.ContentSettingsTypes.JAVASCRIPT;
48 this.$.popups.category = settings.ContentSettingsTypes.POPUPS; 48 this.$.popups.category = settings.ContentSettingsTypes.POPUPS;
49 this.$.geolocation.category = settings.ContentSettingsTypes.GEOLOCATION; 49 this.$.geolocation.category = settings.ContentSettingsTypes.GEOLOCATION;
50 this.$.notification.category = settings.ContentSettingsTypes.NOTIFICATIONS; 50 this.$.notification.category = settings.ContentSettingsTypes.NOTIFICATIONS;
51 this.$.fullscreen.category = settings.ContentSettingsTypes.FULLSCREEN; 51 this.$.fullscreen.category = settings.ContentSettingsTypes.FULLSCREEN;
52 this.$.camera.category = settings.ContentSettingsTypes.CAMERA; 52 this.$.camera.category = settings.ContentSettingsTypes.CAMERA;
53 this.$.mic.category = settings.ContentSettingsTypes.MIC; 53 this.$.mic.category = settings.ContentSettingsTypes.MIC;
54
55 this.storedData_ = '1337 MB'; // TODO(finnur): Fetch actual data.
56 }, 54 },
57 55
58 onStoredDataChanged_: function() { 56 /**
57 * Handler for when the origin changes.
58 */
59 onOriginChanged_: function() {
60 var siteSettingsHandler = new SiteSettingsHandler();
61 siteSettingsHandler.fetchUsageTotal(
62 this.origin, // The origin to fetch usage total for.
63 this, // The context to use for the callback.
64 this.OnUsageDataAvailable); // The callback.
michaelpg 2016/01/19 20:47:54 just bind this to |this| instead of passing the |t
Finnur 2016/01/22 15:07:35 Obsolete code now.
65 },
66
67 /**
68 * Updates the usage data and shows its header.
69 * @param {string} usage The amount of data stored for the current origin.
70 */
71 OnUsageDataAvailable: function(usage) {
michaelpg 2016/01/19 20:47:54 camelCase also, would you mind renaming this? i f
Finnur 2016/01/22 15:07:35 Also obsolete.
72 this.storedData_ = usage;
59 this.$.usage.hidden = false; 73 this.$.usage.hidden = false;
60 this.$.storage.hidden = false; 74 this.$.storage.hidden = false;
61 }, 75 },
62 76
77 /**
78 * Clears all data stored for the current origin.
79 */
63 onClearStorage_: function() { 80 onClearStorage_: function() {
64 // TODO(finnur): Implement. 81 // TODO(finnur): Implement.
65 }, 82 },
66 83
84 /**
85 * Resets all permissions and clears all data stored for the current origin.
86 */
67 onClearAndReset_: function() { 87 onClearAndReset_: function() {
68 Array.prototype.forEach.call( 88 Array.prototype.forEach.call(
69 this.root.querySelectorAll('site-details-permission'), 89 this.root.querySelectorAll('site-details-permission'),
70 function(element) { element.resetPermission(); }); 90 function(element) { element.resetPermission(); });
71 91
72 this.onClearStorage_(); 92 this.onClearStorage_();
73 }, 93 },
74 }); 94 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698