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

Unified Diff: chrome/browser/android/offline_pages/downloads/resource_throttle.h

Issue 2528483003: [Android Downloads] Long-press menu item "Download Link" should delegate job to OfflinePages backen… (Closed)
Patch Set: git merge resolved Created 4 years 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
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/android/offline_pages/downloads/resource_throttle.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/offline_pages/downloads/resource_throttle.h
diff --git a/chrome/browser/android/offline_pages/downloads/resource_throttle.h b/chrome/browser/android/offline_pages/downloads/resource_throttle.h
new file mode 100644
index 0000000000000000000000000000000000000000..3bf5fd5041c121be907279e47b21c455088437a6
--- /dev/null
+++ b/chrome/browser/android/offline_pages/downloads/resource_throttle.h
@@ -0,0 +1,38 @@
+// Copyright 2016 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_OFFLINE_PAGES_DOWNLOADS_RESOURCE_THROTTLE_H_
+#define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_DOWNLOADS_RESOURCE_THROTTLE_H_
+
+#include "content/public/browser/resource_throttle.h"
+#include "net/url_request/url_request.h"
+
+namespace offline_pages {
+namespace downloads {
+
+// This ResourceThrottle is used to hook up into the loading process at the
+// moment when headers are available (WillProcessResponse) to determine if the
+// download has text/html mime type and should be canceled as a download and
+// re-scheduled as a OfflinePage download request. This will be handled by
+// Offline Page backend as a full page download rather than a single .html
+// file download.
+class ResourceThrottle : public content::ResourceThrottle {
+ public:
+ explicit ResourceThrottle(const net::URLRequest* request);
+ ~ResourceThrottle() override;
+
+ // content::ResourceThrottle implementation:
+ void WillProcessResponse(bool* defer) override;
+ const char* GetNameForLogging() const override;
+
+ private:
+ const net::URLRequest* request_;
+
+ DISALLOW_COPY_AND_ASSIGN(ResourceThrottle);
+};
+
+} // namespace downloads
+} // namespace offline_pages
+
+#endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_DOWNLOADS_RESOURCE_THROTTLE_H_
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/android/offline_pages/downloads/resource_throttle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698