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

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

Issue 2784353002: Android: Remove GetApplicationContext part 2 (Closed)
Patch Set: Fix tests 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();
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698