| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_SERVICE_H_ | 5 #ifndef WEBKIT_APPCACHE_APPCACHE_SERVICE_H_ |
| 6 #define WEBKIT_APPCACHE_APPCACHE_SERVICE_H_ | 6 #define WEBKIT_APPCACHE_APPCACHE_SERVICE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // See chrome/browser/AppCacheDispatcherHost. | 136 // See chrome/browser/AppCacheDispatcherHost. |
| 137 void RegisterBackend(AppCacheBackendImpl* backend_impl); | 137 void RegisterBackend(AppCacheBackendImpl* backend_impl); |
| 138 void UnregisterBackend(AppCacheBackendImpl* backend_impl); | 138 void UnregisterBackend(AppCacheBackendImpl* backend_impl); |
| 139 AppCacheBackendImpl* GetBackend(int id) const { | 139 AppCacheBackendImpl* GetBackend(int id) const { |
| 140 BackendMap::const_iterator it = backends_.find(id); | 140 BackendMap::const_iterator it = backends_.find(id); |
| 141 return (it != backends_.end()) ? it->second : NULL; | 141 return (it != backends_.end()) ? it->second : NULL; |
| 142 } | 142 } |
| 143 | 143 |
| 144 AppCacheStorage* storage() const { return storage_.get(); } | 144 AppCacheStorage* storage() const { return storage_.get(); } |
| 145 | 145 |
| 146 bool clear_local_state_on_exit() const { return clear_local_state_on_exit_; } | 146 // Disables the exit-time deletion of session-only data. |
| 147 void set_clear_local_state_on_exit(bool clear_local_state_on_exit) { | 147 void set_force_keep_session_state() { force_keep_session_state_ = true; } |
| 148 clear_local_state_on_exit_ = clear_local_state_on_exit; } | 148 bool force_keep_session_state() const { return force_keep_session_state_; } |
| 149 | |
| 150 bool save_session_state() const { return save_session_state_; } | |
| 151 // If |save_session_state| is true, disables the exit-time deletion for all | |
| 152 // data (also session-only data). | |
| 153 void set_save_session_state(bool save_session_state) { | |
| 154 save_session_state_ = save_session_state; | |
| 155 } | |
| 156 | 149 |
| 157 protected: | 150 protected: |
| 158 friend class AppCacheStorageImplTest; | 151 friend class AppCacheStorageImplTest; |
| 159 friend class AppCacheServiceTest; | 152 friend class AppCacheServiceTest; |
| 160 | 153 |
| 161 class AsyncHelper; | 154 class AsyncHelper; |
| 162 class CanHandleOfflineHelper; | 155 class CanHandleOfflineHelper; |
| 163 class DeleteHelper; | 156 class DeleteHelper; |
| 164 class DeleteOriginHelper; | 157 class DeleteOriginHelper; |
| 165 class GetInfoHelper; | 158 class GetInfoHelper; |
| 166 class CheckResponseHelper; | 159 class CheckResponseHelper; |
| 167 | 160 |
| 168 typedef std::set<AsyncHelper*> PendingAsyncHelpers; | 161 typedef std::set<AsyncHelper*> PendingAsyncHelpers; |
| 169 typedef std::map<int, AppCacheBackendImpl*> BackendMap; | 162 typedef std::map<int, AppCacheBackendImpl*> BackendMap; |
| 170 | 163 |
| 171 AppCachePolicy* appcache_policy_; | 164 AppCachePolicy* appcache_policy_; |
| 172 AppCacheQuotaClient* quota_client_; | 165 AppCacheQuotaClient* quota_client_; |
| 173 scoped_ptr<AppCacheStorage> storage_; | 166 scoped_ptr<AppCacheStorage> storage_; |
| 174 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; | 167 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; |
| 175 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; | 168 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; |
| 176 PendingAsyncHelpers pending_helpers_; | 169 PendingAsyncHelpers pending_helpers_; |
| 177 BackendMap backends_; // One 'backend' per child process. | 170 BackendMap backends_; // One 'backend' per child process. |
| 178 // Context for use during cache updates. | 171 // Context for use during cache updates. |
| 179 net::URLRequestContext* request_context_; | 172 net::URLRequestContext* request_context_; |
| 180 bool clear_local_state_on_exit_; | |
| 181 // If true, nothing (not even session-only data) should be deleted on exit. | 173 // If true, nothing (not even session-only data) should be deleted on exit. |
| 182 bool save_session_state_; | 174 bool force_keep_session_state_; |
| 183 | 175 |
| 184 DISALLOW_COPY_AND_ASSIGN(AppCacheService); | 176 DISALLOW_COPY_AND_ASSIGN(AppCacheService); |
| 185 }; | 177 }; |
| 186 | 178 |
| 187 } // namespace appcache | 179 } // namespace appcache |
| 188 | 180 |
| 189 #endif // WEBKIT_APPCACHE_APPCACHE_SERVICE_H_ | 181 #endif // WEBKIT_APPCACHE_APPCACHE_SERVICE_H_ |
| OLD | NEW |