| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser; | 5 package org.chromium.chrome.browser; |
| 6 | 6 |
| 7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
| 8 import android.app.SearchManager; | 8 import android.app.SearchManager; |
| 9 import android.content.ContentProvider; | 9 import android.content.ContentProvider; |
| 10 import android.content.ContentUris; | 10 import android.content.ContentUris; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 private static final String BROWSER_CONTRACT_API_AUTHORITY = | 77 private static final String BROWSER_CONTRACT_API_AUTHORITY = |
| 78 "com.google.android.apps.chrome.browser-contract"; | 78 "com.google.android.apps.chrome.browser-contract"; |
| 79 | 79 |
| 80 // These values are taken from android.provider.BrowserContract.java since | 80 // These values are taken from android.provider.BrowserContract.java since |
| 81 // that class is hidden from the SDK. | 81 // that class is hidden from the SDK. |
| 82 private static final String BROWSER_CONTRACT_AUTHORITY = "com.android.browse
r"; | 82 private static final String BROWSER_CONTRACT_AUTHORITY = "com.android.browse
r"; |
| 83 private static final String BROWSER_CONTRACT_HISTORY_CONTENT_TYPE = | 83 private static final String BROWSER_CONTRACT_HISTORY_CONTENT_TYPE = |
| 84 "vnd.android.cursor.dir/browser-history"; | 84 "vnd.android.cursor.dir/browser-history"; |
| 85 private static final String BROWSER_CONTRACT_HISTORY_CONTENT_ITEM_TYPE = | 85 private static final String BROWSER_CONTRACT_HISTORY_CONTENT_ITEM_TYPE = |
| 86 "vnd.android.cursor.item/browser-history"; | 86 "vnd.android.cursor.item/browser-history"; |
| 87 private static final String BROWSER_CONTRACT_BOOKMARK_CONTENT_TYPE = |
| 88 "vnd.android.cursor.dir/bookmark"; |
| 89 private static final String BROWSER_CONTRACT_BOOKMARK_CONTENT_ITEM_TYPE = |
| 90 "vnd.android.cursor.item/bookmark"; |
| 91 private static final String BROWSER_CONTRACT_SEARCH_CONTENT_TYPE = |
| 92 "vnd.android.cursor.dir/searches"; |
| 93 private static final String BROWSER_CONTRACT_SEARCH_CONTENT_ITEM_TYPE = |
| 94 "vnd.android.cursor.item/searches"; |
| 87 | 95 |
| 88 // This Authority is for internal interface. It's concatenated with | 96 // This Authority is for internal interface. It's concatenated with |
| 89 // Context.getPackageName() so that we can install different channels | 97 // Context.getPackageName() so that we can install different channels |
| 90 // SxS and have different authorities. | 98 // SxS and have different authorities. |
| 91 private static final String AUTHORITY_SUFFIX = ".ChromeBrowserProvider"; | 99 private static final String AUTHORITY_SUFFIX = ".ChromeBrowserProvider"; |
| 92 private static final String BOOKMARKS_PATH = "bookmarks"; | 100 private static final String BOOKMARKS_PATH = "bookmarks"; |
| 93 private static final String SEARCHES_PATH = "searches"; | 101 private static final String SEARCHES_PATH = "searches"; |
| 94 private static final String HISTORY_PATH = "history"; | 102 private static final String HISTORY_PATH = "history"; |
| 95 private static final String COMBINED_PATH = "combined"; | 103 private static final String COMBINED_PATH = "combined"; |
| 96 private static final String BOOKMARK_FOLDER_PATH = "hierarchy"; | 104 private static final String BOOKMARK_FOLDER_PATH = "hierarchy"; |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 return result; | 529 return result; |
| 522 } | 530 } |
| 523 | 531 |
| 524 @Override | 532 @Override |
| 525 public String getType(Uri uri) { | 533 public String getType(Uri uri) { |
| 526 ensureUriMatcherInitialized(); | 534 ensureUriMatcherInitialized(); |
| 527 int match = mUriMatcher.match(uri); | 535 int match = mUriMatcher.match(uri); |
| 528 switch (match) { | 536 switch (match) { |
| 529 case URI_MATCH_BOOKMARKS: | 537 case URI_MATCH_BOOKMARKS: |
| 530 case URL_MATCH_API_BOOKMARK: | 538 case URL_MATCH_API_BOOKMARK: |
| 531 return "vnd.android.cursor.dir/bookmark"; | 539 return BROWSER_CONTRACT_BOOKMARK_CONTENT_TYPE; |
| 532 case URI_MATCH_BOOKMARKS_ID: | 540 case URI_MATCH_BOOKMARKS_ID: |
| 533 case URL_MATCH_API_BOOKMARK_ID: | 541 case URL_MATCH_API_BOOKMARK_ID: |
| 534 return "vnd.android.cursor.item/bookmark"; | 542 return BROWSER_CONTRACT_BOOKMARK_CONTENT_ITEM_TYPE; |
| 535 case URL_MATCH_API_SEARCHES: | 543 case URL_MATCH_API_SEARCHES: |
| 536 return "vnd.android.cursor.dir/searches"; | 544 return BROWSER_CONTRACT_SEARCH_CONTENT_TYPE; |
| 537 case URL_MATCH_API_SEARCHES_ID: | 545 case URL_MATCH_API_SEARCHES_ID: |
| 538 return "vnd.android.cursor.item/searches"; | 546 return BROWSER_CONTRACT_SEARCH_CONTENT_ITEM_TYPE; |
| 539 case URL_MATCH_API_HISTORY_CONTENT: | 547 case URL_MATCH_API_HISTORY_CONTENT: |
| 540 return BROWSER_CONTRACT_HISTORY_CONTENT_TYPE; | 548 return BROWSER_CONTRACT_HISTORY_CONTENT_TYPE; |
| 541 case URL_MATCH_API_HISTORY_CONTENT_ID: | 549 case URL_MATCH_API_HISTORY_CONTENT_ID: |
| 542 return BROWSER_CONTRACT_HISTORY_CONTENT_ITEM_TYPE; | 550 return BROWSER_CONTRACT_HISTORY_CONTENT_ITEM_TYPE; |
| 543 default: | 551 default: |
| 544 throw new IllegalArgumentException(TAG + ": getType - unknown UR
L " + uri); | 552 throw new IllegalArgumentException(TAG + ": getType - unknown UR
L " + uri); |
| 545 } | 553 } |
| 546 } | 554 } |
| 547 | 555 |
| 548 private long addBookmark(ContentValues values) { | 556 private long addBookmark(ContentValues values) { |
| (...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1354 | 1362 |
| 1355 private native BookmarkNode nativeGetMobileBookmarksFolder(long nativeChrome
BrowserProvider); | 1363 private native BookmarkNode nativeGetMobileBookmarksFolder(long nativeChrome
BrowserProvider); |
| 1356 | 1364 |
| 1357 private native boolean nativeIsBookmarkInMobileBookmarksBranch(long nativeCh
romeBrowserProvider, | 1365 private native boolean nativeIsBookmarkInMobileBookmarksBranch(long nativeCh
romeBrowserProvider, |
| 1358 long id); | 1366 long id); |
| 1359 | 1367 |
| 1360 private native byte[] nativeGetFaviconOrTouchIcon(long nativeChromeBrowserPr
ovider, String url); | 1368 private native byte[] nativeGetFaviconOrTouchIcon(long nativeChromeBrowserPr
ovider, String url); |
| 1361 | 1369 |
| 1362 private native byte[] nativeGetThumbnail(long nativeChromeBrowserProvider, S
tring url); | 1370 private native byte[] nativeGetThumbnail(long nativeChromeBrowserProvider, S
tring url); |
| 1363 } | 1371 } |
| OLD | NEW |