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 function onLoad() { | 10 function onLoad() { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 { event: 'click', id: 'access-mode-button', fn: goEnterAccessCode }, | 47 { event: 'click', id: 'access-mode-button', fn: goEnterAccessCode }, |
48 { event: 'click', id: 'cancel-share-button', fn: remoting.cancelShare }, | 48 { event: 'click', id: 'cancel-share-button', fn: remoting.cancelShare }, |
49 { event: 'click', id: 'host-finished-button', fn: goHome }, | 49 { event: 'click', id: 'host-finished-button', fn: goHome }, |
50 { event: 'click', id: 'client-cancel-button', fn: goHome }, | 50 { event: 'click', id: 'client-cancel-button', fn: goHome }, |
51 { event: 'click', id: 'client-finished-it2me-button', | 51 { event: 'click', id: 'client-finished-it2me-button', |
52 fn: goFinishedIt2Me }, | 52 fn: goFinishedIt2Me }, |
53 { event: 'click', id: 'client-finished-me2me-button', fn: goHome }, | 53 { event: 'click', id: 'client-finished-me2me-button', fn: goHome }, |
54 { event: 'click', id: 'client-reconnect-button', fn: reload }, | 54 { event: 'click', id: 'client-reconnect-button', fn: reload }, |
55 { event: 'click', id: 'cancel-button', | 55 { event: 'click', id: 'cancel-button', |
56 fn: remoting.cancelPendingOperation }, | 56 fn: remoting.cancelPendingOperation }, |
57 { event: 'click', id: 'toolbar-stub', | |
58 fn: function() { remoting.toolbar.toggle(); } }, | |
garykac
2012/02/01 18:24:48
Does
{ ..., fn: remoting.toolbar.toggle },
work?
Jamie
2012/02/01 19:22:20
remoting.toolbar is null when this is invoked, but
| |
57 { event: 'submit', id: 'access-code-form', fn: sendAccessCode }, | 59 { event: 'submit', id: 'access-code-form', fn: sendAccessCode }, |
58 { event: 'submit', id: 'pin-form', fn: connectHostWithPin } | 60 { event: 'submit', id: 'pin-form', fn: connectHostWithPin } |
59 ]; | 61 ]; |
60 | 62 |
61 for (var i = 0; i < actions.length; ++i) { | 63 for (var i = 0; i < actions.length; ++i) { |
62 var action = actions[i]; | 64 var action = actions[i]; |
63 var element = document.getElementById(action.id); | 65 var element = document.getElementById(action.id); |
64 if (element) { | 66 if (element) { |
65 element.addEventListener(action.event, action.fn, false); | 67 element.addEventListener(action.event, action.fn, false); |
66 } else { | 68 } else { |
67 console.error('Could not set ' + action.id + | 69 console.error('Could not set ' + action.id + |
68 ' event handler on element ' + action.event + | 70 ' event handler on element ' + action.event + |
69 ': element not found.'); | 71 ': element not found.'); |
70 } | 72 } |
71 } | 73 } |
72 remoting.init(); | 74 remoting.init(); |
73 } | 75 } |
74 | 76 |
75 function onBeforeUnload() { | 77 function onBeforeUnload() { |
76 return remoting.promptClose(); | 78 return remoting.promptClose(); |
77 } | 79 } |
78 | 80 |
79 window.addEventListener('load', onLoad, false); | 81 window.addEventListener('load', onLoad, false); |
80 window.addEventListener('beforeunload', onBeforeUnload, false); | 82 window.addEventListener('beforeunload', onBeforeUnload, false); |
81 window.addEventListener('resize', remoting.onResize, false); | 83 window.addEventListener('resize', remoting.onResize, false); |
82 window.addEventListener('unload', remoting.disconnect, false); | 84 window.addEventListener('unload', remoting.disconnect, false); |
OLD | NEW |