| Index: chrome/browser/signin/android_profile_oauth2_token_service.cc
|
| diff --git a/chrome/browser/signin/android_profile_oauth2_token_service.cc b/chrome/browser/signin/android_profile_oauth2_token_service.cc
|
| index 71fe1c3b684c752705b2089b178ef77ef6c1e1ac..4d6918632e13d090367923d787d0da16c08f84ba 100644
|
| --- a/chrome/browser/signin/android_profile_oauth2_token_service.cc
|
| +++ b/chrome/browser/signin/android_profile_oauth2_token_service.cc
|
| @@ -171,21 +171,33 @@ void AndroidProfileOAuth2TokenService::ValidateAccounts(JNIEnv* env,
|
|
|
| void AndroidProfileOAuth2TokenService::ValidateAccounts(
|
| const std::string& signed_in_account,
|
| - const std::vector<std::string>& account_ids) {
|
| + const std::vector<std::string>& last_seen_ids) {
|
| if (signed_in_account.empty())
|
| return;
|
|
|
| + std::vector<std::string> account_ids = GetAccounts();
|
| if (std::find(account_ids.begin(),
|
| account_ids.end(),
|
| signed_in_account) != account_ids.end()) {
|
| - // Currently signed in account still exists among accounts on system.
|
| - std::vector<std::string> ids = GetAccounts();
|
| + // Test to see if an account is removed from the Android AccountManager.
|
| + // If so, invoke FireRefreshTokenRevoked to notify the reconcilor.
|
| + for (std::vector<std::string>::const_iterator it = last_seen_ids.begin();
|
| + it != last_seen_ids.end(); it++) {
|
| + if (*it == signed_in_account)
|
| + continue;
|
| +
|
| + if (std::find(account_ids.begin(),
|
| + account_ids.end(),
|
| + *it) == account_ids.end()) {
|
| + FireRefreshTokenRevoked(*it);
|
| + }
|
| + }
|
|
|
| // Always fire the primary signed in account first.
|
| FireRefreshTokenAvailable(signed_in_account);
|
|
|
| - for (std::vector<std::string>::iterator it = ids.begin();
|
| - it != ids.end(); it++) {
|
| + for (std::vector<std::string>::iterator it = account_ids.begin();
|
| + it != account_ids.end(); it++) {
|
| if (*it != signed_in_account) {
|
| FireRefreshTokenAvailable(*it);
|
| }
|
| @@ -252,6 +264,14 @@ void AndroidProfileOAuth2TokenService::FireRefreshTokensLoaded() {
|
| env, java_ref_.obj());
|
| }
|
|
|
| +void AndroidProfileOAuth2TokenService::RevokeAllCredentials() {
|
| + std::vector<std::string> accounts = GetAccounts();
|
| + for (std::vector<std::string>::iterator it = accounts.begin();
|
| + it != accounts.end(); it++) {
|
| + FireRefreshTokenRevoked(*it);
|
| + }
|
| +}
|
| +
|
| // Called from Java when fetching of an OAuth2 token is finished. The
|
| // |authToken| param is only valid when |result| is true.
|
| void OAuth2TokenFetched(JNIEnv* env, jclass clazz,
|
|
|