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

Unified Diff: chrome/browser/resources/quota_internals/quota-internals.js

Issue 7053009: Add chrome://quota-internals/ resources (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Add descriptions Created 9 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/quota_internals/quota-internals.js
diff --git a/chrome/browser/resources/quota_internals/quota-internals.js b/chrome/browser/resources/quota_internals/quota-internals.js
new file mode 100644
index 0000000000000000000000000000000000000000..52c80bbe9a0a4d333527248c4f025d7b72f0a6d4
--- /dev/null
+++ b/chrome/browser/resources/quota_internals/quota-internals.js
@@ -0,0 +1,52 @@
+// Copyright (c) 2011 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.
+
+// require cr.js
+// require cr/event_target.js
+// require cr/util.js
+
+cr.define('cr.quota', function() {
+ 'use strict';
+ return {
+ onAvailableSpaceUpdated: new cr.EventTarget(),
+ onGlobalDataUpdated: new cr.EventTarget(),
+ onHostDataUpdated: new cr.EventTarget(),
+ onOriginDataUpdated: new cr.EventTarget(),
+ onStatisticsUpdated: new cr.EventTarget(),
+
+ triggar: function() {
Evan Stade 2011/06/01 00:48:25 trigger?
tzik 2011/06/03 16:13:47 I couldn't make good name for it. I just renamed i
+ chrome.send('requestData');
+ },
+
+ // Chrome Message Handler
Evan Stade 2011/06/01 00:48:25 why are you doing this instead of making the webui
tzik 2011/06/03 16:13:47 I think, this style makes the page more extendable
+ messageHandler_: function(message, detail) {
+ var target = null;
+ switch (message) {
+ case 'AvailableSpaceUpdated':
+ target = cr.quota.onAvailableSpaceUpdated;
+ break;
+ case 'GlobalDataUpdated':
+ target = cr.quota.onGlobalDataUpdated;
+ break;
+ case 'HostDataUpdated':
+ target = cr.quota.onHostDataUpdated;
+ break;
+ case 'OriginDataUpdated':
+ target = cr.quota.onOriginDataUpdated;
+ break;
+ case 'StatisticsUpdated':
+ target = cr.quota.onStatisticsUpdated;
+ break;
+ default:
+ console.log('Unknown Message');
+ break;
+ }
+ var event = cr.doc.createEvent('CustomEvent');
+ if (target) {
+ event.initCustomEvent('update', false, false, detail);
+ target.dispatchEvent(event);
+ }
+ }
+ };
+});

Powered by Google App Engine
This is Rietveld 408576698