| 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 "chrome/browser/profiles/profile_impl.h" | 5 #include "chrome/browser/profiles/profile_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/environment.h" | 15 #include "base/environment.h" |
| 16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
| 17 #include "base/files/file_util.h" | 17 #include "base/files/file_util.h" |
| 18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 supervised_user_settings = | 450 supervised_user_settings = |
| 451 SupervisedUserSettingsServiceFactory::GetForProfile(this); | 451 SupervisedUserSettingsServiceFactory::GetForProfile(this); |
| 452 supervised_user_settings->Init( | 452 supervised_user_settings->Init( |
| 453 path_, sequenced_task_runner, create_mode == CREATE_MODE_SYNCHRONOUS); | 453 path_, sequenced_task_runner, create_mode == CREATE_MODE_SYNCHRONOUS); |
| 454 #endif | 454 #endif |
| 455 | 455 |
| 456 scoped_refptr<safe_browsing::SafeBrowsingService> safe_browsing_service( | 456 scoped_refptr<safe_browsing::SafeBrowsingService> safe_browsing_service( |
| 457 g_browser_process->safe_browsing_service()); | 457 g_browser_process->safe_browsing_service()); |
| 458 if (safe_browsing_service.get()) { | 458 if (safe_browsing_service.get()) { |
| 459 pref_validation_delegate_ = | 459 pref_validation_delegate_ = |
| 460 safe_browsing_service->CreatePreferenceValidationDelegate(this).Pass(); | 460 safe_browsing_service->CreatePreferenceValidationDelegate(this); |
| 461 } | 461 } |
| 462 | 462 |
| 463 { | 463 { |
| 464 prefs_ = chrome_prefs::CreateProfilePrefs( | 464 prefs_ = chrome_prefs::CreateProfilePrefs( |
| 465 path_, | 465 path_, sequenced_task_runner, pref_validation_delegate_.get(), |
| 466 sequenced_task_runner, | 466 profile_policy_connector_->policy_service(), supervised_user_settings, |
| 467 pref_validation_delegate_.get(), | 467 CreateExtensionPrefStore(this, false), pref_registry_, async_prefs); |
| 468 profile_policy_connector_->policy_service(), | |
| 469 supervised_user_settings, | |
| 470 CreateExtensionPrefStore(this, false), | |
| 471 pref_registry_, | |
| 472 async_prefs).Pass(); | |
| 473 // Register on BrowserContext. | 468 // Register on BrowserContext. |
| 474 user_prefs::UserPrefs::Set(this, prefs_.get()); | 469 user_prefs::UserPrefs::Set(this, prefs_.get()); |
| 475 } | 470 } |
| 476 | 471 |
| 477 if (async_prefs) { | 472 if (async_prefs) { |
| 478 // Wait for the notification that prefs has been loaded | 473 // Wait for the notification that prefs has been loaded |
| 479 // (successfully or not). Note that we can use base::Unretained | 474 // (successfully or not). Note that we can use base::Unretained |
| 480 // because the PrefService is owned by this class and lives on | 475 // because the PrefService is owned by this class and lives on |
| 481 // the same thread. | 476 // the same thread. |
| 482 prefs_->AddPrefInitObserver(base::Bind( | 477 prefs_->AddPrefInitObserver(base::Bind( |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 otr_prefs_.reset(CreateIncognitoPrefServiceSyncable( | 911 otr_prefs_.reset(CreateIncognitoPrefServiceSyncable( |
| 917 prefs_.get(), CreateExtensionPrefStore(this, true))); | 912 prefs_.get(), CreateExtensionPrefStore(this, true))); |
| 918 } | 913 } |
| 919 return otr_prefs_.get(); | 914 return otr_prefs_.get(); |
| 920 } | 915 } |
| 921 | 916 |
| 922 net::URLRequestContextGetter* ProfileImpl::CreateRequestContext( | 917 net::URLRequestContextGetter* ProfileImpl::CreateRequestContext( |
| 923 content::ProtocolHandlerMap* protocol_handlers, | 918 content::ProtocolHandlerMap* protocol_handlers, |
| 924 content::URLRequestInterceptorScopedVector request_interceptors) { | 919 content::URLRequestInterceptorScopedVector request_interceptors) { |
| 925 return io_data_.CreateMainRequestContextGetter( | 920 return io_data_.CreateMainRequestContextGetter( |
| 926 protocol_handlers, | 921 protocol_handlers, std::move(request_interceptors), |
| 927 request_interceptors.Pass(), | 922 g_browser_process->local_state(), |
| 928 g_browser_process->local_state(), | 923 g_browser_process->io_thread()) |
| 929 g_browser_process->io_thread()).get(); | 924 .get(); |
| 930 } | 925 } |
| 931 | 926 |
| 932 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { | 927 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { |
| 933 return GetDefaultStoragePartition(this)->GetURLRequestContext(); | 928 return GetDefaultStoragePartition(this)->GetURLRequestContext(); |
| 934 } | 929 } |
| 935 | 930 |
| 936 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( | 931 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( |
| 937 int renderer_child_id) { | 932 int renderer_child_id) { |
| 938 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( | 933 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( |
| 939 renderer_child_id); | 934 renderer_child_id); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 return io_data_.GetExtensionsRequestContextGetter().get(); | 967 return io_data_.GetExtensionsRequestContextGetter().get(); |
| 973 } | 968 } |
| 974 | 969 |
| 975 net::URLRequestContextGetter* | 970 net::URLRequestContextGetter* |
| 976 ProfileImpl::CreateRequestContextForStoragePartition( | 971 ProfileImpl::CreateRequestContextForStoragePartition( |
| 977 const base::FilePath& partition_path, | 972 const base::FilePath& partition_path, |
| 978 bool in_memory, | 973 bool in_memory, |
| 979 content::ProtocolHandlerMap* protocol_handlers, | 974 content::ProtocolHandlerMap* protocol_handlers, |
| 980 content::URLRequestInterceptorScopedVector request_interceptors) { | 975 content::URLRequestInterceptorScopedVector request_interceptors) { |
| 981 return io_data_.CreateIsolatedAppRequestContextGetter( | 976 return io_data_.CreateIsolatedAppRequestContextGetter( |
| 982 partition_path, | 977 partition_path, in_memory, protocol_handlers, |
| 983 in_memory, | 978 std::move(request_interceptors)) |
| 984 protocol_handlers, | 979 .get(); |
| 985 request_interceptors.Pass()).get(); | |
| 986 } | 980 } |
| 987 | 981 |
| 988 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { | 982 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { |
| 989 // If ssl_config_service_manager_ is null, this typically means that some | 983 // If ssl_config_service_manager_ is null, this typically means that some |
| 990 // KeyedService is trying to create a RequestContext at startup, | 984 // KeyedService is trying to create a RequestContext at startup, |
| 991 // but SSLConfigServiceManager is not initialized until DoFinalInit() which is | 985 // but SSLConfigServiceManager is not initialized until DoFinalInit() which is |
| 992 // invoked after all KeyedServices have been initialized (see | 986 // invoked after all KeyedServices have been initialized (see |
| 993 // http://crbug.com/171406). | 987 // http://crbug.com/171406). |
| 994 DCHECK(ssl_config_service_manager_) << | 988 DCHECK(ssl_config_service_manager_) << |
| 995 "SSLConfigServiceManager is not initialized yet"; | 989 "SSLConfigServiceManager is not initialized yet"; |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1285 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { | 1279 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { |
| 1286 domain_reliability::DomainReliabilityService* service = | 1280 domain_reliability::DomainReliabilityService* service = |
| 1287 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> | 1281 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> |
| 1288 GetForBrowserContext(this); | 1282 GetForBrowserContext(this); |
| 1289 if (!service) | 1283 if (!service) |
| 1290 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); | 1284 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); |
| 1291 | 1285 |
| 1292 return service->CreateMonitor( | 1286 return service->CreateMonitor( |
| 1293 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 1287 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 1294 } | 1288 } |
| OLD | NEW |