OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_BROWSER_APPCACHE_APPCACHE_INTERCEPTOR_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_INTERCEPTOR_H_ |
6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_INTERCEPTOR_H_ | 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_INTERCEPTOR_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 #include "content/public/common/resource_type.h" | 12 #include "content/public/common/resource_type.h" |
13 #include "net/url_request/url_request_interceptor.h" | 13 #include "net/url_request/url_request_interceptor.h" |
14 | 14 |
15 class GURL; | 15 class GURL; |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 class URLRequest; | 18 class URLRequest; |
19 } | 19 } |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 class AppCacheRequestHandler; | 22 class AppCacheRequestHandler; |
23 class AppCacheServiceImpl; | 23 class AppCacheServiceImpl; |
| 24 class ResourceMessageFilter; |
24 | 25 |
25 // An interceptor to hijack requests and potentially service them out of | 26 // An interceptor to hijack requests and potentially service them out of |
26 // the appcache. | 27 // the appcache. |
27 class CONTENT_EXPORT AppCacheInterceptor : public net::URLRequestInterceptor { | 28 class CONTENT_EXPORT AppCacheInterceptor : public net::URLRequestInterceptor { |
28 public: | 29 public: |
29 // Must be called to make a request eligible for retrieval from an appcache. | 30 // Must be called to make a request eligible for retrieval from an appcache. |
30 static void SetExtraRequestInfo(net::URLRequest* request, | 31 static void SetExtraRequestInfo(net::URLRequest* request, |
31 AppCacheServiceImpl* service, | 32 AppCacheServiceImpl* service, |
32 int process_id, | 33 int process_id, |
33 int host_id, | 34 int host_id, |
34 ResourceType resource_type, | 35 ResourceType resource_type, |
35 bool should_reset_appcache); | 36 bool should_reset_appcache); |
36 | 37 |
37 // May be called after response headers are complete to retrieve extra | 38 // May be called after response headers are complete to retrieve extra |
38 // info about the response. | 39 // info about the response. |
39 static void GetExtraResponseInfo(net::URLRequest* request, | 40 static void GetExtraResponseInfo(net::URLRequest* request, |
40 int64_t* cache_id, | 41 int64_t* cache_id, |
41 GURL* manifest_url); | 42 GURL* manifest_url); |
42 | 43 |
43 // Methods to support cross site navigations. | 44 // Methods to support cross site navigations. |
44 static void PrepareForCrossSiteTransfer(net::URLRequest* request, | 45 static void PrepareForCrossSiteTransfer(net::URLRequest* request, |
45 int old_process_id); | 46 int old_process_id); |
46 static void CompleteCrossSiteTransfer(net::URLRequest* request, | 47 static void CompleteCrossSiteTransfer(net::URLRequest* request, |
47 int new_process_id, | 48 int new_process_id, |
48 int new_host_id); | 49 int new_host_id, |
| 50 ResourceMessageFilter* filter); |
49 static void MaybeCompleteCrossSiteTransferInOldProcess( | 51 static void MaybeCompleteCrossSiteTransferInOldProcess( |
50 net::URLRequest* request, | 52 net::URLRequest* request, |
51 int old_process_id); | 53 int old_process_id); |
52 | 54 |
53 AppCacheInterceptor(); | 55 AppCacheInterceptor(); |
54 ~AppCacheInterceptor() override; | 56 ~AppCacheInterceptor() override; |
55 | 57 |
56 protected: | 58 protected: |
57 // Override from net::URLRequestInterceptor: | 59 // Override from net::URLRequestInterceptor: |
58 net::URLRequestJob* MaybeInterceptRequest( | 60 net::URLRequestJob* MaybeInterceptRequest( |
(...skipping 11 matching lines...) Expand all Loading... |
70 static void SetHandler(net::URLRequest* request, | 72 static void SetHandler(net::URLRequest* request, |
71 AppCacheRequestHandler* handler); | 73 AppCacheRequestHandler* handler); |
72 static AppCacheRequestHandler* GetHandler(net::URLRequest* request); | 74 static AppCacheRequestHandler* GetHandler(net::URLRequest* request); |
73 | 75 |
74 DISALLOW_COPY_AND_ASSIGN(AppCacheInterceptor); | 76 DISALLOW_COPY_AND_ASSIGN(AppCacheInterceptor); |
75 }; | 77 }; |
76 | 78 |
77 } // namespace content | 79 } // namespace content |
78 | 80 |
79 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_INTERCEPTOR_H_ | 81 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_INTERCEPTOR_H_ |
OLD | NEW |