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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/child_accounts/ChildAccountService.java

Issue 986303002: Re-enable child account detection, now behind a flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: enum -> int Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/app/generated_resources.grd » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/child_accounts/ChildAccountService.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/child_accounts/ChildAccountService.java b/chrome/android/java/src/org/chromium/chrome/browser/child_accounts/ChildAccountService.java
index 012513b662f534b09c9194ea6404e281264c2ff9..8225faee7408e92bcaae84a3bf5baf4214677185 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/child_accounts/ChildAccountService.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/child_accounts/ChildAccountService.java
@@ -32,6 +32,10 @@ public class ChildAccountService {
private static final String TAG = "ChildAccountService";
+ private static final int CHILD_ACCOUNT_DONT_FORCE = 0;
+ private static final int CHILD_ACCOUNT_FORCE_ON = 1;
+ private static final int CHILD_ACCOUNT_FORCE_OFF = 2;
+
/**
* An account feature (corresponding to a Gaia service flag) that specifies whether the account
* is a child account.
@@ -111,9 +115,10 @@ public class ChildAccountService {
}
Account account = googleAccounts[0];
- if (shouldForceChildAccount(account)) {
- mHasChildAccount = true;
- callback.onChildAccountChecked(true);
+ int forceChildAccount = shouldForceChildAccount(account);
+ if (forceChildAccount != CHILD_ACCOUNT_DONT_FORCE) {
+ mHasChildAccount = forceChildAccount == CHILD_ACCOUNT_FORCE_ON;
+ callback.onChildAccountChecked(mHasChildAccount);
return;
}
@@ -151,10 +156,14 @@ public class ChildAccountService {
}}, CHILD_ACCOUNT_TIMEOUT_MS);
}
- private boolean shouldForceChildAccount(Account account) {
+ private int shouldForceChildAccount(Account account) {
String childAccountName = CommandLine.getInstance().getSwitchValue(
ChromeSwitches.CHILD_ACCOUNT);
- return childAccountName != null && account.name.equals(childAccountName);
+ if (childAccountName != null && account.name.equals(childAccountName)) {
+ return CHILD_ACCOUNT_FORCE_ON;
+ }
+ if (!isChildAccountDetectionEnabled()) return CHILD_ACCOUNT_FORCE_OFF;
+ return CHILD_ACCOUNT_DONT_FORCE;
}
private boolean getFutureResult() {
@@ -213,9 +222,14 @@ public class ChildAccountService {
}
}
+ private boolean isChildAccountDetectionEnabled() {
+ return nativeIsChildAccountDetectionEnabled();
+ }
+
public void onChildAccountSigninComplete() {
nativeOnChildAccountSigninComplete();
}
+ private native boolean nativeIsChildAccountDetectionEnabled();
private native void nativeOnChildAccountSigninComplete();
}
« no previous file with comments | « no previous file | chrome/app/generated_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698