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 #pragma once | |
8 | |
9 #include "webkit/appcache/web_application_cache_host_impl.h" | |
10 | |
11 // Information used to construct and initialize an appcache host | |
12 // for a worker. | |
13 struct WorkerAppCacheInitInfo { | |
14 bool is_shared_worker; | |
15 int parent_process_id; | |
16 int parent_appcache_host_id; // Only valid for dedicated workers. | |
17 int64 main_resource_appcache_id; // Only valid for shared workers. | |
18 | |
19 WorkerAppCacheInitInfo() | |
20 : is_shared_worker(false), parent_process_id(0), | |
21 parent_appcache_host_id(0), main_resource_appcache_id(0) { | |
22 } | |
23 WorkerAppCacheInitInfo( | |
24 bool is_shared, int process_id, int host_id, int64 cache_id) | |
25 : is_shared_worker(is_shared), parent_process_id(process_id), | |
26 parent_appcache_host_id(host_id), main_resource_appcache_id(cache_id) { | |
27 } | |
28 }; | |
29 | |
30 class WorkerWebApplicationCacheHostImpl | |
31 : public appcache::WebApplicationCacheHostImpl { | |
32 public: | |
33 WorkerWebApplicationCacheHostImpl( | |
34 const WorkerAppCacheInitInfo& init_info, | |
35 WebKit::WebApplicationCacheHostClient* client); | |
36 | |
37 // Main resource loading is different for workers. The resource is | |
38 // loaded by the creator of the worker rather than the worker itself. | |
39 virtual void willStartMainResourceRequest(WebKit::WebURLRequest&) {} | |
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 virtual void selectCacheWithoutManifest() {} | |
48 virtual bool selectCacheWithManifest(const WebKit::WebURL& manifestURL); | |
49 }; | |
50 | |
51 #endif // CHROME_WORKER_WORKER_WEBAPPLICATIONCACHEHOST_IMPL_H_ | |
OLD | NEW |