@@ -180,6 +180,10 @@ Shell::Shell(WebContents* web_contents, base::DictionaryValue* manifest)
180
180
Shell::~Shell () {
181
181
SendEvent (" closed" );
182
182
183
+ if (is_devtools_ && devtools_owner_.get ()) {
184
+ devtools_owner_->SendEvent (" devtools-closed" );
185
+ }
186
+
183
187
for (size_t i = 0 ; i < windows_.size (); ++i) {
184
188
if (windows_[i] == this ) {
185
189
windows_.erase (windows_.begin () + i);
@@ -344,10 +348,11 @@ void Shell::ShowDevTools(const char* jail_id, bool headless) {
344
348
browser_client->shell_browser_main_parts ()->devtools_delegate ();
345
349
GURL url = delegate->devtools_http_handler ()->GetFrontendURL (agent.get ());
346
350
347
- if (headless) {
348
- SendEvent (" devtools-opened" , url.spec ());
351
+ SendEvent (" devtools-opened" , url.spec ());
352
+
353
+ if (headless)
349
354
return ;
350
- }
355
+
351
356
// Use our minimum set manifest
352
357
base::DictionaryValue manifest;
353
358
manifest.SetBoolean (switches::kmToolbar, false );
@@ -370,6 +375,7 @@ void Shell::ShowDevTools(const char* jail_id, bool headless) {
370
375
ChildProcessSecurityPolicyImpl::GetInstance ()->GrantScheme (rh_id, chrome::kFileScheme );
371
376
ChildProcessSecurityPolicyImpl::GetInstance ()->GrantScheme (rh_id, " app" );
372
377
shell->is_devtools_ = true ;
378
+ shell->devtools_owner_ = weak_ptr_factory_.GetWeakPtr ();
373
379
shell->force_close_ = true ;
374
380
shell->LoadURL (url);
375
381
0 commit comments