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