Handle authentication failures in the v2 app by restarting the app
commit2589f69a7fb7be7586f075af0b9029517543ed31
authorkelvinp <kelvinp@chromium.org>
Thu, 29 Jan 2015 22:24:28 +0000 (29 14:24 -0800)
committerCommit bot <commit-bot@chromium.org>
Thu, 29 Jan 2015 22:26:29 +0000 (29 22:26 +0000)
tree245f7b4d59019c3fb970ab3990e990071eb893d4
parent91d8e7f8c58a1278ae3ae8e721d4bd0c9d68ff72
Handle authentication failures in the v2 app by restarting the app

This CL handles the case when a token is revoked, e.g. via
https://security.google.com/settings/security/permissions.

We need to instruct chrome.identity to remove the invalid cached
token and fetch a new one.  The app would then be reloaded app as
some of the app components (wcs sandbox) cached the invalid token
and cannot be cleanly reinitialized.

Summary of changes:
1. Implement app reloading using chrome.app.AppWindow API's and
   base.Ipc so that it can be called from foreground pages
2. Implement handleAuthFailure in remoting.identity and remoting.oauth2.
   In remoting.identity, we would remove the cached token and request a
   new one by prompting the user for consent.
3. Modify the call sites to use the new method.

BUG=339677

Review URL: https://codereview.chromium.org/868203002

Cr-Commit-Position: refs/heads/master@{#313807}
14 files changed:
remoting/remoting_webapp_files.gypi
remoting/webapp/base/js/auth_dialog.js
remoting/webapp/base/js/auth_init.js
remoting/webapp/crd/js/activation_handler.js [new file with mode: 0644]
remoting/webapp/crd/js/app_launcher.js
remoting/webapp/crd/js/background.js
remoting/webapp/crd/js/crd_event_handlers.js
remoting/webapp/crd/js/desktop_remoting.js
remoting/webapp/crd/js/host_list.js
remoting/webapp/crd/js/identity.js
remoting/webapp/crd/js/it2me_helpee_channel.js
remoting/webapp/crd/js/oauth2.js
remoting/webapp/crd/js/remoting.js
remoting/webapp/js_proto/dom_proto.js