Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3771)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridge.java

Issue 2225213002: Make GetBestPageForOnlineURL async (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/offline_page_bridge.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridge.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridge.java
index 60824e25ea653bf531d8f5ddbd2f5f7dd038772c..024d975f2d1b96189077c9c89c7ca36f281c4c60 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridge.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridge.java
@@ -246,32 +246,17 @@ public class OfflinePageBridge {
return result;
}
- /**
- * Gets the offline pages associated with a provided online URL. The callback is called when
- * the results are available.
+ /**
+ * Get the offline page associated with the provided offline URL.
*
- * @param onlineURL URL of the page.
- * @param callback Called with the results.
+ * @param onlineUrl URL of the page.
+ * @param tabId Android tab ID.
+ * @param callback callback to pass back the
+ * matching {@link OfflinePageItem} if found. Will pass back null if not.
*/
- @VisibleForTesting
- public void getPagesByOnlineUrl(
- final String onlineUrl, final Callback<List<OfflinePageItem>> callback) {
- runWhenLoaded(new Runnable() {
- @Override
- public void run() {
- List<OfflinePageItem> result = new ArrayList<>();
-
- // TODO(http://crbug.com/589526) This native API returns only one item, but in the
- // future will return a list.
- OfflinePageItem item =
- nativeGetBestPageForOnlineURL(mNativeOfflinePageBridge, onlineUrl);
- if (item != null) {
- result.add(item);
- }
-
- callback.onResult(result);
- }
- });
+ public void selectPageForOnlineUrl(String onlineUrl, int tabId,
+ Callback<OfflinePageItem> callback) {
+ nativeSelectPageForOnlineUrl(mNativeOfflinePageBridge, onlineUrl, tabId, callback);
}
/**
@@ -518,8 +503,9 @@ public class OfflinePageBridge {
@VisibleForTesting
native OfflinePageItem nativeGetPageByOfflineId(long nativeOfflinePageBridge, long offlineId);
- private native OfflinePageItem nativeGetBestPageForOnlineURL(
- long nativeOfflinePageBridge, String onlineURL);
+ private native void nativeSelectPageForOnlineUrl(
+ long nativeOfflinePageBridge, String onlineUrl, int tabId,
+ Callback<OfflinePageItem> callback);
private native void nativeGetPageByOfflineUrl(
long nativeOfflinePageBridge, String offlineUrl, Callback<OfflinePageItem> callback);
private native void nativeSavePage(long nativeOfflinePageBridge, SavePageCallback callback,
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/offline_page_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698