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

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

Issue 1847523002: Avoid HTML in WebRestrictionsContentProvider interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to one more comment Created 4 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
Index: components/web_restrictions/browser/java/src/org/chromium/components/webrestrictions/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/WebRestrictionsClient.java
index 3fb5a02a58255f2291b9f689a5adfc0802a3e950..23df78e01b4beec5abf2521a22e7edba459e7b97 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/WebRestrictionsClient.java
@@ -22,22 +22,40 @@ import org.chromium.base.annotations.JNINamespace;
@JNINamespace("web_restrictions")
public class WebRestrictionsClient {
static class ShouldProceedResult {
- private final boolean mShouldProceed;
- private final String mErrorPage;
+ private final Cursor mCursor;
- ShouldProceedResult(boolean shouldProceed, String errorPage) {
- mShouldProceed = shouldProceed;
- mErrorPage = errorPage;
+ ShouldProceedResult(Cursor cursor) {
+ mCursor = cursor;
}
@CalledByNative("ShouldProceedResult")
boolean shouldProceed() {
- return mShouldProceed;
+ if (mCursor == null) return true;
+ return mCursor.getInt(0) > 0;
}
@CalledByNative("ShouldProceedResult")
- String getErrorPage() {
- return mErrorPage;
+ 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();
}
}
@@ -109,10 +127,7 @@ public class WebRestrictionsClient {
@CalledByNative
ShouldProceedResult shouldProceed(final String url) {
String select = String.format("url = '%s'", url);
- Cursor result = mContentResolver.query(mQueryUri, null, select, null, null);
- boolean shouldProceed = result == null || result.getInt(0) > 0;
- String errorPage = shouldProceed ? null : result.getString(1);
- return new ShouldProceedResult(shouldProceed, errorPage);
+ return new ShouldProceedResult(mContentResolver.query(mQueryUri, null, select, null, null));
}
/**

Powered by Google App Engine
This is Rietveld 408576698