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 WEBKIT_COMMON_APPCACHE_APPCACHE_INTERFACES_H_ | 5 #ifndef WEBKIT_COMMON_APPCACHE_APPCACHE_INTERFACES_H_ |
6 #define WEBKIT_COMMON_APPCACHE_APPCACHE_INTERFACES_H_ | 6 #define WEBKIT_COMMON_APPCACHE_APPCACHE_INTERFACES_H_ |
7 | 7 |
| 8 #include <map> |
8 #include <string> | 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
12 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
13 #include "base/time/time.h" | 14 #include "base/time/time.h" |
14 #include "url/gurl.h" | 15 #include "url/gurl.h" |
15 #include "webkit/common/webkit_storage_common_export.h" | 16 #include "webkit/common/webkit_storage_common_export.h" |
16 | 17 |
17 namespace net { | 18 namespace net { |
18 class URLRequest; | 19 class URLRequest; |
19 } | 20 } |
20 | 21 |
21 namespace appcache { | 22 namespace appcache { |
22 | 23 |
23 // Defines constants, types, and abstract classes used in the main | 24 // Defines constants, types, and abstract classes used in the main |
24 // process and in child processes. | 25 // process and in child processes. |
25 | 26 |
26 static const int kNoHostId = 0; | 27 static const int kNoHostId = 0; |
27 static const int64 kNoCacheId = 0; | 28 static const int64 kNoCacheId = 0; |
28 static const int64 kNoResponseId = 0; | 29 static const int64 kNoResponseId = 0; |
| 30 static const int64 kSynthesizedResponseId = -1; |
29 static const int64 kUnknownCacheId = -1; | 31 static const int64 kUnknownCacheId = -1; |
30 | 32 |
31 enum Status { | 33 enum Status { |
32 UNCACHED, | 34 UNCACHED, |
33 IDLE, | 35 IDLE, |
34 CHECKING, | 36 CHECKING, |
35 DOWNLOADING, | 37 DOWNLOADING, |
36 UPDATE_READY, | 38 UPDATE_READY, |
37 OBSOLETE | 39 OBSOLETE |
38 }; | 40 }; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 ~AppCacheResourceInfo(); | 87 ~AppCacheResourceInfo(); |
86 | 88 |
87 GURL url; | 89 GURL url; |
88 int64 size; | 90 int64 size; |
89 bool is_master; | 91 bool is_master; |
90 bool is_manifest; | 92 bool is_manifest; |
91 bool is_intercept; | 93 bool is_intercept; |
92 bool is_fallback; | 94 bool is_fallback; |
93 bool is_foreign; | 95 bool is_foreign; |
94 bool is_explicit; | 96 bool is_explicit; |
| 97 bool is_executable; |
| 98 std::string intercept_target_url; |
95 int64 response_id; | 99 int64 response_id; |
96 }; | 100 }; |
97 | 101 |
98 typedef std::vector<AppCacheResourceInfo> AppCacheResourceInfoVector; | 102 typedef std::vector<AppCacheResourceInfo> AppCacheResourceInfoVector; |
99 | 103 |
100 struct WEBKIT_STORAGE_COMMON_EXPORT Namespace { | 104 struct WEBKIT_STORAGE_COMMON_EXPORT Namespace { |
101 Namespace(); // Type is set to FALLBACK_NAMESPACE by default. | 105 Namespace(); // Type is set to FALLBACK_NAMESPACE by default. |
102 Namespace(NamespaceType type, const GURL& url, const GURL& target, | 106 Namespace(NamespaceType type, const GURL& url, const GURL& target, |
103 bool is_pattern); | 107 bool is_pattern); |
104 Namespace(NamespaceType type, const GURL& url, const GURL& target, | 108 Namespace(NamespaceType type, const GURL& url, const GURL& target, |
(...skipping 22 matching lines...) Expand all Loading... |
127 EventID event_id) = 0; | 131 EventID event_id) = 0; |
128 virtual void OnProgressEventRaised(const std::vector<int>& host_ids, | 132 virtual void OnProgressEventRaised(const std::vector<int>& host_ids, |
129 const GURL& url, | 133 const GURL& url, |
130 int num_total, int num_complete) = 0; | 134 int num_total, int num_complete) = 0; |
131 virtual void OnErrorEventRaised(const std::vector<int>& host_ids, | 135 virtual void OnErrorEventRaised(const std::vector<int>& host_ids, |
132 const std::string& message) = 0; | 136 const std::string& message) = 0; |
133 virtual void OnContentBlocked(int host_id, | 137 virtual void OnContentBlocked(int host_id, |
134 const GURL& manifest_url) = 0; | 138 const GURL& manifest_url) = 0; |
135 virtual void OnLogMessage(int host_id, LogLevel log_level, | 139 virtual void OnLogMessage(int host_id, LogLevel log_level, |
136 const std::string& message) = 0; | 140 const std::string& message) = 0; |
| 141 virtual void OnControllerReady(int host_id) = 0; |
137 virtual ~AppCacheFrontend() {} | 142 virtual ~AppCacheFrontend() {} |
138 }; | 143 }; |
139 | 144 |
140 // Interface used by frontend (renderer) to talk to backend (browser-process). | 145 // Interface used by frontend (renderer) to talk to backend (browser-process). |
141 class WEBKIT_STORAGE_COMMON_EXPORT AppCacheBackend { | 146 class WEBKIT_STORAGE_COMMON_EXPORT AppCacheBackend { |
142 public: | 147 public: |
143 virtual void RegisterHost(int host_id) = 0; | 148 virtual void RegisterHost(int host_id) = 0; |
144 virtual void UnregisterHost(int host_id) = 0; | 149 virtual void UnregisterHost(int host_id) = 0; |
| 150 virtual void RegisterController(int host_id, |
| 151 const GURL& document_url, |
| 152 const string16& pattern, |
| 153 const GURL& controller_url) = 0; |
| 154 virtual void UnregisterController(int host_id, |
| 155 const GURL& document_url, |
| 156 const string16& pattern) = 0; |
145 virtual void SetSpawningHostId(int host_id, int spawning_host_id) = 0; | 157 virtual void SetSpawningHostId(int host_id, int spawning_host_id) = 0; |
146 virtual void SelectCache(int host_id, | 158 virtual void SelectCache(int host_id, |
147 const GURL& document_url, | 159 const GURL& document_url, |
148 const int64 cache_document_was_loaded_from, | 160 const int64 cache_document_was_loaded_from, |
149 const GURL& manifest_url) = 0; | 161 const GURL& manifest_url) = 0; |
150 virtual void SelectCacheForWorker( | 162 virtual void SelectCacheForWorker( |
151 int host_id, | 163 int host_id, |
152 int parent_process_id, | 164 int parent_process_id, |
153 int parent_host_id) = 0; | 165 int parent_host_id) = 0; |
154 virtual void SelectCacheForSharedWorker( | 166 virtual void SelectCacheForSharedWorker( |
(...skipping 26 matching lines...) Expand all Loading... |
181 WEBKIT_STORAGE_COMMON_EXPORT void AddSupportedScheme(const char* scheme); | 193 WEBKIT_STORAGE_COMMON_EXPORT void AddSupportedScheme(const char* scheme); |
182 | 194 |
183 WEBKIT_STORAGE_COMMON_EXPORT bool IsSchemeSupported(const GURL& url); | 195 WEBKIT_STORAGE_COMMON_EXPORT bool IsSchemeSupported(const GURL& url); |
184 WEBKIT_STORAGE_COMMON_EXPORT bool IsMethodSupported(const std::string& method); | 196 WEBKIT_STORAGE_COMMON_EXPORT bool IsMethodSupported(const std::string& method); |
185 WEBKIT_STORAGE_COMMON_EXPORT bool IsSchemeAndMethodSupported( | 197 WEBKIT_STORAGE_COMMON_EXPORT bool IsSchemeAndMethodSupported( |
186 const net::URLRequest* request); | 198 const net::URLRequest* request); |
187 | 199 |
188 WEBKIT_STORAGE_COMMON_EXPORT extern const base::FilePath::CharType | 200 WEBKIT_STORAGE_COMMON_EXPORT extern const base::FilePath::CharType |
189 kAppCacheDatabaseName[]; | 201 kAppCacheDatabaseName[]; |
190 | 202 |
| 203 |
| 204 class WEBKIT_STORAGE_COMMON_EXPORT AppCacheExecutableHandlerInterfaces { |
| 205 public: |
| 206 struct WEBKIT_STORAGE_COMMON_EXPORT Request { |
| 207 GURL url; |
| 208 std::string method; /* probably an enum somewhere? */ |
| 209 std::string referrer; /* string because URLRequest::referrer i
s a string */ |
| 210 std::map<std::string, std::string> headers; |
| 211 bool is_main_resource_load; |
| 212 |
| 213 Request(); |
| 214 ~Request(); |
| 215 }; |
| 216 |
| 217 // A handler can respond with either a response or defer to the network. |
| 218 struct WEBKIT_STORAGE_COMMON_EXPORT Response { |
| 219 int status_code; |
| 220 string16 status_text; |
| 221 string16 blob_id; |
| 222 bool use_default; /* overrides all other settings */ |
| 223 std::map<string16, string16> headers; |
| 224 |
| 225 Response(); |
| 226 ~Response(); |
| 227 }; |
| 228 }; |
| 229 |
191 } // namespace | 230 } // namespace |
192 | 231 |
193 #endif // WEBKIT_COMMON_APPCACHE_APPCACHE_INTERFACES_H_ | 232 #endif // WEBKIT_COMMON_APPCACHE_APPCACHE_INTERFACES_H_ |
OLD | NEW |