Skip to content

Commit 3b0a78f

Browse files
author
Cong Liu
committed
simplify logic for headless devtools
1 parent 319f7ec commit 3b0a78f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/nw_shell.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -438,19 +438,19 @@ void Shell::ShowDevTools(const char* jail_id, bool headless) {
438438

439439
ShellDevToolsDelegate* delegate =
440440
browser_client->shell_browser_main_parts()->devtools_delegate();
441-
GURL url = delegate->devtools_http_handler()->GetFrontendURL();
442441
DevToolsHttpHandlerImpl* http_handler = static_cast<DevToolsHttpHandlerImpl*>(delegate->devtools_http_handler());
443442
http_handler->EnumerateTargets();
444443

444+
GURL url;
445445
if (headless) {
446-
url = delegate->devtools_http_handler()->GetFrontendURL();
447-
DevToolsHttpHandlerImpl* http_handler = static_cast<DevToolsHttpHandlerImpl*>(delegate->devtools_http_handler());
448-
http_handler->EnumerateTargets();
446+
url = delegate->devtools_http_handler()->GetFrontendURL(agent.get());
449447
SendEvent("devtools-opened", url.spec());
450448
return;
449+
} else {
450+
url = delegate->devtools_http_handler()->GetFrontendURL();
451+
SendEvent("devtools-opened", url.spec());
451452
}
452453

453-
SendEvent("devtools-opened", url.spec());
454454
// Use our minimum set manifest
455455
base::DictionaryValue manifest;
456456
manifest.SetBoolean(switches::kmToolbar, false);

0 commit comments

Comments
 (0)