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 "webkit/database/database_tracker.h" | 8 #include "webkit/database/database_tracker.h" |
9 #include "content/browser/dom_storage/dom_storage_context_impl.h" | 9 #include "content/browser/dom_storage/dom_storage_context_impl.h" |
10 #include "content/browser/download/download_file_manager.h" | 10 #include "content/browser/download/download_file_manager.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 kDownloadManagerKeyName, | 96 kDownloadManagerKeyName, |
97 new UserDataAdapter<DownloadManager>(download_manager)); | 97 new UserDataAdapter<DownloadManager>(download_manager)); |
98 download_manager->SetDelegate(context->GetDownloadManagerDelegate()); | 98 download_manager->SetDelegate(context->GetDownloadManagerDelegate()); |
99 download_manager->Init(context); | 99 download_manager->Init(context); |
100 } | 100 } |
101 | 101 |
102 return UserDataAdapter<DownloadManager>::Get( | 102 return UserDataAdapter<DownloadManager>::Get( |
103 context, kDownloadManagerKeyName); | 103 context, kDownloadManagerKeyName); |
104 } | 104 } |
105 | 105 |
106 fileapi::FileSystemContext* BrowserContext::GetFileSystemContext( | |
107 BrowserContext* browser_context) { | |
108 // TODO(ajwong): Change this API to require a SiteInstance instead of | |
109 // using GetDefaultStoragePartition(). | |
110 return GetDefaultStoragePartition(browser_context)->GetFileSystemContext(); | |
111 } | |
112 | |
113 StoragePartition* BrowserContext::GetStoragePartition( | 106 StoragePartition* BrowserContext::GetStoragePartition( |
114 BrowserContext* browser_context, | 107 BrowserContext* browser_context, |
115 SiteInstance* site_instance) { | 108 SiteInstance* site_instance) { |
116 std::string partition_id; // Default to "" for NULL |site_instance|. | 109 std::string partition_id; // Default to "" for NULL |site_instance|. |
117 | 110 |
118 // TODO(ajwong): After GetDefaultStoragePartition() is removed, get rid of | 111 // TODO(ajwong): After GetDefaultStoragePartition() is removed, get rid of |
119 // this conditional and require that |site_instance| is non-NULL. | 112 // this conditional and require that |site_instance| is non-NULL. |
120 if (site_instance) { | 113 if (site_instance) { |
121 partition_id = GetContentClient()->browser()-> | 114 partition_id = GetContentClient()->browser()-> |
122 GetStoragePartitionIdForSite(browser_context, site_instance->GetSite()); | 115 GetStoragePartitionIdForSite(browser_context, site_instance->GetSite()); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 ForEachStoragePartition(browser_context, | 199 ForEachStoragePartition(browser_context, |
207 base::Bind(&PurgeDOMStorageContextInPartition)); | 200 base::Bind(&PurgeDOMStorageContextInPartition)); |
208 } | 201 } |
209 | 202 |
210 BrowserContext::~BrowserContext() { | 203 BrowserContext::~BrowserContext() { |
211 if (GetUserData(kDownloadManagerKeyName)) | 204 if (GetUserData(kDownloadManagerKeyName)) |
212 GetDownloadManager(this)->Shutdown(); | 205 GetDownloadManager(this)->Shutdown(); |
213 } | 206 } |
214 | 207 |
215 } // namespace content | 208 } // namespace content |
OLD | NEW |