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

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

Issue 1854523002: If a download is initiated by download attribute, don't use stream viewer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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/compiler_specific.h"
9 #include "base/macros.h" 9 #include "base/macros.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 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); 27 int request_id,
28 bool must_download);
28 29
29 // content::ResourceThrottle implementation: 30 // content::ResourceThrottle implementation:
30 void WillProcessResponse(bool* defer) override; 31 void WillProcessResponse(bool* defer) override;
31 const char* GetNameForLogging() const override; 32 const char* GetNameForLogging() const override;
32 33
33 private: 34 private:
34 ~InterceptDownloadResourceThrottle() override; 35 ~InterceptDownloadResourceThrottle() override;
35 36
36 void ProcessDownloadRequest(); 37 void ProcessDownloadRequest();
37 // Set to true when if we want chrome to handle the download. 38 // Set to true when if we want chrome to handle the download.
38 const net::URLRequest* request_; 39 const net::URLRequest* request_;
39 int render_process_id_; 40 int render_process_id_;
40 int render_view_id_; 41 int render_view_id_;
41 int request_id_; 42 int request_id_;
43 bool must_download_;
42 44
43 DISALLOW_COPY_AND_ASSIGN(InterceptDownloadResourceThrottle); 45 DISALLOW_COPY_AND_ASSIGN(InterceptDownloadResourceThrottle);
44 }; 46 };
45 47
46 } // namespace chrome 48 } // namespace chrome
47 49
48 #endif // CHROME_BROWSER_ANDROID_INTERCEPT_DOWNLOAD_RESOURCE_THROTTLE_H_ 50 #endif // CHROME_BROWSER_ANDROID_INTERCEPT_DOWNLOAD_RESOURCE_THROTTLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698