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

Side by Side Diff: chrome/browser/resources/settings/site_settings/site_settings_handler.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
(Empty)
1 // Copyright 2016 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 * @constructor
7 */
8 function SiteSettingsHandler() {}
9
10 /**
11 * Asynchronously fetches the total amount of data attributed to a given origin.
12 * If no data is attributed to the origin, the callback does not fire.
13 * @param {string} origin The origin to look up.
14 * @param {!Element} context The context to use for the callback.
15 * @param {Function=} callback The callback to run when the data is ready.
michaelpg 2016/01/19 20:47:54 uncapitalize function, and have it take a string:
Finnur 2016/01/22 15:07:35 Done.
16 */
17 SiteSettingsHandler.prototype.fetchUsageTotal = function(
18 origin, context, callback) {
19 this.context = context;
20 this.callback = callback;
21
22 var self = this;
23 cr.define('SiteSettingsHandler', function() {
24 return {
25 OnUsageDataAvailable: function() {
26 return self.returnUsageTotal.apply(self, arguments);
27 },
28 };
29 });
30
31 chrome.send('fetchUsageTotal', [origin]);
32 };
33
34 /**
35 * Handles reporting the amount (of usage data) back to the caller.
36 * @param {string} usage The total amount of data attributed to a given origin.
37 */
38 SiteSettingsHandler.prototype.returnUsageTotal = function(usage) {
39 this.callback.call(this.context, usage);
40 };
Finnur 2016/01/19 17:08:57 Is all of the above a reasonable way to do this ab
michaelpg 2016/01/19 20:47:54 I would make SiteSettingsHandler "static" and simp
Finnur 2016/01/22 15:07:35 Obsolete code now.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698