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); |
+ } |
+ } |
+ }; |
+}); |