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_OFFLINE_PAGE_REQUEST_INTERCEPTOR_H_ |
| 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_INTERCEPTOR_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "net/url_request/url_request_interceptor.h" |
| 10 |
| 11 namespace net { |
| 12 class NetworkDelegate; |
| 13 class URLRequest; |
| 14 class URLRequestJob; |
| 15 } |
| 16 |
| 17 namespace offline_pages { |
| 18 |
| 19 // An interceptor to hijack requests and potentially service them based on |
| 20 // their offline information. Created one per profile. |
| 21 class OfflinePageRequestInterceptor : public net::URLRequestInterceptor { |
| 22 public: |
| 23 // |profile_id|, which identifies the profile, is passed as a void* to ensure |
| 24 // it's not accidently used on the IO thread. |
| 25 explicit OfflinePageRequestInterceptor(void* profile_id); |
| 26 ~OfflinePageRequestInterceptor() override; |
| 27 |
| 28 private: |
| 29 // Overrides from net::URLRequestInterceptor: |
| 30 net::URLRequestJob* MaybeInterceptRequest( |
| 31 net::URLRequest* request, |
| 32 net::NetworkDelegate* network_delegate) const override; |
| 33 |
| 34 // The profile for processing offline pages. |
| 35 void* const profile_id_; |
| 36 |
| 37 DISALLOW_COPY_AND_ASSIGN(OfflinePageRequestInterceptor); |
| 38 }; |
| 39 |
| 40 } // namespace offline_pages |
| 41 |
| 42 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_INTERCEPTOR_
H_ |
OLD | NEW |