@@ -202,9 +202,10 @@ void App::Call(Shell* shell,
202
202
shortcut->GetAccelerator (), shortcut);
203
203
return ;
204
204
} else if (method == " SetProxyConfig" ) {
205
- std::string proxy_config;
205
+ std::string proxy_config, pac_url ;
206
206
arguments.GetString (0 , &proxy_config);
207
- SetProxyConfig (GetRenderProcessHost (), proxy_config);
207
+ arguments.GetString (1 , &pac_url);
208
+ SetProxyConfig (GetRenderProcessHost (), proxy_config, pac_url);
208
209
return ;
209
210
} else if (method == " DoneMenuShow" ) {
210
211
dispatcher_host->quit_run_loop ();
@@ -299,9 +300,18 @@ void App::ClearCache(content::RenderProcessHost* render_process_host) {
299
300
}
300
301
301
302
void App::SetProxyConfig (content::RenderProcessHost* render_process_host,
302
- const std::string& proxy_config) {
303
+ const std::string& proxy_config,
304
+ const std::string& pac_url) {
303
305
net::ProxyConfig config;
304
- config.proxy_rules ().ParseFromString (proxy_config);
306
+ if (!pac_url.empty ()) {
307
+ if (pac_url == " <direct>" )
308
+ config = net::ProxyConfig::CreateDirect ();
309
+ else if (pac_url == " <auto>" )
310
+ config = net::ProxyConfig::CreateAutoDetect ();
311
+ else
312
+ config = net::ProxyConfig::CreateFromCustomPacURL (GURL (pac_url));
313
+ } else
314
+ config.proxy_rules ().ParseFromString (proxy_config);
305
315
net::URLRequestContextGetter* context_getter =
306
316
render_process_host->GetBrowserContext ()->
307
317
GetRequestContextForRenderProcess (render_process_host->GetID ());
0 commit comments