OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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_OFFLINE_PAGES_DOWNLOADS_RESOURCE_THROTTLE_H_ |
| 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_DOWNLOADS_RESOURCE_THROTTLE_H_ |
| 7 |
| 8 #include "content/public/browser/resource_throttle.h" |
| 9 #include "net/url_request/url_request.h" |
| 10 |
| 11 namespace offline_pages { |
| 12 namespace downloads { |
| 13 |
| 14 // This ResourceThrottle is used to hook up into the loading process at the |
| 15 // moment when headers are available (WillProcessResponse) to determine if the |
| 16 // download has text/html mime type and should be canceled as a download and |
| 17 // re-scheduled as a OfflinePage download request. This will be handled by |
| 18 // Offline Page backend as a full page download rather than a single .html |
| 19 // file download. |
| 20 class ResourceThrottle : public content::ResourceThrottle { |
| 21 public: |
| 22 explicit ResourceThrottle(const net::URLRequest* request); |
| 23 ~ResourceThrottle() override; |
| 24 |
| 25 // content::ResourceThrottle implementation: |
| 26 void WillProcessResponse(bool* defer) override; |
| 27 const char* GetNameForLogging() const override; |
| 28 |
| 29 private: |
| 30 const net::URLRequest* request_; |
| 31 |
| 32 DISALLOW_COPY_AND_ASSIGN(ResourceThrottle); |
| 33 }; |
| 34 |
| 35 } // namespace downloads |
| 36 } // namespace offline_pages |
| 37 |
| 38 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_DOWNLOADS_RESOURCE_THROTTLE_H_ |
OLD | NEW |