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 15 matching lines...) Expand all Loading... |
26 FORWARD_DECLARE_TEST(AppCacheGroupTest, QueueUpdate); | 26 FORWARD_DECLARE_TEST(AppCacheGroupTest, QueueUpdate); |
27 FORWARD_DECLARE_TEST(AppCacheHostTest, Basic); | 27 FORWARD_DECLARE_TEST(AppCacheHostTest, Basic); |
28 FORWARD_DECLARE_TEST(AppCacheHostTest, SelectNoCache); | 28 FORWARD_DECLARE_TEST(AppCacheHostTest, SelectNoCache); |
29 FORWARD_DECLARE_TEST(AppCacheHostTest, ForeignEntry); | 29 FORWARD_DECLARE_TEST(AppCacheHostTest, ForeignEntry); |
30 FORWARD_DECLARE_TEST(AppCacheHostTest, FailedCacheLoad); | 30 FORWARD_DECLARE_TEST(AppCacheHostTest, FailedCacheLoad); |
31 FORWARD_DECLARE_TEST(AppCacheHostTest, FailedGroupLoad); | 31 FORWARD_DECLARE_TEST(AppCacheHostTest, FailedGroupLoad); |
32 FORWARD_DECLARE_TEST(AppCacheHostTest, SetSwappableCache); | 32 FORWARD_DECLARE_TEST(AppCacheHostTest, SetSwappableCache); |
33 FORWARD_DECLARE_TEST(AppCacheHostTest, ForDedicatedWorker); | 33 FORWARD_DECLARE_TEST(AppCacheHostTest, ForDedicatedWorker); |
34 FORWARD_DECLARE_TEST(AppCacheHostTest, SelectCacheAllowed); | 34 FORWARD_DECLARE_TEST(AppCacheHostTest, SelectCacheAllowed); |
35 FORWARD_DECLARE_TEST(AppCacheHostTest, SelectCacheBlocked); | 35 FORWARD_DECLARE_TEST(AppCacheHostTest, SelectCacheBlocked); |
| 36 FORWARD_DECLARE_TEST(AppCacheHostTest, SelectCacheTwice); |
36 FORWARD_DECLARE_TEST(AppCacheTest, CleanupUnusedCache); | 37 FORWARD_DECLARE_TEST(AppCacheTest, CleanupUnusedCache); |
37 class AppCache; | 38 class AppCache; |
38 class AppCacheFrontend; | 39 class AppCacheFrontend; |
39 class AppCacheGroupTest; | 40 class AppCacheGroupTest; |
40 class AppCacheHostTest; | 41 class AppCacheHostTest; |
41 class AppCacheRequestHandler; | 42 class AppCacheRequestHandler; |
42 class AppCacheRequestHandlerTest; | 43 class AppCacheRequestHandlerTest; |
43 class AppCacheStorageImplTest; | 44 class AppCacheStorageImplTest; |
44 class AppCacheTest; | 45 class AppCacheTest; |
45 class AppCacheUpdateJobTest; | 46 class AppCacheUpdateJobTest; |
(...skipping 23 matching lines...) Expand all Loading... |
69 AppCacheHost(int host_id, AppCacheFrontend* frontend, | 70 AppCacheHost(int host_id, AppCacheFrontend* frontend, |
70 AppCacheServiceImpl* service); | 71 AppCacheServiceImpl* service); |
71 ~AppCacheHost() override; | 72 ~AppCacheHost() override; |
72 | 73 |
73 // Adds/removes an observer, the AppCacheHost does not take | 74 // Adds/removes an observer, the AppCacheHost does not take |
74 // ownership of the observer. | 75 // ownership of the observer. |
75 void AddObserver(Observer* observer); | 76 void AddObserver(Observer* observer); |
76 void RemoveObserver(Observer* observer); | 77 void RemoveObserver(Observer* observer); |
77 | 78 |
78 // Support for cache selection and scriptable method calls. | 79 // Support for cache selection and scriptable method calls. |
79 void SelectCache(const GURL& document_url, | 80 bool SelectCache(const GURL& document_url, |
80 const int64 cache_document_was_loaded_from, | 81 const int64 cache_document_was_loaded_from, |
81 const GURL& manifest_url); | 82 const GURL& manifest_url); |
82 void SelectCacheForWorker(int parent_process_id, | 83 bool SelectCacheForWorker(int parent_process_id, |
83 int parent_host_id); | 84 int parent_host_id); |
84 void SelectCacheForSharedWorker(int64 appcache_id); | 85 bool SelectCacheForSharedWorker(int64 appcache_id); |
85 void MarkAsForeignEntry(const GURL& document_url, | 86 bool MarkAsForeignEntry(const GURL& document_url, |
86 int64 cache_document_was_loaded_from); | 87 int64 cache_document_was_loaded_from); |
87 void GetStatusWithCallback(const GetStatusCallback& callback, | 88 void GetStatusWithCallback(const GetStatusCallback& callback, |
88 void* callback_param); | 89 void* callback_param); |
89 void StartUpdateWithCallback(const StartUpdateCallback& callback, | 90 void StartUpdateWithCallback(const StartUpdateCallback& callback, |
90 void* callback_param); | 91 void* callback_param); |
91 void SwapCacheWithCallback(const SwapCacheCallback& callback, | 92 void SwapCacheWithCallback(const SwapCacheCallback& callback, |
92 void* callback_param); | 93 void* callback_param); |
93 | 94 |
94 // Called prior to the main resource load. When the system contains multiple | 95 // Called prior to the main resource load. When the system contains multiple |
95 // candidates for a main resource load, the appcache preferred by the host | 96 // candidates for a main resource load, the appcache preferred by the host |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // with which pending master entries. | 157 // with which pending master entries. |
157 const GURL& pending_master_entry_url() const { | 158 const GURL& pending_master_entry_url() const { |
158 return new_master_entry_url_; | 159 return new_master_entry_url_; |
159 } | 160 } |
160 | 161 |
161 int host_id() const { return host_id_; } | 162 int host_id() const { return host_id_; } |
162 AppCacheServiceImpl* service() const { return service_; } | 163 AppCacheServiceImpl* service() const { return service_; } |
163 AppCacheStorage* storage() const { return storage_; } | 164 AppCacheStorage* storage() const { return storage_; } |
164 AppCacheFrontend* frontend() const { return frontend_; } | 165 AppCacheFrontend* frontend() const { return frontend_; } |
165 AppCache* associated_cache() const { return associated_cache_.get(); } | 166 AppCache* associated_cache() const { return associated_cache_.get(); } |
166 bool was_select_cache_called() const { return was_select_cache_called_; } | |
167 | 167 |
168 void enable_cache_selection(bool enable) { | 168 void enable_cache_selection(bool enable) { |
169 is_cache_selection_enabled_ = enable; | 169 is_cache_selection_enabled_ = enable; |
170 } | 170 } |
171 | 171 |
172 bool is_selection_pending() const { | 172 bool is_selection_pending() const { |
173 return pending_selected_cache_id_ != kAppCacheNoCacheId || | 173 return pending_selected_cache_id_ != kAppCacheNoCacheId || |
174 !pending_selected_manifest_url_.is_empty(); | 174 !pending_selected_manifest_url_.is_empty(); |
175 } | 175 } |
176 | 176 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 FRIEND_TEST_ALL_PREFIXES(content::AppCacheGroupTest, QueueUpdate); | 329 FRIEND_TEST_ALL_PREFIXES(content::AppCacheGroupTest, QueueUpdate); |
330 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, Basic); | 330 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, Basic); |
331 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, SelectNoCache); | 331 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, SelectNoCache); |
332 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, ForeignEntry); | 332 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, ForeignEntry); |
333 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, FailedCacheLoad); | 333 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, FailedCacheLoad); |
334 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, FailedGroupLoad); | 334 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, FailedGroupLoad); |
335 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, SetSwappableCache); | 335 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, SetSwappableCache); |
336 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, ForDedicatedWorker); | 336 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, ForDedicatedWorker); |
337 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, SelectCacheAllowed); | 337 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, SelectCacheAllowed); |
338 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, SelectCacheBlocked); | 338 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, SelectCacheBlocked); |
| 339 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, SelectCacheTwice); |
339 FRIEND_TEST_ALL_PREFIXES(content::AppCacheTest, CleanupUnusedCache); | 340 FRIEND_TEST_ALL_PREFIXES(content::AppCacheTest, CleanupUnusedCache); |
340 | 341 |
341 DISALLOW_COPY_AND_ASSIGN(AppCacheHost); | 342 DISALLOW_COPY_AND_ASSIGN(AppCacheHost); |
342 }; | 343 }; |
343 | 344 |
344 } // namespace content | 345 } // namespace content |
345 | 346 |
346 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_HOST_H_ | 347 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_HOST_H_ |
OLD | NEW |