diff options
author | Bijan Amirzada <bijana@codeaurora.org> | 2014-06-25 11:48:36 -0700 |
---|---|---|
committer | WebTech Code Review <code-review@localhost> | 2014-06-26 15:59:44 -0700 |
commit | 3f04dc711af946c2a371bf51d1da26448023d030 (patch) | |
tree | 2ef7981323b5c48b02ed088bc2de44ca491c5c47 /src/com/android/browser/platformsupport | |
parent | 87756c1ef981513002860da183cd13713f029bd9 (diff) | |
download | android_packages_apps_Gello-3f04dc711af946c2a371bf51d1da26448023d030.tar.gz android_packages_apps_Gello-3f04dc711af946c2a371bf51d1da26448023d030.tar.bz2 android_packages_apps_Gello-3f04dc711af946c2a371bf51d1da26448023d030.zip |
Removed dependency on framework browser provider from browser
Brought in Browser Provider class locally into platformsupport
and modified all calls into provider to call into this local
class.
Change-Id: I3c471dacf920fd30403590ba23384b7abbf7f3fd
Diffstat (limited to 'src/com/android/browser/platformsupport')
-rw-r--r-- | src/com/android/browser/platformsupport/BookmarkColumns.java | 80 | ||||
-rw-r--r-- | src/com/android/browser/platformsupport/Browser.java | 59 |
2 files changed, 49 insertions, 90 deletions
diff --git a/src/com/android/browser/platformsupport/BookmarkColumns.java b/src/com/android/browser/platformsupport/BookmarkColumns.java deleted file mode 100644 index c1d9db89..00000000 --- a/src/com/android/browser/platformsupport/BookmarkColumns.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013 The Linux Foundation. All rights reserved. - * Not a contribution. - * - * Copyright (C) 2006 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.browser.platformsupport; - -public class BookmarkColumns { - /** - * The URL of the bookmark or history item. - * <p>Type: TEXT (URL)</p> - */ - public static final String URL = "url"; - - /** - * The number of time the item has been visited. - * <p>Type: NUMBER</p> - */ - public static final String VISITS = "visits"; - - /** - * The date the item was last visited, in milliseconds since the epoch. - * <p>Type: NUMBER (date in milliseconds since January 1, 1970)</p> - */ - public static final String DATE = "date"; - - /** - * Flag indicating that an item is a bookmark. A value of 1 indicates a bookmark, a value - * of 0 indicates a history item. - * <p>Type: INTEGER (boolean)</p> - */ - public static final String BOOKMARK = "bookmark"; - - /** - * The user visible title of the bookmark or history item. - * <p>Type: TEXT</p> - */ - public static final String TITLE = "title"; - - /** - * The date the item created, in milliseconds since the epoch. - * <p>Type: NUMBER (date in milliseconds since January 1, 1970)</p> - */ - public static final String CREATED = "created"; - - /** - * The favicon of the bookmark. Must decode via {@link BitmapFactory#decodeByteArray}. - * <p>Type: BLOB (image)</p> - */ - public static final String FAVICON = "favicon"; - - /** - * @hide - */ - public static final String THUMBNAIL = "thumbnail"; - - /** - * @hide - */ - public static final String TOUCH_ICON = "touch_icon"; - - /** - * @hide - */ - public static final String USER_ENTERED = "user_entered"; -} diff --git a/src/com/android/browser/platformsupport/Browser.java b/src/com/android/browser/platformsupport/Browser.java index a34d9c35..a5346eb9 100644 --- a/src/com/android/browser/platformsupport/Browser.java +++ b/src/com/android/browser/platformsupport/Browser.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package android.provider; +package com.android.browser.platformsupport; import android.content.ContentResolver; import android.content.ContentUris; @@ -25,13 +25,15 @@ import android.database.Cursor; import android.database.DatabaseUtils; import android.graphics.BitmapFactory; import android.net.Uri; -import android.provider.BrowserContract.Bookmarks; -import android.provider.BrowserContract.Combined; -import android.provider.BrowserContract.History; -import android.provider.BrowserContract.Searches; import android.util.Log; import android.webkit.WebIconDatabase; +import com.android.browser.R; +import com.android.browser.platformsupport.BrowserContract.Bookmarks; +import com.android.browser.platformsupport.BrowserContract.Combined; +import com.android.browser.platformsupport.BrowserContract.History; +import com.android.browser.platformsupport.BrowserContract.Searches; + public class Browser { private static final String LOGTAG = "browser"; @@ -195,7 +197,7 @@ public class Browser { * @param string the string to send */ public static final void sendString(Context context, String string) { - sendString(context, string, context.getString(com.android.internal.R.string.sendText)); + sendString(context, string, context.getString(R.string.sendText)); } /** @@ -554,7 +556,7 @@ public class Browser { Log.e(LOGTAG, "clearSearches", e); } } - + /** * Request all icons from the database. This call must either be called * in the main thread or have had Looper.prepare() invoked in the calling @@ -568,14 +570,39 @@ public class Browser { */ public static final void requestAllIcons(ContentResolver cr, String where, WebIconDatabase.IconListener listener) { - WebIconDatabase.getInstance().bulkRequestIconForPageUrl(cr, where, listener); + try { + final Cursor c = cr.query(BOOKMARKS_URI, HISTORY_PROJECTION, + where, null, null); + if (c.moveToFirst()) { + final WebIconDatabase db = WebIconDatabase.getInstance(); + do { + db.requestIconForPageUrl(c.getString(HISTORY_PROJECTION_URL_INDEX), + listener); + } while (c.moveToNext()); + } + c.deactivate(); + } catch (IllegalStateException e) { + Log.e(LOGTAG, "requestAllIcons", e); + } } /** * Column definitions for the mixed bookmark and history items available * at {@link #BOOKMARKS_URI}. */ - public static class BookmarkColumns implements BaseColumns { + public static class BookmarkColumns{ + /** + * The unique ID for a row. + * <P>Type: INTEGER (long)</P> + */ + public static final String _ID = "_id"; + + /** + * The count of rows in a directory. + * <P>Type: INTEGER</P> + */ + public static final String _COUNT = "_count"; + /** * The URL of the bookmark or history item. * <p>Type: TEXT (URL)</p> @@ -638,7 +665,19 @@ public class Browser { /** * Column definitions for the search history table, available at {@link #SEARCHES_URI}. */ - public static class SearchColumns implements BaseColumns { + public static class SearchColumns{ + /** + * The unique ID for a row. + * <P>Type: INTEGER (long)</P> + */ + public static final String _ID = "_id"; + + /** + * The count of rows in a directory. + * <P>Type: INTEGER</P> + */ + public static final String _COUNT = "_count"; + /** * @deprecated Not used. */ |