Index: chrome/browser/resources/gcm_internals.js |
diff --git a/chrome/browser/resources/gcm_internals.js b/chrome/browser/resources/gcm_internals.js |
index be7c447d7ab205168edff8b776cb2551b890da1a..807d52aa930b28e9c433e1390ed5a3737b49c12f 100644 |
--- a/chrome/browser/resources/gcm_internals.js |
+++ b/chrome/browser/resources/gcm_internals.js |
@@ -2,16 +2,41 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-cr.define('gcminternals', function() { |
+cr.define('gcm_internals', function() { |
'use strict'; |
+ /** |
+ * Display device informations. |
+ * @param {!Info[]} info A dictionary of device infos to be displayed. |
+ */ |
+ function displayDeviceInfo(info) { |
+ $('gcm-enabled').textContent = info.gcmEnabled; |
+ $('user-signed-in').textContent = info.userSignedIn; |
+ $('gcm-client-created').textContent = info.gcmClientCreated; |
+ if (info.hasOwnProperty('gcmClientReady')) { |
+ $('gcm-client-ready').textContent = info.gcmClientReady; |
+ } |
+ } |
+ |
function initialize() { |
+ chrome.send('gcmInternalsGetInfo'); |
+ } |
+ |
+ /** |
+ * Callback function accepting a dictionary of info items to be displayed. |
+ * @param {!Info[]} infos A dictionary of info items to be displayed. |
+ */ |
+ function returnInfos(infos) { |
fgorski
2014/02/26 23:38:19
I think this method could be called: setGcmInterna
juyik
2014/03/01 00:21:57
Done.
|
+ if (infos.hasOwnProperty('deviceInfo')) { |
+ displayDeviceInfo(infos.deviceInfo); |
+ } |
} |
// Return an object with all of the exports. |
return { |
initialize: initialize, |
+ returnInfos: returnInfos, |
}; |
}); |
-document.addEventListener('DOMContentLoaded', gcminternals.initialize); |
+document.addEventListener('DOMContentLoaded', gcm_internals.initialize); |