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