Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/signin/android_profile_oauth2_token_service.h" | 5 #include "chrome/browser/signin/android_profile_oauth2_token_service.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 &account_ids); | 160 &account_ids); |
| 161 std::string signed_in_account = ConvertJavaStringToUTF8(env, j_current_acc); | 161 std::string signed_in_account = ConvertJavaStringToUTF8(env, j_current_acc); |
| 162 | 162 |
| 163 if (signed_in_account.empty()) | 163 if (signed_in_account.empty()) |
| 164 return; | 164 return; |
| 165 | 165 |
| 166 if (std::find(account_ids.begin(), | 166 if (std::find(account_ids.begin(), |
| 167 account_ids.end(), | 167 account_ids.end(), |
| 168 signed_in_account) != account_ids.end()) { | 168 signed_in_account) != account_ids.end()) { |
| 169 // Currently signed in account still exists among accounts on system. | 169 // Currently signed in account still exists among accounts on system. |
| 170 std::vector<std::string> ids = GetAccounts(); | |
| 171 | |
| 172 // Always fire the primary signed in account first. | |
| 170 FireRefreshTokenAvailable(signed_in_account); | 173 FireRefreshTokenAvailable(signed_in_account); |
|
Roger Tawa OOO till Jul 10th
2013/11/21 16:02:32
Why is it important to fire the primary account fi
acleung1
2013/11/26 09:28:31
Because that becomes the first account in the gaia
Roger Tawa OOO till Jul 10th
2013/11/27 18:45:43
No, you are correct Alan.
| |
| 174 | |
| 175 for (std::vector<std::string>::iterator it = ids.begin(); | |
| 176 it != ids.end(); it++) { | |
| 177 if (*it != signed_in_account) { | |
| 178 FireRefreshTokenAvailable(*it); | |
| 179 } | |
| 180 } | |
| 171 } else { | 181 } else { |
| 172 // Currently signed in account does not any longer exist among accounts on | 182 // Currently signed in account does not any longer exist among accounts on |
| 173 // system. | 183 // system. |
| 174 FireRefreshTokenRevoked(signed_in_account); | 184 FireRefreshTokenRevoked(signed_in_account); |
| 175 } | 185 } |
| 176 } | 186 } |
| 177 | 187 |
| 178 void AndroidProfileOAuth2TokenService::FireRefreshTokenAvailableFromJava( | 188 void AndroidProfileOAuth2TokenService::FireRefreshTokenAvailableFromJava( |
| 179 JNIEnv* env, | 189 JNIEnv* env, |
| 180 jobject obj, | 190 jobject obj, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 GoogleServiceAuthError err(result ? | 254 GoogleServiceAuthError err(result ? |
| 245 GoogleServiceAuthError::NONE : | 255 GoogleServiceAuthError::NONE : |
| 246 GoogleServiceAuthError::CONNECTION_FAILED); | 256 GoogleServiceAuthError::CONNECTION_FAILED); |
| 247 heap_callback->Run(err, token, base::Time()); | 257 heap_callback->Run(err, token, base::Time()); |
| 248 } | 258 } |
| 249 | 259 |
| 250 // static | 260 // static |
| 251 bool AndroidProfileOAuth2TokenService::Register(JNIEnv* env) { | 261 bool AndroidProfileOAuth2TokenService::Register(JNIEnv* env) { |
| 252 return RegisterNativesImpl(env); | 262 return RegisterNativesImpl(env); |
| 253 } | 263 } |
| OLD | NEW |