Index: components/web_restrictions/browser/java/src/org/chromium/components/webrestrictions/browser/WebRestrictionsContentProvider.java |
diff --git a/components/web_restrictions/browser/java/src/org/chromium/components/webrestrictions/WebRestrictionsContentProvider.java b/components/web_restrictions/browser/java/src/org/chromium/components/webrestrictions/browser/WebRestrictionsContentProvider.java |
similarity index 92% |
rename from components/web_restrictions/browser/java/src/org/chromium/components/webrestrictions/WebRestrictionsContentProvider.java |
rename to components/web_restrictions/browser/java/src/org/chromium/components/webrestrictions/browser/WebRestrictionsContentProvider.java |
index 869ff7220d53cae90cc139e8fc3f8009d915b94c..4258e8ce8b20adb6756902f580e7c4921179d54f 100644 |
--- a/components/web_restrictions/browser/java/src/org/chromium/components/webrestrictions/WebRestrictionsContentProvider.java |
+++ b/components/web_restrictions/browser/java/src/org/chromium/components/webrestrictions/browser/WebRestrictionsContentProvider.java |
@@ -2,7 +2,7 @@ |
// 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.ContentProvider; |
import android.content.ContentValues; |
@@ -42,8 +42,8 @@ public abstract class WebRestrictionsContentProvider extends ContentProvider { |
private final int mErrorInts[]; |
private final String mErrorStrings[]; |
- public WebRestrictionsResult(boolean shouldProceed, final int[] errorInts, |
- final String[] errorStrings) { |
+ public WebRestrictionsResult( |
+ boolean shouldProceed, final int[] errorInts, final String[] errorStrings) { |
assert !shouldProceed || errorInts == null; |
assert !shouldProceed || errorStrings == null; |
mShouldProceed = shouldProceed; |
@@ -121,9 +121,11 @@ public abstract class WebRestrictionsContentProvider extends ContentProvider { |
@Override |
public String[] getColumnNames() { |
String errorNames[] = getErrorColumnNames(); |
- String names[] = new String[errorNames.length + 1]; |
+ // The cursor in the client gets the column count from the number of column names |
+ // so it is important to limit this array to the actual number of columns. |
+ String names[] = new String[getColumnCount()]; |
names[0] = "Should Proceed"; |
- for (int i = 0; i < errorNames.length; i++) { |
+ for (int i = 0; i < getColumnCount() - 1; i++) { |
names[i + 1] = errorNames[i]; |
} |
return names; |
@@ -145,11 +147,16 @@ public abstract class WebRestrictionsContentProvider extends ContentProvider { |
@Override |
public short getShort(int column) { |
- return 0; |
+ return (short) getLong(column); |
} |
@Override |
public int getInt(int column) { |
+ return (int) getLong(column); |
+ } |
+ |
+ @Override |
+ public long getLong(int column) { |
if (column == 0) return result.shouldProceed() ? PROCEED : BLOCKED; |
// The column order is: |
// result, |
@@ -164,11 +171,6 @@ public abstract class WebRestrictionsContentProvider extends ContentProvider { |
} |
@Override |
- public long getLong(int column) { |
- return 0; |
- } |
- |
- @Override |
public float getFloat(int column) { |
return 0; |
} |
@@ -191,6 +193,11 @@ public abstract class WebRestrictionsContentProvider extends ContentProvider { |
} |
return FIELD_TYPE_NULL; |
} |
+ |
+ @Override |
+ public int getColumnCount() { |
+ return result.errorIntCount() + result.errorStringCount() + 1; |
+ } |
}; |
} |