| 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/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "content/browser/appcache/chrome_appcache_service.h" | 11 #include "content/browser/appcache/chrome_appcache_service.h" |
| 12 #include "content/browser/dom_storage/dom_storage_context_impl.h" | 12 #include "content/browser/dom_storage/dom_storage_context_impl.h" |
| 13 #include "content/browser/in_process_webkit/indexed_db_context_impl.h" | 13 #include "content/browser/in_process_webkit/indexed_db_context_impl.h" |
| 14 #include "content/public/browser/storage_partition.h" | 14 #include "content/public/browser/storage_partition.h" |
| 15 | 15 |
| 16 class ChromeURLDataManager; |
| 17 |
| 16 namespace content { | 18 namespace content { |
| 17 | 19 |
| 18 class StoragePartitionImpl : public StoragePartition { | 20 class StoragePartitionImpl : public StoragePartition { |
| 19 public: | 21 public: |
| 20 virtual ~StoragePartitionImpl(); | 22 virtual ~StoragePartitionImpl(); |
| 21 | 23 |
| 22 // StoragePartition interface. | 24 // StoragePartition interface. |
| 23 virtual FilePath GetPath() OVERRIDE; | 25 virtual FilePath GetPath() OVERRIDE; |
| 24 virtual net::URLRequestContextGetter* GetURLRequestContext() OVERRIDE; | 26 virtual net::URLRequestContextGetter* GetURLRequestContext() OVERRIDE; |
| 25 virtual net::URLRequestContextGetter* GetMediaURLRequestContext() OVERRIDE; | 27 virtual net::URLRequestContextGetter* GetMediaURLRequestContext() OVERRIDE; |
| 26 virtual quota::QuotaManager* GetQuotaManager() OVERRIDE; | 28 virtual quota::QuotaManager* GetQuotaManager() OVERRIDE; |
| 27 virtual ChromeAppCacheService* GetAppCacheService() OVERRIDE; | 29 virtual ChromeAppCacheService* GetAppCacheService() OVERRIDE; |
| 28 virtual fileapi::FileSystemContext* GetFileSystemContext() OVERRIDE; | 30 virtual fileapi::FileSystemContext* GetFileSystemContext() OVERRIDE; |
| 29 virtual webkit_database::DatabaseTracker* GetDatabaseTracker() OVERRIDE; | 31 virtual webkit_database::DatabaseTracker* GetDatabaseTracker() OVERRIDE; |
| 30 virtual DOMStorageContextImpl* GetDOMStorageContext() OVERRIDE; | 32 virtual DOMStorageContextImpl* GetDOMStorageContext() OVERRIDE; |
| 31 virtual IndexedDBContextImpl* GetIndexedDBContext() OVERRIDE; | 33 virtual IndexedDBContextImpl* GetIndexedDBContext() OVERRIDE; |
| 32 virtual void AsyncClearDataForOrigin( | 34 virtual void AsyncClearDataForOrigin( |
| 33 const GURL& storage_origin, | 35 const GURL& storage_origin, |
| 34 net::URLRequestContextGetter* request_context_getter) OVERRIDE; | 36 net::URLRequestContextGetter* request_context_getter) OVERRIDE; |
| 35 virtual void AsyncClearAllData() OVERRIDE; | 37 virtual void AsyncClearAllData() OVERRIDE; |
| 36 | 38 |
| 39 ChromeURLDataManager* url_data_manager() const { |
| 40 return url_data_manager_.get(); |
| 41 } |
| 42 |
| 37 private: | 43 private: |
| 38 friend class StoragePartitionImplMap; | 44 friend class StoragePartitionImplMap; |
| 39 | 45 |
| 40 // The |partition_path| is the absolute path to the root of this | 46 // The |partition_path| is the absolute path to the root of this |
| 41 // StoragePartition's on-disk storage. | 47 // StoragePartition's on-disk storage. |
| 42 // | 48 // |
| 43 // If |in_memory| is true, the |partition_path| is (ab)used as a way of | 49 // If |in_memory| is true, the |partition_path| is (ab)used as a way of |
| 44 // distinguishing different in-memory partitions, but nothing is persisted | 50 // distinguishing different in-memory partitions, but nothing is persisted |
| 45 // on to disk. | 51 // on to disk. |
| 46 static StoragePartitionImpl* Create(BrowserContext* context, | 52 static StoragePartitionImpl* Create(BrowserContext* context, |
| 47 bool in_memory, | 53 bool in_memory, |
| 48 const FilePath& profile_path); | 54 const FilePath& profile_path); |
| 49 | 55 |
| 50 StoragePartitionImpl( | 56 StoragePartitionImpl( |
| 51 const FilePath& partition_path, | 57 const FilePath& partition_path, |
| 52 quota::QuotaManager* quota_manager, | 58 quota::QuotaManager* quota_manager, |
| 53 ChromeAppCacheService* appcache_service, | 59 ChromeAppCacheService* appcache_service, |
| 54 fileapi::FileSystemContext* filesystem_context, | 60 fileapi::FileSystemContext* filesystem_context, |
| 55 webkit_database::DatabaseTracker* database_tracker, | 61 webkit_database::DatabaseTracker* database_tracker, |
| 56 DOMStorageContextImpl* dom_storage_context, | 62 DOMStorageContextImpl* dom_storage_context, |
| 57 IndexedDBContextImpl* indexed_db_context); | 63 IndexedDBContextImpl* indexed_db_context, |
| 64 ChromeURLDataManager* url_data_manager); |
| 58 | 65 |
| 59 // Used by StoragePartitionImplMap. | 66 // Used by StoragePartitionImplMap. |
| 60 // | 67 // |
| 61 // TODO(ajwong): These should be taken in the constructor and in Create() but | 68 // TODO(ajwong): These should be taken in the constructor and in Create() but |
| 62 // because the URLRequestContextGetter still lives in Profile with a tangled | 69 // because the URLRequestContextGetter still lives in Profile with a tangled |
| 63 // initialization, if we try to retrieve the URLRequestContextGetter() | 70 // initialization, if we try to retrieve the URLRequestContextGetter() |
| 64 // before the default StoragePartition is created, we end up reentering the | 71 // before the default StoragePartition is created, we end up reentering the |
| 65 // construction and double-initializing. For now, we retain the legacy | 72 // construction and double-initializing. For now, we retain the legacy |
| 66 // behavior while allowing StoragePartitionImpl to expose these accessors by | 73 // behavior while allowing StoragePartitionImpl to expose these accessors by |
| 67 // letting StoragePartitionImplMap call these two private settings at the | 74 // letting StoragePartitionImplMap call these two private settings at the |
| 68 // appropriate time. These should move back into the constructor once | 75 // appropriate time. These should move back into the constructor once |
| 69 // URLRequestContextGetter's lifetime is sorted out. We should also move the | 76 // URLRequestContextGetter's lifetime is sorted out. We should also move the |
| 70 // PostCreateInitialization() out of StoragePartitionImplMap. | 77 // PostCreateInitialization() out of StoragePartitionImplMap. |
| 71 void SetURLRequestContext(net::URLRequestContextGetter* url_request_context); | 78 void SetURLRequestContext(net::URLRequestContextGetter* url_request_context); |
| 72 void SetMediaURLRequestContext( | 79 void SetMediaURLRequestContext( |
| 73 net::URLRequestContextGetter* media_url_request_context); | 80 net::URLRequestContextGetter* media_url_request_context); |
| 74 | 81 |
| 75 FilePath partition_path_; | 82 FilePath partition_path_; |
| 76 scoped_refptr<net::URLRequestContextGetter> url_request_context_; | 83 scoped_refptr<net::URLRequestContextGetter> url_request_context_; |
| 77 scoped_refptr<net::URLRequestContextGetter> media_url_request_context_; | 84 scoped_refptr<net::URLRequestContextGetter> media_url_request_context_; |
| 78 scoped_refptr<quota::QuotaManager> quota_manager_; | 85 scoped_refptr<quota::QuotaManager> quota_manager_; |
| 79 scoped_refptr<ChromeAppCacheService> appcache_service_; | 86 scoped_refptr<ChromeAppCacheService> appcache_service_; |
| 80 scoped_refptr<fileapi::FileSystemContext> filesystem_context_; | 87 scoped_refptr<fileapi::FileSystemContext> filesystem_context_; |
| 81 scoped_refptr<webkit_database::DatabaseTracker> database_tracker_; | 88 scoped_refptr<webkit_database::DatabaseTracker> database_tracker_; |
| 82 scoped_refptr<DOMStorageContextImpl> dom_storage_context_; | 89 scoped_refptr<DOMStorageContextImpl> dom_storage_context_; |
| 83 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; | 90 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; |
| 91 scoped_ptr<ChromeURLDataManager> url_data_manager_; |
| 84 | 92 |
| 85 DISALLOW_COPY_AND_ASSIGN(StoragePartitionImpl); | 93 DISALLOW_COPY_AND_ASSIGN(StoragePartitionImpl); |
| 86 }; | 94 }; |
| 87 | 95 |
| 88 } // namespace content | 96 } // namespace content |
| 89 | 97 |
| 90 #endif // CONTENT_BROWSER_STORAGE_PARTITION_IMPL_H_ | 98 #endif // CONTENT_BROWSER_STORAGE_PARTITION_IMPL_H_ |
| OLD | NEW |