| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 static bool RegisterDownloadController(JNIEnv* env); | 49 static bool RegisterDownloadController(JNIEnv* env); |
| 50 | 50 |
| 51 // Called when DownloadController Java object is instantiated. | 51 // Called when DownloadController Java object is instantiated. |
| 52 void Init(JNIEnv* env, jobject obj); | 52 void Init(JNIEnv* env, jobject obj); |
| 53 | 53 |
| 54 // Removes a deferred download from |deferred_downloads_|. | 54 // Removes a deferred download from |deferred_downloads_|. |
| 55 void CancelDeferredDownload(DeferredDownloadObserver* observer); | 55 void CancelDeferredDownload(DeferredDownloadObserver* observer); |
| 56 | 56 |
| 57 // DownloadControllerAndroid implementation. | 57 // DownloadControllerAndroid implementation. |
| 58 void AcquireFileAccessPermission( | 58 void AcquireFileAccessPermission( |
| 59 WebContents* web_contents, | 59 int render_process_id, int render_view_id, |
| 60 const AcquireFileAccessPermissionCallback& callback) override; | 60 const AcquireFileAccessPermissionCallback& callback) override; |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 // Used to store all the information about an Android download. | 63 // Used to store all the information about an Android download. |
| 64 struct DownloadInfoAndroid { | 64 struct DownloadInfoAndroid { |
| 65 explicit DownloadInfoAndroid(net::URLRequest* request); | 65 explicit DownloadInfoAndroid(net::URLRequest* request); |
| 66 ~DownloadInfoAndroid(); | 66 ~DownloadInfoAndroid(); |
| 67 | 67 |
| 68 // The URL from which we are downloading. This is the final URL after any | 68 // The URL from which we are downloading. This is the final URL after any |
| 69 // redirection by the server for |original_url_|. | 69 // redirection by the server for |original_url_|. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 int render_view_id, | 129 int render_view_id, |
| 130 const DownloadInfoAndroid& info, | 130 const DownloadInfoAndroid& info, |
| 131 bool allowed); | 131 bool allowed); |
| 132 | 132 |
| 133 // The download item contains dangerous file types. | 133 // The download item contains dangerous file types. |
| 134 void OnDangerousDownload(DownloadItem *item); | 134 void OnDangerousDownload(DownloadItem *item); |
| 135 | 135 |
| 136 base::android::ScopedJavaLocalRef<jobject> GetContentViewCoreFromWebContents( | 136 base::android::ScopedJavaLocalRef<jobject> GetContentViewCoreFromWebContents( |
| 137 WebContents* web_contents); | 137 WebContents* web_contents); |
| 138 | 138 |
| 139 WebContents* GetWebContents(int render_process_id, int render_view_id); | |
| 140 | |
| 141 // Creates Java object if it is not created already and returns it. | 139 // Creates Java object if it is not created already and returns it. |
| 142 JavaObject* GetJavaObject(); | 140 JavaObject* GetJavaObject(); |
| 143 | 141 |
| 144 JavaObject* java_object_; | 142 JavaObject* java_object_; |
| 145 | 143 |
| 146 ScopedVector<DeferredDownloadObserver> deferred_downloads_; | 144 ScopedVector<DeferredDownloadObserver> deferred_downloads_; |
| 147 | 145 |
| 148 DISALLOW_COPY_AND_ASSIGN(DownloadControllerAndroidImpl); | 146 DISALLOW_COPY_AND_ASSIGN(DownloadControllerAndroidImpl); |
| 149 }; | 147 }; |
| 150 | 148 |
| 151 } // namespace content | 149 } // namespace content |
| 152 | 150 |
| 153 #endif // CONTENT_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_IMPL_H_ | 151 #endif // CONTENT_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_IMPL_H_ |
| OLD | NEW |