feat: allow setting SSL config (#25461)

* feat: allow setting SSL config

* lint

* configure system network context with min TLS1.2

* fix

* note defaults
This commit is contained in:
Jeremy Rose 2020-09-23 13:22:10 -07:00 committed by GitHub
parent 515e85079f
commit 27ea3fc069
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 108 additions and 0 deletions

View file

@ -106,6 +106,7 @@ ElectronBrowserContext::ElectronBrowserContext(const std::string& partition,
storage_policy_(new SpecialStoragePolicy),
protocol_registry_(new ProtocolRegistry),
in_memory_(in_memory),
ssl_config_(network::mojom::SSLConfig::New()),
weak_factory_(this) {
// TODO(nornagon): remove once https://crbug.com/1048822 is fixed.
base::ScopedAllowBlockingForTesting allow_blocking;
@ -446,6 +447,22 @@ ResolveProxyHelper* ElectronBrowserContext::GetResolveProxyHelper() {
return resolve_proxy_helper_.get();
}
network::mojom::SSLConfigPtr ElectronBrowserContext::GetSSLConfig() {
return ssl_config_.Clone();
}
void ElectronBrowserContext::SetSSLConfig(network::mojom::SSLConfigPtr config) {
ssl_config_ = std::move(config);
if (ssl_config_client_) {
ssl_config_client_->OnSSLConfigUpdated(ssl_config_.Clone());
}
}
void ElectronBrowserContext::SetSSLConfigClient(
mojo::Remote<network::mojom::SSLConfigClient> client) {
ssl_config_client_ = std::move(client);
}
// static
ElectronBrowserContext* ElectronBrowserContext::From(
const std::string& partition,