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

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

Issue 1020743002: [Chromoting] Move app-specific code out of remoting.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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() {
11 var goHome = function() { 11 var goHome = function() {
12 remoting.setMode(remoting.AppMode.HOME); 12 remoting.setMode(remoting.AppMode.HOME);
13 }; 13 };
14 var goEnterAccessCode = function() { 14 var goEnterAccessCode = function() {
15 // We don't need a token until we authenticate, but asking for one here 15 // We don't need a token until we authenticate, but asking for one here
16 // handles the token-expired case earlier, avoiding asking the user for 16 // handles the token-expired case earlier, avoiding asking the user for
17 // the access code both before and after re-authentication. 17 // the access code both before and after re-authentication.
18 remoting.identity.getToken(). 18 remoting.identity.getToken().
19 then(function(token) { 19 then(function(token) {
20 remoting.setMode(remoting.AppMode.CLIENT_UNCONNECTED); 20 remoting.setMode(remoting.AppMode.CLIENT_UNCONNECTED);
21 }). 21 }).
22 catch(remoting.Error.handler(remoting.showErrorMessage)); 22 catch(remoting.Error.handler(
23 remoting.app.onAuthError.bind(remoting.app)));
23 }; 24 };
24 var goFinishedIT2Me = function() { 25 var goFinishedIT2Me = function() {
25 if (remoting.currentMode == remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME) { 26 if (remoting.currentMode == remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME) {
26 remoting.setMode(remoting.AppMode.CLIENT_UNCONNECTED); 27 remoting.setMode(remoting.AppMode.CLIENT_UNCONNECTED);
27 } else { 28 } else {
28 goHome(); 29 goHome();
29 } 30 }
30 }; 31 };
31 /** @param {Event} event The event. */ 32 /** @param {Event} event The event. */
32 var sendAccessCode = function(event) { 33 var sendAccessCode = function(event) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 { event: 'click', id: 'sign-out', fn:remoting.signOut }, 78 { event: 'click', id: 'sign-out', fn:remoting.signOut },
78 { event: 'click', id: 'token-refresh-error-ok', fn: goHome }, 79 { event: 'click', id: 'token-refresh-error-ok', fn: goHome },
79 { event: 'click', id: 'token-refresh-error-sign-in', 80 { event: 'click', id: 'token-refresh-error-sign-in',
80 fn: remoting.handleAuthFailureAndRelaunch } 81 fn: remoting.handleAuthFailureAndRelaunch }
81 ]; 82 ];
82 registerEventListeners(it2me_actions); 83 registerEventListeners(it2me_actions);
83 registerEventListeners(me2me_actions); 84 registerEventListeners(me2me_actions);
84 registerEventListeners(host_actions); 85 registerEventListeners(host_actions);
85 registerEventListeners(auth_actions); 86 registerEventListeners(auth_actions);
86 } 87 }
88
89 /**
90 * Sign the user out of Chromoting by clearing (and revoking, if possible) the
91 * OAuth refresh token.
92 *
93 * Also clear all local storage, to avoid leaking information.
94 */
95 remoting.signOut = function() {
garykac 2015/03/19 01:03:43 moved here from remoting.js. It is only used in th
kelvinp 2015/03/19 17:50:20 Acknowledged.
96 remoting.oauth2.removeCachedAuthToken().then(function(){
97 chrome.storage.local.clear();
98 remoting.setMode(remoting.AppMode.HOME);
99 window.location.reload();
100 });
101 };
102
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698