Commit 0caf8569 authored by nyquist@chromium.org's avatar nyquist@chromium.org

Start using OAuth2 for sync cacheinvalidation.

Currently our cacheinvalidation implementation still uses clientlogin.
This changes our implementation to instead use OAuth2.

This requires the roll to r313 of the cacheinvalidation library.

BUG=264503

Review URL: https://chromiumcodereview.appspot.com/22872002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@222262 0039d316-1c4b-4281-b951-d872f2087c98
parent 43197ea2
...@@ -200,14 +200,13 @@ public class InvalidationService extends AndroidListener { ...@@ -200,14 +200,13 @@ public class InvalidationService extends AndroidListener {
// Attempt to retrieve a token for the user. This method will also invalidate // Attempt to retrieve a token for the user. This method will also invalidate
// invalidAuthToken if it is non-null. // invalidAuthToken if it is non-null.
AccountManagerHelper.get(this).getNewAuthTokenFromForeground( AccountManagerHelper.get(this).getNewAuthTokenFromForeground(
account, invalidAuthToken, SyncStatusHelper.AUTH_TOKEN_TYPE_SYNC, account, invalidAuthToken, getOAuth2ScopeWithType(),
new AccountManagerHelper.GetAuthTokenCallback() { new AccountManagerHelper.GetAuthTokenCallback() {
@Override @Override
public void tokenAvailable(String token) { public void tokenAvailable(String token) {
if (token != null) { if (token != null) {
InvalidationService.setAuthToken( setAuthToken(InvalidationService.this.getApplicationContext(),
InvalidationService.this.getApplicationContext(), pendingIntent, pendingIntent, token, getOAuth2ScopeWithType());
token, SyncStatusHelper.AUTH_TOKEN_TYPE_SYNC);
} }
} }
}); });
...@@ -439,6 +438,10 @@ public class InvalidationService extends AndroidListener { ...@@ -439,6 +438,10 @@ public class InvalidationService extends AndroidListener {
return sClientId; return sClientId;
} }
private static String getOAuth2ScopeWithType() {
return "oauth2:" + SyncStatusHelper.CHROME_SYNC_OAUTH2_SCOPE;
}
/** Returns the client name used for the notification client. */ /** Returns the client name used for the notification client. */
private static byte[] getClientName() { private static byte[] getClientName() {
// TODO(dsmyers): we should use the same client name as the native sync code. // TODO(dsmyers): we should use the same client name as the native sync code.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment