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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/download/SystemDownloadNotifier.java

Issue 2239133002: [Offline pages] Downloads UI: Adding bridge for issuing notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@download-notifications
Patch Set: Addressing CR feedback Created 4 years, 4 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.download; 5 package org.chromium.chrome.browser.download;
6 6
7 import android.content.ComponentName; 7 import android.content.ComponentName;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.Intent; 9 import android.content.Intent;
10 import android.content.ServiceConnection; 10 import android.content.ServiceConnection;
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 mActiveDownloads.remove(info.getDownloadGuid()); 257 mActiveDownloads.remove(info.getDownloadGuid());
258 } 258 }
259 if (mBoundService == null) { 259 if (mBoundService == null) {
260 // We need to wait for the service to connect before we can hand le 260 // We need to wait for the service to connect before we can hand le
261 // the notification. Put the notification in the pending notific ations 261 // the notification. Put the notification in the pending notific ations
262 // list. 262 // list.
263 mPendingNotifications.add(notificationInfo); 263 mPendingNotifications.add(notificationInfo);
264 } else { 264 } else {
265 switch (notificationInfo.type) { 265 switch (notificationInfo.type) {
266 case DOWNLOAD_NOTIFICATION_TYPE_PROGRESS: 266 case DOWNLOAD_NOTIFICATION_TYPE_PROGRESS:
267 mBoundService.notifyDownloadProgress( 267 mBoundService.notifyDownloadProgress(info.getDownloadGui d(),
268 info.getDownloadGuid(), info.getFileName(), 268 info.getFileName(), info.getPercentCompleted(),
269 info.getPercentCompleted(), info.getTimeRemainin gInMillis(), 269 info.getTimeRemainingInMillis(), notificationInf o.startTime,
270 notificationInfo.startTime, info.isOffTheRecord( ), 270 info.isOffTheRecord(), notificationInfo.canDownl oadWhileMetered,
271 notificationInfo.canDownloadWhileMetered); 271 info.isOfflinePage());
272 break; 272 break;
273 case DOWNLOAD_NOTIFICATION_TYPE_PAUSE: 273 case DOWNLOAD_NOTIFICATION_TYPE_PAUSE:
274 mBoundService.notifyDownloadPaused(info.getDownloadGuid( ), true, false); 274 mBoundService.notifyDownloadPaused(info.getDownloadGuid( ), true, false);
275 break; 275 break;
276 case DOWNLOAD_NOTIFICATION_TYPE_INTERRUPT: 276 case DOWNLOAD_NOTIFICATION_TYPE_INTERRUPT:
277 mBoundService.notifyDownloadPaused( 277 mBoundService.notifyDownloadPaused(
278 info.getDownloadGuid(), info.isResumable(), 278 info.getDownloadGuid(), info.isResumable(),
279 notificationInfo.isAutoResumable); 279 notificationInfo.isAutoResumable);
280 break; 280 break;
281 case DOWNLOAD_NOTIFICATION_TYPE_SUCCESS: 281 case DOWNLOAD_NOTIFICATION_TYPE_SUCCESS:
282 final int notificationId = mBoundService.notifyDownloadS uccessful( 282 final int notificationId = mBoundService.notifyDownloadS uccessful(
283 info.getDownloadGuid(), info.getFileName(), 283 info.getDownloadGuid(), info.getFileName(),
284 notificationInfo.systemDownloadId); 284 notificationInfo.systemDownloadId, info.isOfflin ePage());
285 onSuccessNotificationShown(notificationInfo, notificatio nId); 285 onSuccessNotificationShown(notificationInfo, notificatio nId);
286 stopServiceIfNeeded(); 286 stopServiceIfNeeded();
287 break; 287 break;
288 case DOWNLOAD_NOTIFICATION_TYPE_FAILURE: 288 case DOWNLOAD_NOTIFICATION_TYPE_FAILURE:
289 mBoundService.notifyDownloadFailed( 289 mBoundService.notifyDownloadFailed(
290 info.getDownloadGuid(), info.getFileName()); 290 info.getDownloadGuid(), info.getFileName());
291 stopServiceIfNeeded(); 291 stopServiceIfNeeded();
292 break; 292 break;
293 case DOWNLOAD_NOTIFICATION_TYPE_CANCEL: 293 case DOWNLOAD_NOTIFICATION_TYPE_CANCEL:
294 mBoundService.notifyDownloadCanceled(info.getDownloadGui d()); 294 mBoundService.notifyDownloadCanceled(info.getDownloadGui d());
295 stopServiceIfNeeded(); 295 stopServiceIfNeeded();
296 break; 296 break;
297 case DOWNLOAD_NOTIFICATION_TYPE_RESUME_ALL: 297 case DOWNLOAD_NOTIFICATION_TYPE_RESUME_ALL:
298 mBoundService.resumeAllPendingDownloads(); 298 mBoundService.resumeAllPendingDownloads();
299 stopServiceIfNeeded(); 299 stopServiceIfNeeded();
300 break; 300 break;
301 default: 301 default:
302 assert false; 302 assert false;
303 } 303 }
304 } 304 }
305 } 305 }
306 } 306 }
307 } 307 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698