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/public/browser/browser_context.h" | 5 #include "content/public/browser/browser_context.h" |
6 | 6 |
7 #include "content/browser/appcache/chrome_appcache_service.h" | 7 #include "content/browser/appcache/chrome_appcache_service.h" |
8 #include "content/browser/dom_storage/dom_storage_context_impl.h" | 8 #include "content/browser/dom_storage/dom_storage_context_impl.h" |
9 #include "content/browser/download/download_manager_impl.h" | 9 #include "content/browser/download/download_manager_impl.h" |
10 #include "content/browser/fileapi/browser_file_system_helper.h" | 10 #include "content/browser/fileapi/browser_file_system_helper.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 context->GetPath(), context->IsOffTheRecord(), | 68 context->GetPath(), context->IsOffTheRecord(), |
69 context->GetSpecialStoragePolicy(), quota_manager->proxy()); | 69 context->GetSpecialStoragePolicy(), quota_manager->proxy()); |
70 context->SetUserData( | 70 context->SetUserData( |
71 kFileSystemContextKeyName, | 71 kFileSystemContextKeyName, |
72 new UserDataAdapter<FileSystemContext>(filesystem_context)); | 72 new UserDataAdapter<FileSystemContext>(filesystem_context)); |
73 | 73 |
74 scoped_refptr<DatabaseTracker> db_tracker = new DatabaseTracker( | 74 scoped_refptr<DatabaseTracker> db_tracker = new DatabaseTracker( |
75 context->GetPath(), context->IsOffTheRecord(), | 75 context->GetPath(), context->IsOffTheRecord(), |
76 context->GetSpecialStoragePolicy(), quota_manager->proxy(), | 76 context->GetSpecialStoragePolicy(), quota_manager->proxy(), |
77 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); | 77 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); |
78 context->SetUserData(kDatabaseTrackerKeyName, | 78 context->SetUserData(kDatabaseTrackerKeyName, |
79 new UserDataAdapter<DatabaseTracker>(db_tracker)); | 79 new UserDataAdapter<DatabaseTracker>(db_tracker)); |
80 | 80 |
81 FilePath path = context->IsOffTheRecord() ? FilePath() : context->GetPath(); | 81 FilePath path = context->IsOffTheRecord() ? FilePath() : context->GetPath(); |
82 scoped_refptr<DOMStorageContextImpl> dom_storage_context = | 82 scoped_refptr<DOMStorageContextImpl> dom_storage_context = |
83 new DOMStorageContextImpl(path, context->GetSpecialStoragePolicy()); | 83 new DOMStorageContextImpl(path, context->GetSpecialStoragePolicy()); |
84 context->SetUserData( | 84 context->SetUserData( |
85 kDOMStorageContextKeyName, | 85 kDOMStorageContextKeyName, |
86 new UserDataAdapter<DOMStorageContextImpl>(dom_storage_context)); | 86 new UserDataAdapter<DOMStorageContextImpl>(dom_storage_context)); |
87 | 87 |
88 scoped_refptr<IndexedDBContext> indexed_db_context = new IndexedDBContextImpl( | 88 scoped_refptr<IndexedDBContext> indexed_db_context = new IndexedDBContextImpl( |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 DOMStorageContextImpl* GetDOMStorageContextImpl(BrowserContext* context) { | 135 DOMStorageContextImpl* GetDOMStorageContextImpl(BrowserContext* context) { |
136 return static_cast<DOMStorageContextImpl*>( | 136 return static_cast<DOMStorageContextImpl*>( |
137 BrowserContext::GetDOMStorageContext(context)); | 137 BrowserContext::GetDOMStorageContext(context)); |
138 } | 138 } |
139 | 139 |
140 } // namespace | 140 } // namespace |
141 | 141 |
142 DownloadManager* BrowserContext::GetDownloadManager( | 142 DownloadManager* BrowserContext::GetDownloadManager( |
143 BrowserContext* context) { | 143 BrowserContext* context) { |
144 if (!context->GetUserData(kDownloadManagerKeyName)) { | 144 if (!context->GetUserData(kDownloadManagerKeyName)) { |
145 scoped_refptr<DownloadManager> download_manager = new DownloadManagerImpl( | 145 scoped_refptr<DownloadManager> download_manager = |
146 GetContentClient()->browser()->GetNetLog()); | 146 DownloadManagerImpl::Create(GetContentClient()->browser()->GetNetLog()); |
147 context->SetUserData( | 147 context->SetUserData( |
148 kDownloadManagerKeyName, | 148 kDownloadManagerKeyName, |
149 new UserDataAdapter<DownloadManager>(download_manager)); | 149 new UserDataAdapter<DownloadManager>(download_manager)); |
150 download_manager->SetDelegate(context->GetDownloadManagerDelegate()); | 150 download_manager->SetDelegate(context->GetDownloadManagerDelegate()); |
151 download_manager->Init(context); | 151 download_manager->Init(context); |
152 } | 152 } |
153 | 153 |
154 return UserDataAdapter<DownloadManager>::Get( | 154 return UserDataAdapter<DownloadManager>::Get( |
155 context, kDownloadManagerKeyName); | 155 context, kDownloadManagerKeyName); |
156 } | 156 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 } | 247 } |
248 | 248 |
249 if (GetUserData(kDOMStorageContextKeyName)) | 249 if (GetUserData(kDOMStorageContextKeyName)) |
250 GetDOMStorageContextImpl(this)->Shutdown(); | 250 GetDOMStorageContextImpl(this)->Shutdown(); |
251 | 251 |
252 if (GetUserData(kDownloadManagerKeyName)) | 252 if (GetUserData(kDownloadManagerKeyName)) |
253 GetDownloadManager(this)->Shutdown(); | 253 GetDownloadManager(this)->Shutdown(); |
254 } | 254 } |
255 | 255 |
256 } // namespace content | 256 } // namespace content |
OLD | NEW |