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.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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
245 | 245 |
246 public Set<String> getNearbyUrls() { | 246 public Set<String> getNearbyUrls() { |
247 return mNearbyUrls; | 247 return mNearbyUrls; |
248 } | 248 } |
249 | 249 |
250 public Set<String> getResolvedUrls() { | 250 public Set<String> getResolvedUrls() { |
251 return mPwsResultMap.keySet(); | 251 return mPwsResultMap.keySet(); |
252 } | 252 } |
253 | 253 |
254 /** | 254 /** |
255 * Gets all resolved URLs as pairs of their UrlInfo and PwsResult. | |
256 */ | |
257 public PwPair[] getPwPairs() { | |
258 ArrayList<PwPair> pairs = new ArrayList<>(); | |
259 for (PwsResult pwsResult : mPwsResultMap.values()) { | |
260 pairs.add(new PwPair(mUrlInfoMap.get(pwsResult.requestUrl), pwsResul t)); | |
cco3
2016/09/16 18:11:49
When we have an ID other than URLs, this will not
hayesjordan
2016/09/16 18:30:10
Would that mean the returned list could have multi
cco3
2016/09/16 18:33:56
Yes
| |
261 } | |
262 return pairs.toArray(new PwPair[0]); | |
263 } | |
264 | |
265 /** | |
255 * Forget all stored URLs and clear the notification. | 266 * Forget all stored URLs and clear the notification. |
256 */ | 267 */ |
257 public void clearAllUrls() { | 268 public void clearAllUrls() { |
258 clearNearbyUrls(); | 269 clearNearbyUrls(); |
259 mUrlsSortedByTimestamp.clear(); | 270 mUrlsSortedByTimestamp.clear(); |
260 mUrlInfoMap.clear(); | 271 mUrlInfoMap.clear(); |
261 mPwsResultMap.clear(); | 272 mPwsResultMap.clear(); |
262 putCachedUrlInfoMap(); | 273 putCachedUrlInfoMap(); |
263 putCachedPwsResultMap(); | 274 putCachedPwsResultMap(); |
264 } | 275 } |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
653 || mPwsResultMap.containsKey(url) | 664 || mPwsResultMap.containsKey(url) |
654 || mUrlInfoMap.containsKey(url) | 665 || mUrlInfoMap.containsKey(url) |
655 || mUrlsSortedByTimestamp.contains(url); | 666 || mUrlsSortedByTimestamp.contains(url); |
656 } | 667 } |
657 | 668 |
658 @VisibleForTesting | 669 @VisibleForTesting |
659 int getMaxCacheSize() { | 670 int getMaxCacheSize() { |
660 return MAX_CACHE_SIZE; | 671 return MAX_CACHE_SIZE; |
661 } | 672 } |
662 } | 673 } |
OLD | NEW |