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

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

Issue 2341643008: Defaulting all downloads to go through Chrome network stack (Closed)
Patch Set: remove extern Created 4 years, 3 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_ANDROID_INTERCEPT_DOWNLOAD_RESOURCE_THROTTLE_H_
6 #define CHROME_BROWSER_ANDROID_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_throttle.h"
11 #include "net/cookies/cookie_store.h"
12
13 namespace net {
14 class URLRequest;
15 }
16
17 namespace chrome {
18
19 // InterceptDownloadResourceThrottle checks if a download request should be
20 // handled by Chrome or passsed to the Android Download Manager.
21 class InterceptDownloadResourceThrottle : public content::ResourceThrottle {
22 public:
23 static bool IsDownloadInterceptionEnabled();
24
25 InterceptDownloadResourceThrottle(net::URLRequest* request,
26 int render_process_id,
27 int render_view_id,
28 bool must_download);
29
30 // content::ResourceThrottle implementation:
31 void WillProcessResponse(bool* defer) override;
32 const char* GetNameForLogging() const override;
33
34 private:
35 ~InterceptDownloadResourceThrottle() override;
36
37 void ProcessDownloadRequest(bool* defer);
38 void CheckCookiePolicy(const net::CookieList& cookie_list);
39 void StartDownload(const DownloadInfo& info);
40
41 // Set to true when if we want chrome to handle the download.
42 const net::URLRequest* request_;
43 int render_process_id_;
44 int render_view_id_;
45 bool must_download_;
46
47 base::WeakPtrFactory<InterceptDownloadResourceThrottle> weak_factory_;
48 DISALLOW_COPY_AND_ASSIGN(InterceptDownloadResourceThrottle);
49 };
50
51 } // namespace chrome
52
53 #endif // CHROME_BROWSER_ANDROID_INTERCEPT_DOWNLOAD_RESOURCE_THROTTLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698