| 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.chrome.browser.services; | 5 package org.chromium.chrome.browser.services; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 | 8 |
| 9 import org.chromium.base.Log; | 9 import org.chromium.base.Log; |
| 10 import org.chromium.chrome.browser.ChromeApplication; | 10 import org.chromium.chrome.browser.ChromeApplication; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 return mHasChildAccount; | 35 return mHasChildAccount; |
| 36 } | 36 } |
| 37 | 37 |
| 38 /** | 38 /** |
| 39 * Starts fetching the Android EDU and child accounts information. | 39 * Starts fetching the Android EDU and child accounts information. |
| 40 * Calls onParametersReady() once the information is fetched. | 40 * Calls onParametersReady() once the information is fetched. |
| 41 * @param appContext The application context. | 41 * @param appContext The application context. |
| 42 */ | 42 */ |
| 43 public void start(Context appContext) { | 43 public void start(Context appContext) { |
| 44 Log.d(TAG, "before checking child and EDU"); | 44 Log.d(TAG, "before checking child and EDU"); |
| 45 ChildAccountService.checkHasChildAccount(appContext, this); | 45 ChildAccountService.getInstance(appContext).checkHasChildAccount(this); |
| 46 ((ChromeApplication) appContext).checkIsAndroidEduDevice(this); | 46 ((ChromeApplication) appContext).checkIsAndroidEduDevice(this); |
| 47 // TODO(aruslan): Should we start a watchdog to kill if Child/Edu stuff
takes too long? | 47 // TODO(aruslan): Should we start a watchdog to kill if Child/Edu stuff
takes too long? |
| 48 Log.d(TAG, "returning from start"); | 48 Log.d(TAG, "returning from start"); |
| 49 } | 49 } |
| 50 | 50 |
| 51 private void checkDone() { | 51 private void checkDone() { |
| 52 if (mIsAndroidEduDevice == null || mHasChildAccount == null) return; | 52 if (mIsAndroidEduDevice == null || mHasChildAccount == null) return; |
| 53 Log.d(TAG, "parameters are ready"); | 53 Log.d(TAG, "parameters are ready"); |
| 54 onParametersReady(); | 54 onParametersReady(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 // AndroidEdu.OwnerCheckCallback: | 57 // AndroidEdu.OwnerCheckCallback: |
| 58 @Override | 58 @Override |
| 59 public void onSchoolCheckDone(boolean isAndroidEduDevice) { | 59 public void onSchoolCheckDone(boolean isAndroidEduDevice) { |
| 60 Log.d(TAG, "onSchoolCheckDone"); | 60 Log.d(TAG, "onSchoolCheckDone"); |
| 61 mIsAndroidEduDevice = isAndroidEduDevice; | 61 mIsAndroidEduDevice = isAndroidEduDevice; |
| 62 checkDone(); | 62 checkDone(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 // ChildAccountManager.HasChildAccountCallback: | 65 // ChildAccountManager.HasChildAccountCallback: |
| 66 @Override | 66 @Override |
| 67 public void onChildAccountChecked(boolean hasChildAccount) { | 67 public void onChildAccountChecked(boolean hasChildAccount) { |
| 68 Log.d(TAG, "onChildAccountChecked"); | 68 Log.d(TAG, "onChildAccountChecked"); |
| 69 mHasChildAccount = hasChildAccount; | 69 mHasChildAccount = hasChildAccount; |
| 70 checkDone(); | 70 checkDone(); |
| 71 } | 71 } |
| 72 } | 72 } |
| OLD | NEW |