| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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.app.SearchManager; | 7 import android.app.SearchManager; |
| 8 import android.content.ContentProvider; | 8 import android.content.ContentProvider; |
| 9 import android.content.ContentUris; | 9 import android.content.ContentUris; |
| 10 import android.content.ContentValues; | 10 import android.content.ContentValues; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 BookmarkColumns.TITLE, | 149 BookmarkColumns.TITLE, |
| 150 BookmarkColumns.URL, | 150 BookmarkColumns.URL, |
| 151 BookmarkColumns.DATE, | 151 BookmarkColumns.DATE, |
| 152 BookmarkColumns.BOOKMARK | 152 BookmarkColumns.BOOKMARK |
| 153 }; | 153 }; |
| 154 | 154 |
| 155 private final Object mInitializeUriMatcherLock = new Object(); | 155 private final Object mInitializeUriMatcherLock = new Object(); |
| 156 private final Object mLoadNativeLock = new Object(); | 156 private final Object mLoadNativeLock = new Object(); |
| 157 private UriMatcher mUriMatcher; | 157 private UriMatcher mUriMatcher; |
| 158 private long mLastModifiedBookmarkFolderId = INVALID_BOOKMARK_ID; | 158 private long mLastModifiedBookmarkFolderId = INVALID_BOOKMARK_ID; |
| 159 private int mNativeChromeBrowserProvider; | 159 private long mNativeChromeBrowserProvider; |
| 160 private BookmarkNode mMobileBookmarksFolder; | 160 private BookmarkNode mMobileBookmarksFolder; |
| 161 | 161 |
| 162 /** | 162 /** |
| 163 * Records whether we've received a call to one of the public ContentProvide
r APIs. | 163 * Records whether we've received a call to one of the public ContentProvide
r APIs. |
| 164 */ | 164 */ |
| 165 protected boolean mContentProviderApiCalled; | 165 protected boolean mContentProviderApiCalled; |
| 166 | 166 |
| 167 private void ensureUriMatcherInitialized() { | 167 private void ensureUriMatcherInitialized() { |
| 168 synchronized (mInitializeUriMatcherLock) { | 168 synchronized (mInitializeUriMatcherLock) { |
| 169 if (mUriMatcher != null) return; | 169 if (mUriMatcher != null) return; |
| (...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1278 | 1278 |
| 1279 /** | 1279 /** |
| 1280 * Call to get the intent to create a bookmark shortcut on homescreen. | 1280 * Call to get the intent to create a bookmark shortcut on homescreen. |
| 1281 */ | 1281 */ |
| 1282 public static Intent getShortcutToBookmark(String url, String title, Bitmap
favicon, int rValue, | 1282 public static Intent getShortcutToBookmark(String url, String title, Bitmap
favicon, int rValue, |
| 1283 int gValue, int bValue, Context context) { | 1283 int gValue, int bValue, Context context) { |
| 1284 return BookmarkUtils.createAddToHomeIntent( | 1284 return BookmarkUtils.createAddToHomeIntent( |
| 1285 context, url, title, favicon, rValue, gValue, bValue); | 1285 context, url, title, favicon, rValue, gValue, bValue); |
| 1286 } | 1286 } |
| 1287 | 1287 |
| 1288 private native int nativeInit(); | 1288 private native long nativeInit(); |
| 1289 private native void nativeDestroy(int nativeChromeBrowserProvider); | 1289 private native void nativeDestroy(long nativeChromeBrowserProvider); |
| 1290 | 1290 |
| 1291 // Public API native methods. | 1291 // Public API native methods. |
| 1292 private native long nativeAddBookmark(int nativeChromeBrowserProvider, | 1292 private native long nativeAddBookmark(long nativeChromeBrowserProvider, |
| 1293 String url, String title, boolean isFolder, long parentId); | 1293 String url, String title, boolean isFolder, long parentId); |
| 1294 | 1294 |
| 1295 private native int nativeRemoveBookmark(int nativeChromeBrowserProvider, lon
g id); | 1295 private native int nativeRemoveBookmark(long nativeChromeBrowserProvider, lo
ng id); |
| 1296 | 1296 |
| 1297 private native int nativeUpdateBookmark(int nativeChromeBrowserProvider, | 1297 private native int nativeUpdateBookmark(long nativeChromeBrowserProvider, |
| 1298 long id, String url, String title, long parentId); | 1298 long id, String url, String title, long parentId); |
| 1299 | 1299 |
| 1300 private native long nativeAddBookmarkFromAPI(int nativeChromeBrowserProvider
, | 1300 private native long nativeAddBookmarkFromAPI(long nativeChromeBrowserProvide
r, |
| 1301 String url, Long created, Boolean isBookmark, Long date, byte[] favi
con, | 1301 String url, Long created, Boolean isBookmark, Long date, byte[] favi
con, |
| 1302 String title, Integer visits, long parentId); | 1302 String title, Integer visits, long parentId); |
| 1303 | 1303 |
| 1304 private native SQLiteCursor nativeQueryBookmarkFromAPI(int nativeChromeBrows
erProvider, | 1304 private native SQLiteCursor nativeQueryBookmarkFromAPI(long nativeChromeBrow
serProvider, |
| 1305 String[] projection, String selection, String[] selectionArgs, Strin
g sortOrder); | 1305 String[] projection, String selection, String[] selectionArgs, Strin
g sortOrder); |
| 1306 | 1306 |
| 1307 private native int nativeUpdateBookmarkFromAPI(int nativeChromeBrowserProvid
er, | 1307 private native int nativeUpdateBookmarkFromAPI(long nativeChromeBrowserProvi
der, |
| 1308 String url, Long created, Boolean isBookmark, Long date, byte[] favi
con, | 1308 String url, Long created, Boolean isBookmark, Long date, byte[] favi
con, |
| 1309 String title, Integer visits, long parentId, String selection, Strin
g[] selectionArgs); | 1309 String title, Integer visits, long parentId, String selection, Strin
g[] selectionArgs); |
| 1310 | 1310 |
| 1311 private native int nativeRemoveBookmarkFromAPI(int nativeChromeBrowserProvid
er, | 1311 private native int nativeRemoveBookmarkFromAPI(long nativeChromeBrowserProvi
der, |
| 1312 String selection, String[] selectionArgs); | 1312 String selection, String[] selectionArgs); |
| 1313 | 1313 |
| 1314 private native int nativeRemoveHistoryFromAPI(int nativeChromeBrowserProvide
r, | 1314 private native int nativeRemoveHistoryFromAPI(long nativeChromeBrowserProvid
er, |
| 1315 String selection, String[] selectionArgs); | 1315 String selection, String[] selectionArgs); |
| 1316 | 1316 |
| 1317 private native long nativeAddSearchTermFromAPI(int nativeChromeBrowserProvid
er, | 1317 private native long nativeAddSearchTermFromAPI(long nativeChromeBrowserProvi
der, |
| 1318 String term, Long date); | 1318 String term, Long date); |
| 1319 | 1319 |
| 1320 private native SQLiteCursor nativeQuerySearchTermFromAPI(int nativeChromeBro
wserProvider, | 1320 private native SQLiteCursor nativeQuerySearchTermFromAPI(long nativeChromeBr
owserProvider, |
| 1321 String[] projection, String selection, String[] selectionArgs, Strin
g sortOrder); | 1321 String[] projection, String selection, String[] selectionArgs, Strin
g sortOrder); |
| 1322 | 1322 |
| 1323 private native int nativeUpdateSearchTermFromAPI(int nativeChromeBrowserProv
ider, | 1323 private native int nativeUpdateSearchTermFromAPI(long nativeChromeBrowserPro
vider, |
| 1324 String search, Long date, String selection, String[] selectionArgs); | 1324 String search, Long date, String selection, String[] selectionArgs); |
| 1325 | 1325 |
| 1326 private native int nativeRemoveSearchTermFromAPI(int nativeChromeBrowserProv
ider, | 1326 private native int nativeRemoveSearchTermFromAPI(long nativeChromeBrowserPro
vider, |
| 1327 String selection, String[] selectionArgs); | 1327 String selection, String[] selectionArgs); |
| 1328 | 1328 |
| 1329 // Client API native methods. | 1329 // Client API native methods. |
| 1330 private native boolean nativeBookmarkNodeExists(int nativeChromeBrowserProvi
der, long id); | 1330 private native boolean nativeBookmarkNodeExists(long nativeChromeBrowserProv
ider, long id); |
| 1331 | 1331 |
| 1332 private native long nativeCreateBookmarksFolderOnce(int nativeChromeBrowserP
rovider, | 1332 private native long nativeCreateBookmarksFolderOnce(long nativeChromeBrowser
Provider, |
| 1333 String title, long parentId); | 1333 String title, long parentId); |
| 1334 | 1334 |
| 1335 private native BookmarkNode nativeGetAllBookmarkFolders(int nativeChromeBrow
serProvider); | 1335 private native BookmarkNode nativeGetAllBookmarkFolders(long nativeChromeBro
wserProvider); |
| 1336 | 1336 |
| 1337 private native void nativeRemoveAllBookmarks(int nativeChromeBrowserProvider
); | 1337 private native void nativeRemoveAllBookmarks(long nativeChromeBrowserProvide
r); |
| 1338 | 1338 |
| 1339 private native BookmarkNode nativeGetBookmarkNode(int nativeChromeBrowserPro
vider, | 1339 private native BookmarkNode nativeGetBookmarkNode(long nativeChromeBrowserPr
ovider, |
| 1340 long id, boolean getParent, boolean getChildren); | 1340 long id, boolean getParent, boolean getChildren); |
| 1341 | 1341 |
| 1342 private native BookmarkNode nativeGetMobileBookmarksFolder(int nativeChromeB
rowserProvider); | 1342 private native BookmarkNode nativeGetMobileBookmarksFolder(long nativeChrome
BrowserProvider); |
| 1343 | 1343 |
| 1344 private native boolean nativeIsBookmarkInMobileBookmarksBranch(int nativeChr
omeBrowserProvider, | 1344 private native boolean nativeIsBookmarkInMobileBookmarksBranch(long nativeCh
romeBrowserProvider, |
| 1345 long id); | 1345 long id); |
| 1346 | 1346 |
| 1347 private native byte[] nativeGetFaviconOrTouchIcon(int nativeChromeBrowserPro
vider, String url); | 1347 private native byte[] nativeGetFaviconOrTouchIcon(long nativeChromeBrowserPr
ovider, String url); |
| 1348 | 1348 |
| 1349 private native byte[] nativeGetThumbnail(int nativeChromeBrowserProvider, St
ring url); | 1349 private native byte[] nativeGetThumbnail(long nativeChromeBrowserProvider, S
tring url); |
| 1350 } | 1350 } |
| OLD | NEW |