| 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 "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // StoragePartition interface. | 24 // StoragePartition interface. |
| 25 virtual base::FilePath GetPath() OVERRIDE; | 25 virtual base::FilePath GetPath() OVERRIDE; |
| 26 virtual net::URLRequestContextGetter* GetURLRequestContext() OVERRIDE; | 26 virtual net::URLRequestContextGetter* GetURLRequestContext() OVERRIDE; |
| 27 virtual net::URLRequestContextGetter* GetMediaURLRequestContext() OVERRIDE; | 27 virtual net::URLRequestContextGetter* GetMediaURLRequestContext() OVERRIDE; |
| 28 virtual quota::QuotaManager* GetQuotaManager() OVERRIDE; | 28 virtual quota::QuotaManager* GetQuotaManager() OVERRIDE; |
| 29 virtual ChromeAppCacheService* GetAppCacheService() OVERRIDE; | 29 virtual ChromeAppCacheService* GetAppCacheService() OVERRIDE; |
| 30 virtual fileapi::FileSystemContext* GetFileSystemContext() OVERRIDE; | 30 virtual fileapi::FileSystemContext* GetFileSystemContext() OVERRIDE; |
| 31 virtual webkit_database::DatabaseTracker* GetDatabaseTracker() OVERRIDE; | 31 virtual webkit_database::DatabaseTracker* GetDatabaseTracker() OVERRIDE; |
| 32 virtual DOMStorageContextImpl* GetDOMStorageContext() OVERRIDE; | 32 virtual DOMStorageContextImpl* GetDOMStorageContext() OVERRIDE; |
| 33 virtual IndexedDBContextImpl* GetIndexedDBContext() OVERRIDE; | 33 virtual IndexedDBContextImpl* GetIndexedDBContext() OVERRIDE; |
| 34 virtual const CookieStoreMap& GetCookieStoreMap() OVERRIDE; |
| 34 virtual void AsyncClearDataForOrigin( | 35 virtual void AsyncClearDataForOrigin( |
| 35 uint32 storage_mask, | 36 uint32 storage_mask, |
| 36 const GURL& storage_origin, | 37 const GURL& storage_origin) OVERRIDE; |
| 37 net::URLRequestContextGetter* request_context_getter) OVERRIDE; | |
| 38 virtual void AsyncClearData(uint32 storage_mask) OVERRIDE; | 38 virtual void AsyncClearData(uint32 storage_mask) OVERRIDE; |
| 39 virtual void AsyncClearDataBetween( | 39 virtual void AsyncClearDataBetween( |
| 40 uint32 storage_mask, | 40 uint32 storage_mask, |
| 41 const base::Time& begin, | 41 const base::Time& begin, |
| 42 const base::Time& end, | 42 const base::Time& end, |
| 43 const base::Closure& callback) OVERRIDE; | 43 const base::Closure& callback) OVERRIDE; |
| 44 | 44 |
| 45 WebRTCIdentityStore* GetWebRTCIdentityStore(); | 45 WebRTCIdentityStore* GetWebRTCIdentityStore(); |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 friend class StoragePartitionImplMap; | 48 friend class StoragePartitionImplMap; |
| 49 FRIEND_TEST_ALL_PREFIXES(StoragePartitionShaderClearTest, ClearShaderCache); | 49 FRIEND_TEST_ALL_PREFIXES(StoragePartitionShaderClearTest, ClearShaderCache); |
| 50 | 50 |
| 51 // The |partition_path| is the absolute path to the root of this | 51 // The |partition_path| is the absolute path to the root of this |
| 52 // StoragePartition's on-disk storage. | 52 // StoragePartition's on-disk storage. |
| 53 // | 53 // |
| 54 // If |in_memory| is true, the |partition_path| is (ab)used as a way of | 54 // If |in_memory| is true, the |partition_path| is (ab)used as a way of |
| 55 // distinguishing different in-memory partitions, but nothing is persisted | 55 // distinguishing different in-memory partitions, but nothing is persisted |
| 56 // on to disk. | 56 // on to disk. |
| 57 static StoragePartitionImpl* Create(BrowserContext* context, | 57 static StoragePartitionImpl* Create( |
| 58 bool in_memory, | 58 BrowserContext* context, |
| 59 const base::FilePath& profile_path); | 59 bool in_memory, |
| 60 const base::FilePath& profile_path, |
| 61 scoped_ptr<CookieStoreMap> cookie_store_map); |
| 60 | 62 |
| 61 CONTENT_EXPORT StoragePartitionImpl( | 63 CONTENT_EXPORT StoragePartitionImpl( |
| 62 const base::FilePath& partition_path, | 64 const base::FilePath& partition_path, |
| 63 quota::QuotaManager* quota_manager, | 65 quota::QuotaManager* quota_manager, |
| 64 ChromeAppCacheService* appcache_service, | 66 ChromeAppCacheService* appcache_service, |
| 65 fileapi::FileSystemContext* filesystem_context, | 67 fileapi::FileSystemContext* filesystem_context, |
| 66 webkit_database::DatabaseTracker* database_tracker, | 68 webkit_database::DatabaseTracker* database_tracker, |
| 67 DOMStorageContextImpl* dom_storage_context, | 69 DOMStorageContextImpl* dom_storage_context, |
| 68 IndexedDBContextImpl* indexed_db_context, | 70 IndexedDBContextImpl* indexed_db_context, |
| 71 scoped_ptr<CookieStoreMap> cookie_store_map, |
| 69 scoped_ptr<WebRTCIdentityStore> webrtc_identity_store); | 72 scoped_ptr<WebRTCIdentityStore> webrtc_identity_store); |
| 70 | 73 |
| 71 // Used by StoragePartitionImplMap. | 74 // Used by StoragePartitionImplMap. |
| 72 // | 75 // |
| 73 // TODO(ajwong): These should be taken in the constructor and in Create() but | 76 // TODO(ajwong): These should be taken in the constructor and in Create() but |
| 74 // because the URLRequestContextGetter still lives in Profile with a tangled | 77 // because the URLRequestContextGetter still lives in Profile with a tangled |
| 75 // initialization, if we try to retrieve the URLRequestContextGetter() | 78 // initialization, if we try to retrieve the URLRequestContextGetter() |
| 76 // before the default StoragePartition is created, we end up reentering the | 79 // before the default StoragePartition is created, we end up reentering the |
| 77 // construction and double-initializing. For now, we retain the legacy | 80 // construction and double-initializing. For now, we retain the legacy |
| 78 // behavior while allowing StoragePartitionImpl to expose these accessors by | 81 // behavior while allowing StoragePartitionImpl to expose these accessors by |
| 79 // letting StoragePartitionImplMap call these two private settings at the | 82 // letting StoragePartitionImplMap call these two private settings at the |
| 80 // appropriate time. These should move back into the constructor once | 83 // appropriate time. These should move back into the constructor once |
| 81 // URLRequestContextGetter's lifetime is sorted out. We should also move the | 84 // URLRequestContextGetter's lifetime is sorted out. We should also move the |
| 82 // PostCreateInitialization() out of StoragePartitionImplMap. | 85 // PostCreateInitialization() out of StoragePartitionImplMap. |
| 83 void SetURLRequestContext(net::URLRequestContextGetter* url_request_context); | 86 void SetURLRequestContext(net::URLRequestContextGetter* url_request_context); |
| 84 void SetMediaURLRequestContext( | 87 void SetMediaURLRequestContext( |
| 85 net::URLRequestContextGetter* media_url_request_context); | 88 net::URLRequestContextGetter* media_url_request_context); |
| 86 | 89 |
| 87 base::FilePath partition_path_; | 90 base::FilePath partition_path_; |
| 88 scoped_refptr<net::URLRequestContextGetter> url_request_context_; | 91 scoped_refptr<net::URLRequestContextGetter> url_request_context_; |
| 89 scoped_refptr<net::URLRequestContextGetter> media_url_request_context_; | 92 scoped_refptr<net::URLRequestContextGetter> media_url_request_context_; |
| 90 scoped_refptr<quota::QuotaManager> quota_manager_; | 93 scoped_refptr<quota::QuotaManager> quota_manager_; |
| 91 scoped_refptr<ChromeAppCacheService> appcache_service_; | 94 scoped_refptr<ChromeAppCacheService> appcache_service_; |
| 92 scoped_refptr<fileapi::FileSystemContext> filesystem_context_; | 95 scoped_refptr<fileapi::FileSystemContext> filesystem_context_; |
| 93 scoped_refptr<webkit_database::DatabaseTracker> database_tracker_; | 96 scoped_refptr<webkit_database::DatabaseTracker> database_tracker_; |
| 94 scoped_refptr<DOMStorageContextImpl> dom_storage_context_; | 97 scoped_refptr<DOMStorageContextImpl> dom_storage_context_; |
| 95 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; | 98 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; |
| 99 scoped_ptr<CookieStoreMap> cookie_store_map_; |
| 96 scoped_ptr<WebRTCIdentityStore> webrtc_identity_store_; | 100 scoped_ptr<WebRTCIdentityStore> webrtc_identity_store_; |
| 97 | 101 |
| 98 DISALLOW_COPY_AND_ASSIGN(StoragePartitionImpl); | 102 DISALLOW_COPY_AND_ASSIGN(StoragePartitionImpl); |
| 99 }; | 103 }; |
| 100 | 104 |
| 101 } // namespace content | 105 } // namespace content |
| 102 | 106 |
| 103 #endif // CONTENT_BROWSER_STORAGE_PARTITION_IMPL_H_ | 107 #endif // CONTENT_BROWSER_STORAGE_PARTITION_IMPL_H_ |
| OLD | NEW |