diff options
author | qinmin <qinmin@chromium.org> | 2016-03-25 21:13:38 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-26 04:14:58 +0000 |
commit | 30ac0f57a0fcae1a13e6374c05927a04caf526e5 (patch) | |
tree | bb56349228c53a3ee588e25971e935af6996f5fb /chrome/browser/android/download/download_manager_service.h | |
parent | 220c7edc3243b54970a13d91c690b2dffc15732d (diff) | |
download | chromium_src-30ac0f57a0fcae1a13e6374c05927a04caf526e5.zip chromium_src-30ac0f57a0fcae1a13e6374c05927a04caf526e5.tar.gz chromium_src-30ac0f57a0fcae1a13e6374c05927a04caf526e5.tar.bz2 |
Switch to use download GUID to indentify download items
Download GUID is introduced by
http://crrev.com/eef62b0282ec19ebc040785d0b7ac36de398cbc1
Unlike download Id, the GUID can live across browser sessions and will
not be reused.
This change switches the java class to also use the
GUID.
Chrome will temporarily use the old download Id as the notification Id.
This is because the android notification requires an int to identify it,
rather than a string.
In the future, we will generate the notification Id from java side.
The download Ids generated by the Android DownloadManager are not
affected by this CL.
However, they are only used in OMA downloads and when we call
addCompletedDownload().
BUG=593020
Review URL: https://codereview.chromium.org/1809203006
Cr-Commit-Position: refs/heads/master@{#383443}
Diffstat (limited to 'chrome/browser/android/download/download_manager_service.h')
-rw-r--r-- | chrome/browser/android/download/download_manager_service.h | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/chrome/browser/android/download/download_manager_service.h b/chrome/browser/android/download/download_manager_service.h index f1a5f9e..aa65a32 100644 --- a/chrome/browser/android/download/download_manager_service.h +++ b/chrome/browser/android/download/download_manager_service.h @@ -13,6 +13,8 @@ #include "base/macros.h" #include "content/public/browser/download_manager.h" +using base::android::JavaParamRef; + namespace content { class DownloadItem; } @@ -29,20 +31,26 @@ class DownloadManagerService : public content::DownloadManager::Observer { content::DownloadManager* manager); ~DownloadManagerService() override; - // Called to resume downloading the item that has ID equal to |download_id|. - // If the DownloadItem is not yet created, retry after a while. + // Called to resume downloading the item that has GUID equal to + // |jdownload_guid|. If the DownloadItem is not yet created, retry after + // a while. void ResumeDownload(JNIEnv* env, jobject obj, uint32_t download_id, + const JavaParamRef<jstring>& jdownload_guid, jstring fileName); - // Called to cancel a download item that has ID equal to |download_id|. + // Called to cancel a download item that has GUID equal to |jdownload_guid|. // If the DownloadItem is not yet created, retry after a while. - void CancelDownload(JNIEnv* env, jobject obj, uint32_t download_id); + void CancelDownload(JNIEnv* env, + jobject obj, + const JavaParamRef<jstring>& jdownload_guid); - // Called to pause a download item that has ID equal to |download_id|. + // Called to pause a download item that has GUID equal to |jdownload_guid|. // If the DownloadItem is not yet created, do nothing as it is already paused. - void PauseDownload(JNIEnv* env, jobject obj, uint32_t download_id); + void PauseDownload(JNIEnv* env, + jobject obj, + const JavaParamRef<jstring>& jdownload_guid); // content::DownloadManager::Observer methods. void ManagerGoingDown(content::DownloadManager* manager) override; @@ -58,12 +66,13 @@ class DownloadManagerService : public content::DownloadManager::Observer { // Helper function to start the download resumption. If |retry| is true, // chrome will retry the resumption if the download item is not loaded. void ResumeDownloadInternal(uint32_t download_id, + const std::string& download_guid, const std::string& fileName, bool retry); // Helper function to cancel a download. If |retry| is true, // chrome will retry the cancellation if the download item is not loaded. - void CancelDownloadInternal(uint32_t download_id, bool retry); + void CancelDownloadInternal(const std::string& download_guid, bool retry); // Called to notify the java side that download resumption failed. void OnResumptionFailed(uint32_t download_id, const std::string& fileName); |