 Chromium Code Reviews
 Chromium Code Reviews Issue 2902653002:
  Get main frame and subframe AppCache loads to work.   (Closed)
    
  
    Issue 2902653002:
  Get main frame and subframe AppCache loads to work.   (Closed) 
  | Index: content/browser/appcache/appcache_url_loader_factory.h | 
| diff --git a/content/browser/appcache/appcache_url_loader_factory.h b/content/browser/appcache/appcache_url_loader_factory.h | 
| index 9c85d932bf16a3f7d5793e4266be8225902735ed..3966a6daf4ab3d9c36673cc840ff4629d6070a9d 100644 | 
| --- a/content/browser/appcache/appcache_url_loader_factory.h | 
| +++ b/content/browser/appcache/appcache_url_loader_factory.h | 
| @@ -11,8 +11,11 @@ | 
| #include "url/gurl.h" | 
| namespace content { | 
| +class AppCacheNavigationHandleCore; | 
| +class AppCacheURLLoader; | 
| class ChromeAppCacheService; | 
| class URLLoaderFactoryGetter; | 
| +class URLLoaderRequestHandler; | 
| // Implements the URLLoaderFactory mojom for AppCache requests. | 
| class AppCacheURLLoaderFactory : public mojom::URLLoaderFactory { | 
| @@ -20,13 +23,26 @@ class AppCacheURLLoaderFactory : public mojom::URLLoaderFactory { | 
| ~AppCacheURLLoaderFactory() override; | 
| // Factory function to create an instance of the factory. | 
| - // The |appcache_service| parameter is used to query the underlying | 
| - // AppCacheStorage instance to check if we can service requests from the | 
| - // AppCache. We pass unhandled requests to the network service retrieved from | 
| - // the |factory_getter|. | 
| + // 1. The |appcache_service| parameter is passed to the URLLoader mojom for | 
| + // checking if the request can be serviced from the AppCache. | 
| + // 2. The |factory_getter| parameter is used to query the network service | 
| + // to pass network requests to. | 
| + // 3. The |navigation_url_loader| is valid only for navigation requests. In | 
| + // other cases like subresource requests we create an instance of the | 
| + // AppCacheURLLoader class to handle the request. | 
| + // 4. The process_id parameter identifies the process. 0 for browser | 
| + // initiated requests. | 
| static void CreateURLLoaderFactory(mojom::URLLoaderFactoryRequest request, | 
| 
jam
2017/06/01 15:00:46
this isn't called externally anymore, so no need t
 
ananta
2017/06/01 17:28:01
The static function uses the loader_factory_bindin
 | 
| ChromeAppCacheService* appcache_service, | 
| - URLLoaderFactoryGetter* factory_getter); | 
| + URLLoaderFactoryGetter* factory_getter, | 
| + AppCacheURLLoader* navigation_url_loader, | 
| + int process_id); | 
| + | 
| + // Creates an instance of the URLLoaderRequestHandler subclass to see if we | 
| + // can serve this request from the AppCache. | 
| + static std::unique_ptr<URLLoaderRequestHandler> CreateRequestHandler( | 
| + AppCacheNavigationHandleCore* appcache_handle_core, | 
| + URLLoaderFactoryGetter* url_loader_factory_getter); | 
| // mojom::URLLoaderFactory implementation. | 
| void CreateLoaderAndStart(mojom::URLLoaderRequest url_loader_request, | 
| @@ -42,7 +58,9 @@ class AppCacheURLLoaderFactory : public mojom::URLLoaderFactory { | 
| private: | 
| AppCacheURLLoaderFactory(ChromeAppCacheService* appcache_service, | 
| - URLLoaderFactoryGetter* factory_getter); | 
| + URLLoaderFactoryGetter* factory_getter, | 
| + AppCacheURLLoader* url_loader_instance, | 
| + int process_id); | 
| // Used to query AppCacheStorage to see if a request can be served out of the | 
| /// AppCache. | 
| @@ -52,6 +70,12 @@ class AppCacheURLLoaderFactory : public mojom::URLLoaderFactory { | 
| // the network service. | 
| scoped_refptr<URLLoaderFactoryGetter> factory_getter_; | 
| + // Only set for navigation requests. | 
| + AppCacheURLLoader* navigation_url_loader_; | 
| + | 
| + // Process id. 0 for browser. | 
| + int process_id_; | 
| + | 
| mojo::StrongBindingSet<mojom::URLLoaderFactory> loader_factory_bindings_; | 
| DISALLOW_COPY_AND_ASSIGN(AppCacheURLLoaderFactory); |