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

Unified Diff: chrome/browser/android/download/intercept_download_resource_throttle.h

Issue 2642683005: reintroduce InterceptDownloadResourceThrottle for some OMA DRM downloads (Closed)
Patch Set: rename CreateGetDownload to CreateAndroidDownload Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/download/intercept_download_resource_throttle.h
diff --git a/chrome/browser/android/download/intercept_download_resource_throttle.h b/chrome/browser/android/download/intercept_download_resource_throttle.h
new file mode 100644
index 0000000000000000000000000000000000000000..c47ba1c8b4fcfdbc7954ba82d48a3f3b0ec66689
--- /dev/null
+++ b/chrome/browser/android/download/intercept_download_resource_throttle.h
@@ -0,0 +1,43 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_ANDROID_DOWNLOAD_INTERCEPT_DOWNLOAD_RESOURCE_THROTTLE_H_
+#define CHROME_BROWSER_ANDROID_DOWNLOAD_INTERCEPT_DOWNLOAD_RESOURCE_THROTTLE_H_
+
+#include "base/memory/weak_ptr.h"
+#include "chrome/browser/android/download/download_controller_base.h"
+#include "content/public/browser/resource_request_info.h"
+#include "content/public/browser/resource_throttle.h"
+#include "net/cookies/cookie_store.h"
+
+namespace net {
+class URLRequest;
+}
+
+// InterceptDownloadResourceThrottle checks if a download request should be
+// handled by Chrome or passsed to the Android Download Manager.
+class InterceptDownloadResourceThrottle : public content::ResourceThrottle {
+ public:
+ InterceptDownloadResourceThrottle(
+ net::URLRequest* request,
+ const content::ResourceRequestInfo::WebContentsGetter& wc_getter);
+ ~InterceptDownloadResourceThrottle() override;
+
+ // content::ResourceThrottle implementation:
+ void WillProcessResponse(bool* defer) override;
+ const char* GetNameForLogging() const override;
+
+ private:
+ void CheckCookiePolicy(const net::CookieList& cookie_list);
+ void StartDownload(const DownloadInfo& info);
+
+ // 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
+ const net::URLRequest* request_;
+ content::ResourceRequestInfo::WebContentsGetter wc_getter_;
+
+ base::WeakPtrFactory<InterceptDownloadResourceThrottle> weak_factory_;
+ DISALLOW_COPY_AND_ASSIGN(InterceptDownloadResourceThrottle);
+};
+
+#endif // CHROME_BROWSER_ANDROID_DOWNLOAD_INTERCEPT_DOWNLOAD_RESOURCE_THROTTLE_H_

Powered by Google App Engine
This is Rietveld 408576698