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_BROWSER_APPCACHE_APPCACHE_H_ | 5 #ifndef WEBKIT_BROWSER_APPCACHE_APPCACHE_H_ |
6 #define WEBKIT_BROWSER_APPCACHE_APPCACHE_H_ | 6 #define WEBKIT_BROWSER_APPCACHE_APPCACHE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 int64 response_id, GURL* optional_url); | 67 int64 response_id, GURL* optional_url); |
68 const EntryMap& entries() const { return entries_; } | 68 const EntryMap& entries() const { return entries_; } |
69 | 69 |
70 // The AppCache owns the collection of executable handlers that have | 70 // The AppCache owns the collection of executable handlers that have |
71 // been started for this instance. The getter looks up an existing | 71 // been started for this instance. The getter looks up an existing |
72 // handler returning null if not found, the GetOrCreate method will | 72 // handler returning null if not found, the GetOrCreate method will |
73 // cons one up if not found. | 73 // cons one up if not found. |
74 // Do not store the returned ptrs, they're owned by 'this'. | 74 // Do not store the returned ptrs, they're owned by 'this'. |
75 AppCacheExecutableHandler* GetExecutableHandler(int64 response_id); | 75 AppCacheExecutableHandler* GetExecutableHandler(int64 response_id); |
76 AppCacheExecutableHandler* GetOrCreateExecutableHandler( | 76 AppCacheExecutableHandler* GetOrCreateExecutableHandler( |
77 int64 response_id, net::IOBuffer* handler_source); | 77 int64 response_id, const std::string& raw_handler_source); |
78 | 78 |
79 // Returns the URL of the resource used as entry for 'namespace_url'. | 79 // Returns the URL of the resource used as entry for 'namespace_url'. |
80 GURL GetFallbackEntryUrl(const GURL& namespace_url) const { | 80 GURL GetFallbackEntryUrl(const GURL& namespace_url) const { |
81 return GetNamespaceEntryUrl(fallback_namespaces_, namespace_url); | 81 return GetNamespaceEntryUrl(fallback_namespaces_, namespace_url); |
82 } | 82 } |
83 GURL GetInterceptEntryUrl(const GURL& namespace_url) const { | 83 GURL GetInterceptEntryUrl(const GURL& namespace_url) const { |
84 return GetNamespaceEntryUrl(intercept_namespaces_, namespace_url); | 84 return GetNamespaceEntryUrl(intercept_namespaces_, namespace_url); |
85 } | 85 } |
86 | 86 |
87 AppCacheHosts& associated_hosts() { return associated_hosts_; } | 87 AppCacheHosts& associated_hosts() { return associated_hosts_; } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 AppCacheEntry* found_fallback_entry, GURL* found_fallback_namespace, | 132 AppCacheEntry* found_fallback_entry, GURL* found_fallback_namespace, |
133 bool* found_network_namespace); | 133 bool* found_network_namespace); |
134 | 134 |
135 // Populates the 'infos' vector with an element per entry in the appcache. | 135 // Populates the 'infos' vector with an element per entry in the appcache. |
136 void ToResourceInfoVector(AppCacheResourceInfoVector* infos) const; | 136 void ToResourceInfoVector(AppCacheResourceInfoVector* infos) const; |
137 | 137 |
138 static const Namespace* FindNamespace( | 138 static const Namespace* FindNamespace( |
139 const NamespaceVector& namespaces, | 139 const NamespaceVector& namespaces, |
140 const GURL& url); | 140 const GURL& url); |
141 | 141 |
| 142 const Namespace* FindInterceptNamespace(const GURL& url) { |
| 143 return FindNamespace(intercept_namespaces_, url); |
| 144 } |
142 private: | 145 private: |
143 friend class AppCacheGroup; | 146 friend class AppCacheGroup; |
144 friend class AppCacheHost; | 147 friend class AppCacheHost; |
145 friend class AppCacheStorageImplTest; | 148 friend class AppCacheStorageImplTest; |
146 friend class AppCacheUpdateJobTest; | 149 friend class AppCacheUpdateJobTest; |
147 friend class base::RefCounted<AppCache>; | 150 friend class base::RefCounted<AppCache>; |
148 | 151 |
149 ~AppCache(); | 152 ~AppCache(); |
150 | 153 |
151 // Use AppCacheGroup::Add/RemoveCache() to manipulate owning group. | 154 // Use AppCacheGroup::Add/RemoveCache() to manipulate owning group. |
152 void set_owning_group(AppCacheGroup* group) { owning_group_ = group; } | 155 void set_owning_group(AppCacheGroup* group) { owning_group_ = group; } |
153 | 156 |
154 // FindResponseForRequest helpers | 157 // FindResponseForRequest helpers |
155 const Namespace* FindInterceptNamespace(const GURL& url) { | |
156 return FindNamespace(intercept_namespaces_, url); | |
157 } | |
158 const Namespace* FindFallbackNamespace(const GURL& url) { | 158 const Namespace* FindFallbackNamespace(const GURL& url) { |
159 return FindNamespace(fallback_namespaces_, url); | 159 return FindNamespace(fallback_namespaces_, url); |
160 } | 160 } |
161 bool IsInNetworkNamespace(const GURL& url) { | 161 bool IsInNetworkNamespace(const GURL& url) { |
162 return FindNamespace(online_whitelist_namespaces_, url) != NULL; | 162 return FindNamespace(online_whitelist_namespaces_, url) != NULL; |
163 } | 163 } |
164 | 164 |
165 GURL GetNamespaceEntryUrl(const NamespaceVector& namespaces, | 165 GURL GetNamespaceEntryUrl(const NamespaceVector& namespaces, |
166 const GURL& namespace_url) const; | 166 const GURL& namespace_url) const; |
167 | 167 |
(...skipping 28 matching lines...) Expand all Loading... |
196 AppCacheStorage* storage_; | 196 AppCacheStorage* storage_; |
197 | 197 |
198 FRIEND_TEST_ALL_PREFIXES(AppCacheTest, InitializeWithManifest); | 198 FRIEND_TEST_ALL_PREFIXES(AppCacheTest, InitializeWithManifest); |
199 FRIEND_TEST_ALL_PREFIXES(AppCacheTest, ToFromDatabaseRecords); | 199 FRIEND_TEST_ALL_PREFIXES(AppCacheTest, ToFromDatabaseRecords); |
200 DISALLOW_COPY_AND_ASSIGN(AppCache); | 200 DISALLOW_COPY_AND_ASSIGN(AppCache); |
201 }; | 201 }; |
202 | 202 |
203 } // namespace appcache | 203 } // namespace appcache |
204 | 204 |
205 #endif // WEBKIT_BROWSER_APPCACHE_APPCACHE_H_ | 205 #endif // WEBKIT_BROWSER_APPCACHE_APPCACHE_H_ |
OLD | NEW |