ProxyConfigDictionary: Use base::Value

1150846
This commit is contained in:
deepak1556 2018-10-25 22:18:25 +05:30
parent 0f9dd3736c
commit 0bd006a8eb
2 changed files with 17 additions and 12 deletions

View file

@ -471,13 +471,14 @@ void Session::SetProxy(const mate::Dictionary& options,
if (!pac_url.empty()) { if (!pac_url.empty()) {
browser_context_->in_memory_pref_store()->SetValue( browser_context_->in_memory_pref_store()->SetValue(
proxy_config::prefs::kProxy, proxy_config::prefs::kProxy,
ProxyConfigDictionary::CreatePacScript(pac_url, std::make_unique<base::Value>(ProxyConfigDictionary::CreatePacScript(
true /* pac_mandatory */), pac_url, true /* pac_mandatory */)),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
} else { } else {
browser_context_->in_memory_pref_store()->SetValue( browser_context_->in_memory_pref_store()->SetValue(
proxy_config::prefs::kProxy, 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); WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
} }

View file

@ -47,19 +47,22 @@ void BrowserProcessImpl::ApplyProxyModeFromCommandLine(
auto* command_line = base::CommandLine::ForCurrentProcess(); auto* command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kNoProxyServer)) { if (command_line->HasSwitch(switches::kNoProxyServer)) {
pref_store->SetValue(proxy_config::prefs::kProxy, pref_store->SetValue(
ProxyConfigDictionary::CreateDirect(), proxy_config::prefs::kProxy,
std::make_unique<base::Value>(ProxyConfigDictionary::CreateDirect()),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
} else if (command_line->HasSwitch(switches::kProxyPacUrl)) { } else if (command_line->HasSwitch(switches::kProxyPacUrl)) {
std::string pac_script_url = std::string pac_script_url =
command_line->GetSwitchValueASCII(switches::kProxyPacUrl); command_line->GetSwitchValueASCII(switches::kProxyPacUrl);
pref_store->SetValue(proxy_config::prefs::kProxy, pref_store->SetValue(
ProxyConfigDictionary::CreatePacScript( proxy_config::prefs::kProxy,
pac_script_url, false /* pac_mandatory */), std::make_unique<base::Value>(ProxyConfigDictionary::CreatePacScript(
pac_script_url, false /* pac_mandatory */)),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
} else if (command_line->HasSwitch(switches::kProxyAutoDetect)) { } else if (command_line->HasSwitch(switches::kProxyAutoDetect)) {
pref_store->SetValue(proxy_config::prefs::kProxy, pref_store->SetValue(proxy_config::prefs::kProxy,
ProxyConfigDictionary::CreateAutoDetect(), std::make_unique<base::Value>(
ProxyConfigDictionary::CreateAutoDetect()),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
} else if (command_line->HasSwitch(switches::kProxyServer)) { } else if (command_line->HasSwitch(switches::kProxyServer)) {
std::string proxy_server = std::string proxy_server =
@ -68,7 +71,8 @@ void BrowserProcessImpl::ApplyProxyModeFromCommandLine(
command_line->GetSwitchValueASCII(switches::kProxyBypassList); command_line->GetSwitchValueASCII(switches::kProxyBypassList);
pref_store->SetValue( pref_store->SetValue(
proxy_config::prefs::kProxy, 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); WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
} }
} }