| 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 #ifndef CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_MANAGER_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_MANAGER_SERVICE_H_ |
| 6 #define CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_MANAGER_SERVICE_H_ | 6 #define CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_MANAGER_SERVICE_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/android/scoped_java_ref.h" | 12 #include "base/android/scoped_java_ref.h" |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "chrome/browser/android/download/download_controller.h" |
| 15 #include "chrome/browser/download/download_history.h" | 16 #include "chrome/browser/download/download_history.h" |
| 16 #include "content/public/browser/download_manager.h" | 17 #include "content/public/browser/download_manager.h" |
| 17 | 18 |
| 18 using base::android::JavaParamRef; | 19 using base::android::JavaParamRef; |
| 19 | 20 |
| 20 namespace content { | 21 namespace content { |
| 21 class DownloadItem; | 22 class DownloadItem; |
| 22 } | 23 } |
| 23 | 24 |
| 24 // Native side of DownloadManagerService.java. The native object is owned by its | 25 // Native side of DownloadManagerService.java. The native object is owned by its |
| 25 // Java object. | 26 // Java object. |
| 26 class DownloadManagerService : public DownloadHistory::Observer { | 27 class DownloadManagerService : public DownloadHistory::Observer { |
| 27 public: | 28 public: |
| 28 // JNI registration. | 29 // JNI registration. |
| 29 static bool RegisterDownloadManagerService(JNIEnv* env); | 30 static bool RegisterDownloadManagerService(JNIEnv* env); |
| 30 | 31 |
| 32 static void OnDownloadCanceled( |
| 33 content::DownloadItem* download, |
| 34 DownloadController::DownloadCancelReason reason); |
| 35 |
| 31 DownloadManagerService(JNIEnv* env, | 36 DownloadManagerService(JNIEnv* env, |
| 32 jobject jobj); | 37 jobject jobj); |
| 33 ~DownloadManagerService() override; | 38 ~DownloadManagerService() override; |
| 34 | 39 |
| 35 // Called to resume downloading the item that has GUID equal to | 40 // Called to resume downloading the item that has GUID equal to |
| 36 // |jdownload_guid|.. | 41 // |jdownload_guid|.. |
| 37 void ResumeDownload(JNIEnv* env, | 42 void ResumeDownload(JNIEnv* env, |
| 38 jobject obj, | 43 jobject obj, |
| 39 const JavaParamRef<jstring>& jdownload_guid); | 44 const JavaParamRef<jstring>& jdownload_guid); |
| 40 | 45 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 100 |
| 96 void EnqueueDownloadAction(const std::string& download_guid, | 101 void EnqueueDownloadAction(const std::string& download_guid, |
| 97 DownloadAction action); | 102 DownloadAction action); |
| 98 | 103 |
| 99 ResumeCallback resume_callback_for_testing_; | 104 ResumeCallback resume_callback_for_testing_; |
| 100 | 105 |
| 101 DISALLOW_COPY_AND_ASSIGN(DownloadManagerService); | 106 DISALLOW_COPY_AND_ASSIGN(DownloadManagerService); |
| 102 }; | 107 }; |
| 103 | 108 |
| 104 #endif // CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_MANAGER_SERVICE_H_ | 109 #endif // CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_MANAGER_SERVICE_H_ |
| OLD | NEW |