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_APPCACHE_APPCACHE_INTERFACES_H_ | 5 #ifndef WEBKIT_APPCACHE_APPCACHE_INTERFACES_H_ |
6 #define WEBKIT_APPCACHE_APPCACHE_INTERFACES_H_ | 6 #define WEBKIT_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/file_path.h" | 11 #include "base/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/appcache/appcache_export.h" | 14 #include "webkit/storage/webkit_storage_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 27 matching lines...) Expand all Loading... |
52 LOG_INFO, | 52 LOG_INFO, |
53 LOG_WARNING, | 53 LOG_WARNING, |
54 LOG_ERROR, | 54 LOG_ERROR, |
55 }; | 55 }; |
56 | 56 |
57 enum NamespaceType { | 57 enum NamespaceType { |
58 FALLBACK_NAMESPACE, | 58 FALLBACK_NAMESPACE, |
59 INTERCEPT_NAMESPACE | 59 INTERCEPT_NAMESPACE |
60 }; | 60 }; |
61 | 61 |
62 struct APPCACHE_EXPORT AppCacheInfo { | 62 struct WEBKIT_STORAGE_EXPORT AppCacheInfo { |
63 AppCacheInfo(); | 63 AppCacheInfo(); |
64 ~AppCacheInfo(); | 64 ~AppCacheInfo(); |
65 | 65 |
66 GURL manifest_url; | 66 GURL manifest_url; |
67 base::Time creation_time; | 67 base::Time creation_time; |
68 base::Time last_update_time; | 68 base::Time last_update_time; |
69 base::Time last_access_time; | 69 base::Time last_access_time; |
70 int64 cache_id; | 70 int64 cache_id; |
71 int64 group_id; | 71 int64 group_id; |
72 Status status; | 72 Status status; |
73 int64 size; | 73 int64 size; |
74 bool is_complete; | 74 bool is_complete; |
75 }; | 75 }; |
76 | 76 |
77 typedef std::vector<AppCacheInfo> AppCacheInfoVector; | 77 typedef std::vector<AppCacheInfo> AppCacheInfoVector; |
78 | 78 |
79 // Type to hold information about a single appcache resource. | 79 // Type to hold information about a single appcache resource. |
80 struct APPCACHE_EXPORT AppCacheResourceInfo { | 80 struct WEBKIT_STORAGE_EXPORT AppCacheResourceInfo { |
81 AppCacheResourceInfo(); | 81 AppCacheResourceInfo(); |
82 ~AppCacheResourceInfo(); | 82 ~AppCacheResourceInfo(); |
83 | 83 |
84 GURL url; | 84 GURL url; |
85 int64 size; | 85 int64 size; |
86 bool is_master; | 86 bool is_master; |
87 bool is_manifest; | 87 bool is_manifest; |
88 bool is_intercept; | 88 bool is_intercept; |
89 bool is_fallback; | 89 bool is_fallback; |
90 bool is_foreign; | 90 bool is_foreign; |
91 bool is_explicit; | 91 bool is_explicit; |
92 int64 response_id; | 92 int64 response_id; |
93 }; | 93 }; |
94 | 94 |
95 typedef std::vector<AppCacheResourceInfo> AppCacheResourceInfoVector; | 95 typedef std::vector<AppCacheResourceInfo> AppCacheResourceInfoVector; |
96 | 96 |
97 struct APPCACHE_EXPORT Namespace { | 97 struct WEBKIT_STORAGE_EXPORT Namespace { |
98 Namespace(); // Type is set to FALLBACK_NAMESPACE by default. | 98 Namespace(); // Type is set to FALLBACK_NAMESPACE by default. |
99 Namespace(NamespaceType type, const GURL& url, const GURL& target); | 99 Namespace(NamespaceType type, const GURL& url, const GURL& target); |
100 ~Namespace(); | 100 ~Namespace(); |
101 | 101 |
102 NamespaceType type; | 102 NamespaceType type; |
103 GURL namespace_url; | 103 GURL namespace_url; |
104 GURL target_url; | 104 GURL target_url; |
105 }; | 105 }; |
106 | 106 |
107 typedef std::vector<Namespace> NamespaceVector; | 107 typedef std::vector<Namespace> NamespaceVector; |
108 | 108 |
109 // Interface used by backend (browser-process) to talk to frontend (renderer). | 109 // Interface used by backend (browser-process) to talk to frontend (renderer). |
110 class APPCACHE_EXPORT AppCacheFrontend { | 110 class WEBKIT_STORAGE_EXPORT AppCacheFrontend { |
111 public: | 111 public: |
112 virtual void OnCacheSelected( | 112 virtual void OnCacheSelected( |
113 int host_id, const appcache::AppCacheInfo& info) = 0; | 113 int host_id, const appcache::AppCacheInfo& info) = 0; |
114 virtual void OnStatusChanged(const std::vector<int>& host_ids, | 114 virtual void OnStatusChanged(const std::vector<int>& host_ids, |
115 Status status) = 0; | 115 Status status) = 0; |
116 virtual void OnEventRaised(const std::vector<int>& host_ids, | 116 virtual void OnEventRaised(const std::vector<int>& host_ids, |
117 EventID event_id) = 0; | 117 EventID event_id) = 0; |
118 virtual void OnProgressEventRaised(const std::vector<int>& host_ids, | 118 virtual void OnProgressEventRaised(const std::vector<int>& host_ids, |
119 const GURL& url, | 119 const GURL& url, |
120 int num_total, int num_complete) = 0; | 120 int num_total, int num_complete) = 0; |
121 virtual void OnErrorEventRaised(const std::vector<int>& host_ids, | 121 virtual void OnErrorEventRaised(const std::vector<int>& host_ids, |
122 const std::string& message) = 0; | 122 const std::string& message) = 0; |
123 virtual void OnContentBlocked(int host_id, | 123 virtual void OnContentBlocked(int host_id, |
124 const GURL& manifest_url) = 0; | 124 const GURL& manifest_url) = 0; |
125 virtual void OnLogMessage(int host_id, LogLevel log_level, | 125 virtual void OnLogMessage(int host_id, LogLevel log_level, |
126 const std::string& message) = 0; | 126 const std::string& message) = 0; |
127 virtual ~AppCacheFrontend() {} | 127 virtual ~AppCacheFrontend() {} |
128 }; | 128 }; |
129 | 129 |
130 // Interface used by frontend (renderer) to talk to backend (browser-process). | 130 // Interface used by frontend (renderer) to talk to backend (browser-process). |
131 class APPCACHE_EXPORT AppCacheBackend { | 131 class WEBKIT_STORAGE_EXPORT AppCacheBackend { |
132 public: | 132 public: |
133 virtual void RegisterHost(int host_id) = 0; | 133 virtual void RegisterHost(int host_id) = 0; |
134 virtual void UnregisterHost(int host_id) = 0; | 134 virtual void UnregisterHost(int host_id) = 0; |
135 virtual void SetSpawningHostId(int host_id, int spawning_host_id) = 0; | 135 virtual void SetSpawningHostId(int host_id, int spawning_host_id) = 0; |
136 virtual void SelectCache(int host_id, | 136 virtual void SelectCache(int host_id, |
137 const GURL& document_url, | 137 const GURL& document_url, |
138 const int64 cache_document_was_loaded_from, | 138 const int64 cache_document_was_loaded_from, |
139 const GURL& manifest_url) = 0; | 139 const GURL& manifest_url) = 0; |
140 virtual void SelectCacheForWorker( | 140 virtual void SelectCacheForWorker( |
141 int host_id, | 141 int host_id, |
(...skipping 20 matching lines...) Expand all Loading... |
162 // any dependencies on the chrome library, so we can't use them in here. | 162 // any dependencies on the chrome library, so we can't use them in here. |
163 extern const char kHttpScheme[]; | 163 extern const char kHttpScheme[]; |
164 extern const char kHttpsScheme[]; | 164 extern const char kHttpsScheme[]; |
165 extern const char kHttpGETMethod[]; | 165 extern const char kHttpGETMethod[]; |
166 extern const char kHttpHEADMethod[]; | 166 extern const char kHttpHEADMethod[]; |
167 | 167 |
168 bool IsSchemeSupported(const GURL& url); | 168 bool IsSchemeSupported(const GURL& url); |
169 bool IsMethodSupported(const std::string& method); | 169 bool IsMethodSupported(const std::string& method); |
170 bool IsSchemeAndMethodSupported(const net::URLRequest* request); | 170 bool IsSchemeAndMethodSupported(const net::URLRequest* request); |
171 | 171 |
172 APPCACHE_EXPORT extern const FilePath::CharType kAppCacheDatabaseName[]; | 172 WEBKIT_STORAGE_EXPORT extern const FilePath::CharType kAppCacheDatabaseName[]; |
173 | 173 |
174 } // namespace | 174 } // namespace |
175 | 175 |
176 #endif // WEBKIT_APPCACHE_APPCACHE_INTERFACES_H_ | 176 #endif // WEBKIT_APPCACHE_APPCACHE_INTERFACES_H_ |
OLD | NEW |