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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java

Issue 2561493002: Pass Physical Web metadata through a struct (Closed)
Patch Set: Fix dependency for real Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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.physicalweb; 5 package org.chromium.chrome.browser.physicalweb;
6 6
7 import android.app.AlarmManager; 7 import android.app.AlarmManager;
8 import android.app.Notification; 8 import android.app.Notification;
9 import android.app.NotificationManager; 9 import android.app.NotificationManager;
10 import android.app.PendingIntent; 10 import android.app.PendingIntent;
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 * which will receive the list of nearby URL metadata. 276 * which will receive the list of nearby URL metadata.
277 */ 277 */
278 @CalledByNative 278 @CalledByNative
279 public void getPwCollection(long nativePhysicalWebCollection) { 279 public void getPwCollection(long nativePhysicalWebCollection) {
280 List<UrlInfo> nearbyUrlInfos = getUrlInfoList(mNearbyUrls); 280 List<UrlInfo> nearbyUrlInfos = getUrlInfoList(mNearbyUrls);
281 for (UrlInfo urlInfo : nearbyUrlInfos) { 281 for (UrlInfo urlInfo : nearbyUrlInfos) {
282 String requestUrl = urlInfo.getUrl(); 282 String requestUrl = urlInfo.getUrl();
283 PwsResult pwsResult = mPwsResultMap.get(requestUrl); 283 PwsResult pwsResult = mPwsResultMap.get(requestUrl);
284 if (pwsResult != null) { 284 if (pwsResult != null) {
285 nativeAppendMetadataItem(nativePhysicalWebCollection, requestUrl , 285 nativeAppendMetadataItem(nativePhysicalWebCollection, requestUrl ,
286 urlInfo.getDistance(), (int) urlInfo.getScanTimestamp(), pwsResult.siteUrl, 286 urlInfo.getDistance(), urlInfo.getScanTimestamp(), pwsRe sult.siteUrl,
287 pwsResult.iconUrl, pwsResult.title, pwsResult.descriptio n, 287 pwsResult.iconUrl, pwsResult.title, pwsResult.descriptio n,
288 pwsResult.groupId); 288 pwsResult.groupId);
289 } 289 }
290 } 290 }
291 } 291 }
292 292
293 /** 293 /**
294 * Forget all stored URLs and clear the notification. 294 * Forget all stored URLs and clear the notification.
295 */ 295 */
296 public void clearAllUrls() { 296 public void clearAllUrls() {
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 || mUrlsSortedByTimestamp.contains(url); 815 || mUrlsSortedByTimestamp.contains(url);
816 } 816 }
817 817
818 @VisibleForTesting 818 @VisibleForTesting
819 int getMaxCacheSize() { 819 int getMaxCacheSize() {
820 return MAX_CACHE_SIZE; 820 return MAX_CACHE_SIZE;
821 } 821 }
822 822
823 private native long nativeInit(); 823 private native long nativeInit();
824 private native void nativeAppendMetadataItem(long nativePhysicalWebCollectio n, 824 private native void nativeAppendMetadataItem(long nativePhysicalWebCollectio n,
825 String requestUrl, double distanceEstimate, int scanTimestamp, Strin g siteUrl, 825 String requestUrl, double distanceEstimate, long scanTimestamp, Stri ng siteUrl,
826 String iconUrl, String title, String description, String groupId); 826 String iconUrl, String title, String description, String groupId);
827 private native void nativeOnFound(long nativePhysicalWebDataSourceAndroid, S tring url); 827 private native void nativeOnFound(long nativePhysicalWebDataSourceAndroid, S tring url);
828 private native void nativeOnLost(long nativePhysicalWebDataSourceAndroid, St ring url); 828 private native void nativeOnLost(long nativePhysicalWebDataSourceAndroid, St ring url);
829 private native void nativeOnDistanceChanged( 829 private native void nativeOnDistanceChanged(
830 long nativePhysicalWebDataSourceAndroid, String url, double distance Changed); 830 long nativePhysicalWebDataSourceAndroid, String url, double distance Changed);
831 } 831 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698