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