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}