| 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 class ResourceRequesterInfo; |
| 25 | 25 |
| 26 // An interceptor to hijack requests and potentially service them out of | 26 // An interceptor to hijack requests and potentially service them out of |
| 27 // the appcache. | 27 // the appcache. |
| 28 class CONTENT_EXPORT AppCacheInterceptor : public net::URLRequestInterceptor { | 28 class CONTENT_EXPORT AppCacheInterceptor : public net::URLRequestInterceptor { |
| 29 public: | 29 public: |
| 30 // 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. |
| 31 static void SetExtraRequestInfo(net::URLRequest* request, | 31 static void SetExtraRequestInfo(net::URLRequest* request, |
| 32 AppCacheServiceImpl* service, | 32 AppCacheServiceImpl* service, |
| 33 int process_id, | 33 int process_id, |
| 34 int host_id, | 34 int host_id, |
| 35 ResourceType resource_type, | 35 ResourceType resource_type, |
| 36 bool should_reset_appcache); | 36 bool should_reset_appcache); |
| 37 | 37 |
| 38 // May be called after response headers are complete to retrieve extra | 38 // May be called after response headers are complete to retrieve extra |
| 39 // info about the response. | 39 // info about the response. |
| 40 static void GetExtraResponseInfo(net::URLRequest* request, | 40 static void GetExtraResponseInfo(net::URLRequest* request, |
| 41 int64_t* cache_id, | 41 int64_t* cache_id, |
| 42 GURL* manifest_url); | 42 GURL* manifest_url); |
| 43 | 43 |
| 44 // Methods to support cross site navigations. | 44 // Methods to support cross site navigations. |
| 45 static void PrepareForCrossSiteTransfer(net::URLRequest* request, | 45 static void PrepareForCrossSiteTransfer(net::URLRequest* request, |
| 46 int old_process_id); | 46 int old_process_id); |
| 47 static void CompleteCrossSiteTransfer(net::URLRequest* request, | 47 static void CompleteCrossSiteTransfer( |
| 48 int new_process_id, | 48 net::URLRequest* request, |
| 49 int new_host_id, | 49 int new_process_id, |
| 50 ResourceMessageFilter* filter); | 50 int new_host_id, |
| 51 const ResourceRequesterInfo* requester_info); |
| 51 static void MaybeCompleteCrossSiteTransferInOldProcess( | 52 static void MaybeCompleteCrossSiteTransferInOldProcess( |
| 52 net::URLRequest* request, | 53 net::URLRequest* request, |
| 53 int old_process_id); | 54 int old_process_id); |
| 54 | 55 |
| 55 AppCacheInterceptor(); | 56 AppCacheInterceptor(); |
| 56 ~AppCacheInterceptor() override; | 57 ~AppCacheInterceptor() override; |
| 57 | 58 |
| 58 protected: | 59 protected: |
| 59 // Override from net::URLRequestInterceptor: | 60 // Override from net::URLRequestInterceptor: |
| 60 net::URLRequestJob* MaybeInterceptRequest( | 61 net::URLRequestJob* MaybeInterceptRequest( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 72 static void SetHandler(net::URLRequest* request, | 73 static void SetHandler(net::URLRequest* request, |
| 73 AppCacheRequestHandler* handler); | 74 AppCacheRequestHandler* handler); |
| 74 static AppCacheRequestHandler* GetHandler(net::URLRequest* request); | 75 static AppCacheRequestHandler* GetHandler(net::URLRequest* request); |
| 75 | 76 |
| 76 DISALLOW_COPY_AND_ASSIGN(AppCacheInterceptor); | 77 DISALLOW_COPY_AND_ASSIGN(AppCacheInterceptor); |
| 77 }; | 78 }; |
| 78 | 79 |
| 79 } // namespace content | 80 } // namespace content |
| 80 | 81 |
| 81 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_INTERCEPTOR_H_ | 82 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_INTERCEPTOR_H_ |
| OLD | NEW |