| 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 CONTENT_BROWSER_APPCACHE_APPCACHE_SERVICE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_SERVICE_IMPL_H_ |
| 6 #define CONTENT_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 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // the lifetime of the old storage instance is a delicate process. | 72 // the lifetime of the old storage instance is a delicate process. |
| 73 // Consumers can keep the old disabled instance alive by hanging on to the | 73 // Consumers can keep the old disabled instance alive by hanging on to the |
| 74 // ref provided. | 74 // ref provided. |
| 75 virtual void OnServiceReinitialized( | 75 virtual void OnServiceReinitialized( |
| 76 AppCacheStorageReference* old_storage_ref) = 0; | 76 AppCacheStorageReference* old_storage_ref) = 0; |
| 77 virtual ~Observer() {} | 77 virtual ~Observer() {} |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 // If not using quota management, the proxy may be NULL. | 80 // If not using quota management, the proxy may be NULL. |
| 81 explicit AppCacheServiceImpl(storage::QuotaManagerProxy* quota_manager_proxy); | 81 explicit AppCacheServiceImpl(storage::QuotaManagerProxy* quota_manager_proxy); |
| 82 virtual ~AppCacheServiceImpl(); | 82 ~AppCacheServiceImpl() override; |
| 83 | 83 |
| 84 void Initialize( | 84 void Initialize( |
| 85 const base::FilePath& cache_directory, | 85 const base::FilePath& cache_directory, |
| 86 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, | 86 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, |
| 87 const scoped_refptr<base::SingleThreadTaskRunner>& cache_thread); | 87 const scoped_refptr<base::SingleThreadTaskRunner>& cache_thread); |
| 88 | 88 |
| 89 void AddObserver(Observer* observer) { | 89 void AddObserver(Observer* observer) { |
| 90 observers_.AddObserver(observer); | 90 observers_.AddObserver(observer); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void RemoveObserver(Observer* observer) { | 93 void RemoveObserver(Observer* observer) { |
| 94 observers_.RemoveObserver(observer); | 94 observers_.RemoveObserver(observer); |
| 95 } | 95 } |
| 96 | 96 |
| 97 // For use in catastrophic failure modes to reboot the appcache system | 97 // For use in catastrophic failure modes to reboot the appcache system |
| 98 // without relaunching the browser. | 98 // without relaunching the browser. |
| 99 void ScheduleReinitialize(); | 99 void ScheduleReinitialize(); |
| 100 | 100 |
| 101 // AppCacheService implementation: | 101 // AppCacheService implementation: |
| 102 virtual void CanHandleMainResourceOffline( | 102 void CanHandleMainResourceOffline( |
| 103 const GURL& url, | 103 const GURL& url, |
| 104 const GURL& first_party, | 104 const GURL& first_party, |
| 105 const net::CompletionCallback& callback) override; | 105 const net::CompletionCallback& callback) override; |
| 106 virtual void GetAllAppCacheInfo( | 106 void GetAllAppCacheInfo(AppCacheInfoCollection* collection, |
| 107 AppCacheInfoCollection* collection, | 107 const net::CompletionCallback& callback) override; |
| 108 const net::CompletionCallback& callback) override; | 108 void DeleteAppCacheGroup(const GURL& manifest_url, |
| 109 virtual void DeleteAppCacheGroup( | 109 const net::CompletionCallback& callback) override; |
| 110 const GURL& manifest_url, | |
| 111 const net::CompletionCallback& callback) override; | |
| 112 | 110 |
| 113 // Deletes all appcaches for the origin, 'callback' is invoked upon | 111 // Deletes all appcaches for the origin, 'callback' is invoked upon |
| 114 // completion. This method always completes asynchronously. | 112 // completion. This method always completes asynchronously. |
| 115 // (virtual for unit testing) | 113 // (virtual for unit testing) |
| 116 virtual void DeleteAppCachesForOrigin( | 114 virtual void DeleteAppCachesForOrigin( |
| 117 const GURL& origin, const net::CompletionCallback& callback); | 115 const GURL& origin, const net::CompletionCallback& callback); |
| 118 | 116 |
| 119 // Checks the integrity of 'response_id' by reading the headers and data. | 117 // Checks the integrity of 'response_id' by reading the headers and data. |
| 120 // If it cannot be read, the cache group for 'manifest_url' is deleted. | 118 // If it cannot be read, the cache group for 'manifest_url' is deleted. |
| 121 void CheckAppCacheResponse(const GURL& manifest_url, int64 cache_id, | 119 void CheckAppCacheResponse(const GURL& manifest_url, int64 cache_id, |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 base::TimeDelta next_reinit_delay_; | 213 base::TimeDelta next_reinit_delay_; |
| 216 base::OneShotTimer<AppCacheServiceImpl> reinit_timer_; | 214 base::OneShotTimer<AppCacheServiceImpl> reinit_timer_; |
| 217 ObserverList<Observer> observers_; | 215 ObserverList<Observer> observers_; |
| 218 | 216 |
| 219 DISALLOW_COPY_AND_ASSIGN(AppCacheServiceImpl); | 217 DISALLOW_COPY_AND_ASSIGN(AppCacheServiceImpl); |
| 220 }; | 218 }; |
| 221 | 219 |
| 222 } // namespace content | 220 } // namespace content |
| 223 | 221 |
| 224 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_SERVICE_IMPL_H_ | 222 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_SERVICE_IMPL_H_ |
| OLD | NEW |