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

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: fix failing tests/bugs 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 "base/memory/weak_ptr.h"
9 #include "base/macros.h" 9 #include "chrome/browser/android/download/download_controller_base.h"
10 #include "content/public/browser/resource_throttle.h" 10 #include "content/public/browser/resource_throttle.h"
11 #include "net/cookies/cookie_store.h"
11 12
12 namespace net { 13 namespace net {
13 class URLRequest; 14 class URLRequest;
14 } 15 }
15 16
16 namespace chrome { 17 namespace chrome {
17 18
18 // InterceptDownloadResourceThrottle checks if a download request should be 19 // InterceptDownloadResourceThrottle checks if a download request should be
19 // handled by Chrome or passsed to the Android Download Manager. 20 // handled by Chrome or passsed to the Android Download Manager.
20 class InterceptDownloadResourceThrottle : public content::ResourceThrottle { 21 class InterceptDownloadResourceThrottle : public content::ResourceThrottle {
21 public: 22 public:
22 static bool IsDownloadInterceptionEnabled(); 23 static bool IsDownloadInterceptionEnabled();
23 24
24 InterceptDownloadResourceThrottle(net::URLRequest* request, 25 InterceptDownloadResourceThrottle(net::URLRequest* request,
25 int render_process_id, 26 int render_process_id,
26 int render_view_id, 27 int render_view_id,
27 int request_id,
28 bool must_download); 28 bool must_download);
29 29
30 // content::ResourceThrottle implementation: 30 // content::ResourceThrottle implementation:
31 void WillProcessResponse(bool* defer) override; 31 void WillProcessResponse(bool* defer) override;
32 const char* GetNameForLogging() const override; 32 const char* GetNameForLogging() const override;
33 33
34 private: 34 private:
35 ~InterceptDownloadResourceThrottle() override; 35 ~InterceptDownloadResourceThrottle() override;
36 36
37 void ProcessDownloadRequest(); 37 void ProcessDownloadRequest(bool* defer);
38 void CheckCookiePolicy(const net::CookieList& cookie_list);
39 void StartDownload(const DownloadInfo& info);
40
38 // Set to true when if we want chrome to handle the download. 41 // Set to true when if we want chrome to handle the download.
39 const net::URLRequest* request_; 42 const net::URLRequest* request_;
40 int render_process_id_; 43 int render_process_id_;
41 int render_view_id_; 44 int render_view_id_;
42 int request_id_;
43 bool must_download_; 45 bool must_download_;
44 46
47 base::WeakPtrFactory<InterceptDownloadResourceThrottle> weak_factory_;
45 DISALLOW_COPY_AND_ASSIGN(InterceptDownloadResourceThrottle); 48 DISALLOW_COPY_AND_ASSIGN(InterceptDownloadResourceThrottle);
46 }; 49 };
47 50
48 } // namespace chrome 51 } // namespace chrome
49 52
50 #endif // CHROME_BROWSER_ANDROID_INTERCEPT_DOWNLOAD_RESOURCE_THROTTLE_H_ 53 #endif // CHROME_BROWSER_ANDROID_INTERCEPT_DOWNLOAD_RESOURCE_THROTTLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698