blob: 9dcdfeced5035d3fa4f37194de7adeefc65e6070 [file] [log] [blame]
[email protected]4c3a23582012-08-18 08:54:341// 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
3// found in the LICENSE file.
4
5#ifndef CONTENT_BROWSER_STORAGE_PARTITION_IMPL_H_
6#define CONTENT_BROWSER_STORAGE_PARTITION_IMPL_H_
7
8#include "base/compiler_specific.h"
[email protected]57999812013-02-24 05:40:529#include "base/files/file_path.h"
[email protected]4c3a23582012-08-18 08:54:3410#include "base/memory/ref_counted.h"
11#include "content/browser/appcache/chrome_appcache_service.h"
12#include "content/browser/dom_storage/dom_storage_context_impl.h"
[email protected]c4d281662013-03-31 00:35:0813#include "content/browser/indexed_db/indexed_db_context_impl.h"
[email protected]d3220662013-07-01 21:21:4614#include "content/browser/media/webrtc_identity_store.h"
[email protected]877e2612013-04-05 05:58:1815#include "content/common/content_export.h"
[email protected]4c3a23582012-08-18 08:54:3416#include "content/public/browser/storage_partition.h"
17
18namespace content {
19
20class StoragePartitionImpl : public StoragePartition {
21 public:
[email protected]877e2612013-04-05 05:58:1822 CONTENT_EXPORT virtual ~StoragePartitionImpl();
[email protected]4c3a23582012-08-18 08:54:3423
[email protected]4c3a23582012-08-18 08:54:3424 // StoragePartition interface.
[email protected]2dec8ec2013-02-07 19:20:3425 virtual base::FilePath GetPath() OVERRIDE;
[email protected]10eb28162012-09-18 03:04:0926 virtual net::URLRequestContextGetter* GetURLRequestContext() OVERRIDE;
27 virtual net::URLRequestContextGetter* GetMediaURLRequestContext() OVERRIDE;
[email protected]4c3a23582012-08-18 08:54:3428 virtual quota::QuotaManager* GetQuotaManager() OVERRIDE;
29 virtual ChromeAppCacheService* GetAppCacheService() OVERRIDE;
30 virtual fileapi::FileSystemContext* GetFileSystemContext() OVERRIDE;
31 virtual webkit_database::DatabaseTracker* GetDatabaseTracker() OVERRIDE;
32 virtual DOMStorageContextImpl* GetDOMStorageContext() OVERRIDE;
33 virtual IndexedDBContextImpl* GetIndexedDBContext() OVERRIDE;
[email protected]5ef99bd92012-11-14 05:00:1134 virtual void AsyncClearDataForOrigin(
[email protected]7a05d9412013-03-05 03:52:0035 uint32 storage_mask,
[email protected]5ef99bd92012-11-14 05:00:1136 const GURL& storage_origin,
37 net::URLRequestContextGetter* request_context_getter) OVERRIDE;
[email protected]7a05d9412013-03-05 03:52:0038 virtual void AsyncClearData(uint32 storage_mask) OVERRIDE;
[email protected]877e2612013-04-05 05:58:1839 virtual void AsyncClearDataBetween(
40 uint32 storage_mask,
41 const base::Time& begin,
42 const base::Time& end,
43 const base::Closure& callback) OVERRIDE;
[email protected]4c3a23582012-08-18 08:54:3444
[email protected]d3220662013-07-01 21:21:4645 WebRTCIdentityStore* GetWebRTCIdentityStore();
46
[email protected]4c3a23582012-08-18 08:54:3447 private:
[email protected]10eb28162012-09-18 03:04:0948 friend class StoragePartitionImplMap;
[email protected]877e2612013-04-05 05:58:1849 FRIEND_TEST_ALL_PREFIXES(StoragePartitionShaderClearTest, ClearShaderCache);
[email protected]10eb28162012-09-18 03:04:0950
[email protected]b471cf42012-11-13 09:11:3051 // The |partition_path| is the absolute path to the root of this
52 // StoragePartition's on-disk storage.
[email protected]1bc28312012-11-08 08:31:5353 //
[email protected]b471cf42012-11-13 09:11:3054 // 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
56 // on to disk.
57 static StoragePartitionImpl* Create(BrowserContext* context,
58 bool in_memory,
[email protected]2dec8ec2013-02-07 19:20:3459 const base::FilePath& profile_path);
[email protected]1bc28312012-11-08 08:31:5360
[email protected]877e2612013-04-05 05:58:1861 CONTENT_EXPORT StoragePartitionImpl(
[email protected]2dec8ec2013-02-07 19:20:3462 const base::FilePath& partition_path,
[email protected]10eb28162012-09-18 03:04:0963 quota::QuotaManager* quota_manager,
64 ChromeAppCacheService* appcache_service,
65 fileapi::FileSystemContext* filesystem_context,
66 webkit_database::DatabaseTracker* database_tracker,
67 DOMStorageContextImpl* dom_storage_context,
[email protected]d3220662013-07-01 21:21:4668 IndexedDBContextImpl* indexed_db_context,
69 scoped_ptr<WebRTCIdentityStore> webrtc_identity_store);
[email protected]10eb28162012-09-18 03:04:0970
71 // Used by StoragePartitionImplMap.
72 //
73 // TODO(ajwong): These should be taken in the constructor and in Create() but
74 // because the URLRequestContextGetter still lives in Profile with a tangled
75 // initialization, if we try to retrieve the URLRequestContextGetter()
76 // before the default StoragePartition is created, we end up reentering the
77 // construction and double-initializing. For now, we retain the legacy
78 // behavior while allowing StoragePartitionImpl to expose these accessors by
79 // letting StoragePartitionImplMap call these two private settings at the
80 // appropriate time. These should move back into the constructor once
81 // URLRequestContextGetter's lifetime is sorted out. We should also move the
82 // PostCreateInitialization() out of StoragePartitionImplMap.
83 void SetURLRequestContext(net::URLRequestContextGetter* url_request_context);
84 void SetMediaURLRequestContext(
85 net::URLRequestContextGetter* media_url_request_context);
[email protected]4c3a23582012-08-18 08:54:3486
[email protected]2dec8ec2013-02-07 19:20:3487 base::FilePath partition_path_;
[email protected]10eb28162012-09-18 03:04:0988 scoped_refptr<net::URLRequestContextGetter> url_request_context_;
89 scoped_refptr<net::URLRequestContextGetter> media_url_request_context_;
[email protected]4c3a23582012-08-18 08:54:3490 scoped_refptr<quota::QuotaManager> quota_manager_;
91 scoped_refptr<ChromeAppCacheService> appcache_service_;
92 scoped_refptr<fileapi::FileSystemContext> filesystem_context_;
93 scoped_refptr<webkit_database::DatabaseTracker> database_tracker_;
94 scoped_refptr<DOMStorageContextImpl> dom_storage_context_;
95 scoped_refptr<IndexedDBContextImpl> indexed_db_context_;
[email protected]d3220662013-07-01 21:21:4696 scoped_ptr<WebRTCIdentityStore> webrtc_identity_store_;
[email protected]4c3a23582012-08-18 08:54:3497
98 DISALLOW_COPY_AND_ASSIGN(StoragePartitionImpl);
99};
100
101} // namespace content
102
103#endif // CONTENT_BROWSER_STORAGE_PARTITION_IMPL_H_