OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_BROWSER_APPCACHE_APPCACHE_SERVICE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_SERVICE_IMPL_H_ |
6 #define WEBKIT_BROWSER_APPCACHE_APPCACHE_SERVICE_IMPL_H_ | 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_SERVICE_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 | 10 |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
| 17 #include "content/common/appcache_interfaces.h" |
| 18 #include "content/common/content_export.h" |
| 19 #include "content/public/browser/appcache_service.h" |
17 #include "net/base/completion_callback.h" | 20 #include "net/base/completion_callback.h" |
18 #include "net/base/net_errors.h" | 21 #include "net/base/net_errors.h" |
19 #include "webkit/browser/appcache/appcache_service.h" | |
20 #include "webkit/browser/quota/quota_manager_proxy.h" | 22 #include "webkit/browser/quota/quota_manager_proxy.h" |
21 #include "webkit/browser/webkit_storage_browser_export.h" | |
22 #include "webkit/common/appcache/appcache_interfaces.h" | |
23 | 23 |
24 namespace net { | 24 namespace net { |
25 class URLRequestContext; | 25 class URLRequestContext; |
26 } // namespace net | 26 } // namespace net |
27 | 27 |
28 namespace base { | 28 namespace base { |
29 class FilePath; | 29 class FilePath; |
30 class MessageLoopProxy; | 30 class MessageLoopProxy; |
31 } | 31 } |
32 | 32 |
33 namespace content { | 33 namespace content { |
34 FORWARD_DECLARE_TEST(AppCacheServiceImplTest, ScheduleReinitialize); | 34 FORWARD_DECLARE_TEST(AppCacheServiceImplTest, ScheduleReinitialize); |
35 class AppCacheServiceImplTest; | 35 class AppCacheServiceImplTest; |
36 class AppCacheStorageImplTest; | 36 class AppCacheStorageImplTest; |
37 } | 37 } |
38 | 38 |
39 namespace quota { | 39 namespace quota { |
40 class SpecialStoragePolicy; | 40 class SpecialStoragePolicy; |
41 } | 41 } |
42 | 42 |
43 namespace appcache { | 43 namespace content { |
44 | 44 |
45 class AppCacheBackendImpl; | 45 class AppCacheBackendImpl; |
46 class AppCacheExecutableHandlerFactory; | 46 class AppCacheExecutableHandlerFactory; |
47 class AppCacheQuotaClient; | 47 class AppCacheQuotaClient; |
48 class AppCachePolicy; | 48 class AppCachePolicy; |
49 class AppCacheStorage; | 49 class AppCacheStorage; |
50 | 50 |
51 // Refcounted container to manage the lifetime of the old storage instance | 51 // Refcounted container to manage the lifetime of the old storage instance |
52 // during Reinitialization. | 52 // during Reinitialization. |
53 class WEBKIT_STORAGE_BROWSER_EXPORT AppCacheStorageReference | 53 class CONTENT_EXPORT AppCacheStorageReference |
54 : public base::RefCounted<AppCacheStorageReference> { | 54 : public base::RefCounted<AppCacheStorageReference> { |
55 public: | 55 public: |
56 AppCacheStorage* storage() const { return storage_.get(); } | 56 AppCacheStorage* storage() const { return storage_.get(); } |
57 private: | 57 private: |
58 friend class AppCacheServiceImpl; | 58 friend class AppCacheServiceImpl; |
59 friend class base::RefCounted<AppCacheStorageReference>; | 59 friend class base::RefCounted<AppCacheStorageReference>; |
60 AppCacheStorageReference(scoped_ptr<AppCacheStorage> storage); | 60 AppCacheStorageReference(scoped_ptr<AppCacheStorage> storage); |
61 ~AppCacheStorageReference(); | 61 ~AppCacheStorageReference(); |
62 | 62 |
63 scoped_ptr<AppCacheStorage> storage_; | 63 scoped_ptr<AppCacheStorage> storage_; |
64 }; | 64 }; |
65 | 65 |
66 // Class that manages the application cache service. Sends notifications | 66 // Class that manages the application cache service. Sends notifications |
67 // to many frontends. One instance per user-profile. Each instance has | 67 // to many frontends. One instance per user-profile. Each instance has |
68 // exclusive access to its cache_directory on disk. | 68 // exclusive access to its cache_directory on disk. |
69 class WEBKIT_STORAGE_BROWSER_EXPORT AppCacheServiceImpl | 69 class CONTENT_EXPORT AppCacheServiceImpl |
70 : public AppCacheService { | 70 : public AppCacheService { |
71 public: | 71 public: |
72 | 72 |
73 class WEBKIT_STORAGE_BROWSER_EXPORT Observer { | 73 class CONTENT_EXPORT Observer { |
74 public: | 74 public: |
75 // An observer method to inform consumers of reinitialzation. Managing | 75 // An observer method to inform consumers of reinitialzation. Managing |
76 // the lifetime of the old storage instance is a delicate process. | 76 // the lifetime of the old storage instance is a delicate process. |
77 // Consumers can keep the old disabled instance alive by hanging on to the | 77 // Consumers can keep the old disabled instance alive by hanging on to the |
78 // ref provided. | 78 // ref provided. |
79 virtual void OnServiceReinitialized( | 79 virtual void OnServiceReinitialized( |
80 AppCacheStorageReference* old_storage_ref) = 0; | 80 AppCacheStorageReference* old_storage_ref) = 0; |
81 virtual ~Observer() {} | 81 virtual ~Observer() {} |
82 }; | 82 }; |
83 | 83 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 // If true, nothing (not even session-only data) should be deleted on exit. | 215 // If true, nothing (not even session-only data) should be deleted on exit. |
216 bool force_keep_session_state_; | 216 bool force_keep_session_state_; |
217 base::Time last_reinit_time_; | 217 base::Time last_reinit_time_; |
218 base::TimeDelta next_reinit_delay_; | 218 base::TimeDelta next_reinit_delay_; |
219 base::OneShotTimer<AppCacheServiceImpl> reinit_timer_; | 219 base::OneShotTimer<AppCacheServiceImpl> reinit_timer_; |
220 ObserverList<Observer> observers_; | 220 ObserverList<Observer> observers_; |
221 | 221 |
222 DISALLOW_COPY_AND_ASSIGN(AppCacheServiceImpl); | 222 DISALLOW_COPY_AND_ASSIGN(AppCacheServiceImpl); |
223 }; | 223 }; |
224 | 224 |
225 } // namespace appcache | 225 } // namespace content |
226 | 226 |
227 #endif // WEBKIT_BROWSER_APPCACHE_APPCACHE_SERVICE_IMPL_H_ | 227 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_SERVICE_IMPL_H_ |
OLD | NEW |