Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(960)

Side by Side Diff: content/browser/appcache/appcache.h

Issue 344493002: Move all remaining appcache-related code to content namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 CONTENT_BROWSER_APPCACHE_APPCACHE_H_
6 #define WEBKIT_BROWSER_APPCACHE_APPCACHE_H_ 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "content/browser/appcache/appcache_database.h"
16 #include "content/browser/appcache/appcache_entry.h"
17 #include "content/browser/appcache/manifest_parser.h"
18 #include "content/common/content_export.h"
15 #include "url/gurl.h" 19 #include "url/gurl.h"
16 #include "webkit/browser/appcache/appcache_database.h"
17 #include "webkit/browser/appcache/appcache_entry.h"
18 #include "webkit/browser/appcache/manifest_parser.h"
19 #include "webkit/browser/webkit_storage_browser_export.h"
20 20
21 namespace net { 21 namespace net {
22 class IOBuffer; 22 class IOBuffer;
23 } 23 }
24 24
25 namespace content { 25 namespace content {
26 FORWARD_DECLARE_TEST(AppCacheTest, InitializeWithManifest); 26 FORWARD_DECLARE_TEST(AppCacheTest, InitializeWithManifest);
jam 2014/06/25 21:51:14 i dont think you need these lines anymore? (also i
27 FORWARD_DECLARE_TEST(AppCacheTest, ToFromDatabaseRecords); 27 FORWARD_DECLARE_TEST(AppCacheTest, ToFromDatabaseRecords);
28 class AppCacheTest; 28 class AppCacheTest;
29 class AppCacheStorageImplTest; 29 class AppCacheStorageImplTest;
30 class AppCacheUpdateJobTest; 30 class AppCacheUpdateJobTest;
31 } 31 }
32 32
33 namespace appcache { 33 namespace content {
jam 2014/06/25 21:51:14 nit: merge this with the section above (also in ot
34 34
35 class AppCacheExecutableHandler; 35 class AppCacheExecutableHandler;
36 class AppCacheGroup; 36 class AppCacheGroup;
37 class AppCacheHost; 37 class AppCacheHost;
38 class AppCacheStorage; 38 class AppCacheStorage;
39 39
40 // Set of cached resources for an application. A cache exists as long as a 40 // Set of cached resources for an application. A cache exists as long as a
41 // host is associated with it, the cache is in an appcache group or the 41 // host is associated with it, the cache is in an appcache group or the
42 // cache is being created during an appcache upate. 42 // cache is being created during an appcache upate.
43 class WEBKIT_STORAGE_BROWSER_EXPORT AppCache 43 class CONTENT_EXPORT AppCache
44 : public base::RefCounted<AppCache> { 44 : public base::RefCounted<AppCache> {
45 public: 45 public:
46 typedef std::map<GURL, AppCacheEntry> EntryMap; 46 typedef std::map<GURL, AppCacheEntry> EntryMap;
47 typedef std::set<AppCacheHost*> AppCacheHosts; 47 typedef std::set<AppCacheHost*> AppCacheHosts;
48 48
49 AppCache(AppCacheStorage* storage, int64 cache_id); 49 AppCache(AppCacheStorage* storage, int64 cache_id);
50 50
51 int64 cache_id() const { return cache_id_; } 51 int64 cache_id() const { return cache_id_; }
52 52
53 AppCacheGroup* owning_group() const { return owning_group_.get(); } 53 AppCacheGroup* owning_group() const { return owning_group_.get(); }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 std::vector<AppCacheDatabase::OnlineWhiteListRecord>* whitelists); 136 std::vector<AppCacheDatabase::OnlineWhiteListRecord>* whitelists);
137 137
138 bool FindResponseForRequest(const GURL& url, 138 bool FindResponseForRequest(const GURL& url,
139 AppCacheEntry* found_entry, GURL* found_intercept_namespace, 139 AppCacheEntry* found_entry, GURL* found_intercept_namespace,
140 AppCacheEntry* found_fallback_entry, GURL* found_fallback_namespace, 140 AppCacheEntry* found_fallback_entry, GURL* found_fallback_namespace,
141 bool* found_network_namespace); 141 bool* found_network_namespace);
142 142
143 // Populates the 'infos' vector with an element per entry in the appcache. 143 // Populates the 'infos' vector with an element per entry in the appcache.
144 void ToResourceInfoVector(AppCacheResourceInfoVector* infos) const; 144 void ToResourceInfoVector(AppCacheResourceInfoVector* infos) const;
145 145
146 static const Namespace* FindNamespace( 146 static const AppCacheNamespace* FindNamespace(
147 const NamespaceVector& namespaces, 147 const AppCacheNamespaceVector& namespaces,
148 const GURL& url); 148 const GURL& url);
149 149
150 private: 150 private:
151 friend class AppCacheGroup; 151 friend class AppCacheGroup;
152 friend class AppCacheHost; 152 friend class AppCacheHost;
153 friend class content::AppCacheTest; 153 friend class content::AppCacheTest;
154 friend class content::AppCacheStorageImplTest; 154 friend class content::AppCacheStorageImplTest;
155 friend class content::AppCacheUpdateJobTest; 155 friend class content::AppCacheUpdateJobTest;
156 friend class base::RefCounted<AppCache>; 156 friend class base::RefCounted<AppCache>;
157 157
158 ~AppCache(); 158 ~AppCache();
159 159
160 // Use AppCacheGroup::Add/RemoveCache() to manipulate owning group. 160 // Use AppCacheGroup::Add/RemoveCache() to manipulate owning group.
161 void set_owning_group(AppCacheGroup* group) { owning_group_ = group; } 161 void set_owning_group(AppCacheGroup* group) { owning_group_ = group; }
162 162
163 // FindResponseForRequest helpers 163 // FindResponseForRequest helpers
164 const Namespace* FindInterceptNamespace(const GURL& url) { 164 const AppCacheNamespace* FindInterceptNamespace(const GURL& url) {
165 return FindNamespace(intercept_namespaces_, url); 165 return FindNamespace(intercept_namespaces_, url);
166 } 166 }
167 const Namespace* FindFallbackNamespace(const GURL& url) { 167 const AppCacheNamespace* FindFallbackNamespace(const GURL& url) {
168 return FindNamespace(fallback_namespaces_, url); 168 return FindNamespace(fallback_namespaces_, url);
169 } 169 }
170 bool IsInNetworkNamespace(const GURL& url) { 170 bool IsInNetworkNamespace(const GURL& url) {
171 return FindNamespace(online_whitelist_namespaces_, url) != NULL; 171 return FindNamespace(online_whitelist_namespaces_, url) != NULL;
172 } 172 }
173 173
174 GURL GetNamespaceEntryUrl(const NamespaceVector& namespaces, 174 GURL GetNamespaceEntryUrl(const AppCacheNamespaceVector& namespaces,
175 const GURL& namespace_url) const; 175 const GURL& namespace_url) const;
176 176
177 // Use AppCacheHost::Associate*Cache() to manipulate host association. 177 // Use AppCacheHost::Associate*Cache() to manipulate host association.
178 void AssociateHost(AppCacheHost* host) { 178 void AssociateHost(AppCacheHost* host) {
179 associated_hosts_.insert(host); 179 associated_hosts_.insert(host);
180 } 180 }
181 void UnassociateHost(AppCacheHost* host); 181 void UnassociateHost(AppCacheHost* host);
182 182
183 const int64 cache_id_; 183 const int64 cache_id_;
184 scoped_refptr<AppCacheGroup> owning_group_; 184 scoped_refptr<AppCacheGroup> owning_group_;
185 AppCacheHosts associated_hosts_; 185 AppCacheHosts associated_hosts_;
186 186
187 EntryMap entries_; // contains entries of all types 187 EntryMap entries_; // contains entries of all types
188 188
189 NamespaceVector intercept_namespaces_; 189 AppCacheNamespaceVector intercept_namespaces_;
190 NamespaceVector fallback_namespaces_; 190 AppCacheNamespaceVector fallback_namespaces_;
191 NamespaceVector online_whitelist_namespaces_; 191 AppCacheNamespaceVector online_whitelist_namespaces_;
192 bool online_whitelist_all_; 192 bool online_whitelist_all_;
193 193
194 bool is_complete_; 194 bool is_complete_;
195 195
196 // when this cache was last updated 196 // when this cache was last updated
197 base::Time update_time_; 197 base::Time update_time_;
198 198
199 int64 cache_size_; 199 int64 cache_size_;
200 200
201 typedef std::map<int64, AppCacheExecutableHandler*> HandlerMap; 201 typedef std::map<int64, AppCacheExecutableHandler*> HandlerMap;
202 HandlerMap executable_handlers_; 202 HandlerMap executable_handlers_;
203 203
204 // to notify storage when cache is deleted 204 // to notify storage when cache is deleted
205 AppCacheStorage* storage_; 205 AppCacheStorage* storage_;
206 206
207 FRIEND_TEST_ALL_PREFIXES(content::AppCacheTest, InitializeWithManifest); 207 FRIEND_TEST_ALL_PREFIXES(content::AppCacheTest, InitializeWithManifest);
208 FRIEND_TEST_ALL_PREFIXES(content::AppCacheTest, ToFromDatabaseRecords); 208 FRIEND_TEST_ALL_PREFIXES(content::AppCacheTest, ToFromDatabaseRecords);
209 DISALLOW_COPY_AND_ASSIGN(AppCache); 209 DISALLOW_COPY_AND_ASSIGN(AppCache);
210 }; 210 };
211 211
212 } // namespace appcache 212 } // namespace content
213 213
214 #endif // WEBKIT_BROWSER_APPCACHE_APPCACHE_H_ 214 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698