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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/weak_ptr.h" |
16 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
17 #include "content/browser/appcache/appcache_group.h" | 18 #include "content/browser/appcache/appcache_group.h" |
18 #include "content/browser/appcache/appcache_service_impl.h" | 19 #include "content/browser/appcache/appcache_service_impl.h" |
19 #include "content/browser/appcache/appcache_storage.h" | 20 #include "content/browser/appcache/appcache_storage.h" |
20 #include "content/common/appcache_interfaces.h" | 21 #include "content/common/appcache_interfaces.h" |
21 #include "content/common/content_export.h" | 22 #include "content/common/content_export.h" |
22 #include "content/public/common/resource_type.h" | 23 #include "content/public/common/resource_type.h" |
23 #include "url/gurl.h" | 24 #include "url/gurl.h" |
24 | 25 |
25 namespace net { | 26 namespace net { |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 return pending_selected_cache_id_ != kAppCacheNoCacheId || | 188 return pending_selected_cache_id_ != kAppCacheNoCacheId || |
188 !pending_selected_manifest_url_.is_empty(); | 189 !pending_selected_manifest_url_.is_empty(); |
189 } | 190 } |
190 | 191 |
191 const GURL& first_party_url() const { return first_party_url_; } | 192 const GURL& first_party_url() const { return first_party_url_; } |
192 | 193 |
193 // Methods to support cross site navigations. | 194 // Methods to support cross site navigations. |
194 void PrepareForTransfer(); | 195 void PrepareForTransfer(); |
195 void CompleteTransfer(int host_id, AppCacheFrontend* frontend); | 196 void CompleteTransfer(int host_id, AppCacheFrontend* frontend); |
196 | 197 |
| 198 // Returns a weak pointer reference to the host. |
| 199 base::WeakPtr<AppCacheHost> GetWeakPtr(); |
| 200 |
197 private: | 201 private: |
198 friend class content::AppCacheHostTest; | 202 friend class content::AppCacheHostTest; |
199 friend class content::AppCacheStorageImplTest; | 203 friend class content::AppCacheStorageImplTest; |
200 friend class content::AppCacheRequestHandlerTest; | 204 friend class content::AppCacheRequestHandlerTest; |
201 friend class content::AppCacheUpdateJobTest; | 205 friend class content::AppCacheUpdateJobTest; |
202 | 206 |
203 AppCacheStatus GetStatus(); | 207 AppCacheStatus GetStatus(); |
204 void LoadSelectedCache(int64_t cache_id); | 208 void LoadSelectedCache(int64_t cache_id); |
205 void LoadOrCreateGroup(const GURL& manifest_url); | 209 void LoadOrCreateGroup(const GURL& manifest_url); |
206 | 210 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, ForeignEntry); | 350 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, ForeignEntry); |
347 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, FailedCacheLoad); | 351 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, FailedCacheLoad); |
348 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, FailedGroupLoad); | 352 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, FailedGroupLoad); |
349 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, SetSwappableCache); | 353 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, SetSwappableCache); |
350 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, ForDedicatedWorker); | 354 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, ForDedicatedWorker); |
351 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, SelectCacheAllowed); | 355 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, SelectCacheAllowed); |
352 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, SelectCacheBlocked); | 356 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, SelectCacheBlocked); |
353 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, SelectCacheTwice); | 357 FRIEND_TEST_ALL_PREFIXES(content::AppCacheHostTest, SelectCacheTwice); |
354 FRIEND_TEST_ALL_PREFIXES(content::AppCacheTest, CleanupUnusedCache); | 358 FRIEND_TEST_ALL_PREFIXES(content::AppCacheTest, CleanupUnusedCache); |
355 | 359 |
| 360 base::WeakPtrFactory<AppCacheHost> weak_factory_; |
| 361 |
356 DISALLOW_COPY_AND_ASSIGN(AppCacheHost); | 362 DISALLOW_COPY_AND_ASSIGN(AppCacheHost); |
357 }; | 363 }; |
358 | 364 |
359 } // namespace content | 365 } // namespace content |
360 | 366 |
361 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_HOST_H_ | 367 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_HOST_H_ |
OLD | NEW |