OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 cr.define('gcminternals', function() { | 5 cr.define('gcm_internals', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 /** | |
9 * Display device informations. | |
10 * @param {!Info[]} info A dictionary of device infos to be displayed. | |
11 */ | |
12 function displayDeviceInfo(info) { | |
13 $('gcm-enabled').textContent = info.gcmEnabled; | |
14 $('user-signed-in').textContent = info.userSignedIn; | |
15 $('gcm-client-created').textContent = info.gcmClientCreated; | |
16 if (info.hasOwnProperty('gcmClientReady')) { | |
17 $('gcm-client-ready').textContent = info.gcmClientReady; | |
18 } | |
19 } | |
20 | |
8 function initialize() { | 21 function initialize() { |
22 chrome.send('gcmInternalsGetInfo'); | |
23 } | |
24 | |
25 /** | |
26 * Callback function accepting a dictionary of info items to be displayed. | |
27 * @param {!Info[]} infos A dictionary of info items to be displayed. | |
28 */ | |
29 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.
| |
30 if (infos.hasOwnProperty('deviceInfo')) { | |
31 displayDeviceInfo(infos.deviceInfo); | |
32 } | |
9 } | 33 } |
10 | 34 |
11 // Return an object with all of the exports. | 35 // Return an object with all of the exports. |
12 return { | 36 return { |
13 initialize: initialize, | 37 initialize: initialize, |
38 returnInfos: returnInfos, | |
14 }; | 39 }; |
15 }); | 40 }); |
16 | 41 |
17 document.addEventListener('DOMContentLoaded', gcminternals.initialize); | 42 document.addEventListener('DOMContentLoaded', gcm_internals.initialize); |
OLD | NEW |