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.DownloadManager; | 7 import android.app.DownloadManager; |
8 import android.content.BroadcastReceiver; | 8 import android.content.BroadcastReceiver; |
9 import android.content.Context; | 9 import android.content.Context; |
10 import android.content.Intent; | 10 import android.content.Intent; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 Uri uri = DownloadManagerDelegate.getContentUriFromDownloadManager(conte
xt, id); | 55 Uri uri = DownloadManagerDelegate.getContentUriFromDownloadManager(conte
xt, id); |
56 if (uri == null) { | 56 if (uri == null) { |
57 DownloadManagerService.openDownloadsPage(context); | 57 DownloadManagerService.openDownloadsPage(context); |
58 return; | 58 return; |
59 } | 59 } |
60 | 60 |
61 String downloadFilename = IntentUtils.safeGetStringExtra( | 61 String downloadFilename = IntentUtils.safeGetStringExtra( |
62 intent, DownloadNotificationService.EXTRA_DOWNLOAD_FILE_PATH); | 62 intent, DownloadNotificationService.EXTRA_DOWNLOAD_FILE_PATH); |
63 boolean isSupportedMimeType = IntentUtils.safeGetBooleanExtra( | 63 boolean isSupportedMimeType = IntentUtils.safeGetBooleanExtra( |
64 intent, DownloadNotificationService.EXTRA_IS_SUPPORTED_MIME_TYPE
, false); | 64 intent, DownloadNotificationService.EXTRA_IS_SUPPORTED_MIME_TYPE
, false); |
| 65 boolean isOffTheRecord = IntentUtils.safeGetBooleanExtra( |
| 66 intent, DownloadNotificationService.EXTRA_IS_OFF_THE_RECORD, fal
se); |
| 67 String downloadGuid = IntentUtils.safeGetStringExtra( |
| 68 intent, DownloadNotificationService.EXTRA_DOWNLOAD_GUID); |
65 DownloadManagerService.openDownloadedContent( | 69 DownloadManagerService.openDownloadedContent( |
66 context, downloadFilename, isSupportedMimeType, id); | 70 context, downloadFilename, isSupportedMimeType, isOffTheRecord,
downloadGuid, id); |
67 } | 71 } |
68 | 72 |
69 /** | 73 /** |
70 * Called to perform a download operation. This will call the DownloadNotifi
cationService | 74 * Called to perform a download operation. This will call the DownloadNotifi
cationService |
71 * to start the browser process asynchronously, and resume or cancel the dow
nload afterwards. | 75 * to start the browser process asynchronously, and resume or cancel the dow
nload afterwards. |
72 * @param context Context of the receiver. | 76 * @param context Context of the receiver. |
73 * @param intent Intent retrieved from the notification. | 77 * @param intent Intent retrieved from the notification. |
74 */ | 78 */ |
75 private void performDownloadOperation(final Context context, Intent intent)
{ | 79 private void performDownloadOperation(final Context context, Intent intent)
{ |
76 if (DownloadNotificationService.isDownloadOperationIntent(intent)) { | 80 if (DownloadNotificationService.isDownloadOperationIntent(intent)) { |
77 DownloadNotificationService.startDownloadNotificationService(context
, intent); | 81 DownloadNotificationService.startDownloadNotificationService(context
, intent); |
78 } | 82 } |
79 } | 83 } |
80 } | 84 } |
OLD | NEW |