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

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

Issue 9148043: Rename webapp_it2me to remoting_webapp and move it from webapp/me2mom to webapp/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add webapp_it2me back Created 8 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 | Annotate | Revision Log
« no previous file with comments | « remoting/webapp/me2mom/dividertop.png ('k') | remoting/webapp/me2mom/host_list.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 'use strict';
6
7 /** @suppress {duplicate} */
8 var remoting = remoting || {};
9
10 function onLoad() {
11 var goHome = function() {
12 remoting.setMode(remoting.AppMode.HOME);
13 };
14 var goClient = function() {
15 remoting.setMode(remoting.AppMode.CLIENT_UNCONNECTED);
16 };
17 /** @param {Event} event */
18 var sendAccessCode = function(event) {
19 remoting.connectIt2Me();
20 event.preventDefault();
21 };
22 /** @param {Event} event */
23 var connectHostWithPin = function(event) {
24 remoting.connectMe2MeWithPin();
25 event.preventDefault();
26 };
27 var doAuthRedirect = function() {
28 remoting.oauth2.doAuthRedirect();
29 }
30 /** @type {Array.<{event: string, id: string, fn: function(Event):void}>} */
31 var actions = [
32 { event: 'click', id: 'clear-oauth', fn: remoting.clearOAuth2 },
33 { event: 'click', id: 'toolbar-disconnect', fn: remoting.disconnect },
34 { event: 'click', id: 'toggle-scaling', fn: remoting.toggleScaleToFit },
35 { event: 'click', id: 'auth-button', fn: doAuthRedirect },
36 { event: 'click', id: 'share-button', fn: remoting.tryShare },
37 { event: 'click', id: 'access-mode-button', fn: goClient },
38 { event: 'click', id: 'cancel-share-button', fn: remoting.cancelShare },
39 { event: 'click', id: 'host-finished-button', fn: goHome },
40 { event: 'click', id: 'client-cancel-button', fn: goHome },
41 { event: 'click', id: 'client-finished-button', fn: goClient },
42 { event: 'click', id: 'cancel-button',
43 fn: remoting.cancelPendingOperation },
44 { event: 'submit', id: 'access-code-form', fn: sendAccessCode },
45 { event: 'submit', id: 'pin-form', fn: connectHostWithPin }
46 ];
47
48 for (var i = 0; i < actions.length; ++i) {
49 var action = actions[i];
50 var element = document.getElementById(action.id);
51 if (element) {
52 element.addEventListener(action.event, action.fn, false);
53 } else {
54 console.error('Could not set ' + action.id +
55 ' event handler on element ' + action.event +
56 ': element not found.');
57 }
58 }
59 remoting.init();
60 }
61
62 function onBeforeUnload() {
63 return remoting.promptClose();
64 }
65
66 window.addEventListener('load', onLoad, false);
67 window.addEventListener('beforeunload', onBeforeUnload, false);
68 window.addEventListener('resize', remoting.onResize, false);
69 window.addEventListener('unload', remoting.disconnect, false);
OLDNEW
« no previous file with comments | « remoting/webapp/me2mom/dividertop.png ('k') | remoting/webapp/me2mom/host_list.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698