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

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

Issue 944183002: HostTableEntry refactor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Jamie's feedback Created 5 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
« no previous file with comments | « remoting/webapp/crd/html/ui_me2me.html ('k') | remoting/webapp/crd/js/crd_main.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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.initElementEventHandlers = function() { 10 remoting.initElementEventHandlers = function() {
(...skipping 19 matching lines...) Expand all
30 }; 30 };
31 /** @param {Event} event The event. */ 31 /** @param {Event} event The event. */
32 var sendAccessCode = function(event) { 32 var sendAccessCode = function(event) {
33 remoting.connectIT2Me(); 33 remoting.connectIT2Me();
34 event.preventDefault(); 34 event.preventDefault();
35 }; 35 };
36 var reconnect = function() { 36 var reconnect = function() {
37 remoting.setMode(remoting.AppMode.CLIENT_CONNECTING); 37 remoting.setMode(remoting.AppMode.CLIENT_CONNECTING);
38 remoting.app.getSessionConnector().reconnect(); 38 remoting.app.getSessionConnector().reconnect();
39 }; 39 };
40 /** @param {Event} event The event. */
41 var stopDaemon = function(event) {
42 remoting.hostSetupDialog.showForStop();
43 event.stopPropagation();
44 };
45 var cancelAccessCode = function() { 40 var cancelAccessCode = function() {
46 remoting.setMode(remoting.AppMode.HOME); 41 remoting.setMode(remoting.AppMode.HOME);
47 document.getElementById('access-code-entry').value = ''; 42 document.getElementById('access-code-entry').value = '';
48 }; 43 };
49 /** @type {Array<{event: string, id: string, fn: function(Event):void}>} */ 44 /** @type {Array<{event: string, id: string, fn: function(Event):void}>} */
50 var it2me_actions = [ 45 var it2me_actions = [
51 { event: 'click', id: 'access-mode-button', fn: goEnterAccessCode }, 46 { event: 'click', id: 'access-mode-button', fn: goEnterAccessCode },
52 { event: 'submit', id: 'access-code-form', fn: sendAccessCode }, 47 { event: 'submit', id: 'access-code-form', fn: sendAccessCode },
53 { event: 'click', id: 'cancel-access-code-button', fn: cancelAccessCode}, 48 { event: 'click', id: 'cancel-access-code-button', fn: cancelAccessCode},
54 { event: 'click', id: 'cancel-share-button', fn: remoting.cancelShare }, 49 { event: 'click', id: 'cancel-share-button', fn: remoting.cancelShare },
55 { event: 'click', id: 'client-finished-it2me-button', fn: goHome }, 50 { event: 'click', id: 'client-finished-it2me-button', fn: goHome },
56 { event: 'click', id: 'get-started-it2me', 51 { event: 'click', id: 'get-started-it2me',
57 fn: remoting.showIT2MeUiAndSave }, 52 fn: remoting.showIT2MeUiAndSave },
58 { event: 'click', id: 'host-finished-button', fn: goHome }, 53 { event: 'click', id: 'host-finished-button', fn: goHome },
59 { event: 'click', id: 'share-button', fn: remoting.tryShare } 54 { event: 'click', id: 'share-button', fn: remoting.tryShare }
60 ]; 55 ];
61 /** @type {Array<{event: string, id: string, fn: function(Event):void}>} */ 56 /** @type {Array<{event: string, id: string, fn: function(Event):void}>} */
62 var me2me_actions = [ 57 var me2me_actions = [
63 { event: 'click', id: 'change-daemon-pin',
64 fn: function() { remoting.hostSetupDialog.showForPin(); } },
65 { event: 'click', id: 'client-finished-me2me-button', fn: goHome }, 58 { event: 'click', id: 'client-finished-me2me-button', fn: goHome },
66 { event: 'click', id: 'client-reconnect-button', fn: reconnect }, 59 { event: 'click', id: 'client-reconnect-button', fn: reconnect },
67 { event: 'click', id: 'daemon-pin-cancel', fn: goHome }, 60 { event: 'click', id: 'daemon-pin-cancel', fn: goHome },
68 { event: 'click', id: 'get-started-me2me', 61 { event: 'click', id: 'get-started-me2me',
69 fn: remoting.showMe2MeUiAndSave }, 62 fn: remoting.showMe2MeUiAndSave }
70 { event: 'click', id: 'start-daemon',
71 fn: function() { remoting.hostSetupDialog.showForStart(); } },
72 { event: 'click', id: 'stop-daemon', fn: stopDaemon }
73 ]; 63 ];
74 /** @type {Array<{event: string, id: string, fn: function(Event):void}>} */ 64 /** @type {Array<{event: string, id: string, fn: function(Event):void}>} */
75 var host_actions = [ 65 var host_actions = [
76 { event: 'click', id: 'close-paired-client-manager-dialog', fn: goHome }, 66 { event: 'click', id: 'close-paired-client-manager-dialog', fn: goHome },
77 { event: 'click', id: 'host-config-done-dismiss', fn: goHome }, 67 { event: 'click', id: 'host-config-done-dismiss', fn: goHome },
78 { event: 'click', id: 'host-config-error-dismiss', fn: goHome }, 68 { event: 'click', id: 'host-config-error-dismiss', fn: goHome },
79 { event: 'click', id: 'open-paired-client-manager-dialog', 69 { event: 'click', id: 'open-paired-client-manager-dialog',
80 fn: remoting.setMode.bind(null, 70 fn: remoting.setMode.bind(null,
81 remoting.AppMode.HOME_MANAGE_PAIRINGS) }, 71 remoting.AppMode.HOME_MANAGE_PAIRINGS) },
82 { event: 'click', id: 'stop-sharing-button', fn: remoting.cancelShare } 72 { event: 'click', id: 'stop-sharing-button', fn: remoting.cancelShare }
83 ]; 73 ];
84 /** @type {Array<{event: string, id: string, fn: function(Event):void}>} */ 74 /** @type {Array<{event: string, id: string, fn: function(Event):void}>} */
85 var auth_actions = [ 75 var auth_actions = [
86 { event: 'click', id: 'cancel-connect-button', fn: goHome }, 76 { event: 'click', id: 'cancel-connect-button', fn: goHome },
87 { event: 'click', id: 'sign-out', fn:remoting.signOut }, 77 { event: 'click', id: 'sign-out', fn:remoting.signOut },
88 { event: 'click', id: 'token-refresh-error-ok', fn: goHome }, 78 { event: 'click', id: 'token-refresh-error-ok', fn: goHome },
89 { event: 'click', id: 'token-refresh-error-sign-in', 79 { event: 'click', id: 'token-refresh-error-sign-in',
90 fn: remoting.handleAuthFailureAndRelaunch } 80 fn: remoting.handleAuthFailureAndRelaunch }
91 ]; 81 ];
92 registerEventListeners(it2me_actions); 82 registerEventListeners(it2me_actions);
93 registerEventListeners(me2me_actions); 83 registerEventListeners(me2me_actions);
94 registerEventListeners(host_actions); 84 registerEventListeners(host_actions);
95 registerEventListeners(auth_actions); 85 registerEventListeners(auth_actions);
96 } 86 }
OLDNEW
« no previous file with comments | « remoting/webapp/crd/html/ui_me2me.html ('k') | remoting/webapp/crd/js/crd_main.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698