| 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 19 matching lines...) Expand all Loading... |
| 30 #include "base/memory/scoped_vector.h" | 30 #include "base/memory/scoped_vector.h" |
| 31 #include "base/memory/singleton.h" | 31 #include "base/memory/singleton.h" |
| 32 #include "content/public/browser/android/download_controller_android.h" | 32 #include "content/public/browser/android/download_controller_android.h" |
| 33 #include "net/cookies/cookie_monster.h" | 33 #include "net/cookies/cookie_monster.h" |
| 34 #include "url/gurl.h" | 34 #include "url/gurl.h" |
| 35 | 35 |
| 36 namespace net { | 36 namespace net { |
| 37 class URLRequest; | 37 class URLRequest; |
| 38 } | 38 } |
| 39 | 39 |
| 40 namespace ui { |
| 41 class WindowAndroid; |
| 42 } |
| 43 |
| 40 namespace content { | 44 namespace content { |
| 41 struct GlobalRequestID; | 45 struct GlobalRequestID; |
| 42 class DeferredDownloadObserver; | 46 class DeferredDownloadObserver; |
| 43 class RenderViewHost; | 47 class RenderViewHost; |
| 44 class WebContents; | 48 class WebContents; |
| 45 | 49 |
| 46 class DownloadControllerAndroidImpl : public DownloadControllerAndroid { | 50 class DownloadControllerAndroidImpl : public DownloadControllerAndroid { |
| 47 public: | 51 public: |
| 48 static DownloadControllerAndroidImpl* GetInstance(); | 52 static DownloadControllerAndroidImpl* GetInstance(); |
| 49 | 53 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 87 |
| 84 WebContents* web_contents; | 88 WebContents* web_contents; |
| 85 // Default copy constructor is used for passing this struct by value. | 89 // Default copy constructor is used for passing this struct by value. |
| 86 }; | 90 }; |
| 87 struct JavaObject; | 91 struct JavaObject; |
| 88 friend struct base::DefaultSingletonTraits<DownloadControllerAndroidImpl>; | 92 friend struct base::DefaultSingletonTraits<DownloadControllerAndroidImpl>; |
| 89 DownloadControllerAndroidImpl(); | 93 DownloadControllerAndroidImpl(); |
| 90 ~DownloadControllerAndroidImpl() override; | 94 ~DownloadControllerAndroidImpl() override; |
| 91 | 95 |
| 92 // Helper method for implementing AcquireFileAccessPermission(). | 96 // Helper method for implementing AcquireFileAccessPermission(). |
| 93 bool HasFileAccessPermission( | 97 bool HasFileAccessPermission(ui::WindowAndroid* window_android); |
| 94 base::android::ScopedJavaLocalRef<jobject> j_content_view_core); | |
| 95 | 98 |
| 96 // DownloadControllerAndroid implementation. | 99 // DownloadControllerAndroid implementation. |
| 97 void CreateGETDownload(int render_process_id, | 100 void CreateGETDownload(int render_process_id, |
| 98 int render_view_id, | 101 int render_view_id, |
| 99 int request_id, | 102 int request_id, |
| 100 bool must_download) override; | 103 bool must_download) override; |
| 101 void OnDownloadStarted(DownloadItem* download_item) override; | 104 void OnDownloadStarted(DownloadItem* download_item) override; |
| 102 void StartContextMenuDownload(const ContextMenuParams& params, | 105 void StartContextMenuDownload(const ContextMenuParams& params, |
| 103 WebContents* web_contents, | 106 WebContents* web_contents, |
| 104 bool is_link, | 107 bool is_link, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 std::string default_file_name_; | 153 std::string default_file_name_; |
| 151 | 154 |
| 152 ScopedVector<DeferredDownloadObserver> deferred_downloads_; | 155 ScopedVector<DeferredDownloadObserver> deferred_downloads_; |
| 153 | 156 |
| 154 DISALLOW_COPY_AND_ASSIGN(DownloadControllerAndroidImpl); | 157 DISALLOW_COPY_AND_ASSIGN(DownloadControllerAndroidImpl); |
| 155 }; | 158 }; |
| 156 | 159 |
| 157 } // namespace content | 160 } // namespace content |
| 158 | 161 |
| 159 #endif // CONTENT_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_IMPL_H_ | 162 #endif // CONTENT_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_IMPL_H_ |
| OLD | NEW |