| 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 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 906 DCHECK(prefs_); | 906 DCHECK(prefs_); |
| 907 if (!otr_prefs_) { | 907 if (!otr_prefs_) { |
| 908 // The new ExtensionPrefStore is ref_counted and the new PrefService | 908 // The new ExtensionPrefStore is ref_counted and the new PrefService |
| 909 // stores a reference so that we do not leak memory here. | 909 // stores a reference so that we do not leak memory here. |
| 910 otr_prefs_.reset(CreateIncognitoPrefServiceSyncable( | 910 otr_prefs_.reset(CreateIncognitoPrefServiceSyncable( |
| 911 prefs_.get(), CreateExtensionPrefStore(this, true))); | 911 prefs_.get(), CreateExtensionPrefStore(this, true))); |
| 912 } | 912 } |
| 913 return otr_prefs_.get(); | 913 return otr_prefs_.get(); |
| 914 } | 914 } |
| 915 | 915 |
| 916 net::URLRequestContextGetter* ProfileImpl::CreateRequestContext( | |
| 917 content::ProtocolHandlerMap* protocol_handlers, | |
| 918 content::URLRequestInterceptorScopedVector request_interceptors) { | |
| 919 return io_data_.CreateMainRequestContextGetter( | |
| 920 protocol_handlers, std::move(request_interceptors), | |
| 921 g_browser_process->io_thread()) | |
| 922 .get(); | |
| 923 } | |
| 924 | |
| 925 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { | 916 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { |
| 926 return GetDefaultStoragePartition(this)->GetURLRequestContext(); | 917 return GetDefaultStoragePartition(this)->GetURLRequestContext(); |
| 927 } | 918 } |
| 928 | 919 |
| 929 net::URLRequestContextGetter* ProfileImpl::GetMediaRequestContext() { | 920 net::URLRequestContextGetter* ProfileImpl::GetMediaRequestContext() { |
| 930 // Return the default media context. | 921 // Return the default media context. |
| 931 return io_data_.GetMediaRequestContextGetter().get(); | 922 return io_data_.GetMediaRequestContextGetter().get(); |
| 932 } | 923 } |
| 933 | 924 |
| 934 net::URLRequestContextGetter* | 925 net::URLRequestContextGetter* |
| (...skipping 15 matching lines...) Expand all Loading... |
| 950 } | 941 } |
| 951 | 942 |
| 952 content::ResourceContext* ProfileImpl::GetResourceContext() { | 943 content::ResourceContext* ProfileImpl::GetResourceContext() { |
| 953 return io_data_.GetResourceContext(); | 944 return io_data_.GetResourceContext(); |
| 954 } | 945 } |
| 955 | 946 |
| 956 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { | 947 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { |
| 957 return io_data_.GetExtensionsRequestContextGetter().get(); | 948 return io_data_.GetExtensionsRequestContextGetter().get(); |
| 958 } | 949 } |
| 959 | 950 |
| 960 net::URLRequestContextGetter* | |
| 961 ProfileImpl::CreateRequestContextForStoragePartition( | |
| 962 const base::FilePath& partition_path, | |
| 963 bool in_memory, | |
| 964 content::ProtocolHandlerMap* protocol_handlers, | |
| 965 content::URLRequestInterceptorScopedVector request_interceptors) { | |
| 966 return io_data_.CreateIsolatedAppRequestContextGetter( | |
| 967 partition_path, in_memory, protocol_handlers, | |
| 968 std::move(request_interceptors)) | |
| 969 .get(); | |
| 970 } | |
| 971 | |
| 972 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { | 951 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { |
| 973 // If ssl_config_service_manager_ is null, this typically means that some | 952 // If ssl_config_service_manager_ is null, this typically means that some |
| 974 // KeyedService is trying to create a RequestContext at startup, | 953 // KeyedService is trying to create a RequestContext at startup, |
| 975 // but SSLConfigServiceManager is not initialized until DoFinalInit() which is | 954 // but SSLConfigServiceManager is not initialized until DoFinalInit() which is |
| 976 // invoked after all KeyedServices have been initialized (see | 955 // invoked after all KeyedServices have been initialized (see |
| 977 // http://crbug.com/171406). | 956 // http://crbug.com/171406). |
| 978 DCHECK(ssl_config_service_manager_) << | 957 DCHECK(ssl_config_service_manager_) << |
| 979 "SSLConfigServiceManager is not initialized yet"; | 958 "SSLConfigServiceManager is not initialized yet"; |
| 980 return ssl_config_service_manager_->Get(); | 959 return ssl_config_service_manager_->Get(); |
| 981 } | 960 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1012 // TODO(mlamouri): we should all these BrowserContext implementation to Profile | 991 // TODO(mlamouri): we should all these BrowserContext implementation to Profile |
| 1013 // instead of repeating them inside all Profile implementations. | 992 // instead of repeating them inside all Profile implementations. |
| 1014 content::PermissionManager* ProfileImpl::GetPermissionManager() { | 993 content::PermissionManager* ProfileImpl::GetPermissionManager() { |
| 1015 return PermissionManagerFactory::GetForProfile(this); | 994 return PermissionManagerFactory::GetForProfile(this); |
| 1016 } | 995 } |
| 1017 | 996 |
| 1018 content::BackgroundSyncController* ProfileImpl::GetBackgroundSyncController() { | 997 content::BackgroundSyncController* ProfileImpl::GetBackgroundSyncController() { |
| 1019 return BackgroundSyncControllerFactory::GetForProfile(this); | 998 return BackgroundSyncControllerFactory::GetForProfile(this); |
| 1020 } | 999 } |
| 1021 | 1000 |
| 1001 net::URLRequestContextGetter* ProfileImpl::CreateRequestContext( |
| 1002 content::ProtocolHandlerMap* protocol_handlers, |
| 1003 content::URLRequestInterceptorScopedVector request_interceptors) { |
| 1004 return io_data_.CreateMainRequestContextGetter( |
| 1005 protocol_handlers, std::move(request_interceptors), |
| 1006 g_browser_process->io_thread()) |
| 1007 .get(); |
| 1008 } |
| 1009 |
| 1010 net::URLRequestContextGetter* |
| 1011 ProfileImpl::CreateRequestContextForStoragePartition( |
| 1012 const base::FilePath& partition_path, |
| 1013 bool in_memory, |
| 1014 content::ProtocolHandlerMap* protocol_handlers, |
| 1015 content::URLRequestInterceptorScopedVector request_interceptors) { |
| 1016 return io_data_.CreateIsolatedAppRequestContextGetter( |
| 1017 partition_path, in_memory, protocol_handlers, |
| 1018 std::move(request_interceptors)) |
| 1019 .get(); |
| 1020 } |
| 1021 |
| 1022 bool ProfileImpl::IsSameProfile(Profile* profile) { | 1022 bool ProfileImpl::IsSameProfile(Profile* profile) { |
| 1023 if (profile == static_cast<Profile*>(this)) | 1023 if (profile == static_cast<Profile*>(this)) |
| 1024 return true; | 1024 return true; |
| 1025 Profile* otr_profile = off_the_record_profile_.get(); | 1025 Profile* otr_profile = off_the_record_profile_.get(); |
| 1026 return otr_profile && profile == otr_profile; | 1026 return otr_profile && profile == otr_profile; |
| 1027 } | 1027 } |
| 1028 | 1028 |
| 1029 Time ProfileImpl::GetStartTime() const { | 1029 Time ProfileImpl::GetStartTime() const { |
| 1030 return start_time_; | 1030 return start_time_; |
| 1031 } | 1031 } |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1269 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { | 1269 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { |
| 1270 domain_reliability::DomainReliabilityService* service = | 1270 domain_reliability::DomainReliabilityService* service = |
| 1271 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> | 1271 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> |
| 1272 GetForBrowserContext(this); | 1272 GetForBrowserContext(this); |
| 1273 if (!service) | 1273 if (!service) |
| 1274 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); | 1274 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); |
| 1275 | 1275 |
| 1276 return service->CreateMonitor( | 1276 return service->CreateMonitor( |
| 1277 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 1277 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 1278 } | 1278 } |
| OLD | NEW |