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

Unified Diff: components/web_restrictions/browser/java/src/org/chromium/components/webrestrictions/browser/WebRestrictionsClient.java

Issue 1890203002: Implement Web Restrictions in WebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix final nits Created 4 years, 4 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
Index: components/web_restrictions/browser/java/src/org/chromium/components/webrestrictions/browser/WebRestrictionsClient.java
diff --git a/components/web_restrictions/browser/java/src/org/chromium/components/webrestrictions/WebRestrictionsClient.java b/components/web_restrictions/browser/java/src/org/chromium/components/webrestrictions/browser/WebRestrictionsClient.java
similarity index 71%
rename from components/web_restrictions/browser/java/src/org/chromium/components/webrestrictions/WebRestrictionsClient.java
rename to components/web_restrictions/browser/java/src/org/chromium/components/webrestrictions/browser/WebRestrictionsClient.java
index 23df78e01b4beec5abf2521a22e7edba459e7b97..9127fd54a047925fa62de26323ffd5f5141658d9 100644
--- a/components/web_restrictions/browser/java/src/org/chromium/components/webrestrictions/WebRestrictionsClient.java
+++ b/components/web_restrictions/browser/java/src/org/chromium/components/webrestrictions/browser/WebRestrictionsClient.java
@@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-package org.chromium.components.webrestrictions;
+package org.chromium.components.webrestrictions.browser;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.database.ContentObserver;
-import android.database.Cursor;
import android.net.Uri;
import android.text.TextUtils;
@@ -21,44 +20,6 @@ import org.chromium.base.annotations.JNINamespace;
*/
@JNINamespace("web_restrictions")
public class WebRestrictionsClient {
- static class ShouldProceedResult {
- private final Cursor mCursor;
-
- ShouldProceedResult(Cursor cursor) {
- mCursor = cursor;
- }
-
- @CalledByNative("ShouldProceedResult")
- boolean shouldProceed() {
- if (mCursor == null) return true;
- return mCursor.getInt(0) > 0;
- }
-
- @CalledByNative("ShouldProceedResult")
- int getInt(int column) {
- if (mCursor == null) return 0;
- return mCursor.getInt(column);
- }
-
- @CalledByNative("ShouldProceedResult")
- String getString(int column) {
- if (mCursor == null) return null;
- return mCursor.getString(column);
- }
-
- @CalledByNative("ShouldProceedResult")
- String getColumnName(int column) {
- if (mCursor == null) return null;
- return mCursor.getColumnName(column);
- }
-
- @CalledByNative("ShouldProceedResult")
- int getColumnCount() {
- if (mCursor == null) return 0;
- return mCursor.getColumnCount();
- }
- }
-
// Handle to allow mocking for C++ unit testing
private static WebRestrictionsClient sMock;
@@ -86,7 +47,7 @@ public class WebRestrictionsClient {
@Override
public void onChange(boolean selfChange, Uri uri) {
- nativeNotifyWebRestrictionsChanged(nativeProvider);
+ nativeOnWebRestrictionsChanged(nativeProvider);
}
};
mContentResolver.registerContentObserver(baseUri, true, mContentObserver);
@@ -125,9 +86,10 @@ public class WebRestrictionsClient {
* error page to show instead.
*/
@CalledByNative
- ShouldProceedResult shouldProceed(final String url) {
+ WebRestrictionsClientResult shouldProceed(final String url) {
String select = String.format("url = '%s'", url);
- return new ShouldProceedResult(mContentResolver.query(mQueryUri, null, select, null, null));
+ return new WebRestrictionsClientResult(
+ mContentResolver.query(mQueryUri, null, select, null, null));
}
/**
@@ -142,7 +104,7 @@ public class WebRestrictionsClient {
return mContentResolver.insert(mRequestUri, values) != null;
}
- native void nativeNotifyWebRestrictionsChanged(long ptrProvider);
+ native void nativeOnWebRestrictionsChanged(long nativeWebRestrictionsClient);
/**
* Allow a mock for of the class for C++ unit testing.

Powered by Google App Engine
This is Rietveld 408576698