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 "third_party/WebKit/public/platform/WebURLResponse.h" | 10 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
11 #include "third_party/WebKit/public/platform/WebVector.h" | 11 #include "third_party/WebKit/public/platform/WebVector.h" |
| 12 #include "third_party/WebKit/public/web/WebApplicationCacheHost.h" |
12 #include "third_party/WebKit/public/web/WebApplicationCacheHostClient.h" | 13 #include "third_party/WebKit/public/web/WebApplicationCacheHostClient.h" |
13 #include "url/gurl.h" | 14 #include "url/gurl.h" |
14 #include "webkit/common/appcache/appcache_interfaces.h" | 15 #include "webkit/common/appcache/appcache_interfaces.h" |
15 | 16 |
16 namespace WebKit { | 17 namespace WebKit { |
17 class WebFrame; | 18 class WebFrame; |
18 } | 19 } |
19 | 20 |
20 namespace content { | 21 namespace content { |
21 | 22 |
(...skipping 15 matching lines...) Expand all Loading... |
37 WebKit::WebApplicationCacheHostClient* client() const { return client_; } | 38 WebKit::WebApplicationCacheHostClient* client() const { return client_; } |
38 | 39 |
39 virtual void OnCacheSelected(const appcache::AppCacheInfo& info); | 40 virtual void OnCacheSelected(const appcache::AppCacheInfo& info); |
40 void OnStatusChanged(appcache::Status); | 41 void OnStatusChanged(appcache::Status); |
41 void OnEventRaised(appcache::EventID); | 42 void OnEventRaised(appcache::EventID); |
42 void OnProgressEventRaised(const GURL& url, int num_total, int num_complete); | 43 void OnProgressEventRaised(const GURL& url, int num_total, int num_complete); |
43 void OnErrorEventRaised(const std::string& message); | 44 void OnErrorEventRaised(const std::string& message); |
44 virtual void OnLogMessage(appcache::LogLevel log_level, | 45 virtual void OnLogMessage(appcache::LogLevel log_level, |
45 const std::string& message) {} | 46 const std::string& message) {} |
46 virtual void OnContentBlocked(const GURL& manifest_url) {} | 47 virtual void OnContentBlocked(const GURL& manifest_url) {} |
| 48 virtual void OnControllerReady(); |
47 | 49 |
48 // WebKit::WebApplicationCacheHost: | 50 // WebKit::WebApplicationCacheHost: |
49 virtual void willStartMainResourceRequest(WebKit::WebURLRequest&, | 51 virtual void willStartMainResourceRequest(WebKit::WebURLRequest&, |
50 const WebKit::WebFrame*); | 52 const WebKit::WebFrame*); |
51 virtual void willStartSubResourceRequest(WebKit::WebURLRequest&); | 53 virtual void willStartSubResourceRequest(WebKit::WebURLRequest&); |
52 virtual void selectCacheWithoutManifest(); | 54 virtual void selectCacheWithoutManifest(); |
53 virtual bool selectCacheWithManifest(const WebKit::WebURL& manifestURL); | 55 virtual bool selectCacheWithManifest(const WebKit::WebURL& manifestURL); |
54 virtual void didReceiveResponseForMainResource(const WebKit::WebURLResponse&); | 56 virtual void didReceiveResponseForMainResource(const WebKit::WebURLResponse&); |
55 virtual void didReceiveDataForMainResource(const char* data, int len); | 57 virtual void didReceiveDataForMainResource(const char* data, int len); |
56 virtual void didFinishLoadingMainResource(bool success); | 58 virtual void didFinishLoadingMainResource(bool success); |
57 virtual WebKit::WebApplicationCacheHost::Status status(); | 59 virtual WebKit::WebApplicationCacheHost::Status status(); |
58 virtual bool startUpdate(); | 60 virtual bool startUpdate(); |
59 virtual bool swapCache(); | 61 virtual bool swapCache(); |
60 virtual void getResourceList(WebKit::WebVector<ResourceInfo>* resources); | 62 virtual void getResourceList(WebKit::WebVector<ResourceInfo>* resources); |
61 virtual void getAssociatedCacheInfo(CacheInfo* info); | 63 virtual void getAssociatedCacheInfo(CacheInfo* info); |
62 | 64 |
| 65 // HACK, should be encapsulated in WebNavigationControllerHost or something |
| 66 virtual void registerController(const WebKit::WebString& pattern, |
| 67 const WebKit::WebURL&); |
| 68 virtual void unregisterController(const WebKit::WebString& pattern); |
| 69 |
63 private: | 70 private: |
64 enum IsNewMasterEntry { | 71 enum IsNewMasterEntry { |
65 MAYBE, | 72 MAYBE, |
66 YES, | 73 YES, |
67 NO | 74 NO |
68 }; | 75 }; |
69 | 76 |
70 WebKit::WebApplicationCacheHostClient* client_; | 77 WebKit::WebApplicationCacheHostClient* client_; |
71 appcache::AppCacheBackend* backend_; | 78 appcache::AppCacheBackend* backend_; |
72 int host_id_; | 79 int host_id_; |
73 appcache::Status status_; | 80 appcache::Status status_; |
74 WebKit::WebURLResponse document_response_; | 81 WebKit::WebURLResponse document_response_; |
75 GURL document_url_; | 82 GURL document_url_; |
76 bool is_scheme_supported_; | 83 bool is_scheme_supported_; |
77 bool is_get_method_; | 84 bool is_get_method_; |
78 IsNewMasterEntry is_new_master_entry_; | 85 IsNewMasterEntry is_new_master_entry_; |
79 appcache::AppCacheInfo cache_info_; | 86 appcache::AppCacheInfo cache_info_; |
80 GURL original_main_resource_url_; // Used to detect redirection. | 87 GURL original_main_resource_url_; // Used to detect redirection. |
81 bool was_select_cache_called_; | 88 bool was_select_cache_called_; |
82 }; | 89 }; |
83 | 90 |
84 } // namespace content | 91 } // namespace content |
85 | 92 |
86 #endif // CONTENT_CHILD_APPCACHE_WEB_APPLICATION_CACHE_HOST_IMPL_H_ | 93 #endif // CONTENT_CHILD_APPCACHE_WEB_APPLICATION_CACHE_HOST_IMPL_H_ |
OLD | NEW |