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

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

Issue 1864583006: Simplify BrowserContext by removing redundant methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 8 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
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 "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
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 DCHECK(prefs_); 908 DCHECK(prefs_);
909 if (!otr_prefs_) { 909 if (!otr_prefs_) {
910 // The new ExtensionPrefStore is ref_counted and the new PrefService 910 // The new ExtensionPrefStore is ref_counted and the new PrefService
911 // stores a reference so that we do not leak memory here. 911 // stores a reference so that we do not leak memory here.
912 otr_prefs_.reset(CreateIncognitoPrefServiceSyncable( 912 otr_prefs_.reset(CreateIncognitoPrefServiceSyncable(
913 prefs_.get(), CreateExtensionPrefStore(this, true))); 913 prefs_.get(), CreateExtensionPrefStore(this, true)));
914 } 914 }
915 return otr_prefs_.get(); 915 return otr_prefs_.get();
916 } 916 }
917 917
918 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() {
919 return GetDefaultStoragePartition(this)->GetURLRequestContext();
920 }
921
922 net::URLRequestContextGetter* ProfileImpl::GetMediaRequestContext() { 918 net::URLRequestContextGetter* ProfileImpl::GetMediaRequestContext() {
923 // Return the default media context. 919 // Return the default media context.
924 return io_data_.GetMediaRequestContextGetter().get(); 920 return io_data_.GetMediaRequestContextGetter().get();
925 } 921 }
926 922
927 net::URLRequestContextGetter* 923 net::URLRequestContextGetter*
928 ProfileImpl::GetMediaRequestContextForRenderProcess( 924 ProfileImpl::GetMediaRequestContextForRenderProcess(
929 int renderer_child_id) { 925 int renderer_child_id) {
930 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( 926 content::RenderProcessHost* rph = content::RenderProcessHost::FromID(
931 renderer_child_id); 927 renderer_child_id);
932 content::StoragePartition* storage_partition = rph->GetStoragePartition(); 928 content::StoragePartition* storage_partition = rph->GetStoragePartition();
933 929
934 return storage_partition->GetMediaURLRequestContext(); 930 return storage_partition->GetMediaURLRequestContext();
935 } 931 }
936 932
937 net::URLRequestContextGetter* 933 net::URLRequestContextGetter*
938 ProfileImpl::GetMediaRequestContextForStoragePartition( 934 ProfileImpl::GetMediaRequestContextForStoragePartition(
939 const base::FilePath& partition_path, 935 const base::FilePath& partition_path,
940 bool in_memory) { 936 bool in_memory) {
941 return io_data_ 937 return io_data_
942 .GetIsolatedMediaRequestContextGetter(partition_path, in_memory).get(); 938 .GetIsolatedMediaRequestContextGetter(partition_path, in_memory).get();
943 } 939 }
944 940
945 content::ResourceContext* ProfileImpl::GetResourceContext() { 941 content::ResourceContext* ProfileImpl::GetResourceContext() {
946 return io_data_.GetResourceContext(); 942 return io_data_.GetResourceContext();
947 } 943 }
948 944
945 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() {
946 return GetDefaultStoragePartition(this)->GetURLRequestContext();
947 }
948
949 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { 949 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() {
950 return io_data_.GetExtensionsRequestContextGetter().get(); 950 return io_data_.GetExtensionsRequestContextGetter().get();
951 } 951 }
952 952
953 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { 953 net::SSLConfigService* ProfileImpl::GetSSLConfigService() {
954 // If ssl_config_service_manager_ is null, this typically means that some 954 // If ssl_config_service_manager_ is null, this typically means that some
955 // KeyedService is trying to create a RequestContext at startup, 955 // KeyedService is trying to create a RequestContext at startup,
956 // but SSLConfigServiceManager is not initialized until DoFinalInit() which is 956 // but SSLConfigServiceManager is not initialized until DoFinalInit() which is
957 // invoked after all KeyedServices have been initialized (see 957 // invoked after all KeyedServices have been initialized (see
958 // http://crbug.com/171406). 958 // http://crbug.com/171406).
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { 1271 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) {
1272 domain_reliability::DomainReliabilityService* service = 1272 domain_reliability::DomainReliabilityService* service =
1273 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> 1273 domain_reliability::DomainReliabilityServiceFactory::GetInstance()->
1274 GetForBrowserContext(this); 1274 GetForBrowserContext(this);
1275 if (!service) 1275 if (!service)
1276 return std::unique_ptr<domain_reliability::DomainReliabilityMonitor>(); 1276 return std::unique_ptr<domain_reliability::DomainReliabilityMonitor>();
1277 1277
1278 return service->CreateMonitor( 1278 return service->CreateMonitor(
1279 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 1279 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
1280 } 1280 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_impl.h ('k') | chrome/browser/search_engines/template_url_fetcher_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698