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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 const GURL& pending_master_entry_url() const { | 156 const GURL& pending_master_entry_url() const { |
157 return new_master_entry_url_; | 157 return new_master_entry_url_; |
158 } | 158 } |
159 | 159 |
160 int host_id() const { return host_id_; } | 160 int host_id() const { return host_id_; } |
161 AppCacheServiceImpl* service() const { return service_; } | 161 AppCacheServiceImpl* service() const { return service_; } |
162 AppCacheStorage* storage() const { return storage_; } | 162 AppCacheStorage* storage() const { return storage_; } |
163 AppCacheFrontend* frontend() const { return frontend_; } | 163 AppCacheFrontend* frontend() const { return frontend_; } |
164 AppCache* associated_cache() const { return associated_cache_.get(); } | 164 AppCache* associated_cache() const { return associated_cache_.get(); } |
165 | 165 |
| 166 void enable_cache_selection(bool enable) { |
| 167 is_cache_selection_enabled_ = enable; |
| 168 } |
| 169 |
166 bool is_selection_pending() const { | 170 bool is_selection_pending() const { |
167 return pending_selected_cache_id_ != kAppCacheNoCacheId || | 171 return pending_selected_cache_id_ != kAppCacheNoCacheId || |
168 !pending_selected_manifest_url_.is_empty(); | 172 !pending_selected_manifest_url_.is_empty(); |
169 } | 173 } |
170 | 174 |
171 const GURL& first_party_url() const { return first_party_url_; } | 175 const GURL& first_party_url() const { return first_party_url_; } |
172 | 176 |
173 // Methods to support cross site navigations. | 177 // Methods to support cross site navigations. |
174 void PrepareForTransfer(); | 178 void PrepareForTransfer(); |
175 void CompleteTransfer(int host_id, AppCacheFrontend* frontend); | 179 void CompleteTransfer(int host_id, AppCacheFrontend* frontend); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 // navigations. | 262 // navigations. |
259 scoped_refptr<AppCache> main_resource_cache_; | 263 scoped_refptr<AppCache> main_resource_cache_; |
260 int64 pending_main_resource_cache_id_; | 264 int64 pending_main_resource_cache_id_; |
261 | 265 |
262 // Cache loading is async, if we're loading a specific cache or group | 266 // Cache loading is async, if we're loading a specific cache or group |
263 // for the purposes of cache selection, one or the other of these will | 267 // for the purposes of cache selection, one or the other of these will |
264 // indicate which cache or group is being loaded. | 268 // indicate which cache or group is being loaded. |
265 int64 pending_selected_cache_id_; | 269 int64 pending_selected_cache_id_; |
266 GURL pending_selected_manifest_url_; | 270 GURL pending_selected_manifest_url_; |
267 | 271 |
| 272 // Used to avoid stepping on pages controlled by ServiceWorkers. |
| 273 bool is_cache_selection_enabled_; |
| 274 |
268 // A new master entry to be added to the cache, may be empty. | 275 // A new master entry to be added to the cache, may be empty. |
269 GURL new_master_entry_url_; | 276 GURL new_master_entry_url_; |
270 | 277 |
271 // The frontend proxy to deliver notifications to the child process. | 278 // The frontend proxy to deliver notifications to the child process. |
272 AppCacheFrontend* frontend_; | 279 AppCacheFrontend* frontend_; |
273 | 280 |
274 // Our central service object. | 281 // Our central service object. |
275 AppCacheServiceImpl* service_; | 282 AppCacheServiceImpl* service_; |
276 | 283 |
277 // And the equally central storage object, with a twist. In some error | 284 // And the equally central storage object, with a twist. In some error |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, SelectCacheAllowed); | 333 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, SelectCacheAllowed); |
327 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, SelectCacheBlocked); | 334 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, SelectCacheBlocked); |
328 FRIEND_TEST_ALL_PREFIXES(content::AppCacheTest, CleanupUnusedCache); | 335 FRIEND_TEST_ALL_PREFIXES(content::AppCacheTest, CleanupUnusedCache); |
329 | 336 |
330 DISALLOW_COPY_AND_ASSIGN(AppCacheHost); | 337 DISALLOW_COPY_AND_ASSIGN(AppCacheHost); |
331 }; | 338 }; |
332 | 339 |
333 } // namespace content | 340 } // namespace content |
334 | 341 |
335 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_HOST_H_ | 342 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_HOST_H_ |
OLD | NEW |