| Index: chrome/browser/ui/views/extensions/extension_popup.cc
|
| diff --git a/chrome/browser/ui/views/extensions/extension_popup.cc b/chrome/browser/ui/views/extensions/extension_popup.cc
|
| index d0704a41fe1516c3c54c1b1f69721b4e1ddf540a..1456b8faf88332c0e9917498409db8d070cddadd 100644
|
| --- a/chrome/browser/ui/views/extensions/extension_popup.cc
|
| +++ b/chrome/browser/ui/views/extensions/extension_popup.cc
|
| @@ -58,6 +58,13 @@ ExtensionPopup::ExtensionPopup(
|
| registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE,
|
| content::Source<Profile>(host->profile()));
|
|
|
| + if (!inspect_with_devtools_) {
|
| + // Listen for the dev tools opening on this popup, so we can stop it going
|
| + // away when the dev tools get focus.
|
| + registrar_.Add(this, content::NOTIFICATION_DEVTOOLS_WINDOW_OPENING,
|
| + content::Source<Profile>(host->profile()));
|
| + }
|
| +
|
| views::WidgetFocusManager::GetInstance()->AddFocusChangeListener(this);
|
| }
|
|
|
| @@ -92,9 +99,22 @@ void ExtensionPopup::Observe(int type,
|
| // Make sure its the devtools window that inspecting our popup.
|
| // Widget::Close posts a task, which should give the devtools window a
|
| // chance to finish detaching from the inspected RenderViewHost.
|
| - if (content::Details<RenderViewHost>(
|
| - host()->render_view_host()) == details)
|
| + if (content::Details<RenderViewHost>(host()->render_view_host()) ==
|
| + details) {
|
| GetWidget()->Close();
|
| + }
|
| + break;
|
| + case content::NOTIFICATION_DEVTOOLS_WINDOW_OPENING:
|
| + // First check that the devtools are being opened on this popup.
|
| + if (content::Details<RenderViewHost>(host()->render_view_host()) ==
|
| + details) {
|
| + // Set inspect_with_devtools_ so the popup will be kept open while
|
| + // the devtools are open.
|
| + inspect_with_devtools_ = true;
|
| + // Listen for the devtools being closed so the popup can be closed.
|
| + registrar_.Add(this, content::NOTIFICATION_DEVTOOLS_WINDOW_CLOSING,
|
| + content::Source<content::BrowserContext>(host()->profile()));
|
| + }
|
| break;
|
| default:
|
| NOTREACHED() << L"Received unexpected notification";
|
|
|