[email protected] | 0a60884 | 2011-09-08 10:55:19 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
[email protected] | 97e3edc | 2009-09-15 22:07:15 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | 98d6d456 | 2014-06-25 20:57:55 | [diff] [blame] | 5 | #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ |
| 6 | #define CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ |
[email protected] | 97e3edc | 2009-09-15 22:07:15 | [diff] [blame] | 7 | |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 8 | #include <stdint.h> |
| 9 | |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 10 | #include <memory> |
| 11 | |
[email protected] | bfe1948 | 2011-09-30 22:14:57 | [diff] [blame] | 12 | #include "base/compiler_specific.h" |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 13 | #include "base/macros.h" |
mmenke | 5289cbfd | 2015-10-29 19:36:17 | [diff] [blame] | 14 | #include "base/memory/weak_ptr.h" |
[email protected] | ea8e181 | 2012-02-15 22:07:34 | [diff] [blame] | 15 | #include "base/supports_user_data.h" |
[email protected] | 98d6d456 | 2014-06-25 20:57:55 | [diff] [blame] | 16 | #include "content/browser/appcache/appcache_entry.h" |
| 17 | #include "content/browser/appcache/appcache_host.h" |
Anantanarayanan Iyengar | d125c460 | 2017-08-19 00:46:56 | [diff] [blame] | 18 | #include "content/browser/appcache/appcache_request_handler.h" |
michaeln | b861840 | 2016-08-02 20:14:33 | [diff] [blame] | 19 | #include "content/browser/appcache/appcache_service_impl.h" |
Kinuko Yasuda | 7f3e172 | 2018-03-26 08:58:58 | [diff] [blame] | 20 | #include "content/browser/loader/navigation_loader_interceptor.h" |
[email protected] | 98d6d456 | 2014-06-25 20:57:55 | [diff] [blame] | 21 | #include "content/common/content_export.h" |
[email protected] | 7491ad0 | 2014-07-05 19:10:07 | [diff] [blame] | 22 | #include "content/public/common/resource_type.h" |
Kinuko Yasuda | be4ad29 | 2018-07-06 01:33:39 | [diff] [blame] | 23 | #include "services/network/public/cpp/shared_url_loader_factory.h" |
[email protected] | 97e3edc | 2009-09-15 22:07:15 | [diff] [blame] | 24 | |
[email protected] | edfe7fab | 2010-11-28 13:11:52 | [diff] [blame] | 25 | namespace net { |
[email protected] | 9f17046 | 2012-08-24 01:06:58 | [diff] [blame] | 26 | class NetworkDelegate; |
[email protected] | 97e3edc | 2009-09-15 22:07:15 | [diff] [blame] | 27 | class URLRequest; |
[email protected] | edfe7fab | 2010-11-28 13:11:52 | [diff] [blame] | 28 | } // namespace net |
[email protected] | 97e3edc | 2009-09-15 22:07:15 | [diff] [blame] | 29 | |
John Abd-El-Malek | 4624803 | 2018-01-17 19:11:23 | [diff] [blame] | 30 | namespace network { |
| 31 | struct ResourceResponseHead; |
| 32 | } |
| 33 | |
[email protected] | 073f24d | 2014-04-09 00:00:23 | [diff] [blame] | 34 | namespace content { |
ananta | 46f3e94 | 2017-05-09 04:56:30 | [diff] [blame] | 35 | class AppCacheJob; |
Anantanarayanan Iyengar | 2130d27 | 2017-09-01 18:21:14 | [diff] [blame] | 36 | class AppCacheSubresourceURLFactory; |
ananta | 4e8a529 | 2017-05-04 03:07:15 | [diff] [blame] | 37 | class AppCacheRequest; |
[email protected] | 073f24d | 2014-04-09 00:00:23 | [diff] [blame] | 38 | class AppCacheRequestHandlerTest; |
[email protected] | 3367fc1d | 2009-11-09 00:09:21 | [diff] [blame] | 39 | class AppCacheURLRequestJob; |
ananta | 2533bff6 | 2017-07-12 04:07:27 | [diff] [blame] | 40 | class AppCacheHost; |
[email protected] | 3367fc1d | 2009-11-09 00:09:21 | [diff] [blame] | 41 | |
[email protected] | 6981d963 | 2010-11-30 21:34:02 | [diff] [blame] | 42 | // An instance is created for each net::URLRequest. The instance survives all |
| 43 | // http transactions involved in the processing of its net::URLRequest, and is |
[email protected] | 97e3edc | 2009-09-15 22:07:15 | [diff] [blame] | 44 | // given the opportunity to hijack the request along the way. Callers |
| 45 | // should use AppCacheHost::CreateRequestHandler to manufacture instances |
| 46 | // that can retrieve resources for a particular host. |
[email protected] | 98d6d456 | 2014-06-25 20:57:55 | [diff] [blame] | 47 | class CONTENT_EXPORT AppCacheRequestHandler |
[email protected] | ea8e181 | 2012-02-15 22:07:34 | [diff] [blame] | 48 | : public base::SupportsUserData::Data, |
[email protected] | bfe1948 | 2011-09-30 22:14:57 | [diff] [blame] | 49 | public AppCacheHost::Observer, |
michaeln | b861840 | 2016-08-02 20:14:33 | [diff] [blame] | 50 | public AppCacheServiceImpl::Observer, |
ananta | a2c8ec6 | 2017-06-09 23:44:05 | [diff] [blame] | 51 | public AppCacheStorage::Delegate, |
Kinuko Yasuda | 7f3e172 | 2018-03-26 08:58:58 | [diff] [blame] | 52 | public NavigationLoaderInterceptor { |
[email protected] | 97e3edc | 2009-09-15 22:07:15 | [diff] [blame] | 53 | public: |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 54 | ~AppCacheRequestHandler() override; |
[email protected] | 7e8e3dd | 2009-09-18 01:05:09 | [diff] [blame] | 55 | |
[email protected] | 3367fc1d | 2009-11-09 00:09:21 | [diff] [blame] | 56 | // These are called on each request intercept opportunity. |
Michael Nordman | 85243a8 | 2017-10-24 01:24:50 | [diff] [blame] | 57 | // When the NetworkService is not enabled, the AppCacheInterceptor calls these |
| 58 | // methods directly. When the NetworkService is enabled, the various |
| 59 | // MaybeCreateLoader methods below call call these internally. |
ananta | 46f3e94 | 2017-05-09 04:56:30 | [diff] [blame] | 60 | AppCacheJob* MaybeLoadResource(net::NetworkDelegate* network_delegate); |
| 61 | AppCacheJob* MaybeLoadFallbackForRedirect( |
[email protected] | 9f17046 | 2012-08-24 01:06:58 | [diff] [blame] | 62 | net::NetworkDelegate* network_delegate, |
| 63 | const GURL& location); |
ananta | 46f3e94 | 2017-05-09 04:56:30 | [diff] [blame] | 64 | AppCacheJob* MaybeLoadFallbackForResponse( |
mmenke | 5289cbfd | 2015-10-29 19:36:17 | [diff] [blame] | 65 | net::NetworkDelegate* network_delegate); |
[email protected] | 97e3edc | 2009-09-15 22:07:15 | [diff] [blame] | 66 | |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 67 | void GetExtraResponseInfo(int64_t* cache_id, GURL* manifest_url); |
[email protected] | 97e3edc | 2009-09-15 22:07:15 | [diff] [blame] | 68 | |
Michael Nordman | 85243a8 | 2017-10-24 01:24:50 | [diff] [blame] | 69 | // NetworkService loading |
Anantanarayanan Iyengar | d125c460 | 2017-08-19 00:46:56 | [diff] [blame] | 70 | |
Kinuko Yasuda | 7f3e172 | 2018-03-26 08:58:58 | [diff] [blame] | 71 | // NavigationLoaderInterceptor overrides - main resource loading. |
arthursonzogni | 1fd60e6 | 2018-05-09 15:57:32 | [diff] [blame] | 72 | // These methods are used by the NavigationURLLoaderImpl. |
Michael Nordman | 85243a8 | 2017-10-24 01:24:50 | [diff] [blame] | 73 | // Internally they use same methods used by the network library based impl, |
| 74 | // MaybeLoadResource and MaybeLoadFallbackForResponse. |
| 75 | // Eventually one of the Deliver*Response() methods is called and the |
| 76 | // LoaderCallback is invoked. |
Matt Falkenhagen | 4376512 | 2018-08-22 19:37:22 | [diff] [blame^] | 77 | void MaybeCreateLoader( |
| 78 | const network::ResourceRequest& tentative_resource_request, |
| 79 | ResourceContext* resource_context, |
| 80 | LoaderCallback callback, |
| 81 | FallbackCallback fallback_callback) override; |
Michael Nordman | 85243a8 | 2017-10-24 01:24:50 | [diff] [blame] | 82 | // MaybeCreateLoaderForResponse always returns synchronously. |
| 83 | bool MaybeCreateLoaderForResponse( |
John Abd-El-Malek | 4624803 | 2018-01-17 19:11:23 | [diff] [blame] | 84 | const network::ResourceResponseHead& response, |
John Abd-El-Malek | b165dc5 | 2018-01-18 17:12:18 | [diff] [blame] | 85 | network::mojom::URLLoaderPtr* loader, |
Tsuyoshi Horo | b8d512a | 2018-01-25 17:01:59 | [diff] [blame] | 86 | network::mojom::URLLoaderClientRequest* client_request, |
| 87 | ThrottlingURLLoader* url_loader) override; |
Kinuko Yasuda | 250577c | 2017-10-29 02:51:24 | [diff] [blame] | 88 | base::Optional<SubresourceLoaderParams> MaybeCreateSubresourceLoaderParams() |
| 89 | override; |
Michael Nordman | 85243a8 | 2017-10-24 01:24:50 | [diff] [blame] | 90 | |
| 91 | // These methods are used for subresource loading by the |
| 92 | // AppCacheSubresourceURLFactory::SubresourceLoader class. |
| 93 | // Internally they use same methods used by the network library based impl, |
| 94 | // MaybeLoadResource, MaybeLoadFallbackForResponse, and |
| 95 | // MaybeLoadFallbackForRedirect. Eventually one of the Deliver*Response() |
| 96 | // methods is called and the LoaderCallback is invoked. |
John Abd-El-Malek | 1df6179 | 2018-01-12 20:40:45 | [diff] [blame] | 97 | void MaybeCreateSubresourceLoader( |
| 98 | const network::ResourceRequest& resource_request, |
| 99 | LoaderCallback callback); |
John Abd-El-Malek | 4624803 | 2018-01-17 19:11:23 | [diff] [blame] | 100 | void MaybeFallbackForSubresourceResponse( |
| 101 | const network::ResourceResponseHead& response, |
| 102 | LoaderCallback callback); |
Michael Nordman | 85243a8 | 2017-10-24 01:24:50 | [diff] [blame] | 103 | void MaybeFallbackForSubresourceRedirect( |
| 104 | const net::RedirectInfo& redirect_info, |
| 105 | LoaderCallback callback); |
| 106 | void MaybeFollowSubresourceRedirect(const net::RedirectInfo& redirect_info, |
| 107 | LoaderCallback callback); |
[email protected] | 15f9cded | 2010-05-20 20:51:06 | [diff] [blame] | 108 | |
ananta | a2c8ec6 | 2017-06-09 23:44:05 | [diff] [blame] | 109 | static std::unique_ptr<AppCacheRequestHandler> |
Hiroki Nakagawa | ff43e447 | 2018-07-26 07:06:46 | [diff] [blame] | 110 | InitializeForMainResourceNetworkService( |
John Abd-El-Malek | 1df6179 | 2018-01-12 20:40:45 | [diff] [blame] | 111 | const network::ResourceRequest& request, |
Hiroki Nakagawa | ff43e447 | 2018-07-26 07:06:46 | [diff] [blame] | 112 | base::WeakPtr<AppCacheHost> appcache_host, |
Kinuko Yasuda | be4ad29 | 2018-07-06 01:33:39 | [diff] [blame] | 113 | scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory); |
ananta | a2c8ec6 | 2017-06-09 23:44:05 | [diff] [blame] | 114 | |
Michael Nordman | 85243a8 | 2017-10-24 01:24:50 | [diff] [blame] | 115 | static bool IsMainResourceType(ResourceType type) { |
| 116 | return IsResourceTypeFrame(type) || type == RESOURCE_TYPE_SHARED_WORKER; |
| 117 | } |
| 118 | |
Anantanarayanan Iyengar | d125c460 | 2017-08-19 00:46:56 | [diff] [blame] | 119 | // Called by unittests to indicate that we are in test mode. |
| 120 | static void SetRunningInTests(bool in_tests); |
Anantanarayanan Iyengar | d125c460 | 2017-08-19 00:46:56 | [diff] [blame] | 121 | static bool IsRunningInTests(); |
ananta | 2533bff6 | 2017-07-12 04:07:27 | [diff] [blame] | 122 | |
[email protected] | 97e3edc | 2009-09-15 22:07:15 | [diff] [blame] | 123 | private: |
| 124 | friend class AppCacheHost; |
Michael Nordman | 85243a8 | 2017-10-24 01:24:50 | [diff] [blame] | 125 | friend class AppCacheRequestHandlerTest; |
[email protected] | 97e3edc | 2009-09-15 22:07:15 | [diff] [blame] | 126 | |
[email protected] | 7e8e3dd | 2009-09-18 01:05:09 | [diff] [blame] | 127 | // Callers should use AppCacheHost::CreateRequestHandler. |
ananta | 4e8a529 | 2017-05-04 03:07:15 | [diff] [blame] | 128 | AppCacheRequestHandler(AppCacheHost* host, |
| 129 | ResourceType resource_type, |
| 130 | bool should_reset_appcache, |
| 131 | std::unique_ptr<AppCacheRequest> request); |
[email protected] | 97e3edc | 2009-09-15 22:07:15 | [diff] [blame] | 132 | |
[email protected] | 3367fc1d | 2009-11-09 00:09:21 | [diff] [blame] | 133 | // AppCacheHost::Observer override |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 134 | void OnDestructionImminent(AppCacheHost* host) override; |
[email protected] | 97e3edc | 2009-09-15 22:07:15 | [diff] [blame] | 135 | |
michaeln | b861840 | 2016-08-02 20:14:33 | [diff] [blame] | 136 | // AppCacheServiceImpl::Observer override |
| 137 | void OnServiceDestructionImminent(AppCacheServiceImpl* service) override; |
| 138 | |
[email protected] | 3367fc1d | 2009-11-09 00:09:21 | [diff] [blame] | 139 | // Helpers to instruct a waiting job with what response to |
| 140 | // deliver for the request we're handling. |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 141 | void DeliverAppCachedResponse(const AppCacheEntry& entry, |
| 142 | int64_t cache_id, |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 143 | const GURL& manifest_url, |
[email protected] | 2abcade | 2012-01-05 00:19:40 | [diff] [blame] | 144 | bool is_fallback, |
| 145 | const GURL& namespace_entry_url); |
[email protected] | 3367fc1d | 2009-11-09 00:09:21 | [diff] [blame] | 146 | void DeliverNetworkResponse(); |
| 147 | void DeliverErrorResponse(); |
| 148 | |
mmenke | 5289cbfd | 2015-10-29 19:36:17 | [diff] [blame] | 149 | // Called just before the request is restarted. Grabs the reason for |
| 150 | // restarting, so can correctly continue to handle the request. |
Michael Nordman | 85243a8 | 2017-10-24 01:24:50 | [diff] [blame] | 151 | void OnPrepareToRestartURLRequest(); |
mmenke | 5289cbfd | 2015-10-29 19:36:17 | [diff] [blame] | 152 | |
ananta | 46f3e94 | 2017-05-09 04:56:30 | [diff] [blame] | 153 | // Helper method to create an AppCacheJob and populate job_. |
mmenke | 5289cbfd | 2015-10-29 19:36:17 | [diff] [blame] | 154 | // Caller takes ownership of returned value. |
ananta | 46f3e94 | 2017-05-09 04:56:30 | [diff] [blame] | 155 | std::unique_ptr<AppCacheJob> CreateJob( |
mmenke | ed0498b | 2015-12-08 23:20:42 | [diff] [blame] | 156 | net::NetworkDelegate* network_delegate); |
mmenke | 5289cbfd | 2015-10-29 19:36:17 | [diff] [blame] | 157 | |
[email protected] | 3367fc1d | 2009-11-09 00:09:21 | [diff] [blame] | 158 | // Helper to retrieve a pointer to the storage object. |
[email protected] | 15f9cded | 2010-05-20 20:51:06 | [diff] [blame] | 159 | AppCacheStorage* storage() const; |
| 160 | |
| 161 | bool is_main_resource() const { |
| 162 | return IsMainResourceType(resource_type_); |
| 163 | } |
[email protected] | 3367fc1d | 2009-11-09 00:09:21 | [diff] [blame] | 164 | |
| 165 | // Main-resource loading ------------------------------------- |
[email protected] | 15f9cded | 2010-05-20 20:51:06 | [diff] [blame] | 166 | // Frame and SharedWorker main resources are handled here. |
[email protected] | 3367fc1d | 2009-11-09 00:09:21 | [diff] [blame] | 167 | |
ananta | 46f3e94 | 2017-05-09 04:56:30 | [diff] [blame] | 168 | std::unique_ptr<AppCacheJob> MaybeLoadMainResource( |
mmenke | 5289cbfd | 2015-10-29 19:36:17 | [diff] [blame] | 169 | net::NetworkDelegate* network_delegate); |
[email protected] | 3367fc1d | 2009-11-09 00:09:21 | [diff] [blame] | 170 | |
| 171 | // AppCacheStorage::Delegate methods |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 172 | void OnMainResponseFound(const GURL& url, |
| 173 | const AppCacheEntry& entry, |
| 174 | const GURL& fallback_url, |
| 175 | const AppCacheEntry& fallback_entry, |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 176 | int64_t cache_id, |
| 177 | int64_t group_id, |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 178 | const GURL& mainfest_url) override; |
[email protected] | 3367fc1d | 2009-11-09 00:09:21 | [diff] [blame] | 179 | |
Kinuko Yasuda | 8757204a | 2017-11-04 07:50:13 | [diff] [blame] | 180 | // NetworkService loading: |
Ken Rockot | 387ddd5a | 2018-01-30 19:18:40 | [diff] [blame] | 181 | // Called when a |callback| that is originally given to |MaybeCreateLoader()| |
| 182 | // runs for the main resource. This flips |should_create_subresource_loader_| |
| 183 | // if a non-null |handler| is given. Always invokes |callback| with |handler|. |
Kinuko Yasuda | 8757204a | 2017-11-04 07:50:13 | [diff] [blame] | 184 | void RunLoaderCallbackForMainResource( |
| 185 | LoaderCallback callback, |
Ken Rockot | 387ddd5a | 2018-01-30 19:18:40 | [diff] [blame] | 186 | SingleRequestURLLoaderFactory::RequestHandler handler); |
Kinuko Yasuda | 8757204a | 2017-11-04 07:50:13 | [diff] [blame] | 187 | |
[email protected] | 3367fc1d | 2009-11-09 00:09:21 | [diff] [blame] | 188 | // Sub-resource loading ------------------------------------- |
[email protected] | 15f9cded | 2010-05-20 20:51:06 | [diff] [blame] | 189 | // Dedicated worker and all manner of sub-resources are handled here. |
[email protected] | 3367fc1d | 2009-11-09 00:09:21 | [diff] [blame] | 190 | |
ananta | 46f3e94 | 2017-05-09 04:56:30 | [diff] [blame] | 191 | std::unique_ptr<AppCacheJob> MaybeLoadSubResource( |
mmenke | 5289cbfd | 2015-10-29 19:36:17 | [diff] [blame] | 192 | net::NetworkDelegate* network_delegate); |
[email protected] | 3367fc1d | 2009-11-09 00:09:21 | [diff] [blame] | 193 | void ContinueMaybeLoadSubResource(); |
| 194 | |
| 195 | // AppCacheHost::Observer override |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 196 | void OnCacheSelectionComplete(AppCacheHost* host) override; |
[email protected] | 3367fc1d | 2009-11-09 00:09:21 | [diff] [blame] | 197 | |
| 198 | // Data members ----------------------------------------------- |
| 199 | |
| 200 | // What host we're servicing a request for. |
[email protected] | 7e8e3dd | 2009-09-18 01:05:09 | [diff] [blame] | 201 | AppCacheHost* host_; |
[email protected] | 3367fc1d | 2009-11-09 00:09:21 | [diff] [blame] | 202 | |
[email protected] | 15f9cded | 2010-05-20 20:51:06 | [diff] [blame] | 203 | // Frame vs subresource vs sharedworker loads are somewhat different. |
[email protected] | 6c1e0521 | 2014-07-31 00:59:40 | [diff] [blame] | 204 | ResourceType resource_type_; |
[email protected] | 3367fc1d | 2009-11-09 00:09:21 | [diff] [blame] | 205 | |
eustas | 2787684 | 2014-11-27 10:48:00 | [diff] [blame] | 206 | // True if corresponding AppCache group should be resetted before load. |
| 207 | bool should_reset_appcache_; |
| 208 | |
[email protected] | 3367fc1d | 2009-11-09 00:09:21 | [diff] [blame] | 209 | // Subresource requests wait until after cache selection completes. |
| 210 | bool is_waiting_for_cache_selection_; |
| 211 | |
| 212 | // Info about the type of response we found for delivery. |
| 213 | // These are relevant for both main and subresource requests. |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 214 | int64_t found_group_id_; |
| 215 | int64_t found_cache_id_; |
[email protected] | 3367fc1d | 2009-11-09 00:09:21 | [diff] [blame] | 216 | AppCacheEntry found_entry_; |
| 217 | AppCacheEntry found_fallback_entry_; |
[email protected] | 2abcade | 2012-01-05 00:19:40 | [diff] [blame] | 218 | GURL found_namespace_entry_url_; |
[email protected] | 3367fc1d | 2009-11-09 00:09:21 | [diff] [blame] | 219 | GURL found_manifest_url_; |
| 220 | bool found_network_namespace_; |
| 221 | |
[email protected] | 1e1f7d5 | 2010-08-25 21:38:20 | [diff] [blame] | 222 | // True if a cache entry this handler attempted to return was |
| 223 | // not found in the disk cache. Once set, the handler will take |
| 224 | // no action on all subsequent intercept opportunities, so the |
| 225 | // request and any redirects will be handled by the network library. |
| 226 | bool cache_entry_not_found_; |
| 227 | |
mmenke | 5289cbfd | 2015-10-29 19:36:17 | [diff] [blame] | 228 | // True if the next time this request is started, the response should be |
| 229 | // delivered from the network, bypassing the AppCache. Cleared after the next |
| 230 | // intercept opportunity. |
| 231 | bool is_delivering_network_response_; |
| 232 | |
[email protected] | 17d64785 | 2012-09-08 17:45:52 | [diff] [blame] | 233 | // True if this->MaybeLoadResource(...) has been called in the past. |
| 234 | bool maybe_load_resource_executed_; |
| 235 | |
mmenke | 5289cbfd | 2015-10-29 19:36:17 | [diff] [blame] | 236 | // The job we use to deliver a response. Only NULL during the following times: |
| 237 | // 1) Before request has started a job. |
| 238 | // 2) Request is not being handled by appcache. |
| 239 | // 3) Request has been cancelled, and the job killed. |
ananta | 46f3e94 | 2017-05-09 04:56:30 | [diff] [blame] | 240 | base::WeakPtr<AppCacheJob> job_; |
[email protected] | 3367fc1d | 2009-11-09 00:09:21 | [diff] [blame] | 241 | |
mmenke | 5289cbfd | 2015-10-29 19:36:17 | [diff] [blame] | 242 | // Cached information about the response being currently served by the |
| 243 | // AppCache, if there is one. |
| 244 | int cache_id_; |
| 245 | GURL manifest_url_; |
| 246 | |
michaeln | b861840 | 2016-08-02 20:14:33 | [diff] [blame] | 247 | // Backptr to the central service object. |
| 248 | AppCacheServiceImpl* service_; |
| 249 | |
ananta | 4e8a529 | 2017-05-04 03:07:15 | [diff] [blame] | 250 | std::unique_ptr<AppCacheRequest> request_; |
| 251 | |
ananta | 2533bff6 | 2017-07-12 04:07:27 | [diff] [blame] | 252 | // Network service related members. |
| 253 | |
Michael Nordman | 85243a8 | 2017-10-24 01:24:50 | [diff] [blame] | 254 | LoaderCallback loader_callback_; |
ananta | a2c8ec6 | 2017-06-09 23:44:05 | [diff] [blame] | 255 | |
Kinuko Yasuda | 8757204a | 2017-11-04 07:50:13 | [diff] [blame] | 256 | // Flipped to true if AppCache wants to handle subresource requests |
Ken Rockot | 387ddd5a | 2018-01-30 19:18:40 | [diff] [blame] | 257 | // (i.e. when |loader_callback_| is fired with a non-null |
| 258 | // RequestHandler for non-error cases. |
Kinuko Yasuda | 8757204a | 2017-11-04 07:50:13 | [diff] [blame] | 259 | bool should_create_subresource_loader_ = false; |
| 260 | |
Kinuko Yasuda | be4ad29 | 2018-07-06 01:33:39 | [diff] [blame] | 261 | // The network URL loader factory. |
| 262 | scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory_; |
ananta | e60d1d4 | 2017-06-20 04:16:27 | [diff] [blame] | 263 | |
ananta | 2533bff6 | 2017-07-12 04:07:27 | [diff] [blame] | 264 | // The AppCache host instance. We pass this to the |
| 265 | // AppCacheSubresourceURLFactory instance on creation. |
| 266 | base::WeakPtr<AppCacheHost> appcache_host_; |
| 267 | |
Kinuko Yasuda | 8757204a | 2017-11-04 07:50:13 | [diff] [blame] | 268 | base::WeakPtrFactory<AppCacheRequestHandler> weak_factory_; |
| 269 | |
[email protected] | 3367fc1d | 2009-11-09 00:09:21 | [diff] [blame] | 270 | DISALLOW_COPY_AND_ASSIGN(AppCacheRequestHandler); |
[email protected] | 97e3edc | 2009-09-15 22:07:15 | [diff] [blame] | 271 | }; |
| 272 | |
[email protected] | 98d6d456 | 2014-06-25 20:57:55 | [diff] [blame] | 273 | } // namespace content |
[email protected] | 97e3edc | 2009-09-15 22:07:15 | [diff] [blame] | 274 | |
[email protected] | 98d6d456 | 2014-06-25 20:57:55 | [diff] [blame] | 275 | #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ |