Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1829)

Unified Diff: chrome/browser/signin/android_profile_oauth2_token_service.cc

Issue 213823004: Calls FireRefreshTokenRevoked if an account is removed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused varible. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/signin/android_profile_oauth2_token_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « chrome/browser/signin/android_profile_oauth2_token_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698