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

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

Issue 875583002: Allow full-screen mode when not connected, and remember the previous setting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 10 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
« no previous file with comments | « remoting/webapp/crd/js/desktop_remoting.js ('k') | remoting/webapp/crd/js/fullscreen_v2.js » ('j') | 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} */
8 var remoting = remoting || {};
9
10 remoting.initGlobalEventHandlers = function() {
11 window.addEventListener('resize', remoting.onResize, false);
12 // When a window goes full-screen, a resize event is triggered, but the
13 // Fullscreen.isActive call is not guaranteed to return true until the
14 // full-screen event is triggered. In apps v2, the size of the window's
15 // client area is calculated differently in full-screen mode, so register
16 // for both events.
17 remoting.fullscreen.addListener(remoting.onResize);
18 if (!base.isAppsV2()) {
19 window.addEventListener('beforeunload', remoting.promptClose, false);
20 window.addEventListener('unload', remoting.disconnect, false);
21 }
22 }
23
24 /** 7 /**
25 * @param {Array.<{event: string, id: string, 8 * @param {Array.<{event: string, id: string,
26 * fn: function(Event):void}>} actions Array of actions to register. 9 * fn: function(Event):void}>} actions Array of actions to register.
27 */ 10 */
28 function registerEventListeners(actions) { 11 function registerEventListeners(actions) {
29 for (var i = 0; i < actions.length; ++i) { 12 for (var i = 0; i < actions.length; ++i) {
30 var action = actions[i]; 13 var action = actions[i];
31 registerEventListener(action.id, action.event, action.fn); 14 registerEventListener(action.id, action.event, action.fn);
32 } 15 }
33 } 16 }
34 17
35 /** 18 /**
36 * Add an event listener to the specified element. 19 * Add an event listener to the specified element.
37 * @param {string} id Id of element. 20 * @param {string} id Id of element.
38 * @param {string} eventname Event name. 21 * @param {string} eventname Event name.
39 * @param {function(Event):void} fn Event handler. 22 * @param {function(Event):void} fn Event handler.
40 */ 23 */
41 function registerEventListener(id, eventname, fn) { 24 function registerEventListener(id, eventname, fn) {
42 var element = document.getElementById(id); 25 var element = document.getElementById(id);
43 if (element) { 26 if (element) {
44 element.addEventListener(eventname, fn, false); 27 element.addEventListener(eventname, fn, false);
45 } else { 28 } else {
46 console.error('Could not set ' + eventname + 29 console.error('Could not set ' + eventname +
47 ' event handler on element ' + id + 30 ' event handler on element ' + id +
48 ': element not found.'); 31 ': element not found.');
49 } 32 }
50 } 33 }
OLDNEW
« no previous file with comments | « remoting/webapp/crd/js/desktop_remoting.js ('k') | remoting/webapp/crd/js/fullscreen_v2.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698