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