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

Side by Side Diff: components/signin/core/browser/android/java/src/org/chromium/components/signin/ChildAccountInfoFetcher.java

Issue 2800833003: Revert of Android: Remove GetApplicationContext part 2 (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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
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();
72 Log.d(TAG, "Checking child account status for %s", mAccount.name); 73 Log.d(TAG, "Checking child account status for %s", mAccount.name);
73 AccountManagerHelper.get().checkChildAccount(mAccount, new Callback<Bool ean>() { 74 AccountManagerHelper.get(context).checkChildAccount(mAccount, new Callba ck<Boolean>() {
74 @Override 75 @Override
75 public void onResult(Boolean isChildAccount) { 76 public void onResult(Boolean isChildAccount) {
76 setIsChildAccount(isChildAccount); 77 setIsChildAccount(isChildAccount);
77 } 78 }
78 }); 79 });
79 } 80 }
80 81
81 @CalledByNative 82 @CalledByNative
82 private void destroy() { 83 private void destroy() {
83 ContextUtils.getApplicationContext().unregisterReceiver(mAccountFlagsCha ngedReceiver); 84 ContextUtils.getApplicationContext().unregisterReceiver(mAccountFlagsCha ngedReceiver);
84 } 85 }
85 86
86 private void setIsChildAccount(boolean isChildAccount) { 87 private void setIsChildAccount(boolean isChildAccount) {
87 Log.d(TAG, "Setting child account status for %s to %s", mAccount.name, 88 Log.d(TAG, "Setting child account status for %s to %s", mAccount.name,
88 Boolean.toString(isChildAccount)); 89 Boolean.toString(isChildAccount));
89 nativeSetIsChildAccount(mNativeAccountFetcherService, mAccountId, isChil dAccount); 90 nativeSetIsChildAccount(mNativeAccountFetcherService, mAccountId, isChil dAccount);
90 } 91 }
91 92
92 private static native void nativeSetIsChildAccount( 93 private static native void nativeSetIsChildAccount(
93 long accountFetcherServicePtr, String accountId, boolean isChildAcco unt); 94 long accountFetcherServicePtr, String accountId, boolean isChildAcco unt);
94 } 95 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698