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 package org.chromium.components.signin; | 5 package org.chromium.components.signin; |
6 | 6 |
7 import android.accounts.Account; | 7 import android.accounts.Account; |
8 import android.content.BroadcastReceiver; | 8 import android.content.BroadcastReceiver; |
9 import android.content.Context; | 9 import android.content.Context; |
10 import android.content.Intent; | 10 import android.content.Intent; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 fetch(); | 62 fetch(); |
63 } | 63 } |
64 | 64 |
65 @CalledByNative | 65 @CalledByNative |
66 private static ChildAccountInfoFetcher create( | 66 private static ChildAccountInfoFetcher create( |
67 long nativeAccountFetcherService, String accountId, String accountNa
me) { | 67 long nativeAccountFetcherService, String accountId, String accountNa
me) { |
68 return new ChildAccountInfoFetcher(nativeAccountFetcherService, accountI
d, accountName); | 68 return new ChildAccountInfoFetcher(nativeAccountFetcherService, accountI
d, accountName); |
69 } | 69 } |
70 | 70 |
71 private void fetch() { | 71 private void fetch() { |
72 Context context = ContextUtils.getApplicationContext(); | |
73 Log.d(TAG, "Checking child account status for %s", mAccount.name); | 72 Log.d(TAG, "Checking child account status for %s", mAccount.name); |
74 AccountManagerHelper.get(context).checkChildAccount(mAccount, new Callba
ck<Boolean>() { | 73 AccountManagerHelper.get().checkChildAccount(mAccount, new Callback<Bool
ean>() { |
75 @Override | 74 @Override |
76 public void onResult(Boolean isChildAccount) { | 75 public void onResult(Boolean isChildAccount) { |
77 setIsChildAccount(isChildAccount); | 76 setIsChildAccount(isChildAccount); |
78 } | 77 } |
79 }); | 78 }); |
80 } | 79 } |
81 | 80 |
82 @CalledByNative | 81 @CalledByNative |
83 private void destroy() { | 82 private void destroy() { |
84 ContextUtils.getApplicationContext().unregisterReceiver(mAccountFlagsCha
ngedReceiver); | 83 ContextUtils.getApplicationContext().unregisterReceiver(mAccountFlagsCha
ngedReceiver); |
85 } | 84 } |
86 | 85 |
87 private void setIsChildAccount(boolean isChildAccount) { | 86 private void setIsChildAccount(boolean isChildAccount) { |
88 Log.d(TAG, "Setting child account status for %s to %s", mAccount.name, | 87 Log.d(TAG, "Setting child account status for %s to %s", mAccount.name, |
89 Boolean.toString(isChildAccount)); | 88 Boolean.toString(isChildAccount)); |
90 nativeSetIsChildAccount(mNativeAccountFetcherService, mAccountId, isChil
dAccount); | 89 nativeSetIsChildAccount(mNativeAccountFetcherService, mAccountId, isChil
dAccount); |
91 } | 90 } |
92 | 91 |
93 private static native void nativeSetIsChildAccount( | 92 private static native void nativeSetIsChildAccount( |
94 long accountFetcherServicePtr, String accountId, boolean isChildAcco
unt); | 93 long accountFetcherServicePtr, String accountId, boolean isChildAcco
unt); |
95 } | 94 } |
OLD | NEW |