mirror of
https://github.com/electron/electron.git
synced 2026-01-28 08:48:14 -05:00
Add BrowserContext::GetRequestContext
This commit is contained in:
@@ -115,6 +115,12 @@ BrowserContext::BrowserContext(const std::string& partition, bool in_memory)
|
||||
content::BrowserContext::Initialize(this, path_);
|
||||
}
|
||||
|
||||
BrowserContext::~BrowserContext() {
|
||||
BrowserThread::DeleteSoon(BrowserThread::IO,
|
||||
FROM_HERE,
|
||||
resource_context_.release());
|
||||
}
|
||||
|
||||
void BrowserContext::InitPrefs() {
|
||||
auto prefs_path = GetPath().Append(FILE_PATH_LITERAL("Preferences"));
|
||||
PrefServiceFactory prefs_factory;
|
||||
@@ -129,16 +135,15 @@ void BrowserContext::InitPrefs() {
|
||||
prefs_ = prefs_factory.Create(registry.get());
|
||||
}
|
||||
|
||||
BrowserContext::~BrowserContext() {
|
||||
BrowserThread::DeleteSoon(BrowserThread::IO,
|
||||
FROM_HERE,
|
||||
resource_context_.release());
|
||||
}
|
||||
|
||||
void BrowserContext::RegisterInternalPrefs(PrefRegistrySimple* registry) {
|
||||
InspectableWebContentsImpl::RegisterPrefs(registry);
|
||||
}
|
||||
|
||||
URLRequestContextGetter* BrowserContext::GetRequestContext() {
|
||||
return static_cast<URLRequestContextGetter*>(
|
||||
GetDefaultStoragePartition(this)->GetURLRequestContext());
|
||||
}
|
||||
|
||||
net::URLRequestContextGetter* BrowserContext::CreateRequestContext(
|
||||
content::ProtocolHandlerMap* protocol_handlers,
|
||||
content::URLRequestInterceptorScopedVector protocol_interceptors) {
|
||||
|
||||
@@ -38,6 +38,9 @@ class BrowserContext : public base::RefCounted<BrowserContext>,
|
||||
static scoped_refptr<BrowserContext> Create(
|
||||
const std::string& partition, bool in_memory);
|
||||
|
||||
// Get the request context, if there is no one, create it.
|
||||
URLRequestContextGetter* GetRequestContext();
|
||||
|
||||
// content::BrowserContext:
|
||||
std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate(
|
||||
const base::FilePath& partition_path) override;
|
||||
|
||||
Reference in New Issue
Block a user