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/oauth2_token_service_delegate_android.h" | 5 #include "chrome/browser/signin/oauth2_token_service_delegate_android.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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 JNIEnv* env = AttachCurrentThread(); | 239 JNIEnv* env = AttachCurrentThread(); |
240 ScopedJavaLocalRef<jobjectArray> j_accounts = | 240 ScopedJavaLocalRef<jobjectArray> j_accounts = |
241 Java_OAuth2TokenService_getAccounts( | 241 Java_OAuth2TokenService_getAccounts( |
242 env, base::android::GetApplicationContext()); | 242 env, base::android::GetApplicationContext()); |
243 // TODO(fgorski): We may decide to filter out some of the accounts. | 243 // TODO(fgorski): We may decide to filter out some of the accounts. |
244 base::android::AppendJavaStringArrayToStringVector(env, j_accounts.obj(), | 244 base::android::AppendJavaStringArrayToStringVector(env, j_accounts.obj(), |
245 &accounts); | 245 &accounts); |
246 return accounts; | 246 return accounts; |
247 } | 247 } |
248 | 248 |
| 249 bool OAuth2TokenServiceDelegateAndroid::NeedsAccountIdNameMap() const { |
| 250 return true; |
| 251 } |
| 252 |
249 std::vector<std::string> | 253 std::vector<std::string> |
250 OAuth2TokenServiceDelegateAndroid::GetSystemAccountNames() { | 254 OAuth2TokenServiceDelegateAndroid::GetSystemAccountNames() { |
251 std::vector<std::string> account_names; | 255 std::vector<std::string> account_names; |
252 JNIEnv* env = AttachCurrentThread(); | 256 JNIEnv* env = AttachCurrentThread(); |
253 ScopedJavaLocalRef<jobjectArray> j_accounts = | 257 ScopedJavaLocalRef<jobjectArray> j_accounts = |
254 Java_OAuth2TokenService_getSystemAccountNames( | 258 Java_OAuth2TokenService_getSystemAccountNames( |
255 env, base::android::GetApplicationContext()); | 259 env, base::android::GetApplicationContext()); |
256 base::android::AppendJavaStringArrayToStringVector(env, j_accounts.obj(), | 260 base::android::AppendJavaStringArrayToStringVector(env, j_accounts.obj(), |
257 &account_names); | 261 &account_names); |
258 return account_names; | 262 return account_names; |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 : isTransientError | 575 : isTransientError |
572 ? GoogleServiceAuthError::CONNECTION_FAILED | 576 ? GoogleServiceAuthError::CONNECTION_FAILED |
573 : GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); | 577 : GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); |
574 heap_callback->Run(err, token, base::Time()); | 578 heap_callback->Run(err, token, base::Time()); |
575 } | 579 } |
576 | 580 |
577 // static | 581 // static |
578 bool OAuth2TokenServiceDelegateAndroid::Register(JNIEnv* env) { | 582 bool OAuth2TokenServiceDelegateAndroid::Register(JNIEnv* env) { |
579 return RegisterNativesImpl(env); | 583 return RegisterNativesImpl(env); |
580 } | 584 } |
OLD | NEW |