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

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

Issue 2094033002: capping how many times background download resumption can automatically start (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comment Created 4 years, 5 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.app.DownloadManager; 7 import android.app.DownloadManager;
8 import android.content.ActivityNotFoundException; 8 import android.content.ActivityNotFoundException;
9 import android.content.BroadcastReceiver; 9 import android.content.BroadcastReceiver;
10 import android.content.Context; 10 import android.content.Context;
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 if (!downloadInfo.isResumable()) { 310 if (!downloadInfo.isResumable()) {
311 status = DOWNLOAD_STATUS_FAILED; 311 status = DOWNLOAD_STATUS_FAILED;
312 } else if (isAutoResumable) { 312 } else if (isAutoResumable) {
313 addAutoResumableDownload(item.getId()); 313 addAutoResumableDownload(item.getId());
314 } 314 }
315 updateDownloadProgress(item, status); 315 updateDownloadProgress(item, status);
316 scheduleUpdateIfNeeded(); 316 scheduleUpdateIfNeeded();
317 } 317 }
318 318
319 /** 319 /**
320 * Called when browser activity is launched. For background resumption and c ancellation, this
321 * will not be called.
322 */
323 public void onActivityLaunched() {
324 DownloadNotificationService.clearResumptionAttemptLeft();
325 }
326
327 /**
320 * Clear any pending OMA downloads by reading them from shared prefs. 328 * Clear any pending OMA downloads by reading them from shared prefs.
321 * TODO(qinmin): move this to a separate class. 329 * TODO(qinmin): move this to a separate class.
322 */ 330 */
323 public void clearPendingOMADownloads() { 331 public void clearPendingOMADownloads() {
324 if (mSharedPrefs.contains(PENDING_OMA_DOWNLOADS)) { 332 if (mSharedPrefs.contains(PENDING_OMA_DOWNLOADS)) {
325 Set<String> omaDownloads = getStoredDownloadInfo(mSharedPrefs, PENDI NG_OMA_DOWNLOADS); 333 Set<String> omaDownloads = getStoredDownloadInfo(mSharedPrefs, PENDI NG_OMA_DOWNLOADS);
326 for (String omaDownload : omaDownloads) { 334 for (String omaDownload : omaDownloads) {
327 OMAEntry entry = OMAEntry.parseOMAEntry(omaDownload); 335 OMAEntry entry = OMAEntry.parseOMAEntry(omaDownload);
328 clearPendingOMADownload(entry.mDownloadId, entry.mInstallNotifyU RI); 336 clearPendingOMADownload(entry.mDownloadId, entry.mInstallNotifyU RI);
329 } 337 }
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 public void purgeActiveNetworkList(int[] activeNetIds) {} 1465 public void purgeActiveNetworkList(int[] activeNetIds) {}
1458 1466
1459 private native long nativeInit(); 1467 private native long nativeInit();
1460 private native void nativeResumeDownload( 1468 private native void nativeResumeDownload(
1461 long nativeDownloadManagerService, String downloadGuid); 1469 long nativeDownloadManagerService, String downloadGuid);
1462 private native void nativeCancelDownload( 1470 private native void nativeCancelDownload(
1463 long nativeDownloadManagerService, String downloadGuid, boolean isOf fTheRecord, 1471 long nativeDownloadManagerService, String downloadGuid, boolean isOf fTheRecord,
1464 boolean isNotificationDismissed); 1472 boolean isNotificationDismissed);
1465 private native void nativePauseDownload(long nativeDownloadManagerService, S tring downloadGuid); 1473 private native void nativePauseDownload(long nativeDownloadManagerService, S tring downloadGuid);
1466 } 1474 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698