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

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

Issue 848993002: Improve apps v2 upgrade UX (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address CL feedback 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 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 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 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 15 // client area is calculated differently in full-screen mode, so register
16 // for both events. 16 // for both events.
17 remoting.fullscreen.addListener(remoting.onResize); 17 remoting.fullscreen.addListener(remoting.onResize);
18 if (!base.isAppsV2()) { 18 if (!base.isAppsV2()) {
19 window.addEventListener('beforeunload', remoting.promptClose, false); 19 window.addEventListener('beforeunload', remoting.onBeforeUnload, false);
20 window.addEventListener('unload', remoting.disconnect, false); 20 window.addEventListener('unload', remoting.disconnect, false);
21 } 21 }
22 } 22 }
23 23
24 /** 24 /**
25 * @param {Array.<{event: string, id: string, 25 * @param {Array.<{event: string, id: string,
26 * fn: function(Event):void}>} actions Array of actions to register. 26 * fn: function(Event):void}>} actions Array of actions to register.
27 */ 27 */
28 function registerEventListeners(actions) { 28 function registerEventListeners(actions) {
29 for (var i = 0; i < actions.length; ++i) { 29 for (var i = 0; i < actions.length; ++i) {
(...skipping 11 matching lines...) Expand all
41 function registerEventListener(id, eventname, fn) { 41 function registerEventListener(id, eventname, fn) {
42 var element = document.getElementById(id); 42 var element = document.getElementById(id);
43 if (element) { 43 if (element) {
44 element.addEventListener(eventname, fn, false); 44 element.addEventListener(eventname, fn, false);
45 } else { 45 } else {
46 console.error('Could not set ' + eventname + 46 console.error('Could not set ' + eventname +
47 ' event handler on element ' + id + 47 ' event handler on element ' + id +
48 ': element not found.'); 48 ': element not found.');
49 } 49 }
50 } 50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698