OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_HOST_H_ | 5 #ifndef WEBKIT_APPCACHE_APPCACHE_HOST_H_ |
6 #define WEBKIT_APPCACHE_APPCACHE_HOST_H_ | 6 #define WEBKIT_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/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // or by the update algorithm (see AppCacheUpdateJob). | 83 // or by the update algorithm (see AppCacheUpdateJob). |
84 void AssociateCache(AppCache* cache); | 84 void AssociateCache(AppCache* cache); |
85 | 85 |
86 // Adds a reference to the newest complete cache in a group, unless it's the | 86 // Adds a reference to the newest complete cache in a group, unless it's the |
87 // same as the cache that is currently associated with the host. | 87 // same as the cache that is currently associated with the host. |
88 void SetSwappableCache(AppCacheGroup* group); | 88 void SetSwappableCache(AppCacheGroup* group); |
89 | 89 |
90 // Used to ensure that a loaded appcache survives a frame navigation. | 90 // Used to ensure that a loaded appcache survives a frame navigation. |
91 void LoadMainResourceCache(int64 cache_id); | 91 void LoadMainResourceCache(int64 cache_id); |
92 | 92 |
| 93 // Used to notify the host that a fallback resource is being delivered as |
| 94 // the main resource of the page and to provide its url. |
| 95 void NotifyMainResourceFallback(const GURL& fallback_url); |
| 96 |
93 // Used to notify the host that the main resource was blocked by a policy. To | 97 // Used to notify the host that the main resource was blocked by a policy. To |
94 // work properly, this method needs to by invoked prior to cache selection. | 98 // work properly, this method needs to by invoked prior to cache selection. |
95 void NotifyMainResourceBlocked(const GURL& manifest_url); | 99 void NotifyMainResourceBlocked(const GURL& manifest_url); |
96 | 100 |
97 // Used by the update job to keep track of which hosts are associated | 101 // Used by the update job to keep track of which hosts are associated |
98 // with which pending master entries. | 102 // with which pending master entries. |
99 const GURL& pending_master_entry_url() const { | 103 const GURL& pending_master_entry_url() const { |
100 return new_master_entry_url_; | 104 return new_master_entry_url_; |
101 } | 105 } |
102 | 106 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // Since these are synchronous scriptable api calls in the client, | 195 // Since these are synchronous scriptable api calls in the client, |
192 // there can only be one type of callback pending. | 196 // there can only be one type of callback pending. |
193 // Also, we have to wait until we have a cache selection prior | 197 // Also, we have to wait until we have a cache selection prior |
194 // to responding to these calls, as cache selection involves | 198 // to responding to these calls, as cache selection involves |
195 // async loading of a cache or a group from storage. | 199 // async loading of a cache or a group from storage. |
196 GetStatusCallback* pending_get_status_callback_; | 200 GetStatusCallback* pending_get_status_callback_; |
197 StartUpdateCallback* pending_start_update_callback_; | 201 StartUpdateCallback* pending_start_update_callback_; |
198 SwapCacheCallback* pending_swap_cache_callback_; | 202 SwapCacheCallback* pending_swap_cache_callback_; |
199 void* pending_callback_param_; | 203 void* pending_callback_param_; |
200 | 204 |
| 205 // True if a fallback resource was delivered as the main resource. |
| 206 bool main_resource_was_fallback_; |
| 207 GURL fallback_url_; |
| 208 |
201 // True if requests for this host were blocked by a policy. | 209 // True if requests for this host were blocked by a policy. |
202 bool main_resource_blocked_; | 210 bool main_resource_blocked_; |
203 GURL blocked_manifest_url_; | 211 GURL blocked_manifest_url_; |
204 | 212 |
205 // Tells if info about associated cache is pending. Info is pending | 213 // Tells if info about associated cache is pending. Info is pending |
206 // when update job has not returned success yet. | 214 // when update job has not returned success yet. |
207 bool associated_cache_info_pending_; | 215 bool associated_cache_info_pending_; |
208 | 216 |
209 // List of objects observing us. | 217 // List of objects observing us. |
210 ObserverList<Observer> observers_; | 218 ObserverList<Observer> observers_; |
(...skipping 10 matching lines...) Expand all Loading... |
221 FRIEND_TEST_ALL_PREFIXES(AppCacheHostTest, SetSwappableCache); | 229 FRIEND_TEST_ALL_PREFIXES(AppCacheHostTest, SetSwappableCache); |
222 FRIEND_TEST_ALL_PREFIXES(AppCacheHostTest, ForDedicatedWorker); | 230 FRIEND_TEST_ALL_PREFIXES(AppCacheHostTest, ForDedicatedWorker); |
223 FRIEND_TEST_ALL_PREFIXES(AppCacheGroupTest, QueueUpdate); | 231 FRIEND_TEST_ALL_PREFIXES(AppCacheGroupTest, QueueUpdate); |
224 | 232 |
225 DISALLOW_COPY_AND_ASSIGN(AppCacheHost); | 233 DISALLOW_COPY_AND_ASSIGN(AppCacheHost); |
226 }; | 234 }; |
227 | 235 |
228 } // namespace appcache | 236 } // namespace appcache |
229 | 237 |
230 #endif // WEBKIT_APPCACHE_APPCACHE_HOST_H_ | 238 #endif // WEBKIT_APPCACHE_APPCACHE_HOST_H_ |
OLD | NEW |