| 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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/time.h" | 12 #include "base/time.h" |
| 13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
| 14 #include "webkit/storage/webkit_storage_export.h" | 14 #include "webkit/common/webkit_common_export.h" |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 class URLRequest; | 17 class URLRequest; |
| 18 } // namespace net | 18 } // namespace net |
| 19 | 19 |
| 20 namespace appcache { | 20 namespace appcache { |
| 21 | 21 |
| 22 // Defines constants, types, and abstract classes used in the main | 22 // Defines constants, types, and abstract classes used in the main |
| 23 // process and in child processes. | 23 // process and in child processes. |
| 24 | 24 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 54 LOG_WARNING = 2, | 54 LOG_WARNING = 2, |
| 55 LOG_ERROR = 3, | 55 LOG_ERROR = 3, |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 enum NamespaceType { | 58 enum NamespaceType { |
| 59 FALLBACK_NAMESPACE, | 59 FALLBACK_NAMESPACE, |
| 60 INTERCEPT_NAMESPACE, | 60 INTERCEPT_NAMESPACE, |
| 61 NETWORK_NAMESPACE | 61 NETWORK_NAMESPACE |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 struct WEBKIT_STORAGE_EXPORT AppCacheInfo { | 64 struct WEBKIT_COMMON_EXPORT AppCacheInfo { |
| 65 AppCacheInfo(); | 65 AppCacheInfo(); |
| 66 ~AppCacheInfo(); | 66 ~AppCacheInfo(); |
| 67 | 67 |
| 68 GURL manifest_url; | 68 GURL manifest_url; |
| 69 base::Time creation_time; | 69 base::Time creation_time; |
| 70 base::Time last_update_time; | 70 base::Time last_update_time; |
| 71 base::Time last_access_time; | 71 base::Time last_access_time; |
| 72 int64 cache_id; | 72 int64 cache_id; |
| 73 int64 group_id; | 73 int64 group_id; |
| 74 Status status; | 74 Status status; |
| 75 int64 size; | 75 int64 size; |
| 76 bool is_complete; | 76 bool is_complete; |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 typedef std::vector<AppCacheInfo> AppCacheInfoVector; | 79 typedef std::vector<AppCacheInfo> AppCacheInfoVector; |
| 80 | 80 |
| 81 // Type to hold information about a single appcache resource. | 81 // Type to hold information about a single appcache resource. |
| 82 struct WEBKIT_STORAGE_EXPORT AppCacheResourceInfo { | 82 struct WEBKIT_COMMON_EXPORT AppCacheResourceInfo { |
| 83 AppCacheResourceInfo(); | 83 AppCacheResourceInfo(); |
| 84 ~AppCacheResourceInfo(); | 84 ~AppCacheResourceInfo(); |
| 85 | 85 |
| 86 GURL url; | 86 GURL url; |
| 87 int64 size; | 87 int64 size; |
| 88 bool is_master; | 88 bool is_master; |
| 89 bool is_manifest; | 89 bool is_manifest; |
| 90 bool is_intercept; | 90 bool is_intercept; |
| 91 bool is_fallback; | 91 bool is_fallback; |
| 92 bool is_foreign; | 92 bool is_foreign; |
| 93 bool is_explicit; | 93 bool is_explicit; |
| 94 int64 response_id; | 94 int64 response_id; |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 typedef std::vector<AppCacheResourceInfo> AppCacheResourceInfoVector; | 97 typedef std::vector<AppCacheResourceInfo> AppCacheResourceInfoVector; |
| 98 | 98 |
| 99 struct WEBKIT_STORAGE_EXPORT Namespace { | 99 struct WEBKIT_COMMON_EXPORT Namespace { |
| 100 Namespace(); // Type is set to FALLBACK_NAMESPACE by default. | 100 Namespace(); // Type is set to FALLBACK_NAMESPACE by default. |
| 101 Namespace(NamespaceType type, const GURL& url, const GURL& target, | 101 Namespace(NamespaceType type, const GURL& url, const GURL& target, |
| 102 bool is_pattern); | 102 bool is_pattern); |
| 103 Namespace(NamespaceType type, const GURL& url, const GURL& target, | 103 Namespace(NamespaceType type, const GURL& url, const GURL& target, |
| 104 bool is_pattern, bool is_executable); | 104 bool is_pattern, bool is_executable); |
| 105 ~Namespace(); | 105 ~Namespace(); |
| 106 | 106 |
| 107 bool IsMatch(const GURL& url) const; | 107 bool IsMatch(const GURL& url) const; |
| 108 | 108 |
| 109 NamespaceType type; | 109 NamespaceType type; |
| 110 GURL namespace_url; | 110 GURL namespace_url; |
| 111 GURL target_url; | 111 GURL target_url; |
| 112 bool is_pattern; | 112 bool is_pattern; |
| 113 bool is_executable; | 113 bool is_executable; |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 typedef std::vector<Namespace> NamespaceVector; | 116 typedef std::vector<Namespace> NamespaceVector; |
| 117 | 117 |
| 118 // Interface used by backend (browser-process) to talk to frontend (renderer). | 118 // Interface used by backend (browser-process) to talk to frontend (renderer). |
| 119 class WEBKIT_STORAGE_EXPORT AppCacheFrontend { | 119 class WEBKIT_COMMON_EXPORT AppCacheFrontend { |
| 120 public: | 120 public: |
| 121 virtual void OnCacheSelected( | 121 virtual void OnCacheSelected( |
| 122 int host_id, const appcache::AppCacheInfo& info) = 0; | 122 int host_id, const appcache::AppCacheInfo& info) = 0; |
| 123 virtual void OnStatusChanged(const std::vector<int>& host_ids, | 123 virtual void OnStatusChanged(const std::vector<int>& host_ids, |
| 124 Status status) = 0; | 124 Status status) = 0; |
| 125 virtual void OnEventRaised(const std::vector<int>& host_ids, | 125 virtual void OnEventRaised(const std::vector<int>& host_ids, |
| 126 EventID event_id) = 0; | 126 EventID event_id) = 0; |
| 127 virtual void OnProgressEventRaised(const std::vector<int>& host_ids, | 127 virtual void OnProgressEventRaised(const std::vector<int>& host_ids, |
| 128 const GURL& url, | 128 const GURL& url, |
| 129 int num_total, int num_complete) = 0; | 129 int num_total, int num_complete) = 0; |
| 130 virtual void OnErrorEventRaised(const std::vector<int>& host_ids, | 130 virtual void OnErrorEventRaised(const std::vector<int>& host_ids, |
| 131 const std::string& message) = 0; | 131 const std::string& message) = 0; |
| 132 virtual void OnContentBlocked(int host_id, | 132 virtual void OnContentBlocked(int host_id, |
| 133 const GURL& manifest_url) = 0; | 133 const GURL& manifest_url) = 0; |
| 134 virtual void OnLogMessage(int host_id, LogLevel log_level, | 134 virtual void OnLogMessage(int host_id, LogLevel log_level, |
| 135 const std::string& message) = 0; | 135 const std::string& message) = 0; |
| 136 virtual ~AppCacheFrontend() {} | 136 virtual ~AppCacheFrontend() {} |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 // Interface used by frontend (renderer) to talk to backend (browser-process). | 139 // Interface used by frontend (renderer) to talk to backend (browser-process). |
| 140 class WEBKIT_STORAGE_EXPORT AppCacheBackend { | 140 class WEBKIT_COMMON_EXPORT AppCacheBackend { |
| 141 public: | 141 public: |
| 142 virtual void RegisterHost(int host_id) = 0; | 142 virtual void RegisterHost(int host_id) = 0; |
| 143 virtual void UnregisterHost(int host_id) = 0; | 143 virtual void UnregisterHost(int host_id) = 0; |
| 144 virtual void SetSpawningHostId(int host_id, int spawning_host_id) = 0; | 144 virtual void SetSpawningHostId(int host_id, int spawning_host_id) = 0; |
| 145 virtual void SelectCache(int host_id, | 145 virtual void SelectCache(int host_id, |
| 146 const GURL& document_url, | 146 const GURL& document_url, |
| 147 const int64 cache_document_was_loaded_from, | 147 const int64 cache_document_was_loaded_from, |
| 148 const GURL& manifest_url) = 0; | 148 const GURL& manifest_url) = 0; |
| 149 virtual void SelectCacheForWorker( | 149 virtual void SelectCacheForWorker( |
| 150 int host_id, | 150 int host_id, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 162 int host_id, std::vector<AppCacheResourceInfo>* resource_infos) = 0; | 162 int host_id, std::vector<AppCacheResourceInfo>* resource_infos) = 0; |
| 163 | 163 |
| 164 protected: | 164 protected: |
| 165 virtual ~AppCacheBackend() {} | 165 virtual ~AppCacheBackend() {} |
| 166 }; | 166 }; |
| 167 | 167 |
| 168 // Useful string constants. | 168 // Useful string constants. |
| 169 // Note: These are also defined elsewhere in the chrome code base in | 169 // Note: These are also defined elsewhere in the chrome code base in |
| 170 // url_contants.h .cc, however the appcache library doesn't not have | 170 // url_contants.h .cc, however the appcache library doesn't not have |
| 171 // any dependencies on the chrome library, so we can't use them in here. | 171 // any dependencies on the chrome library, so we can't use them in here. |
| 172 extern const char kHttpScheme[]; | 172 WEBKIT_COMMON_EXPORT extern const char kHttpScheme[]; |
| 173 extern const char kHttpsScheme[]; | 173 WEBKIT_COMMON_EXPORT extern const char kHttpsScheme[]; |
| 174 extern const char kHttpGETMethod[]; | 174 WEBKIT_COMMON_EXPORT extern const char kHttpGETMethod[]; |
| 175 extern const char kHttpHEADMethod[]; | 175 WEBKIT_COMMON_EXPORT extern const char kHttpHEADMethod[]; |
| 176 | 176 |
| 177 // CommandLine flag to turn this experimental feature on. | 177 // CommandLine flag to turn this experimental feature on. |
| 178 extern const char kEnableExecutableHandlers[]; | 178 WEBKIT_COMMON_EXPORT extern const char kEnableExecutableHandlers[]; |
| 179 | 179 |
| 180 WEBKIT_STORAGE_EXPORT void AddSupportedScheme(const char* scheme); | 180 WEBKIT_COMMON_EXPORT void AddSupportedScheme(const char* scheme); |
| 181 | 181 |
| 182 bool IsSchemeSupported(const GURL& url); | 182 WEBKIT_COMMON_EXPORT bool IsSchemeSupported(const GURL& url); |
| 183 bool IsMethodSupported(const std::string& method); | 183 WEBKIT_COMMON_EXPORT bool IsMethodSupported(const std::string& method); |
| 184 bool IsSchemeAndMethodSupported(const net::URLRequest* request); | 184 WEBKIT_COMMON_EXPORT bool IsSchemeAndMethodSupported( |
| 185 const net::URLRequest* request); |
| 185 | 186 |
| 186 WEBKIT_STORAGE_EXPORT extern const base::FilePath::CharType | 187 WEBKIT_COMMON_EXPORT extern const base::FilePath::CharType |
| 187 kAppCacheDatabaseName[]; | 188 kAppCacheDatabaseName[]; |
| 188 | 189 |
| 189 } // namespace | 190 } // namespace |
| 190 | 191 |
| 191 #endif // WEBKIT_COMMON_APPCACHE_APPCACHE_INTERFACES_H_ | 192 #endif // WEBKIT_COMMON_APPCACHE_APPCACHE_INTERFACES_H_ |
| OLD | NEW |