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

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

Issue 836913003: Add check for read/write access to ChromeBrowserProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added comments Created 5 years, 11 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 | no next file » | 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/ChromeBrowserProvider.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeBrowserProvider.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeBrowserProvider.java
index ff65ee62dcb2585d449c043ceb4a213905bcc2ce..bba6d124bb025374d1bab5bd2c9442bc95a2707a 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeBrowserProvider.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeBrowserProvider.java
@@ -330,7 +330,7 @@ public class ChromeBrowserProvider extends ContentProvider {
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
String sortOrder) {
- if (!canHandleContentProviderApiCall()) return null;
+ if (!canHandleContentProviderApiCall() || !hasReadAccess()) return null;
// Check for invalid id values if provided.
long bookmarkId = getContentUriId(uri);
@@ -387,7 +387,7 @@ public class ChromeBrowserProvider extends ContentProvider {
@Override
public Uri insert(Uri uri, ContentValues values) {
- if (!canHandleContentProviderApiCall()) return null;
+ if (!canHandleContentProviderApiCall() || !hasWriteAccess()) return null;
int match = mUriMatcher.match(uri);
Uri res = null;
@@ -420,7 +420,7 @@ public class ChromeBrowserProvider extends ContentProvider {
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
- if (!canHandleContentProviderApiCall()) return 0;
+ if (!canHandleContentProviderApiCall() || !hasWriteAccess()) return 0;
// Check for invalid id values if provided.
long bookmarkId = getContentUriId(uri);
@@ -469,7 +469,7 @@ public class ChromeBrowserProvider extends ContentProvider {
@Override
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
- if (!canHandleContentProviderApiCall()) return 0;
+ if (!canHandleContentProviderApiCall() || !hasWriteAccess()) return 0;
// Check for invalid id values if provided.
long bookmarkId = getContentUriId(uri);
@@ -748,6 +748,24 @@ public class ChromeBrowserProvider extends ContentProvider {
}
/**
+ * Read access restrictions may be set by the manifest or subclasses, but none are set
+ * by default.
+ * @return Whether the caller has read access to history and bookmarks information.
+ */
+ protected boolean hasReadAccess() {
+ return true;
+ }
+
+ /**
+ * Write access restrictions may be set by the manifest or subclasses, but none are set
+ * by default.
+ * @return Whether the caller has write access to history and bookmarks information.
+ */
+ protected boolean hasWriteAccess() {
+ return true;
+ }
+
+ /**
* The type of a BookmarkNode.
*/
public enum Type {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698