Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: chrome/browser/android/download/download_controller.h

Issue 2371773003: Clean up Android DownloadManager code as most download now go through Chrome Network stack (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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(
80 const content::ResourceRequestInfo::WebContentsGetter& wc_getter,
81 bool must_download,
82 const DownloadInfo& info) override;
83 void OnDownloadStarted(content::DownloadItem* download_item) override; 79 void OnDownloadStarted(content::DownloadItem* download_item) override;
84 void StartContextMenuDownload(const content::ContextMenuParams& params, 80 void StartContextMenuDownload(const content::ContextMenuParams& params,
85 content::WebContents* web_contents, 81 content::WebContents* web_contents,
86 bool is_link, 82 bool is_link,
87 const std::string& extra_headers) override; 83 const std::string& extra_headers) override;
88 void DangerousDownloadValidated(content::WebContents* web_contents, 84 void DangerousDownloadValidated(content::WebContents* web_contents,
89 const std::string& download_guid, 85 const std::string& download_guid,
90 bool accept) override; 86 bool accept) override;
91 87
92 // DownloadItem::Observer interface. 88 // DownloadItem::Observer interface.
93 void OnDownloadUpdated(content::DownloadItem* item) override; 89 void OnDownloadUpdated(content::DownloadItem* item) override;
94 90
95 void StartAndroidDownload(
96 const content::ResourceRequestInfo::WebContentsGetter& wc_getter,
97 bool must_download,
98 const DownloadInfo& info);
99 void StartAndroidDownloadInternal(
100 const content::ResourceRequestInfo::WebContentsGetter& wc_getter,
101 bool must_download,
102 const DownloadInfo& info,
103 bool allowed);
104
105 // The download item contains dangerous file types. 91 // The download item contains dangerous file types.
106 void OnDangerousDownload(content::DownloadItem *item); 92 void OnDangerousDownload(content::DownloadItem *item);
107 93
108 base::android::ScopedJavaLocalRef<jobject> GetContentViewCoreFromWebContents( 94 base::android::ScopedJavaLocalRef<jobject> GetContentViewCoreFromWebContents(
109 content::WebContents* web_contents); 95 content::WebContents* web_contents);
110 96
111 // Creates Java object if it is not created already and returns it. 97 // Creates Java object if it is not created already and returns it.
112 JavaObject* GetJavaObject(); 98 JavaObject* GetJavaObject();
113 99
114 JavaObject* java_object_; 100 JavaObject* java_object_;
115 101
116 std::string default_file_name_; 102 std::string default_file_name_;
117 103
118 DISALLOW_COPY_AND_ASSIGN(DownloadController); 104 DISALLOW_COPY_AND_ASSIGN(DownloadController);
119 }; 105 };
120 106
121 #endif // CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_CONTROLLER_H_ 107 #endif // CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698