| OLD | NEW |
| 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 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * | 7 * |
| 8 * It2MeHelpeeChannel relays messages between the Hangouts web page (Hangouts) | 8 * It2MeHelpeeChannel relays messages between the Hangouts web page (Hangouts) |
| 9 * and the It2Me Native Messaging Host (It2MeHost) for the helpee (the Hangouts | 9 * and the It2Me Native Messaging Host (It2MeHost) for the helpee (the Hangouts |
| 10 * participant who is receiving remoting assistance). | 10 * participant who is receiving remoting assistance). |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 var onAuthenticated = function() { | 395 var onAuthenticated = function() { |
| 396 oauth2.callWithToken( | 396 oauth2.callWithToken( |
| 397 resolve, | 397 resolve, |
| 398 function() { throw new Error('Authentication failed.'); }); | 398 function() { throw new Error('Authentication failed.'); }); |
| 399 }; | 399 }; |
| 400 /** @param {remoting.Error} error */ | 400 /** @param {remoting.Error} error */ |
| 401 var onError = function(error) { | 401 var onError = function(error) { |
| 402 if (error != remoting.Error.NOT_AUTHENTICATED) { | 402 if (error != remoting.Error.NOT_AUTHENTICATED) { |
| 403 throw new Error('Unexpected error fetch auth token: ' + error); | 403 throw new Error('Unexpected error fetch auth token: ' + error); |
| 404 } | 404 } |
| 405 oauth2.doAuthRedirect(onAuthenticated); | 405 oauth2.removeCachedAuthToken(base.doNothing); |
| 406 }; | 406 }; |
| 407 oauth2.callWithToken(resolve, onError); | 407 oauth2.callWithToken(resolve, onError); |
| 408 }); | 408 }); |
| 409 } | 409 } |
| 410 }; | 410 }; |
| 411 | 411 |
| 412 /** | 412 /** |
| 413 * Connects to the It2Me Native Messaging Host and retrieves the access code | 413 * Connects to the It2Me Native Messaging Host and retrieves the access code |
| 414 * in the |onHostStateChanged_| callback. | 414 * in the |onHostStateChanged_| callback. |
| 415 * | 415 * |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 | 488 |
| 489 console.error('Error responding to message method:' + | 489 console.error('Error responding to message method:' + |
| 490 (incomingMessage ? incomingMessage.method : 'null') + | 490 (incomingMessage ? incomingMessage.method : 'null') + |
| 491 ' error:' + error); | 491 ' error:' + error); |
| 492 this.hangoutPort_.postMessage({ | 492 this.hangoutPort_.postMessage({ |
| 493 method: remoting.It2MeHelpeeChannel.HangoutMessageTypes.ERROR, | 493 method: remoting.It2MeHelpeeChannel.HangoutMessageTypes.ERROR, |
| 494 message: error, | 494 message: error, |
| 495 request: incomingMessage | 495 request: incomingMessage |
| 496 }); | 496 }); |
| 497 }; | 497 }; |
| OLD | NEW |