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

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: Created 4 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 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 74%
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..d65a89830d95199a2db1b1550e469b44adbbc3d3 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;
@@ -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));
}
/**

Powered by Google App Engine
This is Rietveld 408576698