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

Side by Side Diff: chrome/browser/profiles/profile_io_data.cc

Issue 8401001: Fix history importing by delaying DownloadManager creation. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: comments Created 9 years, 1 month 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/profiles/profile_io_data.h" 5 #include "chrome/browser/profiles/profile_io_data.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/stl_util.h" 14 #include "base/stl_util.h"
15 #include "base/string_number_conversions.h" 15 #include "base/string_number_conversions.h"
16 #include "base/task.h" 16 #include "base/task.h"
17 #include "chrome/browser/browser_process.h" 17 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/content_settings/host_content_settings_map.h" 18 #include "chrome/browser/content_settings/host_content_settings_map.h"
19 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 19 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
20 #include "chrome/browser/download/download_service.h"
21 #include "chrome/browser/download/download_service_factory.h"
20 #include "chrome/browser/extensions/extension_info_map.h" 22 #include "chrome/browser/extensions/extension_info_map.h"
21 #include "chrome/browser/extensions/extension_protocols.h" 23 #include "chrome/browser/extensions/extension_protocols.h"
22 #include "chrome/browser/io_thread.h" 24 #include "chrome/browser/io_thread.h"
23 #include "chrome/browser/media/media_internals.h" 25 #include "chrome/browser/media/media_internals.h"
24 #include "chrome/browser/net/chrome_cookie_notification_details.h" 26 #include "chrome/browser/net/chrome_cookie_notification_details.h"
25 #include "chrome/browser/net/chrome_dns_cert_provenance_checker_factory.h" 27 #include "chrome/browser/net/chrome_dns_cert_provenance_checker_factory.h"
26 #include "chrome/browser/net/chrome_fraudulent_certificate_reporter.h" 28 #include "chrome/browser/net/chrome_fraudulent_certificate_reporter.h"
27 #include "chrome/browser/net/chrome_net_log.h" 29 #include "chrome/browser/net/chrome_net_log.h"
28 #include "chrome/browser/net/chrome_network_delegate.h" 30 #include "chrome/browser/net/chrome_network_delegate.h"
29 #include "chrome/browser/net/pref_proxy_config_service.h" 31 #include "chrome/browser/net/pref_proxy_config_service.h"
30 #include "chrome/browser/net/proxy_service_factory.h" 32 #include "chrome/browser/net/proxy_service_factory.h"
31 #include "chrome/browser/notifications/desktop_notification_service_factory.h" 33 #include "chrome/browser/notifications/desktop_notification_service_factory.h"
32 #include "chrome/browser/policy/url_blacklist_manager.h" 34 #include "chrome/browser/policy/url_blacklist_manager.h"
33 #include "chrome/browser/prefs/pref_service.h" 35 #include "chrome/browser/prefs/pref_service.h"
34 #include "chrome/browser/profiles/profile.h" 36 #include "chrome/browser/profiles/profile.h"
35 #include "chrome/browser/profiles/profile_manager.h" 37 #include "chrome/browser/profiles/profile_manager.h"
36 #include "chrome/browser/transport_security_persister.h" 38 #include "chrome/browser/transport_security_persister.h"
37 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" 39 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h"
38 #include "chrome/common/chrome_notification_types.h" 40 #include "chrome/common/chrome_notification_types.h"
39 #include "chrome/common/chrome_switches.h" 41 #include "chrome/common/chrome_switches.h"
40 #include "chrome/common/pref_names.h" 42 #include "chrome/common/pref_names.h"
41 #include "chrome/common/url_constants.h" 43 #include "chrome/common/url_constants.h"
42 #include "content/browser/appcache/chrome_appcache_service.h" 44 #include "content/browser/appcache/chrome_appcache_service.h"
43 #include "content/browser/browser_thread.h" 45 #include "content/browser/browser_thread.h"
44 #include "content/browser/chrome_blob_storage_context.h" 46 #include "content/browser/chrome_blob_storage_context.h"
47 #include "content/browser/download/download_id_factory.h"
45 #include "content/browser/host_zoom_map.h" 48 #include "content/browser/host_zoom_map.h"
46 #include "content/browser/renderer_host/media/media_stream_manager.h" 49 #include "content/browser/renderer_host/media/media_stream_manager.h"
47 #include "content/browser/renderer_host/resource_dispatcher_host.h" 50 #include "content/browser/renderer_host/resource_dispatcher_host.h"
48 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" 51 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
49 #include "content/browser/resource_context.h" 52 #include "content/browser/resource_context.h"
50 #include "content/public/browser/notification_service.h" 53 #include "content/public/browser/notification_service.h"
51 #include "net/base/origin_bound_cert_service.h" 54 #include "net/base/origin_bound_cert_service.h"
52 #include "net/http/http_transaction_factory.h" 55 #include "net/http/http_transaction_factory.h"
53 #include "net/http/http_util.h" 56 #include "net/http/http_util.h"
54 #include "net/proxy/proxy_config_service_fixed.h" 57 #include "net/proxy/proxy_config_service_fixed.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 return profile; 182 return profile;
180 return NULL; 183 return NULL;
181 } 184 }
182 185
183 } // namespace 186 } // namespace
184 187
185 void ProfileIOData::InitializeOnUIThread(Profile* profile) { 188 void ProfileIOData::InitializeOnUIThread(Profile* profile) {
186 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 189 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
187 PrefService* pref_service = profile->GetPrefs(); 190 PrefService* pref_service = profile->GetPrefs();
188 191
189 next_download_id_thunk_ = profile->GetDownloadManager()->GetNextIdThunk(); 192 download_id_factory_ = DownloadServiceFactory::GetForProfile(profile)->
193 GetDownloadIdFactory();
190 194
191 scoped_ptr<ProfileParams> params(new ProfileParams); 195 scoped_ptr<ProfileParams> params(new ProfileParams);
192 params->path = profile->GetPath(); 196 params->path = profile->GetPath();
193 params->is_incognito = profile->IsOffTheRecord(); 197 params->is_incognito = profile->IsOffTheRecord();
194 params->clear_local_state_on_exit = 198 params->clear_local_state_on_exit =
195 pref_service->GetBoolean(prefs::kClearSiteDataOnExit); 199 pref_service->GetBoolean(prefs::kClearSiteDataOnExit);
196 200
197 params->appcache_service = profile->GetAppCacheService(); 201 params->appcache_service = profile->GetAppCacheService();
198 202
199 // Set up Accept-Language and Accept-Charset header values 203 // Set up Accept-Language and Accept-Charset header values
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 resource_context_.set_request_context(main_request_context_); 497 resource_context_.set_request_context(main_request_context_);
494 resource_context_.set_database_tracker(database_tracker_); 498 resource_context_.set_database_tracker(database_tracker_);
495 resource_context_.set_appcache_service(appcache_service_); 499 resource_context_.set_appcache_service(appcache_service_);
496 resource_context_.set_blob_storage_context(blob_storage_context_); 500 resource_context_.set_blob_storage_context(blob_storage_context_);
497 resource_context_.set_file_system_context(file_system_context_); 501 resource_context_.set_file_system_context(file_system_context_);
498 resource_context_.set_quota_manager(quota_manager_); 502 resource_context_.set_quota_manager(quota_manager_);
499 resource_context_.set_host_zoom_map(host_zoom_map_); 503 resource_context_.set_host_zoom_map(host_zoom_map_);
500 resource_context_.SetUserData(NULL, const_cast<ProfileIOData*>(this)); 504 resource_context_.SetUserData(NULL, const_cast<ProfileIOData*>(this));
501 resource_context_.set_media_observer( 505 resource_context_.set_media_observer(
502 io_thread_globals->media.media_internals.get()); 506 io_thread_globals->media.media_internals.get());
503 resource_context_.set_next_download_id_thunk(next_download_id_thunk_); 507 resource_context_.set_download_id_factory(download_id_factory_);
504 resource_context_.set_media_stream_manager(media_stream_manager_.get()); 508 resource_context_.set_media_stream_manager(media_stream_manager_.get());
505 509
506 LazyInitializeInternal(profile_params_.get()); 510 LazyInitializeInternal(profile_params_.get());
507 511
508 profile_params_.reset(); 512 profile_params_.reset();
509 initialized_ = true; 513 initialized_ = true;
510 } 514 }
511 515
512 void ProfileIOData::ApplyProfileParamsToContext( 516 void ProfileIOData::ApplyProfileParamsToContext(
513 ChromeURLRequestContext* context) const { 517 ChromeURLRequestContext* context) const {
(...skipping 22 matching lines...) Expand all
536 bool posted = BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 540 bool posted = BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
537 new DeleteTask<ProfileIOData>(this)); 541 new DeleteTask<ProfileIOData>(this));
538 if (!posted) 542 if (!posted)
539 delete this; 543 delete this;
540 } 544 }
541 545
542 void ProfileIOData::set_origin_bound_cert_service( 546 void ProfileIOData::set_origin_bound_cert_service(
543 net::OriginBoundCertService* origin_bound_cert_service) const { 547 net::OriginBoundCertService* origin_bound_cert_service) const {
544 origin_bound_cert_service_.reset(origin_bound_cert_service); 548 origin_bound_cert_service_.reset(origin_bound_cert_service);
545 } 549 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698