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 /** |
(...skipping 21 matching lines...) Expand all Loading... |
32 remoting.fullscreen = new remoting.FullscreenAppsV2(); | 32 remoting.fullscreen = new remoting.FullscreenAppsV2(); |
33 } else { | 33 } else { |
34 remoting.fullscreen = new remoting.FullscreenAppsV1(); | 34 remoting.fullscreen = new remoting.FullscreenAppsV1(); |
35 } | 35 } |
36 | 36 |
37 remoting.stats = new remoting.ConnectionStats( | 37 remoting.stats = new remoting.ConnectionStats( |
38 document.getElementById('statistics')); | 38 document.getElementById('statistics')); |
39 remoting.formatIq = new remoting.FormatIq(); | 39 remoting.formatIq = new remoting.FormatIq(); |
40 | 40 |
41 remoting.clipboard = new remoting.Clipboard(); | 41 remoting.clipboard = new remoting.Clipboard(); |
42 var sandbox = /** @type {HTMLIFrameElement} */ | 42 var sandbox = |
43 document.getElementById('wcs-sandbox'); | 43 /** @type {HTMLIFrameElement} */ (document.getElementById('wcs-sandbox')); |
44 remoting.wcsSandbox = new remoting.WcsSandboxContainer(sandbox.contentWindow); | 44 remoting.wcsSandbox = new remoting.WcsSandboxContainer(sandbox.contentWindow); |
45 | 45 |
46 // The plugin's onFocus handler sends a paste command to |window|, because | 46 // The plugin's onFocus handler sends a paste command to |window|, because |
47 // it can't send one to the plugin element itself. | 47 // it can't send one to the plugin element itself. |
48 window.addEventListener('paste', pluginGotPaste_, false); | 48 window.addEventListener('paste', pluginGotPaste_, false); |
49 window.addEventListener('copy', pluginGotCopy_, false); | 49 window.addEventListener('copy', pluginGotCopy_, false); |
50 | 50 |
51 remoting.initModalDialogs(); | 51 remoting.initModalDialogs(); |
52 | 52 |
53 remoting.testEvents = new base.EventSource(); | 53 remoting.testEvents = new base.EventSource(); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 remoting.signOut = function() { | 119 remoting.signOut = function() { |
120 remoting.oauth2.clear(); | 120 remoting.oauth2.clear(); |
121 chrome.storage.local.clear(); | 121 chrome.storage.local.clear(); |
122 remoting.setMode(remoting.AppMode.HOME); | 122 remoting.setMode(remoting.AppMode.HOME); |
123 document.getElementById('auth-dialog').hidden = false; | 123 document.getElementById('auth-dialog').hidden = false; |
124 }; | 124 }; |
125 | 125 |
126 /** | 126 /** |
127 * Callback function called when the browser window gets a paste operation. | 127 * Callback function called when the browser window gets a paste operation. |
128 * | 128 * |
129 * @param {Event} eventUncast | 129 * @param {Event} event |
130 * @return {void} Nothing. | 130 * @return {void} Nothing. |
131 */ | 131 */ |
132 function pluginGotPaste_(eventUncast) { | 132 function pluginGotPaste_(event) { |
133 var event = /** @type {remoting.ClipboardEvent} */ eventUncast; | |
134 if (event && event.clipboardData) { | 133 if (event && event.clipboardData) { |
135 remoting.clipboard.toHost(event.clipboardData); | 134 remoting.clipboard.toHost(event.clipboardData); |
136 } | 135 } |
137 } | 136 } |
138 | 137 |
139 /** | 138 /** |
140 * Callback function called when the browser window gets a copy operation. | 139 * Callback function called when the browser window gets a copy operation. |
141 * | 140 * |
142 * @param {Event} eventUncast | 141 * @param {Event} event |
143 * @return {void} Nothing. | 142 * @return {void} Nothing. |
144 */ | 143 */ |
145 function pluginGotCopy_(eventUncast) { | 144 function pluginGotCopy_(event) { |
146 var event = /** @type {remoting.ClipboardEvent} */ eventUncast; | |
147 if (event && event.clipboardData) { | 145 if (event && event.clipboardData) { |
148 if (remoting.clipboard.toOs(event.clipboardData)) { | 146 if (remoting.clipboard.toOs(event.clipboardData)) { |
149 // The default action may overwrite items that we added to clipboardData. | 147 // The default action may overwrite items that we added to clipboardData. |
150 event.preventDefault(); | 148 event.preventDefault(); |
151 } | 149 } |
152 } | 150 } |
153 } | 151 } |
154 | 152 |
155 /** | 153 /** |
156 * @return {Object.<string, string>} The URL parameters. | 154 * @return {Object.<string, string>} The URL parameters. |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 ]; | 247 ]; |
250 for (var setting in window.localStorage) { | 248 for (var setting in window.localStorage) { |
251 if (oauthSettings.indexOf(setting) == -1) { | 249 if (oauthSettings.indexOf(setting) == -1) { |
252 var copy = {} | 250 var copy = {} |
253 copy[setting] = window.localStorage.getItem(setting); | 251 copy[setting] = window.localStorage.getItem(setting); |
254 chrome.storage.local.set(copy); | 252 chrome.storage.local.set(copy); |
255 window.localStorage.removeItem(setting); | 253 window.localStorage.removeItem(setting); |
256 } | 254 } |
257 } | 255 } |
258 } | 256 } |
OLD | NEW |