 Chromium Code Reviews
 Chromium Code Reviews Issue 1920773003:
  headless: Make it possible to override the DevTools server address  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1920773003:
  headless: Make it possible to override the DevTools server address  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| Index: headless/app/headless_shell.cc | 
| diff --git a/headless/app/headless_shell.cc b/headless/app/headless_shell.cc | 
| index e1348e328ed10634668affd59a479af1b29429ed..525ff12e1cf777f76f57b9410354919d2e0e619b 100644 | 
| --- a/headless/app/headless_shell.cc | 
| +++ b/headless/app/headless_shell.cc | 
| @@ -101,14 +101,18 @@ int main(int argc, const char** argv) { | 
| // Enable devtools if requested. | 
| base::CommandLine command_line(argc, argv); | 
| if (command_line.HasSwitch(switches::kRemoteDebuggingPort)) { | 
| + std::string address = kDevToolsHttpServerAddress; | 
| + if (command_line.HasSwitch(headless::switches::kRemoteDebuggingAddress)) { | 
| + address = command_line.GetSwitchValueASCII( | 
| + headless::switches::kRemoteDebuggingAddress); | 
| 
Mike West
2016/04/26 08:04:37
It seems reasonable to do some sanity checking her
 
Sami
2016/04/26 10:07:52
Good point. I've now made this use net::ParseURLHo
 | 
| + } | 
| int parsed_port; | 
| std::string port_str = | 
| command_line.GetSwitchValueASCII(switches::kRemoteDebuggingPort); | 
| if (base::StringToInt(port_str, &parsed_port) && | 
| base::IsValueInRangeForNumericType<uint16_t>(parsed_port)) { | 
| net::IPAddress devtools_address; | 
| - bool result = | 
| - devtools_address.AssignFromIPLiteral(kDevToolsHttpServerAddress); | 
| + bool result = devtools_address.AssignFromIPLiteral(address); | 
| DCHECK(result); | 
| builder.EnableDevToolsServer(net::IPEndPoint( | 
| devtools_address, base::checked_cast<uint16_t>(parsed_port))); |