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

Side by Side Diff: content/browser/browser_context.cc

Issue 10861002: Revert 152213 - Replace the DownloadFileManager with direct ownership of DownloadFile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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
« no previous file with comments | « chrome/browser/download/download_browsertest.cc ('k') | content/browser/browser_main_loop.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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_manager_impl.h" 11 #include "content/browser/download/download_manager_impl.h"
11 #include "content/browser/in_process_webkit/indexed_db_context_impl.h" 12 #include "content/browser/in_process_webkit/indexed_db_context_impl.h"
12 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" 13 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h"
13 #include "content/public/browser/resource_context.h" 14 #include "content/public/browser/resource_context.h"
14 #include "content/browser/storage_partition_impl.h" 15 #include "content/browser/storage_partition_impl.h"
15 #include "content/browser/storage_partition_impl_map.h" 16 #include "content/browser/storage_partition_impl_map.h"
16 #include "content/common/child_process_host_impl.h" 17 #include "content/common/child_process_host_impl.h"
17 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
18 #include "content/public/browser/content_browser_client.h" 19 #include "content/public/browser/content_browser_client.h"
19 #include "net/base/server_bound_cert_service.h" 20 #include "net/base/server_bound_cert_service.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 73 }
73 74
74 } // namespace 75 } // namespace
75 76
76 DownloadManager* BrowserContext::GetDownloadManager( 77 DownloadManager* BrowserContext::GetDownloadManager(
77 BrowserContext* context) { 78 BrowserContext* context) {
78 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 79 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
79 if (!context->GetUserData(kDownloadManagerKeyName)) { 80 if (!context->GetUserData(kDownloadManagerKeyName)) {
80 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); 81 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get();
81 DCHECK(rdh); 82 DCHECK(rdh);
83 DownloadFileManager* file_manager = rdh->download_file_manager();
84 DCHECK(file_manager);
82 scoped_refptr<DownloadManager> download_manager = 85 scoped_refptr<DownloadManager> download_manager =
83 new DownloadManagerImpl( 86 new DownloadManagerImpl(
87 file_manager,
84 scoped_ptr<DownloadItemFactory>(), 88 scoped_ptr<DownloadItemFactory>(),
85 GetContentClient()->browser()->GetNetLog()); 89 GetContentClient()->browser()->GetNetLog());
86 90
87 context->SetUserData( 91 context->SetUserData(
88 kDownloadManagerKeyName, 92 kDownloadManagerKeyName,
89 new UserDataAdapter<DownloadManager>(download_manager)); 93 new UserDataAdapter<DownloadManager>(download_manager));
90 download_manager->SetDelegate(context->GetDownloadManagerDelegate()); 94 download_manager->SetDelegate(context->GetDownloadManagerDelegate());
91 download_manager->Init(context); 95 download_manager->Init(context);
92 } 96 }
93 97
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 ForEachStoragePartition(browser_context, 215 ForEachStoragePartition(browser_context,
212 base::Bind(&PurgeDOMStorageContextInPartition)); 216 base::Bind(&PurgeDOMStorageContextInPartition));
213 } 217 }
214 218
215 BrowserContext::~BrowserContext() { 219 BrowserContext::~BrowserContext() {
216 if (GetUserData(kDownloadManagerKeyName)) 220 if (GetUserData(kDownloadManagerKeyName))
217 GetDownloadManager(this)->Shutdown(); 221 GetDownloadManager(this)->Shutdown();
218 } 222 }
219 223
220 } // namespace content 224 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/download/download_browsertest.cc ('k') | content/browser/browser_main_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698