diff options
Diffstat (limited to 'src/com/android/browser/Bookmarks.java')
| -rw-r--r-- | src/com/android/browser/Bookmarks.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/com/android/browser/Bookmarks.java b/src/com/android/browser/Bookmarks.java index c8aaee700..8d98f8995 100644 --- a/src/com/android/browser/Bookmarks.java +++ b/src/com/android/browser/Bookmarks.java @@ -41,6 +41,18 @@ import java.util.Date; private static String[] SELECTION_ARGS; + // We only want the user to be able to bookmark content that + // the browser can handle directly. + private static final String acceptableBookmarkSchemes[] = { + "http:", + "https:", + "about:", + "data:", + "javascript:", + "file:", + "content:" + }; + /** * Add a bookmark to the database. * @param context Context of the calling Activity. This is used to make @@ -214,4 +226,17 @@ import java.util.Date; bm.compress(Bitmap.CompressFormat.PNG, 100, os); return os.toByteArray(); } + + /* package */ static boolean urlHasAcceptableScheme(String url) { + if (url == null) { + return false; + } + + for (int i = 0; i < acceptableBookmarkSchemes.length; i++) { + if (url.startsWith(acceptableBookmarkSchemes[i])) { + return true; + } + } + return false; + } } |
