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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/superviseduser/SupervisedUserContentProvider.java

Issue 2713513004: [Webview, Child Accounts] Always Google Play Services to show the reauthentication page. (Closed)
Patch Set: review Created 3 years, 10 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/android/javatests/src/org/chromium/chrome/browser/superviseduser/SupervisedUserContentProviderTest.java » ('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/superviseduser/SupervisedUserContentProvider.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/superviseduser/SupervisedUserContentProvider.java b/chrome/android/java/src/org/chromium/chrome/browser/superviseduser/SupervisedUserContentProvider.java
index 88bd0ea071e86442d5127e0046fa7e6618d9c795..020ccc8bd8e555d5deeac72195e50e7e1dd7beef 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/superviseduser/SupervisedUserContentProvider.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/superviseduser/SupervisedUserContentProvider.java
@@ -9,10 +9,12 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.SystemClock;
import android.os.UserManager;
+import android.text.TextUtils;
import org.chromium.base.Callback;
import org.chromium.base.ThreadUtils;
@@ -45,6 +47,9 @@ public class SupervisedUserContentProvider extends WebRestrictionsContentProvide
private static final String TAG = "SupervisedUserContent";
+ private static final String ACCOUNTS_GOOGLE_COM = "accounts.google.com";
+ private static final String GOOGLE_PLAY_SERVICES_UI_PACKAGE = "com.google.android.gms.ui";
+
// Three value "boolean" caching enabled state, null if not yet known.
private static Boolean sEnabled;
@@ -159,7 +164,7 @@ public class SupervisedUserContentProvider extends WebRestrictionsContentProvide
}
@Override
- protected WebRestrictionsResult shouldProceed(final String url) {
+ protected WebRestrictionsResult shouldProceed(String callingPackage, final String url) {
// This will be called on multiple threads (but never the UI thread),
// see http://developer.android.com/guide/components/processes-and-threads.html#ThreadSafe.
// The reply comes back on a different thread (possibly the UI thread) some time later.
@@ -167,12 +172,17 @@ public class SupervisedUserContentProvider extends WebRestrictionsContentProvide
// reply object for each query, and passing this through the callback structure. The reply
// object also handles waiting for the reply.
long startTimeMs = SystemClock.elapsedRealtime();
- final SupervisedUserQueryReply queryReply = new SupervisedUserQueryReply();
+ if (requestIsWhitelisted(callingPackage, url)) {
+ return new WebRestrictionsResult(true, null, null);
+ }
+
final long contentProvider = getSupervisedUserContentProvider();
if (contentProvider == 0) {
return new WebRestrictionsResult(
false, new int[] {FilteringBehaviorReason.NOT_SIGNED_IN}, null);
}
+
+ final SupervisedUserQueryReply queryReply = new SupervisedUserQueryReply();
ThreadUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
@@ -197,6 +207,13 @@ public class SupervisedUserContentProvider extends WebRestrictionsContentProvide
}
}
+ private boolean requestIsWhitelisted(String callingPackage, String url) {
+ // Always allow Google Play Services to show the reauthentication page (which is necessary
+ // to fix account issues).
+ return TextUtils.equals(callingPackage, GOOGLE_PLAY_SERVICES_UI_PACKAGE)
+ && Uri.parse(url).getHost().equals(ACCOUNTS_GOOGLE_COM);
+ }
+
@Override
protected boolean canInsert() {
// Chrome always allows insertion requests.
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/superviseduser/SupervisedUserContentProviderTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698