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 CONTENT_BROWSER_APPCACHE_APPCACHE_HOST_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_HOST_H_ |
6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_HOST_H_ | 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_HOST_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 virtual void OnCacheSelectionComplete(AppCacheHost* host) = 0; | 61 virtual void OnCacheSelectionComplete(AppCacheHost* host) = 0; |
62 | 62 |
63 // Called just prior to the instance being deleted. | 63 // Called just prior to the instance being deleted. |
64 virtual void OnDestructionImminent(AppCacheHost* host) = 0; | 64 virtual void OnDestructionImminent(AppCacheHost* host) = 0; |
65 | 65 |
66 virtual ~Observer() {} | 66 virtual ~Observer() {} |
67 }; | 67 }; |
68 | 68 |
69 AppCacheHost(int host_id, AppCacheFrontend* frontend, | 69 AppCacheHost(int host_id, AppCacheFrontend* frontend, |
70 AppCacheServiceImpl* service); | 70 AppCacheServiceImpl* service); |
71 virtual ~AppCacheHost(); | 71 ~AppCacheHost() override; |
72 | 72 |
73 // Adds/removes an observer, the AppCacheHost does not take | 73 // Adds/removes an observer, the AppCacheHost does not take |
74 // ownership of the observer. | 74 // ownership of the observer. |
75 void AddObserver(Observer* observer); | 75 void AddObserver(Observer* observer); |
76 void RemoveObserver(Observer* observer); | 76 void RemoveObserver(Observer* observer); |
77 | 77 |
78 // Support for cache selection and scriptable method calls. | 78 // Support for cache selection and scriptable method calls. |
79 void SelectCache(const GURL& document_url, | 79 void SelectCache(const GURL& document_url, |
80 const int64 cache_document_was_loaded_from, | 80 const int64 cache_document_was_loaded_from, |
81 const GURL& manifest_url); | 81 const GURL& manifest_url); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 friend class content::AppCacheUpdateJobTest; | 185 friend class content::AppCacheUpdateJobTest; |
186 | 186 |
187 AppCacheStatus GetStatus(); | 187 AppCacheStatus GetStatus(); |
188 void LoadSelectedCache(int64 cache_id); | 188 void LoadSelectedCache(int64 cache_id); |
189 void LoadOrCreateGroup(const GURL& manifest_url); | 189 void LoadOrCreateGroup(const GURL& manifest_url); |
190 | 190 |
191 // See public Associate*Host() methods above. | 191 // See public Associate*Host() methods above. |
192 void AssociateCacheHelper(AppCache* cache, const GURL& manifest_url); | 192 void AssociateCacheHelper(AppCache* cache, const GURL& manifest_url); |
193 | 193 |
194 // AppCacheStorage::Delegate impl | 194 // AppCacheStorage::Delegate impl |
195 virtual void OnCacheLoaded(AppCache* cache, int64 cache_id) override; | 195 void OnCacheLoaded(AppCache* cache, int64 cache_id) override; |
196 virtual void OnGroupLoaded(AppCacheGroup* group, | 196 void OnGroupLoaded(AppCacheGroup* group, const GURL& manifest_url) override; |
197 const GURL& manifest_url) override; | |
198 // AppCacheServiceImpl::Observer impl | 197 // AppCacheServiceImpl::Observer impl |
199 virtual void OnServiceReinitialized( | 198 void OnServiceReinitialized( |
200 AppCacheStorageReference* old_storage_ref) override; | 199 AppCacheStorageReference* old_storage_ref) override; |
201 | 200 |
202 void FinishCacheSelection(AppCache* cache, AppCacheGroup* group); | 201 void FinishCacheSelection(AppCache* cache, AppCacheGroup* group); |
203 void DoPendingGetStatus(); | 202 void DoPendingGetStatus(); |
204 void DoPendingStartUpdate(); | 203 void DoPendingStartUpdate(); |
205 void DoPendingSwapCache(); | 204 void DoPendingSwapCache(); |
206 | 205 |
207 void ObserveGroupBeingUpdated(AppCacheGroup* group); | 206 void ObserveGroupBeingUpdated(AppCacheGroup* group); |
208 | 207 |
209 // AppCacheGroup::UpdateObserver methods. | 208 // AppCacheGroup::UpdateObserver methods. |
210 virtual void OnUpdateComplete(AppCacheGroup* group) override; | 209 void OnUpdateComplete(AppCacheGroup* group) override; |
211 | 210 |
212 // Returns true if this host is for a dedicated worker context. | 211 // Returns true if this host is for a dedicated worker context. |
213 bool is_for_dedicated_worker() const { | 212 bool is_for_dedicated_worker() const { |
214 return parent_host_id_ != kAppCacheNoHostId; | 213 return parent_host_id_ != kAppCacheNoHostId; |
215 } | 214 } |
216 | 215 |
217 // Returns the parent context's host instance. This is only valid | 216 // Returns the parent context's host instance. This is only valid |
218 // to call when this instance is_for_dedicated_worker. | 217 // to call when this instance is_for_dedicated_worker. |
219 AppCacheHost* GetParentAppCacheHost() const; | 218 AppCacheHost* GetParentAppCacheHost() const; |
220 | 219 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, SelectCacheAllowed); | 332 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, SelectCacheAllowed); |
334 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, SelectCacheBlocked); | 333 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, SelectCacheBlocked); |
335 FRIEND_TEST_ALL_PREFIXES(content::AppCacheTest, CleanupUnusedCache); | 334 FRIEND_TEST_ALL_PREFIXES(content::AppCacheTest, CleanupUnusedCache); |
336 | 335 |
337 DISALLOW_COPY_AND_ASSIGN(AppCacheHost); | 336 DISALLOW_COPY_AND_ASSIGN(AppCacheHost); |
338 }; | 337 }; |
339 | 338 |
340 } // namespace content | 339 } // namespace content |
341 | 340 |
342 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_HOST_H_ | 341 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_HOST_H_ |
OLD | NEW |