| 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.download; | 5 package org.chromium.chrome.browser.download; |
| 6 | 6 |
| 7 import android.app.Notification; | 7 import android.app.Notification; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.util.Pair; |
| 9 | 10 |
| 10 import org.chromium.base.BuildInfo; | 11 import org.chromium.base.BuildInfo; |
| 11 import org.chromium.base.ThreadUtils; | 12 import org.chromium.base.ThreadUtils; |
| 12 | 13 |
| 13 import java.util.ArrayList; | 14 import java.util.ArrayList; |
| 14 import java.util.List; | 15 import java.util.List; |
| 15 import java.util.concurrent.Callable; | 16 import java.util.concurrent.Callable; |
| 16 | 17 |
| 17 /** | 18 /** |
| 18 * Mock class to DownloadNotificationService for testing purpose. | 19 * Mock class to DownloadNotificationService for testing purpose. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 48 // Cancelling notifications here is synchronous, so we don't really have
to worry about | 49 // Cancelling notifications here is synchronous, so we don't really have
to worry about |
| 49 // {@code notificationIdToIgnore}, but address it properly anyway. | 50 // {@code notificationIdToIgnore}, but address it properly anyway. |
| 50 if (mNotificationIds.size() == 1 && notificationIdToIgnore != null) { | 51 if (mNotificationIds.size() == 1 && notificationIdToIgnore != null) { |
| 51 return !mNotificationIds.contains(notificationIdToIgnore); | 52 return !mNotificationIds.contains(notificationIdToIgnore); |
| 52 } | 53 } |
| 53 | 54 |
| 54 return !mNotificationIds.isEmpty(); | 55 return !mNotificationIds.isEmpty(); |
| 55 } | 56 } |
| 56 | 57 |
| 57 @Override | 58 @Override |
| 59 void updateSummaryIcon( |
| 60 int removedNotificationId, Pair<Integer, Notification> addedNotifica
tion) {} |
| 61 |
| 62 @Override |
| 58 void cancelSummaryNotification() {} | 63 void cancelSummaryNotification() {} |
| 59 | 64 |
| 60 @Override | 65 @Override |
| 61 void updateNotification(int id, Notification notification) { | 66 void updateNotification(int id, Notification notification) { |
| 62 if (!mNotificationIds.contains(id)) { | 67 if (!mNotificationIds.contains(id)) { |
| 63 mNotificationIds.add(id); | 68 mNotificationIds.add(id); |
| 64 mLastNotificationId = id; | 69 mLastNotificationId = id; |
| 65 } | 70 } |
| 66 } | 71 } |
| 67 | 72 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 public void notifyDownloadCanceled(final String downloadGuid) { | 139 public void notifyDownloadCanceled(final String downloadGuid) { |
| 135 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | 140 ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
| 136 @Override | 141 @Override |
| 137 public void run() { | 142 public void run() { |
| 138 MockDownloadNotificationService.super.notifyDownloadCanceled(dow
nloadGuid); | 143 MockDownloadNotificationService.super.notifyDownloadCanceled(dow
nloadGuid); |
| 139 } | 144 } |
| 140 }); | 145 }); |
| 141 } | 146 } |
| 142 } | 147 } |
| 143 | 148 |
| OLD | NEW |