| 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 #if !defined(OS_IOS) | 7 #if !defined(OS_IOS) |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "content/browser/appcache/chrome_appcache_service.h" | 9 #include "content/browser/appcache/chrome_appcache_service.h" |
| 10 #include "content/browser/dom_storage/dom_storage_context_impl.h" | 10 #include "content/browser/dom_storage/dom_storage_context_impl.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 BrowserContext* browser_context, | 99 BrowserContext* browser_context, |
| 100 const GURL& site, | 100 const GURL& site, |
| 101 const base::Closure& on_gc_required) { | 101 const base::Closure& on_gc_required) { |
| 102 GetStoragePartitionMap(browser_context)->AsyncObliterate(site, | 102 GetStoragePartitionMap(browser_context)->AsyncObliterate(site, |
| 103 on_gc_required); | 103 on_gc_required); |
| 104 } | 104 } |
| 105 | 105 |
| 106 // static | 106 // static |
| 107 void BrowserContext::GarbageCollectStoragePartitions( | 107 void BrowserContext::GarbageCollectStoragePartitions( |
| 108 BrowserContext* browser_context, | 108 BrowserContext* browser_context, |
| 109 scoped_ptr<base::hash_set<FilePath> > active_paths, | 109 scoped_ptr<base::hash_set<base::FilePath> > active_paths, |
| 110 const base::Closure& done) { | 110 const base::Closure& done) { |
| 111 GetStoragePartitionMap(browser_context)->GarbageCollect( | 111 GetStoragePartitionMap(browser_context)->GarbageCollect( |
| 112 active_paths.Pass(), done); | 112 active_paths.Pass(), done); |
| 113 } | 113 } |
| 114 | 114 |
| 115 DownloadManager* BrowserContext::GetDownloadManager( | 115 DownloadManager* BrowserContext::GetDownloadManager( |
| 116 BrowserContext* context) { | 116 BrowserContext* context) { |
| 117 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 117 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 118 if (!context->GetUserData(kDownloadManagerKeyName)) { | 118 if (!context->GetUserData(kDownloadManagerKeyName)) { |
| 119 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); | 119 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 144 #if defined(OS_CHROMEOS) | 144 #if defined(OS_CHROMEOS) |
| 145 if (!context->GetUserData(kMountPointsKey)) { | 145 if (!context->GetUserData(kMountPointsKey)) { |
| 146 scoped_refptr<fileapi::ExternalMountPoints> mount_points = | 146 scoped_refptr<fileapi::ExternalMountPoints> mount_points = |
| 147 fileapi::ExternalMountPoints::CreateRefCounted(); | 147 fileapi::ExternalMountPoints::CreateRefCounted(); |
| 148 context->SetUserData( | 148 context->SetUserData( |
| 149 kMountPointsKey, | 149 kMountPointsKey, |
| 150 new UserDataAdapter<fileapi::ExternalMountPoints>( | 150 new UserDataAdapter<fileapi::ExternalMountPoints>( |
| 151 mount_points)); | 151 mount_points)); |
| 152 | 152 |
| 153 // Add Downloads mount point. | 153 // Add Downloads mount point. |
| 154 FilePath home_path; | 154 base::FilePath home_path; |
| 155 if (PathService::Get(base::DIR_HOME, &home_path)) { | 155 if (PathService::Get(base::DIR_HOME, &home_path)) { |
| 156 mount_points->RegisterFileSystem( | 156 mount_points->RegisterFileSystem( |
| 157 "Downloads", | 157 "Downloads", |
| 158 fileapi::kFileSystemTypeNativeLocal, | 158 fileapi::kFileSystemTypeNativeLocal, |
| 159 home_path.AppendASCII("Downloads")); | 159 home_path.AppendASCII("Downloads")); |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 | 162 |
| 163 return UserDataAdapter<fileapi::ExternalMountPoints>::Get( | 163 return UserDataAdapter<fileapi::ExternalMountPoints>::Get( |
| 164 context, kMountPointsKey); | 164 context, kMountPointsKey); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 #endif // !OS_IOS | 276 #endif // !OS_IOS |
| 277 | 277 |
| 278 BrowserContext::~BrowserContext() { | 278 BrowserContext::~BrowserContext() { |
| 279 #if !defined(OS_IOS) | 279 #if !defined(OS_IOS) |
| 280 if (GetUserData(kDownloadManagerKeyName)) | 280 if (GetUserData(kDownloadManagerKeyName)) |
| 281 GetDownloadManager(this)->Shutdown(); | 281 GetDownloadManager(this)->Shutdown(); |
| 282 #endif | 282 #endif |
| 283 } | 283 } |
| 284 | 284 |
| 285 } // namespace content | 285 } // namespace content |
| OLD | NEW |