| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 DownloadControllerAndroidImpl(); | 88 DownloadControllerAndroidImpl(); |
| 89 ~DownloadControllerAndroidImpl() override; | 89 ~DownloadControllerAndroidImpl() override; |
| 90 | 90 |
| 91 // Helper method for implementing AcquireFileAccessPermission(). | 91 // Helper method for implementing AcquireFileAccessPermission(). |
| 92 bool HasFileAccessPermission( | 92 bool HasFileAccessPermission( |
| 93 base::android::ScopedJavaLocalRef<jobject> j_content_view_core); | 93 base::android::ScopedJavaLocalRef<jobject> j_content_view_core); |
| 94 | 94 |
| 95 // DownloadControllerAndroid implementation. | 95 // DownloadControllerAndroid implementation. |
| 96 void CreateGETDownload(int render_process_id, | 96 void CreateGETDownload(int render_process_id, |
| 97 int render_view_id, | 97 int render_view_id, |
| 98 int request_id) override; | 98 int request_id, |
| 99 bool must_download) override; |
| 99 void OnDownloadStarted(DownloadItem* download_item) override; | 100 void OnDownloadStarted(DownloadItem* download_item) override; |
| 100 void StartContextMenuDownload(const ContextMenuParams& params, | 101 void StartContextMenuDownload(const ContextMenuParams& params, |
| 101 WebContents* web_contents, | 102 WebContents* web_contents, |
| 102 bool is_link, | 103 bool is_link, |
| 103 const std::string& extra_headers) override; | 104 const std::string& extra_headers) override; |
| 104 void DangerousDownloadValidated(WebContents* web_contents, | 105 void DangerousDownloadValidated(WebContents* web_contents, |
| 105 const std::string& download_guid, | 106 const std::string& download_guid, |
| 106 bool accept) override; | 107 bool accept) override; |
| 107 | 108 |
| 108 // DownloadItem::Observer interface. | 109 // DownloadItem::Observer interface. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 119 void DoLoadCookies(const DownloadInfoAndroid& info, | 120 void DoLoadCookies(const DownloadInfoAndroid& info, |
| 120 const GetDownloadInfoCB& callback, | 121 const GetDownloadInfoCB& callback, |
| 121 const GlobalRequestID& global_id); | 122 const GlobalRequestID& global_id); |
| 122 void OnCookieResponse(DownloadInfoAndroid info, | 123 void OnCookieResponse(DownloadInfoAndroid info, |
| 123 const GetDownloadInfoCB& callback, | 124 const GetDownloadInfoCB& callback, |
| 124 const std::string& cookie); | 125 const std::string& cookie); |
| 125 void StartDownloadOnUIThread(const GetDownloadInfoCB& callback, | 126 void StartDownloadOnUIThread(const GetDownloadInfoCB& callback, |
| 126 const DownloadInfoAndroid& info); | 127 const DownloadInfoAndroid& info); |
| 127 void StartAndroidDownload(int render_process_id, | 128 void StartAndroidDownload(int render_process_id, |
| 128 int render_view_id, | 129 int render_view_id, |
| 130 bool must_download, |
| 129 const DownloadInfoAndroid& info); | 131 const DownloadInfoAndroid& info); |
| 130 void StartAndroidDownloadInternal(int render_process_id, | 132 void StartAndroidDownloadInternal(int render_process_id, |
| 131 int render_view_id, | 133 int render_view_id, |
| 134 bool must_download, |
| 132 const DownloadInfoAndroid& info, | 135 const DownloadInfoAndroid& info, |
| 133 bool allowed); | 136 bool allowed); |
| 134 | 137 |
| 135 // The download item contains dangerous file types. | 138 // The download item contains dangerous file types. |
| 136 void OnDangerousDownload(DownloadItem *item); | 139 void OnDangerousDownload(DownloadItem *item); |
| 137 | 140 |
| 138 base::android::ScopedJavaLocalRef<jobject> GetContentViewCoreFromWebContents( | 141 base::android::ScopedJavaLocalRef<jobject> GetContentViewCoreFromWebContents( |
| 139 WebContents* web_contents); | 142 WebContents* web_contents); |
| 140 | 143 |
| 141 // Creates Java object if it is not created already and returns it. | 144 // Creates Java object if it is not created already and returns it. |
| 142 JavaObject* GetJavaObject(); | 145 JavaObject* GetJavaObject(); |
| 143 | 146 |
| 144 JavaObject* java_object_; | 147 JavaObject* java_object_; |
| 145 | 148 |
| 146 std::string default_file_name_; | 149 std::string default_file_name_; |
| 147 | 150 |
| 148 ScopedVector<DeferredDownloadObserver> deferred_downloads_; | 151 ScopedVector<DeferredDownloadObserver> deferred_downloads_; |
| 149 | 152 |
| 150 DISALLOW_COPY_AND_ASSIGN(DownloadControllerAndroidImpl); | 153 DISALLOW_COPY_AND_ASSIGN(DownloadControllerAndroidImpl); |
| 151 }; | 154 }; |
| 152 | 155 |
| 153 } // namespace content | 156 } // namespace content |
| 154 | 157 |
| 155 #endif // CONTENT_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_IMPL_H_ | 158 #endif // CONTENT_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_IMPL_H_ |
| OLD | NEW |