OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** @suppress {duplicate} */ | 7 /** @suppress {duplicate} */ |
8 var remoting = remoting || {}; | 8 var remoting = remoting || {}; |
9 | 9 |
10 /** | 10 /** |
11 * @type {base.EventSourceImpl} An event source object for handling global | 11 * @type {base.EventSourceImpl} An event source object for handling global |
12 * events. This is an interim hack. Eventually, we should move | 12 * events. This is an interim hack. Eventually, we should move |
13 * functionalities away from the remoting namespace and into smaller objects. | 13 * functionalities away from the remoting namespace and into smaller objects. |
14 */ | 14 */ |
15 remoting.testEvents; | 15 remoting.testEvents; |
16 | 16 |
17 /** | 17 /** |
18 * Initialization tasks that are common to all remoting apps. | 18 * Initialization tasks that are common to all remoting apps. |
19 */ | 19 */ |
20 remoting.initGlobalObjects = function() { | 20 remoting.initGlobalObjects = function() { |
21 if (base.isAppsV2()) { | 21 if (base.isAppsV2()) { |
22 var htmlNode = /** @type {HTMLElement} */ (document.body.parentNode); | 22 var htmlNode = /** @type {HTMLElement} */ (document.body.parentNode); |
23 htmlNode.classList.add('apps-v2'); | 23 htmlNode.classList.add('apps-v2'); |
24 } | 24 } |
25 | 25 |
26 console.log(remoting.getExtensionInfo()); | 26 console.log(remoting.getExtensionInfo()); |
27 l10n.localize(); | 27 l10n.localize(); |
28 | 28 |
29 remoting.stats = new remoting.ConnectionStats( | |
30 document.getElementById('statistics')); | |
31 remoting.formatIq = new remoting.FormatIq(); | 29 remoting.formatIq = new remoting.FormatIq(); |
32 | 30 |
33 var sandbox = | 31 var sandbox = |
34 /** @type {HTMLIFrameElement} */ (document.getElementById('wcs-sandbox')); | 32 /** @type {HTMLIFrameElement} */ (document.getElementById('wcs-sandbox')); |
35 remoting.wcsSandbox = new remoting.WcsSandboxContainer(sandbox.contentWindow); | 33 remoting.wcsSandbox = new remoting.WcsSandboxContainer(sandbox.contentWindow); |
36 | 34 |
37 remoting.initModalDialogs(); | 35 remoting.initModalDialogs(); |
38 | 36 |
39 remoting.testEvents = new base.EventSourceImpl(); | 37 remoting.testEvents = new base.EventSourceImpl(); |
40 /** @enum {string} */ | 38 /** @enum {string} */ |
41 remoting.testEvents.Names = { | 39 remoting.testEvents.Names = { |
42 uiModeChanged: 'uiModeChanged' | 40 uiModeChanged: 'uiModeChanged' |
43 }; | 41 }; |
44 remoting.testEvents.defineEvents(base.values(remoting.testEvents.Names)); | 42 remoting.testEvents.defineEvents(base.values(remoting.testEvents.Names)); |
45 } | 43 }; |
46 | 44 |
47 /** | 45 /** |
48 * @return {string} Information about the current extension. | 46 * @return {string} Information about the current extension. |
49 */ | 47 */ |
50 remoting.getExtensionInfo = function() { | 48 remoting.getExtensionInfo = function() { |
51 var v2OrLegacy = base.isAppsV2() ? " (v2)" : " (legacy)"; | 49 var v2OrLegacy = base.isAppsV2() ? " (v2)" : " (legacy)"; |
52 var manifest = chrome.runtime.getManifest(); | 50 var manifest = chrome.runtime.getManifest(); |
53 if (manifest && manifest.version) { | 51 if (manifest && manifest.version) { |
54 var name = remoting.app.getApplicationName(); | 52 var name = remoting.app.getApplicationName(); |
55 return name + ' version: ' + manifest.version + v2OrLegacy; | 53 return name + ' version: ' + manifest.version + v2OrLegacy; |
(...skipping 20 matching lines...) Expand all Loading... |
76 result = new Array(len - result.length + 1).join('0') + result; | 74 result = new Array(len - result.length + 1).join('0') + result; |
77 } | 75 } |
78 return result; | 76 return result; |
79 }; | 77 }; |
80 var now = new Date(); | 78 var now = new Date(); |
81 var timestamp = pad(now.getMonth() + 1, 2) + pad(now.getDate(), 2) + '/' + | 79 var timestamp = pad(now.getMonth() + 1, 2) + pad(now.getDate(), 2) + '/' + |
82 pad(now.getHours(), 2) + pad(now.getMinutes(), 2) + | 80 pad(now.getHours(), 2) + pad(now.getMinutes(), 2) + |
83 pad(now.getSeconds(), 2) + '.' + pad(now.getMilliseconds(), 3); | 81 pad(now.getSeconds(), 2) + '.' + pad(now.getMilliseconds(), 3); |
84 return '[' + timestamp + ']'; | 82 return '[' + timestamp + ']'; |
85 }; | 83 }; |
OLD | NEW |