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