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

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

Issue 2557593003: Store device addresses in UrlInfo (Closed)
Patch Set: Created 4 years 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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 * @return The updated cache entry 483 * @return The updated cache entry
484 */ 484 */
485 private UrlInfo updateCacheEntry(UrlInfo urlInfo) { 485 private UrlInfo updateCacheEntry(UrlInfo urlInfo) {
486 UrlInfo currentUrlInfo = mUrlInfoMap.get(urlInfo.getUrl()); 486 UrlInfo currentUrlInfo = mUrlInfoMap.get(urlInfo.getUrl());
487 if (currentUrlInfo == null) { 487 if (currentUrlInfo == null) {
488 mUrlInfoMap.put(urlInfo.getUrl(), urlInfo); 488 mUrlInfoMap.put(urlInfo.getUrl(), urlInfo);
489 currentUrlInfo = urlInfo; 489 currentUrlInfo = urlInfo;
490 } else { 490 } else {
491 mUrlsSortedByTimestamp.remove(urlInfo.getUrl()); 491 mUrlsSortedByTimestamp.remove(urlInfo.getUrl());
492 currentUrlInfo.setScanTimestamp(urlInfo.getScanTimestamp()); 492 currentUrlInfo.setScanTimestamp(urlInfo.getScanTimestamp());
493 currentUrlInfo.setDistance(urlInfo.getDistance()); 493 if (urlInfo.getDistance() > 0.0) {
494 currentUrlInfo.setDistance(urlInfo.getDistance());
495 }
496 if (urlInfo.getDeviceAddress() != null) {
497 currentUrlInfo.setDeviceAddress(urlInfo.getDeviceAddress());
498 }
494 } 499 }
495 mUrlsSortedByTimestamp.add(urlInfo.getUrl()); 500 mUrlsSortedByTimestamp.add(urlInfo.getUrl());
496 return currentUrlInfo; 501 return currentUrlInfo;
497 } 502 }
498 503
499 private void resolveUrl(final UrlInfo url) { 504 private void resolveUrl(final UrlInfo url) {
500 Set<UrlInfo> urls = new HashSet<UrlInfo>(Arrays.asList(url)); 505 Set<UrlInfo> urls = new HashSet<UrlInfo>(Arrays.asList(url));
501 final long timestamp = SystemClock.elapsedRealtime(); 506 final long timestamp = SystemClock.elapsedRealtime();
502 mPwsClient.resolve(urls, new PwsClient.ResolveScanCallback() { 507 mPwsClient.resolve(urls, new PwsClient.ResolveScanCallback() {
503 @Override 508 @Override
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 829
825 private native long nativeInit(); 830 private native long nativeInit();
826 private native void nativeAppendMetadataItem(long nativePhysicalWebCollectio n, 831 private native void nativeAppendMetadataItem(long nativePhysicalWebCollectio n,
827 String requestUrl, double distanceEstimate, int scanTimestamp, Strin g siteUrl, 832 String requestUrl, double distanceEstimate, int scanTimestamp, Strin g siteUrl,
828 String iconUrl, String title, String description, String groupId); 833 String iconUrl, String title, String description, String groupId);
829 private native void nativeOnFound(long nativePhysicalWebDataSourceAndroid, S tring url); 834 private native void nativeOnFound(long nativePhysicalWebDataSourceAndroid, S tring url);
830 private native void nativeOnLost(long nativePhysicalWebDataSourceAndroid, St ring url); 835 private native void nativeOnLost(long nativePhysicalWebDataSourceAndroid, St ring url);
831 private native void nativeOnDistanceChanged( 836 private native void nativeOnDistanceChanged(
832 long nativePhysicalWebDataSourceAndroid, String url, double distance Changed); 837 long nativePhysicalWebDataSourceAndroid, String url, double distance Changed);
833 } 838 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698