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 <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/supports_user_data.h" | 15 #include "base/supports_user_data.h" |
16 #include "content/browser/appcache/appcache_entry.h" | 16 #include "content/browser/appcache/appcache_entry.h" |
17 #include "content/browser/appcache/appcache_host.h" | 17 #include "content/browser/appcache/appcache_host.h" |
18 #include "content/browser/appcache/appcache_service_impl.h" | 18 #include "content/browser/appcache/appcache_service_impl.h" |
19 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
20 #include "content/common/url_loader_factory.mojom.h" | |
20 #include "content/public/common/resource_type.h" | 21 #include "content/public/common/resource_type.h" |
21 | 22 |
22 namespace net { | 23 namespace net { |
23 class NetworkDelegate; | 24 class NetworkDelegate; |
24 class URLRequest; | 25 class URLRequest; |
25 } // namespace net | 26 } // namespace net |
26 | 27 |
27 namespace content { | 28 namespace content { |
28 class AppCacheJob; | 29 class AppCacheJob; |
30 class AppCacheNavigationHandleCore; | |
29 class AppCacheRequest; | 31 class AppCacheRequest; |
30 class AppCacheRequestHandlerTest; | 32 class AppCacheRequestHandlerTest; |
31 class AppCacheURLRequestJob; | 33 class AppCacheURLRequestJob; |
34 class ResourceContext; | |
32 | 35 |
33 // An instance is created for each net::URLRequest. The instance survives all | 36 // An instance is created for each net::URLRequest. The instance survives all |
34 // http transactions involved in the processing of its net::URLRequest, and is | 37 // http transactions involved in the processing of its net::URLRequest, and is |
35 // given the opportunity to hijack the request along the way. Callers | 38 // given the opportunity to hijack the request along the way. Callers |
36 // should use AppCacheHost::CreateRequestHandler to manufacture instances | 39 // should use AppCacheHost::CreateRequestHandler to manufacture instances |
37 // that can retrieve resources for a particular host. | 40 // that can retrieve resources for a particular host. |
38 class CONTENT_EXPORT AppCacheRequestHandler | 41 class CONTENT_EXPORT AppCacheRequestHandler |
39 : public base::SupportsUserData::Data, | 42 : public base::SupportsUserData::Data, |
40 public AppCacheHost::Observer, | 43 public AppCacheHost::Observer, |
41 public AppCacheServiceImpl::Observer, | 44 public AppCacheServiceImpl::Observer, |
(...skipping 20 matching lines...) Expand all Loading... | |
62 // of cross site transfer navigations. | 65 // of cross site transfer navigations. |
63 bool SanityCheckIsSameService(AppCacheService* service) { | 66 bool SanityCheckIsSameService(AppCacheService* service) { |
64 return !host_ || (host_->service() == service); | 67 return !host_ || (host_->service() == service); |
65 } | 68 } |
66 | 69 |
67 static bool IsMainResourceType(ResourceType type) { | 70 static bool IsMainResourceType(ResourceType type) { |
68 return IsResourceTypeFrame(type) || | 71 return IsResourceTypeFrame(type) || |
69 type == RESOURCE_TYPE_SHARED_WORKER; | 72 type == RESOURCE_TYPE_SHARED_WORKER; |
70 } | 73 } |
71 | 74 |
75 // PlzNavigate and --enable-network-service. | |
76 // Same as InitializeForNavigation() but instead of attaching to a URLRequest, | |
kinuko
2017/05/11 02:14:14
nit: Incomplete sentence
ananta
2017/05/11 02:30:24
Done.
| |
77 static void InitializeForNavigationNetworkService( | |
78 std::unique_ptr<ResourceRequest> resource_request, | |
79 ResourceContext* resource_context, | |
80 AppCacheNavigationHandleCore* navigation_handle_core, | |
81 ResourceType resource_type, | |
82 base::Callback<void(mojom::URLLoaderFactoryPtrInfo, | |
83 std::unique_ptr<ResourceRequest>)> callback); | |
84 | |
72 private: | 85 private: |
73 friend class AppCacheHost; | 86 friend class AppCacheHost; |
74 | 87 |
75 // Callers should use AppCacheHost::CreateRequestHandler. | 88 // Callers should use AppCacheHost::CreateRequestHandler. |
76 AppCacheRequestHandler(AppCacheHost* host, | 89 AppCacheRequestHandler(AppCacheHost* host, |
77 ResourceType resource_type, | 90 ResourceType resource_type, |
78 bool should_reset_appcache, | 91 bool should_reset_appcache, |
79 std::unique_ptr<AppCacheRequest> request); | 92 std::unique_ptr<AppCacheRequest> request); |
80 | 93 |
81 // AppCacheHost::Observer override | 94 // AppCacheHost::Observer override |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 | 208 |
196 std::unique_ptr<AppCacheRequest> request_; | 209 std::unique_ptr<AppCacheRequest> request_; |
197 | 210 |
198 friend class content::AppCacheRequestHandlerTest; | 211 friend class content::AppCacheRequestHandlerTest; |
199 DISALLOW_COPY_AND_ASSIGN(AppCacheRequestHandler); | 212 DISALLOW_COPY_AND_ASSIGN(AppCacheRequestHandler); |
200 }; | 213 }; |
201 | 214 |
202 } // namespace content | 215 } // namespace content |
203 | 216 |
204 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ | 217 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ |
OLD | NEW |