Chromium Code Reviews| 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 CONTENT_COMMON_APPCACHE_APPCACHE_INTERFACES_H_ |
| 6 #define WEBKIT_COMMON_APPCACHE_APPCACHE_INTERFACES_H_ | 6 #define CONTENT_COMMON_APPCACHE_APPCACHE_INTERFACES_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "content/common/content_export.h" | |
| 14 #include "url/gurl.h" | 15 #include "url/gurl.h" |
| 15 #include "webkit/common/webkit_storage_common_export.h" | |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 class URLRequest; | 18 class URLRequest; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace appcache { | 21 namespace content { |
| 22 | 22 |
| 23 // Defines constants, types, and abstract classes used in the main | 23 // Defines constants, types, and abstract classes used in the main |
| 24 // process and in child processes. | 24 // process and in child processes. |
| 25 | 25 |
| 26 static const int kAppCacheNoHostId = 0; | 26 static const int kAppCacheNoHostId = 0; |
| 27 static const int64 kAppCacheNoCacheId = 0; | 27 static const int64 kAppCacheNoCacheId = 0; |
| 28 static const int64 kAppCacheNoResponseId = 0; | 28 static const int64 kAppCacheNoResponseId = 0; |
| 29 static const int64 kAppCacheUnknownCacheId = -1; | 29 static const int64 kAppCacheUnknownCacheId = -1; |
| 30 | 30 |
| 31 enum AppCacheStatus { | 31 enum AppCacheStatus { |
|
michaeln
2014/06/17 23:34:29
this is needed but not the other enums
| |
| 32 APPCACHE_STATUS_UNCACHED, | 32 APPCACHE_STATUS_UNCACHED, |
| 33 APPCACHE_STATUS_IDLE, | 33 APPCACHE_STATUS_IDLE, |
| 34 APPCACHE_STATUS_CHECKING, | 34 APPCACHE_STATUS_CHECKING, |
| 35 APPCACHE_STATUS_DOWNLOADING, | 35 APPCACHE_STATUS_DOWNLOADING, |
| 36 APPCACHE_STATUS_UPDATE_READY, | 36 APPCACHE_STATUS_UPDATE_READY, |
| 37 APPCACHE_STATUS_OBSOLETE, | 37 APPCACHE_STATUS_OBSOLETE, |
| 38 APPCACHE_STATUS_LAST = APPCACHE_STATUS_OBSOLETE | 38 APPCACHE_STATUS_LAST = APPCACHE_STATUS_OBSOLETE |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 enum AppCacheEventID { | 41 enum AppCacheEventID { |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 69 APPCACHE_SIGNATURE_ERROR, | 69 APPCACHE_SIGNATURE_ERROR, |
| 70 APPCACHE_RESOURCE_ERROR, | 70 APPCACHE_RESOURCE_ERROR, |
| 71 APPCACHE_CHANGED_ERROR, | 71 APPCACHE_CHANGED_ERROR, |
| 72 APPCACHE_ABORT_ERROR, | 72 APPCACHE_ABORT_ERROR, |
| 73 APPCACHE_QUOTA_ERROR, | 73 APPCACHE_QUOTA_ERROR, |
| 74 APPCACHE_POLICY_ERROR, | 74 APPCACHE_POLICY_ERROR, |
| 75 APPCACHE_UNKNOWN_ERROR, | 75 APPCACHE_UNKNOWN_ERROR, |
| 76 APPCACHE_ERROR_REASON_LAST = APPCACHE_UNKNOWN_ERROR | 76 APPCACHE_ERROR_REASON_LAST = APPCACHE_UNKNOWN_ERROR |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 struct WEBKIT_STORAGE_COMMON_EXPORT AppCacheInfo { | 79 struct CONTENT_EXPORT AppCacheInfo { |
|
michaeln
2014/06/17 23:34:29
this struct is needed but not the other structs
| |
| 80 AppCacheInfo(); | 80 AppCacheInfo(); |
| 81 ~AppCacheInfo(); | 81 ~AppCacheInfo(); |
| 82 | 82 |
| 83 GURL manifest_url; | 83 GURL manifest_url; |
| 84 base::Time creation_time; | 84 base::Time creation_time; |
| 85 base::Time last_update_time; | 85 base::Time last_update_time; |
| 86 base::Time last_access_time; | 86 base::Time last_access_time; |
| 87 int64 cache_id; | 87 int64 cache_id; |
| 88 int64 group_id; | 88 int64 group_id; |
| 89 AppCacheStatus status; | 89 AppCacheStatus status; |
| 90 int64 size; | 90 int64 size; |
| 91 bool is_complete; | 91 bool is_complete; |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 typedef std::vector<AppCacheInfo> AppCacheInfoVector; | 94 typedef std::vector<AppCacheInfo> AppCacheInfoVector; |
|
michaeln
2014/06/17 23:34:29
this is needed too
| |
| 95 | 95 |
| 96 // Type to hold information about a single appcache resource. | 96 // Type to hold information about a single appcache resource. |
| 97 struct WEBKIT_STORAGE_COMMON_EXPORT AppCacheResourceInfo { | 97 struct CONTENT_EXPORT AppCacheResourceInfo { |
| 98 AppCacheResourceInfo(); | 98 AppCacheResourceInfo(); |
| 99 ~AppCacheResourceInfo(); | 99 ~AppCacheResourceInfo(); |
| 100 | 100 |
| 101 GURL url; | 101 GURL url; |
| 102 int64 size; | 102 int64 size; |
| 103 bool is_master; | 103 bool is_master; |
| 104 bool is_manifest; | 104 bool is_manifest; |
| 105 bool is_intercept; | 105 bool is_intercept; |
| 106 bool is_fallback; | 106 bool is_fallback; |
| 107 bool is_foreign; | 107 bool is_foreign; |
| 108 bool is_explicit; | 108 bool is_explicit; |
| 109 int64 response_id; | 109 int64 response_id; |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 struct WEBKIT_STORAGE_COMMON_EXPORT AppCacheErrorDetails { | 112 struct CONTENT_EXPORT AppCacheErrorDetails { |
| 113 AppCacheErrorDetails(); | 113 AppCacheErrorDetails(); |
| 114 AppCacheErrorDetails(std::string message, | 114 AppCacheErrorDetails(std::string message, |
| 115 AppCacheErrorReason reason, | 115 AppCacheErrorReason reason, |
| 116 GURL url, | 116 GURL url, |
| 117 int status, | 117 int status, |
| 118 bool is_cross_origin); | 118 bool is_cross_origin); |
| 119 ~AppCacheErrorDetails(); | 119 ~AppCacheErrorDetails(); |
| 120 | 120 |
| 121 std::string message; | 121 std::string message; |
| 122 AppCacheErrorReason reason; | 122 AppCacheErrorReason reason; |
| 123 GURL url; | 123 GURL url; |
| 124 int status; | 124 int status; |
| 125 bool is_cross_origin; | 125 bool is_cross_origin; |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 typedef std::vector<AppCacheResourceInfo> AppCacheResourceInfoVector; | 128 typedef std::vector<AppCacheResourceInfo> AppCacheResourceInfoVector; |
| 129 | 129 |
| 130 struct WEBKIT_STORAGE_COMMON_EXPORT Namespace { | 130 struct CONTENT_EXPORT Namespace { |
|
michaeln
2014/06/17 23:34:29
this is an overly generic name for the larger cont
| |
| 131 Namespace(); // Type is set to APPCACHE_FALLBACK_NAMESPACE by default. | 131 Namespace(); // Type is set to APPCACHE_FALLBACK_NAMESPACE by default. |
| 132 Namespace(AppCacheNamespaceType type, const GURL& url, const GURL& target, | 132 Namespace(AppCacheNamespaceType type, const GURL& url, const GURL& target, |
| 133 bool is_pattern); | 133 bool is_pattern); |
| 134 Namespace(AppCacheNamespaceType type, const GURL& url, const GURL& target, | 134 Namespace(AppCacheNamespaceType type, const GURL& url, const GURL& target, |
| 135 bool is_pattern, bool is_executable); | 135 bool is_pattern, bool is_executable); |
| 136 ~Namespace(); | 136 ~Namespace(); |
| 137 | 137 |
| 138 bool IsMatch(const GURL& url) const; | 138 bool IsMatch(const GURL& url) const; |
| 139 | 139 |
| 140 AppCacheNamespaceType type; | 140 AppCacheNamespaceType type; |
| 141 GURL namespace_url; | 141 GURL namespace_url; |
| 142 GURL target_url; | 142 GURL target_url; |
| 143 bool is_pattern; | 143 bool is_pattern; |
| 144 bool is_executable; | 144 bool is_executable; |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 typedef std::vector<Namespace> NamespaceVector; | 147 typedef std::vector<Namespace> NamespaceVector; |
| 148 | 148 |
| 149 // Interface used by backend (browser-process) to talk to frontend (renderer). | 149 // Interface used by backend (browser-process) to talk to frontend (renderer). |
| 150 class WEBKIT_STORAGE_COMMON_EXPORT AppCacheFrontend { | 150 class CONTENT_EXPORT AppCacheFrontend { |
| 151 public: | 151 public: |
| 152 virtual void OnCacheSelected( | 152 virtual void OnCacheSelected( |
| 153 int host_id, const appcache::AppCacheInfo& info) = 0; | 153 int host_id, const AppCacheInfo& info) = 0; |
| 154 virtual void OnStatusChanged(const std::vector<int>& host_ids, | 154 virtual void OnStatusChanged(const std::vector<int>& host_ids, |
| 155 AppCacheStatus status) = 0; | 155 AppCacheStatus status) = 0; |
| 156 virtual void OnEventRaised(const std::vector<int>& host_ids, | 156 virtual void OnEventRaised(const std::vector<int>& host_ids, |
| 157 AppCacheEventID event_id) = 0; | 157 AppCacheEventID event_id) = 0; |
| 158 virtual void OnProgressEventRaised(const std::vector<int>& host_ids, | 158 virtual void OnProgressEventRaised(const std::vector<int>& host_ids, |
| 159 const GURL& url, | 159 const GURL& url, |
| 160 int num_total, int num_complete) = 0; | 160 int num_total, int num_complete) = 0; |
| 161 virtual void OnErrorEventRaised( | 161 virtual void OnErrorEventRaised( |
| 162 const std::vector<int>& host_ids, | 162 const std::vector<int>& host_ids, |
| 163 const appcache::AppCacheErrorDetails& details) = 0; | 163 const AppCacheErrorDetails& details) = 0; |
| 164 virtual void OnContentBlocked(int host_id, | 164 virtual void OnContentBlocked(int host_id, |
| 165 const GURL& manifest_url) = 0; | 165 const GURL& manifest_url) = 0; |
| 166 virtual void OnLogMessage(int host_id, AppCacheLogLevel log_level, | 166 virtual void OnLogMessage(int host_id, AppCacheLogLevel log_level, |
| 167 const std::string& message) = 0; | 167 const std::string& message) = 0; |
| 168 virtual ~AppCacheFrontend() {} | 168 virtual ~AppCacheFrontend() {} |
| 169 }; | 169 }; |
| 170 | 170 |
| 171 // Interface used by frontend (renderer) to talk to backend (browser-process). | 171 // Interface used by frontend (renderer) to talk to backend (browser-process). |
| 172 class WEBKIT_STORAGE_COMMON_EXPORT AppCacheBackend { | 172 class CONTENT_EXPORT AppCacheBackend { |
| 173 public: | 173 public: |
| 174 virtual void RegisterHost(int host_id) = 0; | 174 virtual void RegisterHost(int host_id) = 0; |
| 175 virtual void UnregisterHost(int host_id) = 0; | 175 virtual void UnregisterHost(int host_id) = 0; |
| 176 virtual void SetSpawningHostId(int host_id, int spawning_host_id) = 0; | 176 virtual void SetSpawningHostId(int host_id, int spawning_host_id) = 0; |
| 177 virtual void SelectCache(int host_id, | 177 virtual void SelectCache(int host_id, |
| 178 const GURL& document_url, | 178 const GURL& document_url, |
| 179 const int64 cache_document_was_loaded_from, | 179 const int64 cache_document_was_loaded_from, |
| 180 const GURL& manifest_url) = 0; | 180 const GURL& manifest_url) = 0; |
| 181 virtual void SelectCacheForWorker( | 181 virtual void SelectCacheForWorker( |
| 182 int host_id, | 182 int host_id, |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 194 int host_id, std::vector<AppCacheResourceInfo>* resource_infos) = 0; | 194 int host_id, std::vector<AppCacheResourceInfo>* resource_infos) = 0; |
| 195 | 195 |
| 196 protected: | 196 protected: |
| 197 virtual ~AppCacheBackend() {} | 197 virtual ~AppCacheBackend() {} |
| 198 }; | 198 }; |
| 199 | 199 |
| 200 // Useful string constants. | 200 // Useful string constants. |
| 201 // Note: These are also defined elsewhere in the chrome code base in | 201 // Note: These are also defined elsewhere in the chrome code base in |
| 202 // url_contants.h .cc, however the appcache library doesn't not have | 202 // url_contants.h .cc, however the appcache library doesn't not have |
| 203 // any dependencies on the chrome library, so we can't use them in here. | 203 // any dependencies on the chrome library, so we can't use them in here. |
| 204 WEBKIT_STORAGE_COMMON_EXPORT extern const char kHttpScheme[]; | 204 CONTENT_EXPORT extern const char kHttpScheme[]; |
| 205 WEBKIT_STORAGE_COMMON_EXPORT extern const char kHttpsScheme[]; | 205 CONTENT_EXPORT extern const char kHttpsScheme[]; |
| 206 WEBKIT_STORAGE_COMMON_EXPORT extern const char kHttpGETMethod[]; | 206 CONTENT_EXPORT extern const char kHttpGETMethod[]; |
| 207 WEBKIT_STORAGE_COMMON_EXPORT extern const char kHttpHEADMethod[]; | 207 CONTENT_EXPORT extern const char kHttpHEADMethod[]; |
|
michaeln
2014/06/17 23:34:29
definitely these (and the other two) str constants
| |
| 208 | 208 |
| 209 // CommandLine flag to turn this experimental feature on. | 209 // CommandLine flag to turn this experimental feature on. |
| 210 WEBKIT_STORAGE_COMMON_EXPORT extern const char kEnableExecutableHandlers[]; | 210 CONTENT_EXPORT extern const char kEnableExecutableHandlers[]; |
| 211 | 211 |
| 212 WEBKIT_STORAGE_COMMON_EXPORT bool IsSchemeSupported(const GURL& url); | 212 CONTENT_EXPORT bool IsSchemeSupported(const GURL& url); |
| 213 WEBKIT_STORAGE_COMMON_EXPORT bool IsMethodSupported(const std::string& method); | 213 CONTENT_EXPORT bool IsMethodSupported(const std::string& method); |
| 214 WEBKIT_STORAGE_COMMON_EXPORT bool IsSchemeAndMethodSupported( | 214 CONTENT_EXPORT bool IsSchemeAndMethodSupported( |
|
michaeln
2014/06/17 23:34:29
ditto these do not belong in public and also overl
| |
| 215 const net::URLRequest* request); | 215 const net::URLRequest* request); |
| 216 | 216 |
| 217 WEBKIT_STORAGE_COMMON_EXPORT extern const base::FilePath::CharType | 217 CONTENT_EXPORT extern const base::FilePath::CharType |
| 218 kAppCacheDatabaseName[]; | 218 kAppCacheDatabaseName[]; |
| 219 | 219 |
| 220 } // namespace | 220 } // namespace |
| 221 | 221 |
| 222 #endif // WEBKIT_COMMON_APPCACHE_APPCACHE_INTERFACES_H_ | 222 #endif // CONTENT_COMMON_APPCACHE_APPCACHE_INTERFACES_H_ |
| OLD | NEW |