Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java |
| index ed45d91856b7a195f0600ae26afb13bd8f18f466..095761c33d2afc7ed3b08c6ab299c63d8399adbd 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java |
| @@ -260,17 +260,23 @@ class UrlManager { |
| } |
| /** |
| - * Gets all UrlInfos and PwsResults for nearby URLs. |
| - * The UrlInfos and PwsResults are returned as parallel arrays. Unresolved URLs in the UrlInfo |
| - * array will have a null element in the corresponding entry of the PwsResult array. |
| - * @return A PwCollection object containg parallel arrays of UrlInfos and PwsResults. |
| + * Gets all UrlInfos and PwsResults for URLs that are nearby and resolved. |
| + * @param nativePhysicalWebCollection A pointer to the native PhysicalWebCollection container |
| + * which will receive the list of nearby URL metadata. |
|
gone
2016/10/24 16:35:35
nit: indent which under A?
mattreynolds
2016/10/24 22:39:52
Done.
|
| */ |
| - public PwCollection getPwCollection() { |
| - List<PwsResult> nearbyPwsResults = new ArrayList<>(); |
| - for (String url : mNearbyUrls) { |
| - nearbyPwsResults.add(mPwsResultMap.get(url)); |
| + @CalledByNative |
| + public void getPwCollection(long nativePhysicalWebCollection) { |
| + List<UrlInfo> nearbyUrlInfos = getUrlInfoList(mNearbyUrls); |
| + for (UrlInfo urlInfo : nearbyUrlInfos) { |
| + String requestUrl = urlInfo.getUrl(); |
| + PwsResult pwsResult = mPwsResultMap.get(requestUrl); |
| + if (pwsResult != null) { |
| + nativeAppendMetadataItem(nativePhysicalWebCollection, requestUrl, |
| + urlInfo.getDistance(), (int) urlInfo.getScanTimestamp(), pwsResult.siteUrl, |
| + pwsResult.iconUrl, pwsResult.title, pwsResult.description, |
| + pwsResult.groupId); |
| + } |
| } |
| - return new PwCollection(getUrlInfoList(mNearbyUrls), nearbyPwsResults); |
| } |
| /** |
| @@ -714,4 +720,7 @@ class UrlManager { |
| } |
| private native long nativeInit(); |
| + private native void nativeAppendMetadataItem(long nativePhysicalWebCollection, |
| + String requestUrl, double distanceEstimate, int scanTimestamp, String siteUrl, |
| + String iconUrl, String title, String description, String groupId); |
| } |