OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 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 "webkit/appcache/web_application_cache_host_impl.h" |
| 9 |
| 10 // Information used to construct and initialize an appcache host |
| 11 // for a worker. |
| 12 struct WorkerAppCacheInitInfo { |
| 13 bool is_shared_worker; |
| 14 int parent_process_id; |
| 15 int parent_appcache_host_id; // Only valid for dedicated workers. |
| 16 int64 main_resource_appcache_id; // Only valid for shared workers. |
| 17 |
| 18 WorkerAppCacheInitInfo() |
| 19 : is_shared_worker(false), parent_process_id(0), |
| 20 parent_appcache_host_id(0), main_resource_appcache_id(0) { |
| 21 } |
| 22 WorkerAppCacheInitInfo( |
| 23 bool is_shared, int process_id, int host_id, int64 cache_id) |
| 24 : is_shared_worker(is_shared), parent_process_id(process_id), |
| 25 parent_appcache_host_id(host_id), main_resource_appcache_id(cache_id) { |
| 26 } |
| 27 }; |
| 28 |
| 29 class WorkerWebApplicationCacheHostImpl |
| 30 : public appcache::WebApplicationCacheHostImpl { |
| 31 public: |
| 32 WorkerWebApplicationCacheHostImpl( |
| 33 const WorkerAppCacheInitInfo& init_info, |
| 34 WebKit::WebApplicationCacheHostClient* client); |
| 35 |
| 36 // Main resource loading is different for workers. The resource is |
| 37 // loaded by the creator of the worker rather than the worker itself. |
| 38 virtual void willStartMainResourceRequest(WebKit::WebURLRequest&) {} |
| 39 virtual void didReceiveResponseForMainResource( |
| 40 const WebKit::WebURLResponse&) {} |
| 41 virtual void didReceiveDataForMainResource(const char* data, int len) {} |
| 42 virtual void didFinishLoadingMainResource(bool success) {} |
| 43 |
| 44 // Cache selection is also different for workers. We know at construction |
| 45 // time what cache to select and do so then. |
| 46 virtual void selectCacheWithoutManifest() {} |
| 47 virtual bool selectCacheWithManifest(const WebKit::WebURL& manifestURL) { |
| 48 return true; |
| 49 } |
| 50 }; |
| 51 |
| 52 #endif // CHROME_WORKER_WORKER_WEBAPPLICATIONCACHEHOST_IMPL_H_ |
OLD | NEW |