| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This class pairs with DownloadController on Java side to forward requests | 5 // This class pairs with DownloadController on Java side to forward requests |
| 6 // for GET downloads to the current DownloadListener. POST downloads are | 6 // for GET downloads to the current DownloadListener. POST downloads are |
| 7 // handled on the native side. | 7 // handled on the native side. |
| 8 // | 8 // |
| 9 // Both classes are Singleton classes. C++ object owns Java object. | 9 // Both classes are Singleton classes. C++ object owns Java object. |
| 10 // | 10 // |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // Called when DownloadController Java object is instantiated. | 52 // Called when DownloadController Java object is instantiated. |
| 53 void Init(JNIEnv* env, jobject obj); | 53 void Init(JNIEnv* env, jobject obj); |
| 54 | 54 |
| 55 // Removes a deferred download from |deferred_downloads_|. | 55 // Removes a deferred download from |deferred_downloads_|. |
| 56 void CancelDeferredDownload(DeferredDownloadObserver* observer); | 56 void CancelDeferredDownload(DeferredDownloadObserver* observer); |
| 57 | 57 |
| 58 // DownloadControllerAndroid implementation. | 58 // DownloadControllerAndroid implementation. |
| 59 void AcquireFileAccessPermission( | 59 void AcquireFileAccessPermission( |
| 60 WebContents* web_contents, | 60 WebContents* web_contents, |
| 61 const AcquireFileAccessPermissionCallback& callback) override; | 61 const AcquireFileAccessPermissionCallback& callback) override; |
| 62 void SetDefaultDownloadFileName(const std::string& file_name) override; |
| 62 | 63 |
| 63 private: | 64 private: |
| 64 // Used to store all the information about an Android download. | 65 // Used to store all the information about an Android download. |
| 65 struct DownloadInfoAndroid { | 66 struct DownloadInfoAndroid { |
| 66 explicit DownloadInfoAndroid(net::URLRequest* request); | 67 explicit DownloadInfoAndroid(net::URLRequest* request); |
| 67 ~DownloadInfoAndroid(); | 68 ~DownloadInfoAndroid(); |
| 68 | 69 |
| 69 // The URL from which we are downloading. This is the final URL after any | 70 // The URL from which we are downloading. This is the final URL after any |
| 70 // redirection by the server for |original_url_|. | 71 // redirection by the server for |original_url_|. |
| 71 GURL url; | 72 GURL url; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 void OnDangerousDownload(DownloadItem *item); | 136 void OnDangerousDownload(DownloadItem *item); |
| 136 | 137 |
| 137 base::android::ScopedJavaLocalRef<jobject> GetContentViewCoreFromWebContents( | 138 base::android::ScopedJavaLocalRef<jobject> GetContentViewCoreFromWebContents( |
| 138 WebContents* web_contents); | 139 WebContents* web_contents); |
| 139 | 140 |
| 140 // Creates Java object if it is not created already and returns it. | 141 // Creates Java object if it is not created already and returns it. |
| 141 JavaObject* GetJavaObject(); | 142 JavaObject* GetJavaObject(); |
| 142 | 143 |
| 143 JavaObject* java_object_; | 144 JavaObject* java_object_; |
| 144 | 145 |
| 146 std::string default_file_name_; |
| 147 |
| 145 ScopedVector<DeferredDownloadObserver> deferred_downloads_; | 148 ScopedVector<DeferredDownloadObserver> deferred_downloads_; |
| 146 | 149 |
| 147 DISALLOW_COPY_AND_ASSIGN(DownloadControllerAndroidImpl); | 150 DISALLOW_COPY_AND_ASSIGN(DownloadControllerAndroidImpl); |
| 148 }; | 151 }; |
| 149 | 152 |
| 150 } // namespace content | 153 } // namespace content |
| 151 | 154 |
| 152 #endif // CONTENT_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_IMPL_H_ | 155 #endif // CONTENT_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_IMPL_H_ |
| OLD | NEW |