зеркало из https://github.com/electron/electron.git
ProxyConfigDictionary: Use base::Value
https://chromium-review.googlesource.com/c/chromium/src/+/1150846
This commit is contained in:
Родитель
0f9dd3736c
Коммит
0bd006a8eb
|
@ -471,13 +471,14 @@ void Session::SetProxy(const mate::Dictionary& options,
|
|||
if (!pac_url.empty()) {
|
||||
browser_context_->in_memory_pref_store()->SetValue(
|
||||
proxy_config::prefs::kProxy,
|
||||
ProxyConfigDictionary::CreatePacScript(pac_url,
|
||||
true /* pac_mandatory */),
|
||||
std::make_unique<base::Value>(ProxyConfigDictionary::CreatePacScript(
|
||||
pac_url, true /* pac_mandatory */)),
|
||||
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
|
||||
} else {
|
||||
browser_context_->in_memory_pref_store()->SetValue(
|
||||
proxy_config::prefs::kProxy,
|
||||
ProxyConfigDictionary::CreateFixedServers(proxy_rules, bypass_list),
|
||||
std::make_unique<base::Value>(ProxyConfigDictionary::CreateFixedServers(
|
||||
proxy_rules, bypass_list)),
|
||||
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,19 +47,22 @@ void BrowserProcessImpl::ApplyProxyModeFromCommandLine(
|
|||
auto* command_line = base::CommandLine::ForCurrentProcess();
|
||||
|
||||
if (command_line->HasSwitch(switches::kNoProxyServer)) {
|
||||
pref_store->SetValue(proxy_config::prefs::kProxy,
|
||||
ProxyConfigDictionary::CreateDirect(),
|
||||
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
|
||||
pref_store->SetValue(
|
||||
proxy_config::prefs::kProxy,
|
||||
std::make_unique<base::Value>(ProxyConfigDictionary::CreateDirect()),
|
||||
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
|
||||
} else if (command_line->HasSwitch(switches::kProxyPacUrl)) {
|
||||
std::string pac_script_url =
|
||||
command_line->GetSwitchValueASCII(switches::kProxyPacUrl);
|
||||
pref_store->SetValue(proxy_config::prefs::kProxy,
|
||||
ProxyConfigDictionary::CreatePacScript(
|
||||
pac_script_url, false /* pac_mandatory */),
|
||||
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
|
||||
pref_store->SetValue(
|
||||
proxy_config::prefs::kProxy,
|
||||
std::make_unique<base::Value>(ProxyConfigDictionary::CreatePacScript(
|
||||
pac_script_url, false /* pac_mandatory */)),
|
||||
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
|
||||
} else if (command_line->HasSwitch(switches::kProxyAutoDetect)) {
|
||||
pref_store->SetValue(proxy_config::prefs::kProxy,
|
||||
ProxyConfigDictionary::CreateAutoDetect(),
|
||||
std::make_unique<base::Value>(
|
||||
ProxyConfigDictionary::CreateAutoDetect()),
|
||||
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
|
||||
} else if (command_line->HasSwitch(switches::kProxyServer)) {
|
||||
std::string proxy_server =
|
||||
|
@ -68,7 +71,8 @@ void BrowserProcessImpl::ApplyProxyModeFromCommandLine(
|
|||
command_line->GetSwitchValueASCII(switches::kProxyBypassList);
|
||||
pref_store->SetValue(
|
||||
proxy_config::prefs::kProxy,
|
||||
ProxyConfigDictionary::CreateFixedServers(proxy_server, bypass_list),
|
||||
std::make_unique<base::Value>(ProxyConfigDictionary::CreateFixedServers(
|
||||
proxy_server, bypass_list)),
|
||||
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче