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

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

Issue 10918024: Revert 154294 - Remove DownloadFileManager in favor of direct ownership of DownloadFiles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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/test/functional/downloads.py ('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 "content/browser/dom_storage/dom_storage_context_impl.h" 9 #include "content/browser/dom_storage/dom_storage_context_impl.h"
9 #include "content/browser/download/download_file_factory.h" 10 #include "content/browser/download/download_file_manager.h"
10 #include "content/browser/download/download_item_factory.h"
11 #include "content/browser/download/download_manager_impl.h" 11 #include "content/browser/download/download_manager_impl.h"
12 #include "content/browser/in_process_webkit/indexed_db_context_impl.h" 12 #include "content/browser/in_process_webkit/indexed_db_context_impl.h"
13 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" 13 #include "content/browser/renderer_host/resource_dispatcher_host_impl.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 "content/public/browser/resource_context.h"
20 #include "net/base/server_bound_cert_service.h" 20 #include "net/base/server_bound_cert_service.h"
21 #include "net/base/server_bound_cert_store.h" 21 #include "net/base/server_bound_cert_store.h"
22 #include "net/cookies/cookie_monster.h" 22 #include "net/cookies/cookie_monster.h"
23 #include "net/cookies/cookie_store.h" 23 #include "net/cookies/cookie_store.h"
24 #include "net/url_request/url_request_context.h" 24 #include "net/url_request/url_request_context.h"
25 #include "net/url_request/url_request_context_getter.h" 25 #include "net/url_request/url_request_context_getter.h"
26 #include "webkit/database/database_tracker.h"
27 26
28 using base::UserDataAdapter; 27 using base::UserDataAdapter;
29 28
30 // Key names on BrowserContext. 29 // Key names on BrowserContext.
31 static const char* kDownloadManagerKeyName = "download_manager"; 30 static const char* kDownloadManagerKeyName = "download_manager";
32 static const char* kStorageParitionMapKeyName = "content_storage_partition_map"; 31 static const char* kStorageParitionMapKeyName = "content_storage_partition_map";
33 32
34 namespace content { 33 namespace content {
35 34
36 namespace { 35 namespace {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 76 }
78 77
79 } // namespace 78 } // namespace
80 79
81 DownloadManager* BrowserContext::GetDownloadManager( 80 DownloadManager* BrowserContext::GetDownloadManager(
82 BrowserContext* context) { 81 BrowserContext* context) {
83 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 82 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
84 if (!context->GetUserData(kDownloadManagerKeyName)) { 83 if (!context->GetUserData(kDownloadManagerKeyName)) {
85 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); 84 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get();
86 DCHECK(rdh); 85 DCHECK(rdh);
86 DownloadFileManager* file_manager = rdh->download_file_manager();
87 DCHECK(file_manager);
87 scoped_refptr<DownloadManager> download_manager = 88 scoped_refptr<DownloadManager> download_manager =
88 new DownloadManagerImpl( 89 new DownloadManagerImpl(
90 file_manager,
89 scoped_ptr<DownloadItemFactory>(), 91 scoped_ptr<DownloadItemFactory>(),
90 scoped_ptr<DownloadFileFactory>(),
91 GetContentClient()->browser()->GetNetLog()); 92 GetContentClient()->browser()->GetNetLog());
92 93
93 context->SetUserData( 94 context->SetUserData(
94 kDownloadManagerKeyName, 95 kDownloadManagerKeyName,
95 new UserDataAdapter<DownloadManager>(download_manager)); 96 new UserDataAdapter<DownloadManager>(download_manager));
96 download_manager->SetDelegate(context->GetDownloadManagerDelegate()); 97 download_manager->SetDelegate(context->GetDownloadManagerDelegate());
97 download_manager->Init(context); 98 download_manager->Init(context);
98 } 99 }
99 100
100 return UserDataAdapter<DownloadManager>::Get( 101 return UserDataAdapter<DownloadManager>::Get(
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 ForEachStoragePartition(browser_context, 210 ForEachStoragePartition(browser_context,
210 base::Bind(&PurgeDOMStorageContextInPartition)); 211 base::Bind(&PurgeDOMStorageContextInPartition));
211 } 212 }
212 213
213 BrowserContext::~BrowserContext() { 214 BrowserContext::~BrowserContext() {
214 if (GetUserData(kDownloadManagerKeyName)) 215 if (GetUserData(kDownloadManagerKeyName))
215 GetDownloadManager(this)->Shutdown(); 216 GetDownloadManager(this)->Shutdown();
216 } 217 }
217 218
218 } // namespace content 219 } // namespace content
OLDNEW
« no previous file with comments | « chrome/test/functional/downloads.py ('k') | content/browser/browser_main_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698