Browser.java revision b4be02088f221564817b2ac164408cc3eeff118c
1/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.provider;
18
19import android.content.ContentResolver;
20import android.content.ContentUris;
21import android.content.ContentValues;
22import android.content.Context;
23import android.content.Intent;
24import android.database.Cursor;
25import android.database.DatabaseUtils;
26import android.graphics.BitmapFactory;
27import android.net.Uri;
28import android.os.Build;
29import android.provider.BrowserContract.Bookmarks;
30import android.provider.BrowserContract.Combined;
31import android.provider.BrowserContract.History;
32import android.provider.BrowserContract.Searches;
33import android.util.Log;
34import android.webkit.WebIconDatabase;
35
36public class Browser {
37    private static final String LOGTAG = "browser";
38
39    /**
40     * A table containing both bookmarks and history items. The columns of the table are defined in
41     * {@link BookmarkColumns}. Reading this table requires the
42     * {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS} permission and writing to it
43     * requires the {@link android.Manifest.permission#WRITE_HISTORY_BOOKMARKS} permission.
44     */
45    public static final Uri BOOKMARKS_URI = Uri.parse("content://browser/bookmarks");
46
47    /**
48     * The name of extra data when starting Browser with ACTION_VIEW or
49     * ACTION_SEARCH intent.
50     * <p>
51     * The value should be an integer between 0 and 1000. If not set or set to
52     * 0, the Browser will use default. If set to 100, the Browser will start
53     * with 100%.
54     */
55    public static final String INITIAL_ZOOM_LEVEL = "browser.initialZoomLevel";
56
57    /**
58     * The name of the extra data when starting the Browser from another
59     * application.
60     * <p>
61     * The value is a unique identification string that will be used to
62     * identify the calling application. The Browser will attempt to reuse the
63     * same window each time the application launches the Browser with the same
64     * identifier.
65     */
66    public static final String EXTRA_APPLICATION_ID = "com.android.browser.application_id";
67
68    /**
69     * The name of the extra data in the VIEW intent. The data are key/value
70     * pairs in the format of Bundle. They will be sent in the HTTP request
71     * headers for the provided url. The keys can't be the standard HTTP headers
72     * as they are set by the WebView. The url's schema must be http(s).
73     * <p>
74     */
75    public static final String EXTRA_HEADERS = "com.android.browser.headers";
76
77    /* if you change column order you must also change indices
78       below */
79    public static final String[] HISTORY_PROJECTION = new String[] {
80            BookmarkColumns._ID, // 0
81            BookmarkColumns.URL, // 1
82            BookmarkColumns.VISITS, // 2
83            BookmarkColumns.DATE, // 3
84            BookmarkColumns.BOOKMARK, // 4
85            BookmarkColumns.TITLE, // 5
86            BookmarkColumns.FAVICON, // 6
87            BookmarkColumns.THUMBNAIL, // 7
88            BookmarkColumns.TOUCH_ICON, // 8
89            BookmarkColumns.USER_ENTERED, // 9
90    };
91
92    /* these indices dependent on HISTORY_PROJECTION */
93    public static final int HISTORY_PROJECTION_ID_INDEX = 0;
94    public static final int HISTORY_PROJECTION_URL_INDEX = 1;
95    public static final int HISTORY_PROJECTION_VISITS_INDEX = 2;
96    public static final int HISTORY_PROJECTION_DATE_INDEX = 3;
97    public static final int HISTORY_PROJECTION_BOOKMARK_INDEX = 4;
98    public static final int HISTORY_PROJECTION_TITLE_INDEX = 5;
99    public static final int HISTORY_PROJECTION_FAVICON_INDEX = 6;
100    /**
101     * @hide
102     */
103    public static final int HISTORY_PROJECTION_THUMBNAIL_INDEX = 7;
104    /**
105     * @hide
106     */
107    public static final int HISTORY_PROJECTION_TOUCH_ICON_INDEX = 8;
108
109    /* columns needed to determine whether to truncate history */
110    public static final String[] TRUNCATE_HISTORY_PROJECTION = new String[] {
111            BookmarkColumns._ID,
112            BookmarkColumns.DATE,
113    };
114
115    public static final int TRUNCATE_HISTORY_PROJECTION_ID_INDEX = 0;
116
117    /* truncate this many history items at a time */
118    public static final int TRUNCATE_N_OLDEST = 5;
119
120    /**
121     * A table containing a log of browser searches. The columns of the table are defined in
122     * {@link SearchColumns}. Reading this table requires the
123     * {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS} permission and writing to it
124     * requires the {@link android.Manifest.permission#WRITE_HISTORY_BOOKMARKS} permission.
125     */
126    public static final Uri SEARCHES_URI = Uri.parse("content://browser/searches");
127
128    /**
129     * A projection of {@link #SEARCHES_URI} that contains {@link SearchColumns#_ID},
130     * {@link SearchColumns#SEARCH}, and {@link SearchColumns#DATE}.
131     */
132    public static final String[] SEARCHES_PROJECTION = new String[] {
133            // if you change column order you must also change indices below
134            SearchColumns._ID, // 0
135            SearchColumns.SEARCH, // 1
136            SearchColumns.DATE, // 2
137    };
138
139    /* these indices dependent on SEARCHES_PROJECTION */
140    public static final int SEARCHES_PROJECTION_SEARCH_INDEX = 1;
141    public static final int SEARCHES_PROJECTION_DATE_INDEX = 2;
142
143    /* Set a cap on the count of history items in the history/bookmark
144       table, to prevent db and layout operations from dragging to a
145       crawl.  Revisit this cap when/if db/layout performance
146       improvements are made.  Note: this does not affect bookmark
147       entries -- if the user wants more bookmarks than the cap, they
148       get them. */
149    private static final int MAX_HISTORY_COUNT = 250;
150
151    /**
152     *  Open an activity to save a bookmark. Launch with a title
153     *  and/or a url, both of which can be edited by the user before saving.
154     *
155     *  @param c        Context used to launch the activity to add a bookmark.
156     *  @param title    Title for the bookmark. Can be null or empty string.
157     *  @param url      Url for the bookmark. Can be null or empty string.
158     */
159    public static final void saveBookmark(Context c,
160                                          String title,
161                                          String url) {
162        Intent i = new Intent(Intent.ACTION_INSERT, Browser.BOOKMARKS_URI);
163        i.putExtra("title", title);
164        i.putExtra("url", url);
165        c.startActivity(i);
166    }
167
168    /**
169     * Boolean extra passed along with an Intent to a browser, specifying that
170     * a new tab be created.  Overrides EXTRA_APPLICATION_ID; if both are set,
171     * a new tab will be used, rather than using the same one.
172     */
173    public static final String EXTRA_CREATE_NEW_TAB = "create_new_tab";
174
175    /**
176     * Stores a Bitmap extra in an {@link Intent} representing the screenshot of
177     * a page to share.  When receiving an {@link Intent#ACTION_SEND} from the
178     * Browser, use this to access the screenshot.
179     * @hide
180     */
181    public final static String EXTRA_SHARE_SCREENSHOT = "share_screenshot";
182
183    /**
184     * Stores a Bitmap extra in an {@link Intent} representing the favicon of a
185     * page to share.  When receiving an {@link Intent#ACTION_SEND} from the
186     * Browser, use this to access the favicon.
187     * @hide
188     */
189    public final static String EXTRA_SHARE_FAVICON = "share_favicon";
190
191    /**
192     * Sends the given string using an Intent with {@link Intent#ACTION_SEND} and a mime type
193     * of text/plain. The string is put into {@link Intent#EXTRA_TEXT}.
194     *
195     * @param context the context used to start the activity
196     * @param string the string to send
197     */
198    public static final void sendString(Context context, String string) {
199        sendString(context, string, context.getString(com.android.internal.R.string.sendText));
200    }
201
202    /**
203     *  Find an application to handle the given string and, if found, invoke
204     *  it with the given string as a parameter.
205     *  @param c Context used to launch the new activity.
206     *  @param stringToSend The string to be handled.
207     *  @param chooserDialogTitle The title of the dialog that allows the user
208     *  to select between multiple applications that are all capable of handling
209     *  the string.
210     *  @hide pending API council approval
211     */
212    public static final void sendString(Context c,
213                                        String stringToSend,
214                                        String chooserDialogTitle) {
215        Intent send = new Intent(Intent.ACTION_SEND);
216        send.setType("text/plain");
217        send.putExtra(Intent.EXTRA_TEXT, stringToSend);
218
219        try {
220            Intent i = Intent.createChooser(send, chooserDialogTitle);
221            // In case this is called from outside an Activity
222            i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
223            c.startActivity(i);
224        } catch(android.content.ActivityNotFoundException ex) {
225            // if no app handles it, do nothing
226        }
227    }
228
229    /**
230     *  Return a cursor pointing to a list of all the bookmarks. The cursor will have a single
231     *  column, {@link BookmarkColumns#URL}.
232     *  <p>
233     *  Requires {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS}
234     *
235     *  @param cr   The ContentResolver used to access the database.
236     */
237    public static final Cursor getAllBookmarks(ContentResolver cr) throws
238            IllegalStateException {
239        return cr.query(Bookmarks.CONTENT_URI,
240                new String[] { Bookmarks.URL },
241                Bookmarks.IS_FOLDER + " = 0", null, null);
242    }
243
244    /**
245     *  Return a cursor pointing to a list of all visited site urls. The cursor will
246     *  have a single column, {@link BookmarkColumns#URL}.
247     *  <p>
248     *  Requires {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS}
249     *
250     *  @param cr   The ContentResolver used to access the database.
251     */
252    public static final Cursor getAllVisitedUrls(ContentResolver cr) throws
253            IllegalStateException {
254        return cr.query(Combined.CONTENT_URI,
255                new String[] { Combined.URL }, null, null,
256                Combined.DATE_CREATED + " ASC");
257    }
258
259    private static final void addOrUrlEquals(StringBuilder sb) {
260        sb.append(" OR " + BookmarkColumns.URL + " = ");
261    }
262
263    private static final Cursor getVisitedLike(ContentResolver cr, String url) {
264        boolean secure = false;
265        String compareString = url;
266        if (compareString.startsWith("http://")) {
267            compareString = compareString.substring(7);
268        } else if (compareString.startsWith("https://")) {
269            compareString = compareString.substring(8);
270            secure = true;
271        }
272        if (compareString.startsWith("www.")) {
273            compareString = compareString.substring(4);
274        }
275        StringBuilder whereClause = null;
276        if (secure) {
277            whereClause = new StringBuilder(Bookmarks.URL + " = ");
278            DatabaseUtils.appendEscapedSQLString(whereClause,
279                    "https://" + compareString);
280            addOrUrlEquals(whereClause);
281            DatabaseUtils.appendEscapedSQLString(whereClause,
282                    "https://www." + compareString);
283        } else {
284            whereClause = new StringBuilder(Bookmarks.URL + " = ");
285            DatabaseUtils.appendEscapedSQLString(whereClause,
286                    compareString);
287            addOrUrlEquals(whereClause);
288            String wwwString = "www." + compareString;
289            DatabaseUtils.appendEscapedSQLString(whereClause,
290                    wwwString);
291            addOrUrlEquals(whereClause);
292            DatabaseUtils.appendEscapedSQLString(whereClause,
293                    "http://" + compareString);
294            addOrUrlEquals(whereClause);
295            DatabaseUtils.appendEscapedSQLString(whereClause,
296                    "http://" + wwwString);
297        }
298        return cr.query(History.CONTENT_URI, new String[] { History._ID, History.VISITS },
299                whereClause.toString(), null, null);
300    }
301
302    /**
303     *  Update the visited history to acknowledge that a site has been
304     *  visited.
305     *  Requires {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS}
306     *  Requires {@link android.Manifest.permission#WRITE_HISTORY_BOOKMARKS}
307     *  @param cr   The ContentResolver used to access the database.
308     *  @param url  The site being visited.
309     *  @param real If true, this is an actual visit, and should add to the
310     *              number of visits.  If false, the user entered it manually.
311     */
312    public static final void updateVisitedHistory(ContentResolver cr,
313                                                  String url, boolean real) {
314        long now = System.currentTimeMillis();
315        Cursor c = null;
316        try {
317            c = getVisitedLike(cr, url);
318            /* We should only get one answer that is exactly the same. */
319            if (c.moveToFirst()) {
320                ContentValues values = new ContentValues();
321                if (real) {
322                    values.put(History.VISITS, c.getInt(1) + 1);
323                } else {
324                    values.put(History.USER_ENTERED, 1);
325                }
326                values.put(History.DATE_LAST_VISITED, now);
327                cr.update(ContentUris.withAppendedId(History.CONTENT_URI, c.getLong(0)),
328                        values, null, null);
329            } else {
330                truncateHistory(cr);
331                ContentValues values = new ContentValues();
332                int visits;
333                int user_entered;
334                if (real) {
335                    visits = 1;
336                    user_entered = 0;
337                } else {
338                    visits = 0;
339                    user_entered = 1;
340                }
341                values.put(History.URL, url);
342                values.put(History.VISITS, visits);
343                values.put(History.DATE_LAST_VISITED, now);
344                values.put(History.TITLE, url);
345                values.put(History.DATE_CREATED, 0);
346                values.put(History.USER_ENTERED, user_entered);
347                cr.insert(History.CONTENT_URI, values);
348            }
349        } catch (IllegalStateException e) {
350            Log.e(LOGTAG, "updateVisitedHistory", e);
351        } finally {
352            if (c != null) c.close();
353        }
354    }
355
356    /**
357     *  Returns all the URLs in the history.
358     *  Requires {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS}
359     *  @param cr   The ContentResolver used to access the database.
360     *  @hide pending API council approval
361     */
362    public static final String[] getVisitedHistory(ContentResolver cr) {
363        Cursor c = null;
364        String[] str = null;
365        try {
366            String[] projection = new String[] {
367                    History.URL,
368            };
369            c = cr.query(History.CONTENT_URI, projection, History.VISITS + " > 0", null, null);
370            if (c == null) return new String[0];
371            str = new String[c.getCount()];
372            int i = 0;
373            while (c.moveToNext()) {
374                str[i] = c.getString(0);
375                i++;
376            }
377        } catch (IllegalStateException e) {
378            Log.e(LOGTAG, "getVisitedHistory", e);
379            str = new String[0];
380        } finally {
381            if (c != null) c.close();
382        }
383        return str;
384    }
385
386    /**
387     * If there are more than MAX_HISTORY_COUNT non-bookmark history
388     * items in the bookmark/history table, delete TRUNCATE_N_OLDEST
389     * of them.  This is used to keep our history table to a
390     * reasonable size.  Note: it does not prune bookmarks.  If the
391     * user wants 1000 bookmarks, the user gets 1000 bookmarks.
392     *  Requires {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS}
393     *  Requires {@link android.Manifest.permission#WRITE_HISTORY_BOOKMARKS}
394     *
395     * @param cr The ContentResolver used to access the database.
396     */
397    public static final void truncateHistory(ContentResolver cr) {
398        // TODO make a single request to the provider to do this in a single transaction
399        Cursor cursor = null;
400        try {
401
402            // Select non-bookmark history, ordered by date
403            cursor = cr.query(History.CONTENT_URI,
404                    new String[] { History._ID, History.URL, History.DATE_LAST_VISITED },
405                    null, null, History.DATE_LAST_VISITED + " ASC");
406
407            if (cursor.moveToFirst() && cursor.getCount() >= MAX_HISTORY_COUNT) {
408                WebIconDatabase iconDb = null;
409                if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
410                    iconDb = WebIconDatabase.getInstance();
411                }
412                /* eliminate oldest history items */
413                for (int i = 0; i < TRUNCATE_N_OLDEST; i++) {
414                    cr.delete(ContentUris.withAppendedId(History.CONTENT_URI, cursor.getLong(0)),
415                        null, null);
416                    if (iconDb != null) {
417                        iconDb.releaseIconForPageUrl(cursor.getString(1));
418                    }
419                    if (!cursor.moveToNext()) break;
420                }
421            }
422        } catch (IllegalStateException e) {
423            Log.e(LOGTAG, "truncateHistory", e);
424        } finally {
425            if (cursor != null) cursor.close();
426        }
427    }
428
429    /**
430     * Returns whether there is any history to clear.
431     *  Requires {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS}
432     * @param cr   The ContentResolver used to access the database.
433     * @return boolean  True if the history can be cleared.
434     */
435    public static final boolean canClearHistory(ContentResolver cr) {
436        Cursor cursor = null;
437        boolean ret = false;
438        try {
439            cursor = cr.query(History.CONTENT_URI,
440                new String [] { History._ID, History.VISITS },
441                null, null, null);
442            ret = cursor.getCount() > 0;
443        } catch (IllegalStateException e) {
444            Log.e(LOGTAG, "canClearHistory", e);
445        } finally {
446            if (cursor != null) cursor.close();
447        }
448        return ret;
449    }
450
451    /**
452     *  Delete all entries from the bookmarks/history table which are
453     *  not bookmarks.  Also set all visited bookmarks to unvisited.
454     *  Requires {@link android.Manifest.permission#WRITE_HISTORY_BOOKMARKS}
455     *  @param cr   The ContentResolver used to access the database.
456     */
457    public static final void clearHistory(ContentResolver cr) {
458        deleteHistoryWhere(cr, null);
459    }
460
461    /**
462     * Helper function to delete all history items and release the icons for them in the
463     * {@link WebIconDatabase}.
464     *
465     * Requires {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS}
466     * Requires {@link android.Manifest.permission#WRITE_HISTORY_BOOKMARKS}
467     *
468     * @param cr   The ContentResolver used to access the database.
469     * @param whereClause   String to limit the items affected.
470     *                      null means all items.
471     */
472    private static final void deleteHistoryWhere(ContentResolver cr, String whereClause) {
473        Cursor cursor = null;
474        try {
475            cursor = cr.query(History.CONTENT_URI, new String[] { History.URL }, whereClause,
476                    null, null);
477            if (cursor.moveToFirst()) {
478                WebIconDatabase iconDb = null;
479                if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
480                    iconDb = WebIconDatabase.getInstance();
481                }
482                do {
483                  // Delete favicons
484                  // TODO don't release if the URL is bookmarked
485                  if (iconDb != null) {
486                      iconDb.releaseIconForPageUrl(cursor.getString(0));
487                  }
488                } while (cursor.moveToNext());
489
490                cr.delete(History.CONTENT_URI, whereClause, null);
491            }
492        } catch (IllegalStateException e) {
493            Log.e(LOGTAG, "deleteHistoryWhere", e);
494            return;
495        } finally {
496            if (cursor != null) cursor.close();
497        }
498    }
499
500    /**
501     * Delete all history items from begin to end.
502     *  Requires {@link android.Manifest.permission#WRITE_HISTORY_BOOKMARKS}
503     * @param cr    The ContentResolver used to access the database.
504     * @param begin First date to remove.  If -1, all dates before end.
505     *              Inclusive.
506     * @param end   Last date to remove. If -1, all dates after begin.
507     *              Non-inclusive.
508     */
509    public static final void deleteHistoryTimeFrame(ContentResolver cr,
510            long begin, long end) {
511        String whereClause;
512        String date = BookmarkColumns.DATE;
513        if (-1 == begin) {
514            if (-1 == end) {
515                clearHistory(cr);
516                return;
517            }
518            whereClause = date + " < " + Long.toString(end);
519        } else if (-1 == end) {
520            whereClause = date + " >= " + Long.toString(begin);
521        } else {
522            whereClause = date + " >= " + Long.toString(begin) + " AND " + date
523                    + " < " + Long.toString(end);
524        }
525        deleteHistoryWhere(cr, whereClause);
526    }
527
528    /**
529     * Remove a specific url from the history database.
530     *  Requires {@link android.Manifest.permission#WRITE_HISTORY_BOOKMARKS}
531     * @param cr    The ContentResolver used to access the database.
532     * @param url   url to remove.
533     */
534    public static final void deleteFromHistory(ContentResolver cr,
535                                               String url) {
536        cr.delete(History.CONTENT_URI, History.URL + "=?", new String[] { url });
537    }
538
539    /**
540     * Add a search string to the searches database.
541     *  Requires {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS}
542     *  Requires {@link android.Manifest.permission#WRITE_HISTORY_BOOKMARKS}
543     * @param cr   The ContentResolver used to access the database.
544     * @param search    The string to add to the searches database.
545     */
546    public static final void addSearchUrl(ContentResolver cr, String search) {
547        // The content provider will take care of updating existing searches instead of duplicating
548        ContentValues values = new ContentValues();
549        values.put(Searches.SEARCH, search);
550        values.put(Searches.DATE, System.currentTimeMillis());
551        cr.insert(Searches.CONTENT_URI, values);
552    }
553
554    /**
555     * Remove all searches from the search database.
556     *  Requires {@link android.Manifest.permission#WRITE_HISTORY_BOOKMARKS}
557     * @param cr   The ContentResolver used to access the database.
558     */
559    public static final void clearSearches(ContentResolver cr) {
560        // FIXME: Should this clear the urls to which these searches lead?
561        // (i.e. remove google.com/query= blah blah blah)
562        try {
563            cr.delete(Searches.CONTENT_URI, null, null);
564        } catch (IllegalStateException e) {
565            Log.e(LOGTAG, "clearSearches", e);
566        }
567    }
568
569    /**
570     *  Request all icons from the database.  This call must either be called
571     *  in the main thread or have had Looper.prepare() invoked in the calling
572     *  thread.
573     *  Requires {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS}
574     *  @param  cr The ContentResolver used to access the database.
575     *  @param  where Clause to be used to limit the query from the database.
576     *          Must be an allowable string to be passed into a database query.
577     *  @param  listener IconListener that gets the icons once they are
578     *          retrieved.
579     */
580    public static final void requestAllIcons(ContentResolver cr, String where,
581            WebIconDatabase.IconListener listener) {
582        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
583            WebIconDatabase.getInstance().bulkRequestIconForPageUrl(cr, where, listener);
584        }
585    }
586
587    /**
588     * Column definitions for the mixed bookmark and history items available
589     * at {@link #BOOKMARKS_URI}.
590     */
591    public static class BookmarkColumns implements BaseColumns {
592        /**
593         * The URL of the bookmark or history item.
594         * <p>Type: TEXT (URL)</p>
595         */
596        public static final String URL = "url";
597
598        /**
599         * The number of time the item has been visited.
600         * <p>Type: NUMBER</p>
601         */
602        public static final String VISITS = "visits";
603
604        /**
605         * The date the item was last visited, in milliseconds since the epoch.
606         * <p>Type: NUMBER (date in milliseconds since January 1, 1970)</p>
607         */
608        public static final String DATE = "date";
609
610        /**
611         * Flag indicating that an item is a bookmark. A value of 1 indicates a bookmark, a value
612         * of 0 indicates a history item.
613         * <p>Type: INTEGER (boolean)</p>
614         */
615        public static final String BOOKMARK = "bookmark";
616
617        /**
618         * The user visible title of the bookmark or history item.
619         * <p>Type: TEXT</p>
620         */
621        public static final String TITLE = "title";
622
623        /**
624         * The date the item created, in milliseconds since the epoch.
625         * <p>Type: NUMBER (date in milliseconds since January 1, 1970)</p>
626         */
627        public static final String CREATED = "created";
628
629        /**
630         * The favicon of the bookmark. Must decode via {@link BitmapFactory#decodeByteArray}.
631         * <p>Type: BLOB (image)</p>
632         */
633        public static final String FAVICON = "favicon";
634
635        /**
636         * @hide
637         */
638        public static final String THUMBNAIL = "thumbnail";
639
640        /**
641         * @hide
642         */
643        public static final String TOUCH_ICON = "touch_icon";
644
645        /**
646         * @hide
647         */
648        public static final String USER_ENTERED = "user_entered";
649    }
650
651    /**
652     * Column definitions for the search history table, available at {@link #SEARCHES_URI}.
653     */
654    public static class SearchColumns implements BaseColumns {
655        /**
656         * @deprecated Not used.
657         */
658        @Deprecated
659        public static final String URL = "url";
660
661        /**
662         * The user entered search term.
663         */
664        public static final String SEARCH = "search";
665
666        /**
667         * The date the search was performed, in milliseconds since the epoch.
668         * <p>Type: NUMBER (date in milliseconds since January 1, 1970)</p>
669         */
670        public static final String DATE = "date";
671    }
672}
673