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

Side by Side Diff: chrome/browser/android/intercept_download_resource_throttle.h

Issue 2014803002: Move DownloadControllerAndroid from content/ to chrome/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: resolved race condition Created 4 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_ANDROID_INTERCEPT_DOWNLOAD_RESOURCE_THROTTLE_H_ 5 #ifndef CHROME_BROWSER_ANDROID_INTERCEPT_DOWNLOAD_RESOURCE_THROTTLE_H_
6 #define CHROME_BROWSER_ANDROID_INTERCEPT_DOWNLOAD_RESOURCE_THROTTLE_H_ 6 #define CHROME_BROWSER_ANDROID_INTERCEPT_DOWNLOAD_RESOURCE_THROTTLE_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "chrome/browser/android/download/download_controller_base.h"
9 #include "base/macros.h"
10 #include "content/public/browser/resource_throttle.h" 9 #include "content/public/browser/resource_throttle.h"
10 #include "net/cookies/cookie_store.h"
11 11
12 namespace net { 12 namespace net {
13 class URLRequest; 13 class URLRequest;
14 } 14 }
15 15
16 namespace chrome { 16 namespace chrome {
17 17
18 // InterceptDownloadResourceThrottle checks if a download request should be 18 // InterceptDownloadResourceThrottle checks if a download request should be
19 // handled by Chrome or passsed to the Android Download Manager. 19 // handled by Chrome or passsed to the Android Download Manager.
20 class InterceptDownloadResourceThrottle : public content::ResourceThrottle { 20 class InterceptDownloadResourceThrottle : public content::ResourceThrottle {
21 public: 21 public:
22 static bool IsDownloadInterceptionEnabled(); 22 static bool IsDownloadInterceptionEnabled();
23 23
24 InterceptDownloadResourceThrottle(net::URLRequest* request, 24 InterceptDownloadResourceThrottle(net::URLRequest* request,
25 int render_process_id, 25 int render_process_id,
26 int render_view_id, 26 int render_view_id,
27 int request_id,
28 bool must_download); 27 bool must_download);
29 28
30 // content::ResourceThrottle implementation: 29 // content::ResourceThrottle implementation:
31 void WillProcessResponse(bool* defer) override; 30 void WillProcessResponse(bool* defer) override;
32 const char* GetNameForLogging() const override; 31 const char* GetNameForLogging() const override;
33 32
34 private: 33 private:
35 ~InterceptDownloadResourceThrottle() override; 34 ~InterceptDownloadResourceThrottle() override;
36 35
37 void ProcessDownloadRequest(); 36 void ProcessDownloadRequest();
37
38 typedef base::Callback<void(const DownloadInfo&)>
39 StartDownloadCB;
40
41 void CheckCookiePolicy(const DownloadInfo& info,
42 const StartDownloadCB& callback,
43 const net::CookieList& cookie_list);
44 void DoLoadCookies(const DownloadInfo& info,
45 const StartDownloadCB& callback);
46 void OnCookieResponse(DownloadInfo info,
47 const StartDownloadCB& callback,
48 const std::string& cookie);
49 void StartDownload(const DownloadInfo& info);
50
38 // Set to true when if we want chrome to handle the download. 51 // Set to true when if we want chrome to handle the download.
39 const net::URLRequest* request_; 52 const net::URLRequest* request_;
40 int render_process_id_; 53 int render_process_id_;
41 int render_view_id_; 54 int render_view_id_;
42 int request_id_;
43 bool must_download_; 55 bool must_download_;
44 56
45 DISALLOW_COPY_AND_ASSIGN(InterceptDownloadResourceThrottle); 57 DISALLOW_COPY_AND_ASSIGN(InterceptDownloadResourceThrottle);
46 }; 58 };
47 59
48 } // namespace chrome 60 } // namespace chrome
49 61
50 #endif // CHROME_BROWSER_ANDROID_INTERCEPT_DOWNLOAD_RESOURCE_THROTTLE_H_ 62 #endif // CHROME_BROWSER_ANDROID_INTERCEPT_DOWNLOAD_RESOURCE_THROTTLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698