OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_REQUEST_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ |
6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ | 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/supports_user_data.h" | 14 #include "base/supports_user_data.h" |
15 #include "content/browser/appcache/appcache_entry.h" | 15 #include "content/browser/appcache/appcache_entry.h" |
16 #include "content/browser/appcache/appcache_host.h" | 16 #include "content/browser/appcache/appcache_host.h" |
17 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
18 #include "content/public/common/resource_type.h" | 18 #include "content/public/common/resource_type.h" |
19 | 19 |
20 namespace net { | 20 namespace net { |
21 class NetworkDelegate; | 21 class NetworkDelegate; |
22 class URLRequest; | 22 class URLRequest; |
23 class URLRequestJob; | 23 class URLRequestJob; |
24 } // namespace net | 24 } // namespace net |
25 | 25 |
26 namespace content { | 26 namespace content { |
27 class AppCacheRequestHandlerTest; | 27 class AppCacheRequestHandlerTest; |
28 class AppCacheService; | |
28 class AppCacheURLRequestJob; | 29 class AppCacheURLRequestJob; |
29 | 30 |
30 // An instance is created for each net::URLRequest. The instance survives all | 31 // An instance is created for each net::URLRequest. The instance survives all |
31 // http transactions involved in the processing of its net::URLRequest, and is | 32 // http transactions involved in the processing of its net::URLRequest, and is |
32 // given the opportunity to hijack the request along the way. Callers | 33 // given the opportunity to hijack the request along the way. Callers |
33 // should use AppCacheHost::CreateRequestHandler to manufacture instances | 34 // should use AppCacheHost::CreateRequestHandler to manufacture instances |
34 // that can retrieve resources for a particular host. | 35 // that can retrieve resources for a particular host. |
35 class CONTENT_EXPORT AppCacheRequestHandler | 36 class CONTENT_EXPORT AppCacheRequestHandler |
36 : public base::SupportsUserData::Data, | 37 : public base::SupportsUserData::Data, |
37 public AppCacheHost::Observer, | 38 public AppCacheHost::Observer, |
(...skipping 12 matching lines...) Expand all Loading... | |
50 AppCacheURLRequestJob* MaybeLoadFallbackForResponse( | 51 AppCacheURLRequestJob* MaybeLoadFallbackForResponse( |
51 net::URLRequest* request, | 52 net::URLRequest* request, |
52 net::NetworkDelegate* network_delegate); | 53 net::NetworkDelegate* network_delegate); |
53 | 54 |
54 void GetExtraResponseInfo(int64_t* cache_id, GURL* manifest_url); | 55 void GetExtraResponseInfo(int64_t* cache_id, GURL* manifest_url); |
55 | 56 |
56 // Methods to support cross site navigations. | 57 // Methods to support cross site navigations. |
57 void PrepareForCrossSiteTransfer(int old_process_id); | 58 void PrepareForCrossSiteTransfer(int old_process_id); |
58 void CompleteCrossSiteTransfer(int new_process_id, int new_host_id); | 59 void CompleteCrossSiteTransfer(int new_process_id, int new_host_id); |
59 void MaybeCompleteCrossSiteTransferInOldProcess(int old_process_id); | 60 void MaybeCompleteCrossSiteTransferInOldProcess(int old_process_id); |
61 bool SanityCheckIsSameService(AppCacheService* service) { | |
jsbell
2016/01/14 22:52:29
Add brief documentation here, i.e. why anyone woul
| |
62 return !host_ || (host_->service() == service); | |
63 } | |
60 | 64 |
61 static bool IsMainResourceType(ResourceType type) { | 65 static bool IsMainResourceType(ResourceType type) { |
62 return IsResourceTypeFrame(type) || | 66 return IsResourceTypeFrame(type) || |
63 type == RESOURCE_TYPE_SHARED_WORKER; | 67 type == RESOURCE_TYPE_SHARED_WORKER; |
64 } | 68 } |
65 | 69 |
66 private: | 70 private: |
67 friend class AppCacheHost; | 71 friend class AppCacheHost; |
68 | 72 |
69 // Callers should use AppCacheHost::CreateRequestHandler. | 73 // Callers should use AppCacheHost::CreateRequestHandler. |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
183 int cache_id_; | 187 int cache_id_; |
184 GURL manifest_url_; | 188 GURL manifest_url_; |
185 | 189 |
186 friend class content::AppCacheRequestHandlerTest; | 190 friend class content::AppCacheRequestHandlerTest; |
187 DISALLOW_COPY_AND_ASSIGN(AppCacheRequestHandler); | 191 DISALLOW_COPY_AND_ASSIGN(AppCacheRequestHandler); |
188 }; | 192 }; |
189 | 193 |
190 } // namespace content | 194 } // namespace content |
191 | 195 |
192 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ | 196 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ |
OLD | NEW |