OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_CHILD_APPCACHE_WEB_APPLICATION_CACHE_HOST_IMPL_H_ | 5 #ifndef CONTENT_CHILD_APPCACHE_WEB_APPLICATION_CACHE_HOST_IMPL_H_ |
6 #define CONTENT_CHILD_APPCACHE_WEB_APPLICATION_CACHE_HOST_IMPL_H_ | 6 #define CONTENT_CHILD_APPCACHE_WEB_APPLICATION_CACHE_HOST_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
| 10 #include "content/common/appcache_interfaces.h" |
10 #include "third_party/WebKit/public/platform/WebApplicationCacheHost.h" | 11 #include "third_party/WebKit/public/platform/WebApplicationCacheHost.h" |
11 #include "third_party/WebKit/public/platform/WebApplicationCacheHostClient.h" | 12 #include "third_party/WebKit/public/platform/WebApplicationCacheHostClient.h" |
12 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 13 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
13 #include "third_party/WebKit/public/platform/WebVector.h" | 14 #include "third_party/WebKit/public/platform/WebVector.h" |
14 #include "url/gurl.h" | 15 #include "url/gurl.h" |
15 #include "webkit/common/appcache/appcache_interfaces.h" | |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 | 18 |
19 class WebApplicationCacheHostImpl | 19 class WebApplicationCacheHostImpl |
20 : NON_EXPORTED_BASE(public blink::WebApplicationCacheHost) { | 20 : NON_EXPORTED_BASE(public blink::WebApplicationCacheHost) { |
21 public: | 21 public: |
22 // Returns the host having given id or NULL if there is no such host. | 22 // Returns the host having given id or NULL if there is no such host. |
23 static WebApplicationCacheHostImpl* FromId(int id); | 23 static WebApplicationCacheHostImpl* FromId(int id); |
24 | 24 |
25 WebApplicationCacheHostImpl(blink::WebApplicationCacheHostClient* client, | 25 WebApplicationCacheHostImpl(blink::WebApplicationCacheHostClient* client, |
26 appcache::AppCacheBackend* backend); | 26 AppCacheBackend* backend); |
27 virtual ~WebApplicationCacheHostImpl(); | 27 virtual ~WebApplicationCacheHostImpl(); |
28 | 28 |
29 int host_id() const { return host_id_; } | 29 int host_id() const { return host_id_; } |
30 appcache::AppCacheBackend* backend() const { return backend_; } | 30 AppCacheBackend* backend() const { return backend_; } |
31 blink::WebApplicationCacheHostClient* client() const { return client_; } | 31 blink::WebApplicationCacheHostClient* client() const { return client_; } |
32 | 32 |
33 virtual void OnCacheSelected(const appcache::AppCacheInfo& info); | 33 virtual void OnCacheSelected(const AppCacheInfo& info); |
34 void OnStatusChanged(appcache::AppCacheStatus); | 34 void OnStatusChanged(AppCacheStatus); |
35 void OnEventRaised(appcache::AppCacheEventID); | 35 void OnEventRaised(AppCacheEventID); |
36 void OnProgressEventRaised(const GURL& url, int num_total, int num_complete); | 36 void OnProgressEventRaised(const GURL& url, int num_total, int num_complete); |
37 void OnErrorEventRaised(const appcache::AppCacheErrorDetails& details); | 37 void OnErrorEventRaised(const AppCacheErrorDetails& details); |
38 virtual void OnLogMessage(appcache::AppCacheLogLevel log_level, | 38 virtual void OnLogMessage(AppCacheLogLevel log_level, |
39 const std::string& message) {} | 39 const std::string& message) {} |
40 virtual void OnContentBlocked(const GURL& manifest_url) {} | 40 virtual void OnContentBlocked(const GURL& manifest_url) {} |
41 | 41 |
42 // blink::WebApplicationCacheHost: | 42 // blink::WebApplicationCacheHost: |
43 virtual void willStartMainResourceRequest( | 43 virtual void willStartMainResourceRequest( |
44 blink::WebURLRequest&, const blink::WebApplicationCacheHost*); | 44 blink::WebURLRequest&, const blink::WebApplicationCacheHost*); |
45 virtual void willStartSubResourceRequest(blink::WebURLRequest&); | 45 virtual void willStartSubResourceRequest(blink::WebURLRequest&); |
46 virtual void selectCacheWithoutManifest(); | 46 virtual void selectCacheWithoutManifest(); |
47 virtual bool selectCacheWithManifest(const blink::WebURL& manifestURL); | 47 virtual bool selectCacheWithManifest(const blink::WebURL& manifestURL); |
48 virtual void didReceiveResponseForMainResource(const blink::WebURLResponse&); | 48 virtual void didReceiveResponseForMainResource(const blink::WebURLResponse&); |
49 virtual void didReceiveDataForMainResource(const char* data, int len); | 49 virtual void didReceiveDataForMainResource(const char* data, int len); |
50 virtual void didFinishLoadingMainResource(bool success); | 50 virtual void didFinishLoadingMainResource(bool success); |
51 virtual blink::WebApplicationCacheHost::Status status(); | 51 virtual blink::WebApplicationCacheHost::Status status(); |
52 virtual bool startUpdate(); | 52 virtual bool startUpdate(); |
53 virtual bool swapCache(); | 53 virtual bool swapCache(); |
54 virtual void getResourceList(blink::WebVector<ResourceInfo>* resources); | 54 virtual void getResourceList(blink::WebVector<ResourceInfo>* resources); |
55 virtual void getAssociatedCacheInfo(CacheInfo* info); | 55 virtual void getAssociatedCacheInfo(CacheInfo* info); |
56 | 56 |
57 private: | 57 private: |
58 enum IsNewMasterEntry { | 58 enum IsNewMasterEntry { |
59 MAYBE, | 59 MAYBE, |
60 YES, | 60 YES, |
61 NO | 61 NO |
62 }; | 62 }; |
63 | 63 |
64 blink::WebApplicationCacheHostClient* client_; | 64 blink::WebApplicationCacheHostClient* client_; |
65 appcache::AppCacheBackend* backend_; | 65 AppCacheBackend* backend_; |
66 int host_id_; | 66 int host_id_; |
67 appcache::AppCacheStatus status_; | 67 AppCacheStatus status_; |
68 blink::WebURLResponse document_response_; | 68 blink::WebURLResponse document_response_; |
69 GURL document_url_; | 69 GURL document_url_; |
70 bool is_scheme_supported_; | 70 bool is_scheme_supported_; |
71 bool is_get_method_; | 71 bool is_get_method_; |
72 IsNewMasterEntry is_new_master_entry_; | 72 IsNewMasterEntry is_new_master_entry_; |
73 appcache::AppCacheInfo cache_info_; | 73 AppCacheInfo cache_info_; |
74 GURL original_main_resource_url_; // Used to detect redirection. | 74 GURL original_main_resource_url_; // Used to detect redirection. |
75 bool was_select_cache_called_; | 75 bool was_select_cache_called_; |
76 }; | 76 }; |
77 | 77 |
78 } // namespace content | 78 } // namespace content |
79 | 79 |
80 #endif // CONTENT_CHILD_APPCACHE_WEB_APPLICATION_CACHE_HOST_IMPL_H_ | 80 #endif // CONTENT_CHILD_APPCACHE_WEB_APPLICATION_CACHE_HOST_IMPL_H_ |
OLD | NEW |