| 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 CONTENT_BROWSER_STORAGE_PARTITION_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_STORAGE_PARTITION_IMPL_H_ |
| 6 #define CONTENT_BROWSER_STORAGE_PARTITION_IMPL_H_ | 6 #define CONTENT_BROWSER_STORAGE_PARTITION_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/weak_ptr.h" |
| 15 #include "content/browser/appcache/chrome_appcache_service.h" | 16 #include "content/browser/appcache/chrome_appcache_service.h" |
| 16 #include "content/browser/background_sync/background_sync_context.h" | 17 #include "content/browser/background_sync/background_sync_context.h" |
| 17 #include "content/browser/broadcast_channel/broadcast_channel_provider.h" | 18 #include "content/browser/broadcast_channel/broadcast_channel_provider.h" |
| 18 #include "content/browser/cache_storage/cache_storage_context_impl.h" | 19 #include "content/browser/cache_storage/cache_storage_context_impl.h" |
| 19 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" | 20 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" |
| 20 #include "content/browser/host_zoom_level_context.h" | 21 #include "content/browser/host_zoom_level_context.h" |
| 21 #include "content/browser/indexed_db/indexed_db_context_impl.h" | 22 #include "content/browser/indexed_db/indexed_db_context_impl.h" |
| 22 #include "content/browser/notifications/platform_notification_context_impl.h" | 23 #include "content/browser/notifications/platform_notification_context_impl.h" |
| 23 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 24 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| 24 #include "content/common/content_export.h" | 25 #include "content/common/content_export.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 // of distinguishing different in-memory partitions, but nothing is persisted | 154 // of distinguishing different in-memory partitions, but nothing is persisted |
| 154 // on to disk. | 155 // on to disk. |
| 155 static StoragePartitionImpl* Create( | 156 static StoragePartitionImpl* Create( |
| 156 BrowserContext* context, | 157 BrowserContext* context, |
| 157 bool in_memory, | 158 bool in_memory, |
| 158 const base::FilePath& relative_partition_path); | 159 const base::FilePath& relative_partition_path); |
| 159 | 160 |
| 160 StoragePartitionImpl( | 161 StoragePartitionImpl( |
| 161 BrowserContext* browser_context, | 162 BrowserContext* browser_context, |
| 162 const base::FilePath& partition_path, | 163 const base::FilePath& partition_path, |
| 163 storage::QuotaManager* quota_manager, | 164 storage::SpecialStoragePolicy* special_storage_policy); |
| 164 ChromeAppCacheService* appcache_service, | |
| 165 storage::FileSystemContext* filesystem_context, | |
| 166 storage::DatabaseTracker* database_tracker, | |
| 167 DOMStorageContextWrapper* dom_storage_context, | |
| 168 IndexedDBContextImpl* indexed_db_context, | |
| 169 CacheStorageContextImpl* cache_storage_context, | |
| 170 ServiceWorkerContextWrapper* service_worker_context, | |
| 171 storage::SpecialStoragePolicy* special_storage_policy, | |
| 172 HostZoomLevelContext* host_zoom_level_context, | |
| 173 PlatformNotificationContextImpl* platform_notification_context, | |
| 174 BackgroundSyncContext* background_sync_context, | |
| 175 scoped_refptr<BroadcastChannelProvider>broadcast_channel_provider); | |
| 176 | 165 |
| 177 // We will never have both remove_origin be populated and a cookie_matcher. | 166 // We will never have both remove_origin be populated and a cookie_matcher. |
| 178 void ClearDataImpl(uint32_t remove_mask, | 167 void ClearDataImpl(uint32_t remove_mask, |
| 179 uint32_t quota_storage_remove_mask, | 168 uint32_t quota_storage_remove_mask, |
| 180 const GURL& remove_origin, | 169 const GURL& remove_origin, |
| 181 const OriginMatcherFunction& origin_matcher, | 170 const OriginMatcherFunction& origin_matcher, |
| 182 const CookieMatcherFunction& cookie_matcher, | 171 const CookieMatcherFunction& cookie_matcher, |
| 183 net::URLRequestContextGetter* rq_context, | 172 net::URLRequestContextGetter* rq_context, |
| 184 const base::Time begin, | 173 const base::Time begin, |
| 185 const base::Time end, | 174 const base::Time end, |
| 186 const base::Closure& callback); | 175 const base::Closure& callback); |
| 187 | 176 |
| 188 // Used by StoragePartitionImplMap. | 177 // Used by StoragePartitionImplMap. |
| 189 // | 178 // |
| 190 // TODO(ajwong): These should be taken in the constructor and in Create() but | 179 // TODO(ajwong): These should be taken in the constructor and in Create() but |
| 191 // because the URLRequestContextGetter still lives in Profile with a tangled | 180 // because the URLRequestContextGetter still lives in Profile with a tangled |
| 192 // initialization, if we try to retrieve the URLRequestContextGetter() | 181 // initialization, if we try to retrieve the URLRequestContextGetter() |
| 193 // before the default StoragePartition is created, we end up reentering the | 182 // before the default StoragePartition is created, we end up reentering the |
| 194 // construction and double-initializing. For now, we retain the legacy | 183 // construction and double-initializing. For now, we retain the legacy |
| 195 // behavior while allowing StoragePartitionImpl to expose these accessors by | 184 // behavior while allowing StoragePartitionImpl to expose these accessors by |
| 196 // letting StoragePartitionImplMap call these two private settings at the | 185 // letting StoragePartitionImplMap call these two private settings at the |
| 197 // appropriate time. These should move back into the constructor once | 186 // appropriate time. These should move back into the constructor once |
| 198 // URLRequestContextGetter's lifetime is sorted out. We should also move the | 187 // URLRequestContextGetter's lifetime is sorted out. We should also move the |
| 199 // PostCreateInitialization() out of StoragePartitionImplMap. | 188 // PostCreateInitialization() out of StoragePartitionImplMap. |
| 200 void SetURLRequestContext( | 189 void SetURLRequestContext( |
| 201 net::URLRequestContextGetter* url_request_context); | 190 net::URLRequestContextGetter* url_request_context); |
| 202 void SetMediaURLRequestContext( | 191 void SetMediaURLRequestContext( |
| 203 net::URLRequestContextGetter* media_url_request_context); | 192 net::URLRequestContextGetter* media_url_request_context); |
| 204 | 193 |
| 194 void GetTemporaryStorageConfiguration( |
| 195 const base::FilePath& profile_path, bool is_incognito, |
| 196 const storage::TemporaryStorageConfigurationCallback& callback); |
| 197 |
| 205 base::FilePath partition_path_; | 198 base::FilePath partition_path_; |
| 206 scoped_refptr<net::URLRequestContextGetter> url_request_context_; | 199 scoped_refptr<net::URLRequestContextGetter> url_request_context_; |
| 207 scoped_refptr<net::URLRequestContextGetter> media_url_request_context_; | 200 scoped_refptr<net::URLRequestContextGetter> media_url_request_context_; |
| 208 scoped_refptr<storage::QuotaManager> quota_manager_; | 201 scoped_refptr<storage::QuotaManager> quota_manager_; |
| 209 scoped_refptr<ChromeAppCacheService> appcache_service_; | 202 scoped_refptr<ChromeAppCacheService> appcache_service_; |
| 210 scoped_refptr<storage::FileSystemContext> filesystem_context_; | 203 scoped_refptr<storage::FileSystemContext> filesystem_context_; |
| 211 scoped_refptr<storage::DatabaseTracker> database_tracker_; | 204 scoped_refptr<storage::DatabaseTracker> database_tracker_; |
| 212 scoped_refptr<DOMStorageContextWrapper> dom_storage_context_; | 205 scoped_refptr<DOMStorageContextWrapper> dom_storage_context_; |
| 213 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; | 206 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; |
| 214 scoped_refptr<CacheStorageContextImpl> cache_storage_context_; | 207 scoped_refptr<CacheStorageContextImpl> cache_storage_context_; |
| 215 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; | 208 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; |
| 216 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy_; | 209 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy_; |
| 217 scoped_refptr<HostZoomLevelContext> host_zoom_level_context_; | 210 scoped_refptr<HostZoomLevelContext> host_zoom_level_context_; |
| 218 scoped_refptr<PlatformNotificationContextImpl> platform_notification_context_; | 211 scoped_refptr<PlatformNotificationContextImpl> platform_notification_context_; |
| 219 scoped_refptr<BackgroundSyncContext> background_sync_context_; | 212 scoped_refptr<BackgroundSyncContext> background_sync_context_; |
| 220 scoped_refptr<BroadcastChannelProvider> broadcast_channel_provider_; | 213 scoped_refptr<BroadcastChannelProvider> broadcast_channel_provider_; |
| 221 | 214 |
| 222 mojo::BindingSet<mojom::StoragePartitionService> bindings_; | 215 mojo::BindingSet<mojom::StoragePartitionService> bindings_; |
| 223 | 216 |
| 224 // Raw pointer that should always be valid. The BrowserContext owns the | 217 // Raw pointer that should always be valid. The BrowserContext owns the |
| 225 // StoragePartitionImplMap which then owns StoragePartitionImpl. When the | 218 // StoragePartitionImplMap which then owns StoragePartitionImpl. When the |
| 226 // BrowserContext is destroyed, |this| will be destroyed too. | 219 // BrowserContext is destroyed, |this| will be destroyed too. |
| 227 BrowserContext* browser_context_; | 220 BrowserContext* browser_context_; |
| 228 | 221 |
| 222 base::WeakPtrFactory<StoragePartitionImpl> weak_factory_; |
| 223 |
| 229 DISALLOW_COPY_AND_ASSIGN(StoragePartitionImpl); | 224 DISALLOW_COPY_AND_ASSIGN(StoragePartitionImpl); |
| 230 }; | 225 }; |
| 231 | 226 |
| 232 } // namespace content | 227 } // namespace content |
| 233 | 228 |
| 234 #endif // CONTENT_BROWSER_STORAGE_PARTITION_IMPL_H_ | 229 #endif // CONTENT_BROWSER_STORAGE_PARTITION_IMPL_H_ |
| OLD | NEW |