Chromium Code Reviews| OLD | NEW |
|---|---|
| 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.content.Context; | 7 import android.content.Context; |
| 8 import android.content.SharedPreferences; | 8 import android.content.SharedPreferences; |
| 9 import android.os.AsyncTask; | 9 import android.os.AsyncTask; |
| 10 import android.os.Handler; | 10 import android.os.Handler; |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 429 * previously undiscovered. | 429 * previously undiscovered. |
| 430 * @return The updated cache entry | 430 * @return The updated cache entry |
| 431 */ | 431 */ |
| 432 private UrlInfo updateCacheEntry(UrlInfo urlInfo) { | 432 private UrlInfo updateCacheEntry(UrlInfo urlInfo) { |
| 433 UrlInfo currentUrlInfo = mUrlInfoMap.get(urlInfo.getUrl()); | 433 UrlInfo currentUrlInfo = mUrlInfoMap.get(urlInfo.getUrl()); |
| 434 if (currentUrlInfo == null) { | 434 if (currentUrlInfo == null) { |
| 435 mUrlInfoMap.put(urlInfo.getUrl(), urlInfo); | 435 mUrlInfoMap.put(urlInfo.getUrl(), urlInfo); |
| 436 currentUrlInfo = urlInfo; | 436 currentUrlInfo = urlInfo; |
| 437 } else { | 437 } else { |
| 438 mUrlsSortedByTimestamp.remove(urlInfo.getUrl()); | 438 mUrlsSortedByTimestamp.remove(urlInfo.getUrl()); |
| 439 currentUrlInfo.setScanTimestamp(urlInfo.getScanTimestamp()); | 439 |
| 440 // TODO(ranj): Update scantimestamp when metadata is refreshed appro priately. | |
| 441 // currentUrlInfo.setScanTimestamp(urlInfo.getScanTimestamp()); | |
|
mmocny
2017/02/22 19:36:52
If we don't update this here, won't these results
cco3
2017/02/22 20:21:47
Yes, but that's OK. time-based garbage collection
| |
| 440 if (urlInfo.getDistance() > 0.0) { | 442 if (urlInfo.getDistance() > 0.0) { |
| 441 currentUrlInfo.setDistance(urlInfo.getDistance()); | 443 currentUrlInfo.setDistance(urlInfo.getDistance()); |
| 442 } | 444 } |
| 443 if (urlInfo.getDeviceAddress() != null) { | 445 if (urlInfo.getDeviceAddress() != null) { |
| 444 currentUrlInfo.setDeviceAddress(urlInfo.getDeviceAddress()); | 446 currentUrlInfo.setDeviceAddress(urlInfo.getDeviceAddress()); |
| 445 } | 447 } |
| 446 } | 448 } |
| 447 mUrlsSortedByTimestamp.add(urlInfo.getUrl()); | 449 mUrlsSortedByTimestamp.add(urlInfo.getUrl()); |
| 448 return currentUrlInfo; | 450 return currentUrlInfo; |
| 449 } | 451 } |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 643 | 645 |
| 644 private native long nativeInit(); | 646 private native long nativeInit(); |
| 645 private native void nativeAppendMetadataItem(long nativePhysicalWebCollectio n, | 647 private native void nativeAppendMetadataItem(long nativePhysicalWebCollectio n, |
| 646 String requestUrl, double distanceEstimate, long scanTimestamp, Stri ng siteUrl, | 648 String requestUrl, double distanceEstimate, long scanTimestamp, Stri ng siteUrl, |
| 647 String iconUrl, String title, String description, String groupId); | 649 String iconUrl, String title, String description, String groupId); |
| 648 private native void nativeOnFound(long nativePhysicalWebDataSourceAndroid, S tring url); | 650 private native void nativeOnFound(long nativePhysicalWebDataSourceAndroid, S tring url); |
| 649 private native void nativeOnLost(long nativePhysicalWebDataSourceAndroid, St ring url); | 651 private native void nativeOnLost(long nativePhysicalWebDataSourceAndroid, St ring url); |
| 650 private native void nativeOnDistanceChanged( | 652 private native void nativeOnDistanceChanged( |
| 651 long nativePhysicalWebDataSourceAndroid, String url, double distance Changed); | 653 long nativePhysicalWebDataSourceAndroid, String url, double distance Changed); |
| 652 } | 654 } |
| OLD | NEW |