OLD | NEW |
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/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "content/public/browser/resource_throttle.h" | 10 #include "content/public/browser/resource_throttle.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 InterceptDownloadResourceThrottle(net::URLRequest* request, | 22 InterceptDownloadResourceThrottle(net::URLRequest* request, |
23 int render_process_id, | 23 int render_process_id, |
24 int render_view_id, | 24 int render_view_id, |
25 int request_id); | 25 int request_id); |
26 | 26 |
27 // content::ResourceThrottle implementation: | 27 // content::ResourceThrottle implementation: |
28 virtual void WillProcessResponse(bool* defer) override; | 28 void WillProcessResponse(bool* defer) override; |
29 virtual const char* GetNameForLogging() const override; | 29 const char* GetNameForLogging() const override; |
30 | 30 |
31 private: | 31 private: |
32 virtual ~InterceptDownloadResourceThrottle(); | 32 ~InterceptDownloadResourceThrottle() override; |
33 | 33 |
34 void ProcessDownloadRequest(); | 34 void ProcessDownloadRequest(); |
35 // Set to true when if we want chrome to handle the download. | 35 // Set to true when if we want chrome to handle the download. |
36 const net::URLRequest* request_; | 36 const net::URLRequest* request_; |
37 int render_process_id_; | 37 int render_process_id_; |
38 int render_view_id_; | 38 int render_view_id_; |
39 int request_id_; | 39 int request_id_; |
40 | 40 |
41 DISALLOW_COPY_AND_ASSIGN(InterceptDownloadResourceThrottle); | 41 DISALLOW_COPY_AND_ASSIGN(InterceptDownloadResourceThrottle); |
42 }; | 42 }; |
43 | 43 |
44 } // namespace chrome | 44 } // namespace chrome |
45 | 45 |
46 #endif // CHROME_BROWSER_ANDROID_INTERCEPT_DOWNLOAD_RESOURCE_THROTTLE_H_ | 46 #endif // CHROME_BROWSER_ANDROID_INTERCEPT_DOWNLOAD_RESOURCE_THROTTLE_H_ |
OLD | NEW |