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

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: Created 5 years, 11 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
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 remoting.initGlobalEventHandlers = function() { 10 remoting.initGlobalEventHandlers = function() {
11 window.addEventListener('resize', remoting.onResize, false); 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);
Jamie 2015/01/23 22:37:24 This needed to be moved because remoting.fullscree
kelvinp 2015/01/23 23:39:58 I think we should also move both handlers (window.
Jamie 2015/01/24 00:46:35 Done. I've also moved the two remaining lines out
18 if (!base.isAppsV2()) { 12 if (!base.isAppsV2()) {
19 window.addEventListener('beforeunload', remoting.promptClose, false); 13 window.addEventListener('beforeunload', remoting.promptClose, false);
20 window.addEventListener('unload', remoting.disconnect, false); 14 window.addEventListener('unload', remoting.disconnect, false);
21 } 15 }
22 } 16 }
23 17
24 /** 18 /**
25 * @param {Array.<{event: string, id: string, 19 * @param {Array.<{event: string, id: string,
26 * fn: function(Event):void}>} actions Array of actions to register. 20 * fn: function(Event):void}>} actions Array of actions to register.
27 */ 21 */
(...skipping 13 matching lines...) Expand all
41 function registerEventListener(id, eventname, fn) { 35 function registerEventListener(id, eventname, fn) {
42 var element = document.getElementById(id); 36 var element = document.getElementById(id);
43 if (element) { 37 if (element) {
44 element.addEventListener(eventname, fn, false); 38 element.addEventListener(eventname, fn, false);
45 } else { 39 } else {
46 console.error('Could not set ' + eventname + 40 console.error('Could not set ' + eventname +
47 ' event handler on element ' + id + 41 ' event handler on element ' + id +
48 ': element not found.'); 42 ': element not found.');
49 } 43 }
50 } 44 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698