Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: content/browser/storage_partition_impl.h

Issue 10909182: Make FileSystemContext respect StoragePartitions. filesystem:// urls will be properly isolated (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch unittest fix from michael Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 namespace content { 16 namespace content {
17 17
18 class StoragePartitionImpl : public StoragePartition { 18 class StoragePartitionImpl : public StoragePartition {
19 public: 19 public:
20 virtual ~StoragePartitionImpl(); 20 virtual ~StoragePartitionImpl();
21 21
22 // TODO(ajwong): Break the direct dependency on |context|. We only 22 // TODO(ajwong): Break the direct dependency on |context|. We only
23 // need 3 pieces of info from it. 23 // need 3 pieces of info from it.
24 static StoragePartitionImpl* Create(BrowserContext* context, 24 static StoragePartitionImpl* Create(
25 const FilePath& partition_path); 25 BrowserContext* context,
26 const FilePath& partition_path);
26 27
27 // StoragePartition interface. 28 // StoragePartition interface.
29 virtual FilePath GetPath() OVERRIDE;
30 virtual net::URLRequestContextGetter* GetURLRequestContext() OVERRIDE;
31 virtual net::URLRequestContextGetter* GetMediaURLRequestContext() OVERRIDE;
28 virtual quota::QuotaManager* GetQuotaManager() OVERRIDE; 32 virtual quota::QuotaManager* GetQuotaManager() OVERRIDE;
29 virtual ChromeAppCacheService* GetAppCacheService() OVERRIDE; 33 virtual ChromeAppCacheService* GetAppCacheService() OVERRIDE;
30 virtual fileapi::FileSystemContext* GetFileSystemContext() OVERRIDE; 34 virtual fileapi::FileSystemContext* GetFileSystemContext() OVERRIDE;
31 virtual webkit_database::DatabaseTracker* GetDatabaseTracker() OVERRIDE; 35 virtual webkit_database::DatabaseTracker* GetDatabaseTracker() OVERRIDE;
32 virtual DOMStorageContextImpl* GetDOMStorageContext() OVERRIDE; 36 virtual DOMStorageContextImpl* GetDOMStorageContext() OVERRIDE;
33 virtual IndexedDBContextImpl* GetIndexedDBContext() OVERRIDE; 37 virtual IndexedDBContextImpl* GetIndexedDBContext() OVERRIDE;
34 38
35 private: 39 private:
36 StoragePartitionImpl(const FilePath& partition_path, 40 friend class StoragePartitionImplMap;
37 quota::QuotaManager* quota_manager, 41
38 ChromeAppCacheService* appcache_service, 42 StoragePartitionImpl(
39 fileapi::FileSystemContext* filesystem_context, 43 const FilePath& partition_path,
40 webkit_database::DatabaseTracker* database_tracker, 44 quota::QuotaManager* quota_manager,
41 DOMStorageContextImpl* dom_storage_context, 45 ChromeAppCacheService* appcache_service,
42 IndexedDBContextImpl* indexed_db_context); 46 fileapi::FileSystemContext* filesystem_context,
47 webkit_database::DatabaseTracker* database_tracker,
48 DOMStorageContextImpl* dom_storage_context,
49 IndexedDBContextImpl* indexed_db_context);
50
51 // Used by StoragePartitionImplMap.
52 //
53 // TODO(ajwong): These should be taken in the constructor and in Create() but
54 // because the URLRequestContextGetter still lives in Profile with a tangle
55 // initialization, if we call try to retrieve the URLRequestContextGetter()
56 // before the default StoragePartition is created, we end up reentering the
57 // construction and double-initializing. For now, we retain the legacy
58 // behavior while allowing StoragePartitionImpl to expose these accessors by
59 // letting StoragePartitionImplMap call these two private settings at the
60 // appropriate time. These should move back into the constructor once
61 // URLRequestContextGetter's lifetime is sorted out.
62 void SetURLRequestContext(net::URLRequestContextGetter* url_request_context);
63 void SetMediaURLRequestContext(
64 net::URLRequestContextGetter* media_url_request_context);
43 65
44 FilePath partition_path_; 66 FilePath partition_path_;
67 scoped_refptr<net::URLRequestContextGetter> url_request_context_;
68 scoped_refptr<net::URLRequestContextGetter> media_url_request_context_;
45 scoped_refptr<quota::QuotaManager> quota_manager_; 69 scoped_refptr<quota::QuotaManager> quota_manager_;
46 scoped_refptr<ChromeAppCacheService> appcache_service_; 70 scoped_refptr<ChromeAppCacheService> appcache_service_;
47 scoped_refptr<fileapi::FileSystemContext> filesystem_context_; 71 scoped_refptr<fileapi::FileSystemContext> filesystem_context_;
48 scoped_refptr<webkit_database::DatabaseTracker> database_tracker_; 72 scoped_refptr<webkit_database::DatabaseTracker> database_tracker_;
49 scoped_refptr<DOMStorageContextImpl> dom_storage_context_; 73 scoped_refptr<DOMStorageContextImpl> dom_storage_context_;
50 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; 74 scoped_refptr<IndexedDBContextImpl> indexed_db_context_;
51 75
52 DISALLOW_COPY_AND_ASSIGN(StoragePartitionImpl); 76 DISALLOW_COPY_AND_ASSIGN(StoragePartitionImpl);
53 }; 77 };
54 78
55 } // namespace content 79 } // namespace content
56 80
57 #endif // CONTENT_BROWSER_STORAGE_PARTITION_IMPL_H_ 81 #endif // CONTENT_BROWSER_STORAGE_PARTITION_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698