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 #include "content/browser/storage_partition_impl.h" | 5 #include "content/browser/storage_partition_impl.h" |
6 | 6 |
7 #include "content/browser/fileapi/browser_file_system_helper.h" | 7 #include "content/browser/fileapi/browser_file_system_helper.h" |
8 #include "content/public/browser/browser_context.h" | 8 #include "content/public/browser/browser_context.h" |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 #include "net/url_request/url_request_context_getter.h" | |
10 #include "webkit/database/database_tracker.h" | 11 #include "webkit/database/database_tracker.h" |
11 #include "webkit/quota/quota_manager.h" | 12 #include "webkit/quota/quota_manager.h" |
12 | 13 |
13 namespace content { | 14 namespace content { |
14 | 15 |
15 StoragePartitionImpl::StoragePartitionImpl( | 16 StoragePartitionImpl::StoragePartitionImpl( |
16 const FilePath& partition_path, | 17 const FilePath& partition_path, |
17 quota::QuotaManager* quota_manager, | 18 quota::QuotaManager* quota_manager, |
18 ChromeAppCacheService* appcache_service, | 19 ChromeAppCacheService* appcache_service, |
19 fileapi::FileSystemContext* filesystem_context, | 20 fileapi::FileSystemContext* filesystem_context, |
(...skipping 21 matching lines...) Expand all Loading... | |
41 | 42 |
42 if (GetDOMStorageContext()) | 43 if (GetDOMStorageContext()) |
43 GetDOMStorageContext()->Shutdown(); | 44 GetDOMStorageContext()->Shutdown(); |
44 } | 45 } |
45 | 46 |
46 // TODO(ajwong): Break the direct dependency on |context|. We only | 47 // TODO(ajwong): Break the direct dependency on |context|. We only |
47 // need 3 pieces of info from it. | 48 // need 3 pieces of info from it. |
48 StoragePartitionImpl* StoragePartitionImpl::Create( | 49 StoragePartitionImpl* StoragePartitionImpl::Create( |
49 BrowserContext* context, | 50 BrowserContext* context, |
50 const FilePath& partition_path) { | 51 const FilePath& partition_path) { |
52 | |
michaeln
2012/09/15 01:48:33
stray newline
awong
2012/09/15 02:05:02
Done.
| |
51 // Ensure that these methods are called on the UI thread, except for | 53 // Ensure that these methods are called on the UI thread, except for |
52 // unittests where a UI thread might not have been created. | 54 // unittests where a UI thread might not have been created. |
53 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || | 55 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || |
54 !BrowserThread::IsMessageLoopValid(BrowserThread::UI)); | 56 !BrowserThread::IsMessageLoopValid(BrowserThread::UI)); |
55 | 57 |
56 // All of the clients have to be created and registered with the | 58 // All of the clients have to be created and registered with the |
57 // QuotaManager prior to the QuotaManger being used. We do them | 59 // QuotaManager prior to the QuotaManger being used. We do them |
58 // all together here prior to handing out a reference to anything | 60 // all together here prior to handing out a reference to anything |
59 // that utilizes the QuotaManager. | 61 // that utilizes the QuotaManager. |
60 scoped_refptr<quota::QuotaManager> quota_manager = | 62 scoped_refptr<quota::QuotaManager> quota_manager = |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 | 94 |
93 return new StoragePartitionImpl(partition_path, | 95 return new StoragePartitionImpl(partition_path, |
94 quota_manager, | 96 quota_manager, |
95 appcache_service, | 97 appcache_service, |
96 filesystem_context, | 98 filesystem_context, |
97 database_tracker, | 99 database_tracker, |
98 dom_storage_context, | 100 dom_storage_context, |
99 indexed_db_context); | 101 indexed_db_context); |
100 } | 102 } |
101 | 103 |
104 FilePath StoragePartitionImpl::GetPath() { | |
105 return partition_path_; | |
106 } | |
107 | |
108 net::URLRequestContextGetter* StoragePartitionImpl::GetURLRequestContext() { | |
109 return url_request_context_; | |
110 } | |
111 | |
112 net::URLRequestContextGetter* | |
113 StoragePartitionImpl::GetMediaURLRequestContext() { | |
114 return media_url_request_context_; | |
115 } | |
116 | |
102 quota::QuotaManager* StoragePartitionImpl::GetQuotaManager() { | 117 quota::QuotaManager* StoragePartitionImpl::GetQuotaManager() { |
103 return quota_manager_; | 118 return quota_manager_; |
104 } | 119 } |
105 | 120 |
106 ChromeAppCacheService* StoragePartitionImpl::GetAppCacheService() { | 121 ChromeAppCacheService* StoragePartitionImpl::GetAppCacheService() { |
107 return appcache_service_; | 122 return appcache_service_; |
108 } | 123 } |
109 | 124 |
110 fileapi::FileSystemContext* StoragePartitionImpl::GetFileSystemContext() { | 125 fileapi::FileSystemContext* StoragePartitionImpl::GetFileSystemContext() { |
111 return filesystem_context_; | 126 return filesystem_context_; |
112 } | 127 } |
113 | 128 |
114 webkit_database::DatabaseTracker* StoragePartitionImpl::GetDatabaseTracker() { | 129 webkit_database::DatabaseTracker* StoragePartitionImpl::GetDatabaseTracker() { |
115 return database_tracker_; | 130 return database_tracker_; |
116 } | 131 } |
117 | 132 |
118 DOMStorageContextImpl* StoragePartitionImpl::GetDOMStorageContext() { | 133 DOMStorageContextImpl* StoragePartitionImpl::GetDOMStorageContext() { |
119 return dom_storage_context_; | 134 return dom_storage_context_; |
120 } | 135 } |
121 | 136 |
122 IndexedDBContextImpl* StoragePartitionImpl::GetIndexedDBContext() { | 137 IndexedDBContextImpl* StoragePartitionImpl::GetIndexedDBContext() { |
123 return indexed_db_context_; | 138 return indexed_db_context_; |
124 } | 139 } |
125 | 140 |
141 void StoragePartitionImpl::SetURLRequestContext( | |
142 net::URLRequestContextGetter* url_request_context) { | |
143 url_request_context_ = url_request_context; | |
144 } | |
145 | |
146 void StoragePartitionImpl::SetMediaURLRequestContext( | |
147 net::URLRequestContextGetter* media_url_request_context) { | |
148 media_url_request_context_ = media_url_request_context; | |
149 } | |
150 | |
126 } // namespace content | 151 } // namespace content |
OLD | NEW |