OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 private: | 69 private: |
70 struct JavaObject; | 70 struct JavaObject; |
71 friend struct base::DefaultSingletonTraits<DownloadController>; | 71 friend struct base::DefaultSingletonTraits<DownloadController>; |
72 DownloadController(); | 72 DownloadController(); |
73 ~DownloadController() override; | 73 ~DownloadController() override; |
74 | 74 |
75 // Helper method for implementing AcquireFileAccessPermission(). | 75 // Helper method for implementing AcquireFileAccessPermission(). |
76 bool HasFileAccessPermission(ui::WindowAndroid* window_android); | 76 bool HasFileAccessPermission(ui::WindowAndroid* window_android); |
77 | 77 |
78 // DownloadControllerBase implementation. | 78 // DownloadControllerBase implementation. |
79 void CreateGETDownload(int render_process_id, | 79 void CreateGETDownload( |
80 int render_view_id, | 80 const content::ResourceRequestInfo::WebContentsGetter& wc_getter, |
81 bool must_download, | 81 bool must_download, |
82 const DownloadInfo& info) override; | 82 const DownloadInfo& info) override; |
83 void OnDownloadStarted(content::DownloadItem* download_item) override; | 83 void OnDownloadStarted(content::DownloadItem* download_item) override; |
84 void StartContextMenuDownload(const content::ContextMenuParams& params, | 84 void StartContextMenuDownload(const content::ContextMenuParams& params, |
85 content::WebContents* web_contents, | 85 content::WebContents* web_contents, |
86 bool is_link, | 86 bool is_link, |
87 const std::string& extra_headers) override; | 87 const std::string& extra_headers) override; |
88 void DangerousDownloadValidated(content::WebContents* web_contents, | 88 void DangerousDownloadValidated(content::WebContents* web_contents, |
89 const std::string& download_guid, | 89 const std::string& download_guid, |
90 bool accept) override; | 90 bool accept) override; |
91 | 91 |
92 // DownloadItem::Observer interface. | 92 // DownloadItem::Observer interface. |
93 void OnDownloadUpdated(content::DownloadItem* item) override; | 93 void OnDownloadUpdated(content::DownloadItem* item) override; |
94 | 94 |
95 void StartAndroidDownload(int render_process_id, | 95 void StartAndroidDownload( |
96 int render_view_id, | 96 const content::ResourceRequestInfo::WebContentsGetter& wc_getter, |
97 bool must_download, | 97 bool must_download, |
98 const DownloadInfo& info); | 98 const DownloadInfo& info); |
99 void StartAndroidDownloadInternal(int render_process_id, | 99 void StartAndroidDownloadInternal( |
100 int render_view_id, | 100 const content::ResourceRequestInfo::WebContentsGetter& wc_getter, |
101 bool must_download, | 101 bool must_download, |
102 const DownloadInfo& info, | 102 const DownloadInfo& info, |
103 bool allowed); | 103 bool allowed); |
104 | 104 |
105 // The download item contains dangerous file types. | 105 // The download item contains dangerous file types. |
106 void OnDangerousDownload(content::DownloadItem *item); | 106 void OnDangerousDownload(content::DownloadItem *item); |
107 | 107 |
108 base::android::ScopedJavaLocalRef<jobject> GetContentViewCoreFromWebContents( | 108 base::android::ScopedJavaLocalRef<jobject> GetContentViewCoreFromWebContents( |
109 content::WebContents* web_contents); | 109 content::WebContents* web_contents); |
110 | 110 |
111 // Creates Java object if it is not created already and returns it. | 111 // Creates Java object if it is not created already and returns it. |
112 JavaObject* GetJavaObject(); | 112 JavaObject* GetJavaObject(); |
113 | 113 |
114 JavaObject* java_object_; | 114 JavaObject* java_object_; |
115 | 115 |
116 std::string default_file_name_; | 116 std::string default_file_name_; |
117 | 117 |
118 DISALLOW_COPY_AND_ASSIGN(DownloadController); | 118 DISALLOW_COPY_AND_ASSIGN(DownloadController); |
119 }; | 119 }; |
120 | 120 |
121 #endif // CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_CONTROLLER_H_ | 121 #endif // CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_CONTROLLER_H_ |
OLD | NEW |