Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_ANDROID_DOWNLOAD_INTERCEPT_DOWNLOAD_RESOURCE_THROTTLE_H_ | |
| 6 #define CHROME_BROWSER_ANDROID_DOWNLOAD_INTERCEPT_DOWNLOAD_RESOURCE_THROTTLE_H_ | |
| 7 | |
| 8 #include "base/memory/weak_ptr.h" | |
| 9 #include "chrome/browser/android/download/download_controller_base.h" | |
| 10 #include "content/public/browser/resource_request_info.h" | |
| 11 #include "content/public/browser/resource_throttle.h" | |
| 12 #include "net/cookies/cookie_store.h" | |
| 13 | |
| 14 namespace net { | |
| 15 class URLRequest; | |
| 16 } | |
| 17 | |
| 18 // InterceptDownloadResourceThrottle checks if a download request should be | |
| 19 // handled by Chrome or passsed to the Android Download Manager. | |
| 20 class InterceptDownloadResourceThrottle : public content::ResourceThrottle { | |
| 21 public: | |
| 22 InterceptDownloadResourceThrottle( | |
| 23 net::URLRequest* request, | |
| 24 const content::ResourceRequestInfo::WebContentsGetter& wc_getter); | |
| 25 ~InterceptDownloadResourceThrottle() override; | |
| 26 | |
| 27 // content::ResourceThrottle implementation: | |
| 28 void WillProcessResponse(bool* defer) override; | |
| 29 const char* GetNameForLogging() const override; | |
| 30 | |
| 31 private: | |
| 32 void CheckCookiePolicy(const net::CookieList& cookie_list); | |
| 33 void StartDownload(const DownloadInfo& info); | |
| 34 | |
| 35 // Set to true when if we want chrome to handle the download. | |
|
David Trainor- moved to gerrit
2017/01/27 17:16:47
What is set to true?
qinmin
2017/01/27 21:29:54
removed
| |
| 36 const net::URLRequest* request_; | |
| 37 content::ResourceRequestInfo::WebContentsGetter wc_getter_; | |
| 38 | |
| 39 base::WeakPtrFactory<InterceptDownloadResourceThrottle> weak_factory_; | |
| 40 DISALLOW_COPY_AND_ASSIGN(InterceptDownloadResourceThrottle); | |
| 41 }; | |
| 42 | |
| 43 #endif // CHROME_BROWSER_ANDROID_DOWNLOAD_INTERCEPT_DOWNLOAD_RESOURCE_THROTTLE_ H_ | |
| OLD | NEW |