Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(296)

Side by Side Diff: remoting/webapp/remoting.js

Issue 9875031: [Chromoting] Move the onBlur handler from window to the plugin element. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/webapp/client_session.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /** @type {remoting.HostSession} */ remoting.hostSession = null; 10 /** @type {remoting.HostSession} */ remoting.hostSession = null;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 remoting.toolbar = new remoting.Toolbar( 46 remoting.toolbar = new remoting.Toolbar(
47 document.getElementById('session-toolbar')); 47 document.getElementById('session-toolbar'));
48 remoting.clipboard = new remoting.Clipboard(); 48 remoting.clipboard = new remoting.Clipboard();
49 49
50 refreshEmail_(); 50 refreshEmail_();
51 var email = remoting.oauth2.getCachedEmail(); 51 var email = remoting.oauth2.getCachedEmail();
52 if (email) { 52 if (email) {
53 document.getElementById('current-email').innerText = email; 53 document.getElementById('current-email').innerText = email;
54 } 54 }
55 55
56 window.addEventListener('blur', pluginLostFocus_, false);
57 // The plugin's onFocus handler sends a paste command to |window|, because 56 // The plugin's onFocus handler sends a paste command to |window|, because
58 // it can't send one to the plugin element itself. 57 // it can't send one to the plugin element itself.
59 window.addEventListener('paste', pluginGotPaste_, false); 58 window.addEventListener('paste', pluginGotPaste_, false);
60 59
61 if (isHostModeSupported_()) { 60 if (isHostModeSupported_()) {
62 var noShare = document.getElementById('chrome-os-no-share'); 61 var noShare = document.getElementById('chrome-os-no-share');
63 noShare.parentNode.removeChild(noShare); 62 noShare.parentNode.removeChild(noShare);
64 } else { 63 } else {
65 var button = document.getElementById('share-button'); 64 var button = document.getElementById('share-button');
66 button.disabled = true; 65 button.disabled = true;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 */ 142 */
144 function pluginGotPaste_(eventUncast) { 143 function pluginGotPaste_(eventUncast) {
145 var event = /** @type {remoting.ClipboardEvent} */ eventUncast; 144 var event = /** @type {remoting.ClipboardEvent} */ eventUncast;
146 if (event && event.clipboardData) { 145 if (event && event.clipboardData) {
147 remoting.clipboard.toHost(event.clipboardData); 146 remoting.clipboard.toHost(event.clipboardData);
148 } 147 }
149 return false; 148 return false;
150 } 149 }
151 150
152 /** 151 /**
153 * Callback function called when the browser window loses focus. In this case,
154 * release all keys to prevent them becoming 'stuck down' on the host.
155 */
156 function pluginLostFocus_() {
157 if (remoting.clientSession && remoting.clientSession.plugin) {
158 remoting.clientSession.plugin.releaseAllKeys();
159 }
160 }
161
162 /**
163 * If the user is authenticated, but there is no email address cached, get one. 152 * If the user is authenticated, but there is no email address cached, get one.
164 */ 153 */
165 function refreshEmail_() { 154 function refreshEmail_() {
166 if (!getEmail_() && remoting.oauth2.isAuthenticated()) { 155 if (!getEmail_() && remoting.oauth2.isAuthenticated()) {
167 remoting.oauth2.getEmail(setEmail_); 156 remoting.oauth2.getEmail(setEmail_);
168 } 157 }
169 } 158 }
170 159
171 /** 160 /**
172 * The key under which the email address is stored. 161 * The key under which the email address is stored.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 */ 215 */
227 function getUrlParameters_() { 216 function getUrlParameters_() {
228 var result = {}; 217 var result = {};
229 var parts = window.location.search.substring(1).split('&'); 218 var parts = window.location.search.substring(1).split('&');
230 for (var i = 0; i < parts.length; i++) { 219 for (var i = 0; i < parts.length; i++) {
231 var pair = parts[i].split('='); 220 var pair = parts[i].split('=');
232 result[pair[0]] = decodeURIComponent(pair[1]); 221 result[pair[0]] = decodeURIComponent(pair[1]);
233 } 222 }
234 return result; 223 return result;
235 } 224 }
OLDNEW
« no previous file with comments | « remoting/webapp/client_session.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698