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

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

Issue 11769002: Apps v2 identity integration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 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
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 function onLoad() { 10 function onLoad() {
11 var restartWebapp = function() { 11 var restartWebapp = function() {
12 window.location.replace(chrome.extension.getURL('main.html')); 12 window.location.replace(chrome.extension.getURL('main.html'));
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.oauth2.callWithToken( 18 remoting.identity.callWithToken(
19 /** @param {string} token */ 19 /** @param {string} token */
20 function(token) { 20 function(token) {
21 remoting.setMode(remoting.AppMode.CLIENT_UNCONNECTED); 21 remoting.setMode(remoting.AppMode.CLIENT_UNCONNECTED);
22 }, 22 },
23 remoting.showErrorMessage); 23 remoting.showErrorMessage);
24 }; 24 };
25 var goFinishedIt2Me = function() { 25 var goFinishedIt2Me = function() {
26 if (remoting.currentMode == remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME) { 26 if (remoting.currentMode == remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME) {
27 remoting.setMode(remoting.AppMode.CLIENT_UNCONNECTED); 27 remoting.setMode(remoting.AppMode.CLIENT_UNCONNECTED);
28 } else { 28 } else {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 } 120 }
121 121
122 function onBeforeUnload() { 122 function onBeforeUnload() {
123 return remoting.promptClose(); 123 return remoting.promptClose();
124 } 124 }
125 125
126 window.addEventListener('load', onLoad, false); 126 window.addEventListener('load', onLoad, false);
127 window.addEventListener('beforeunload', onBeforeUnload, false); 127 window.addEventListener('beforeunload', onBeforeUnload, false);
128 window.addEventListener('resize', remoting.onResize, false); 128 window.addEventListener('resize', remoting.onResize, false);
129 window.addEventListener('unload', remoting.disconnect, false); 129 window.addEventListener('unload', remoting.disconnect, false);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698