Home | History | Annotate | Download | only in worker
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_WORKER_WORKER_WEBAPPLICATIONCACHEHOST_IMPL_H_
      6 #define CHROME_WORKER_WORKER_WEBAPPLICATIONCACHEHOST_IMPL_H_
      7 
      8 #include "content/child/appcache/web_application_cache_host_impl.h"
      9 
     10 namespace content {
     11 
     12 // Information used to construct and initialize an appcache host
     13 // for a worker.
     14 struct WorkerAppCacheInitInfo {
     15   int parent_process_id;
     16   int64 main_resource_appcache_id;  // Only valid for shared workers.
     17 
     18   WorkerAppCacheInitInfo()
     19       : parent_process_id(0),
     20         main_resource_appcache_id(0) {
     21   }
     22   WorkerAppCacheInitInfo(
     23       int process_id, int64 cache_id)
     24       : parent_process_id(process_id),
     25         main_resource_appcache_id(cache_id) {
     26   }
     27 };
     28 
     29 class WorkerWebApplicationCacheHostImpl : public WebApplicationCacheHostImpl {
     30  public:
     31   WorkerWebApplicationCacheHostImpl(
     32       const WorkerAppCacheInitInfo& init_info,
     33       WebKit::WebApplicationCacheHostClient* client);
     34 
     35   // Main resource loading is different for workers. The resource is
     36   // loaded by the creator of the worker rather than the worker itself.
     37   // These overrides are stubbed out.
     38   virtual void willStartMainResourceRequest(
     39       WebKit::WebURLRequest&, const WebKit::WebFrame*);
     40   virtual void didReceiveResponseForMainResource(
     41       const WebKit::WebURLResponse&);
     42   virtual void didReceiveDataForMainResource(const char* data, int len);
     43   virtual void didFinishLoadingMainResource(bool success);
     44 
     45   // Cache selection is also different for workers. We know at construction
     46   // time what cache to select and do so then.
     47   // These overrides are stubbed out.
     48   virtual void selectCacheWithoutManifest();
     49   virtual bool selectCacheWithManifest(const WebKit::WebURL& manifestURL);
     50 };
     51 
     52 }  // namespace content
     53 
     54 #endif  // CHROME_WORKER_WORKER_WEBAPPLICATIONCACHEHOST_IMPL_H_
     55