OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/signin/core/browser/child_account_info_fetcher_android.h" | 5 #include "components/signin/core/browser/child_account_info_fetcher_android.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
9 #include "components/signin/core/browser/account_fetcher_service.h" | 9 #include "components/signin/core/browser/account_fetcher_service.h" |
10 #include "components/signin/core/browser/account_tracker_service.h" | 10 #include "components/signin/core/browser/account_tracker_service.h" |
11 #include "jni/ChildAccountInfoFetcher_jni.h" | 11 #include "jni/ChildAccountInfoFetcher_jni.h" |
12 | 12 |
| 13 using base::android::JavaParamRef; |
| 14 |
13 // static | 15 // static |
14 void ChildAccountInfoFetcherAndroid::StartFetchingChildAccountInfo( | 16 void ChildAccountInfoFetcherAndroid::StartFetchingChildAccountInfo( |
15 AccountFetcherService* service, | 17 AccountFetcherService* service, |
16 const std::string& account_id) { | 18 const std::string& account_id) { |
17 JNIEnv* env = base::android::AttachCurrentThread(); | 19 JNIEnv* env = base::android::AttachCurrentThread(); |
18 std::string account_name = | 20 std::string account_name = |
19 service->account_tracker_service()->GetAccountInfo(account_id).email; | 21 service->account_tracker_service()->GetAccountInfo(account_id).email; |
20 // The AccountTrackerService may not be populated correctly in tests. | 22 // The AccountTrackerService may not be populated correctly in tests. |
21 if (account_name.empty()) | 23 if (account_name.empty()) |
22 return; | 24 return; |
(...skipping 12 matching lines...) Expand all Loading... |
35 const JavaParamRef<jclass>& caller, | 37 const JavaParamRef<jclass>& caller, |
36 jlong native_service, | 38 jlong native_service, |
37 const JavaParamRef<jstring>& j_account_id, | 39 const JavaParamRef<jstring>& j_account_id, |
38 jboolean is_child_account) { | 40 jboolean is_child_account) { |
39 AccountFetcherService* service = | 41 AccountFetcherService* service = |
40 reinterpret_cast<AccountFetcherService*>(native_service); | 42 reinterpret_cast<AccountFetcherService*>(native_service); |
41 service->SetIsChildAccount( | 43 service->SetIsChildAccount( |
42 base::android::ConvertJavaStringToUTF8(env, j_account_id), | 44 base::android::ConvertJavaStringToUTF8(env, j_account_id), |
43 is_child_account); | 45 is_child_account); |
44 } | 46 } |
OLD | NEW |