| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_STORAGE_H_ | 5 #ifndef WEBKIT_APPCACHE_APPCACHE_STORAGE_H_ |
| 6 #define WEBKIT_APPCACHE_APPCACHE_STORAGE_H_ | 6 #define WEBKIT_APPCACHE_APPCACHE_STORAGE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 class AppCacheService; | 29 class AppCacheService; |
| 30 struct AppCacheInfoCollection; | 30 struct AppCacheInfoCollection; |
| 31 struct HttpResponseInfoIOBuffer; | 31 struct HttpResponseInfoIOBuffer; |
| 32 | 32 |
| 33 class APPCACHE_EXPORT AppCacheStorage { | 33 class APPCACHE_EXPORT AppCacheStorage { |
| 34 public: | 34 public: |
| 35 typedef std::map<GURL, int64> UsageMap; | 35 typedef std::map<GURL, int64> UsageMap; |
| 36 | 36 |
| 37 class APPCACHE_EXPORT Delegate { | 37 class APPCACHE_EXPORT Delegate { |
| 38 public: | 38 public: |
| 39 virtual ~Delegate() {} | |
| 40 | |
| 41 // If retrieval fails, 'collection' will be NULL. | 39 // If retrieval fails, 'collection' will be NULL. |
| 42 virtual void OnAllInfo(AppCacheInfoCollection* collection) {} | 40 virtual void OnAllInfo(AppCacheInfoCollection* collection) {} |
| 43 | 41 |
| 44 // If a load fails the 'cache' will be NULL. | 42 // If a load fails the 'cache' will be NULL. |
| 45 virtual void OnCacheLoaded(AppCache* cache, int64 cache_id) {} | 43 virtual void OnCacheLoaded(AppCache* cache, int64 cache_id) {} |
| 46 | 44 |
| 47 // If a load fails the 'group' will be NULL. | 45 // If a load fails the 'group' will be NULL. |
| 48 virtual void OnGroupLoaded( | 46 virtual void OnGroupLoaded( |
| 49 AppCacheGroup* group, const GURL& manifest_url) {} | 47 AppCacheGroup* group, const GURL& manifest_url) {} |
| 50 | 48 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 63 // If no response is found, entry.response_id() and | 61 // If no response is found, entry.response_id() and |
| 64 // fallback_entry.response_id() will be kNoResponseId. | 62 // fallback_entry.response_id() will be kNoResponseId. |
| 65 // If the response is the entry for an intercept or fallback | 63 // If the response is the entry for an intercept or fallback |
| 66 // namespace, the url of the namespece entry is returned. | 64 // namespace, the url of the namespece entry is returned. |
| 67 // If a response is found, the cache id and manifest url of the | 65 // If a response is found, the cache id and manifest url of the |
| 68 // containing cache and group are also returned. | 66 // containing cache and group are also returned. |
| 69 virtual void OnMainResponseFound( | 67 virtual void OnMainResponseFound( |
| 70 const GURL& url, const AppCacheEntry& entry, | 68 const GURL& url, const AppCacheEntry& entry, |
| 71 const GURL& namespace_entry_url, const AppCacheEntry& fallback_entry, | 69 const GURL& namespace_entry_url, const AppCacheEntry& fallback_entry, |
| 72 int64 cache_id, int64 group_id, const GURL& mainfest_url) {} | 70 int64 cache_id, int64 group_id, const GURL& mainfest_url) {} |
| 71 |
| 72 protected: |
| 73 virtual ~Delegate() {} |
| 73 }; | 74 }; |
| 74 | 75 |
| 75 explicit AppCacheStorage(AppCacheService* service); | 76 explicit AppCacheStorage(AppCacheService* service); |
| 76 virtual ~AppCacheStorage(); | 77 virtual ~AppCacheStorage(); |
| 77 | 78 |
| 78 // Schedules a task to retrieve basic info about all groups and caches | 79 // Schedules a task to retrieve basic info about all groups and caches |
| 79 // stored in the system. Upon completion the delegate will be called | 80 // stored in the system. Upon completion the delegate will be called |
| 80 // with the results. | 81 // with the results. |
| 81 virtual void GetAllInfo(Delegate* delegate) = 0; | 82 virtual void GetAllInfo(Delegate* delegate) = 0; |
| 82 | 83 |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 FRIEND_TEST_ALL_PREFIXES(AppCacheStorageTest, DelegateReferences); | 313 FRIEND_TEST_ALL_PREFIXES(AppCacheStorageTest, DelegateReferences); |
| 313 FRIEND_TEST_ALL_PREFIXES(AppCacheStorageTest, UsageMap); | 314 FRIEND_TEST_ALL_PREFIXES(AppCacheStorageTest, UsageMap); |
| 314 | 315 |
| 315 DISALLOW_COPY_AND_ASSIGN(AppCacheStorage); | 316 DISALLOW_COPY_AND_ASSIGN(AppCacheStorage); |
| 316 }; | 317 }; |
| 317 | 318 |
| 318 } // namespace appcache | 319 } // namespace appcache |
| 319 | 320 |
| 320 #endif // WEBKIT_APPCACHE_APPCACHE_STORAGE_H_ | 321 #endif // WEBKIT_APPCACHE_APPCACHE_STORAGE_H_ |
| 321 | 322 |
| OLD | NEW |