Chromium Code Reviews| 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 a3e984d34855bda92f716596f096f52f084bb1d3..c0b3e5ab36cc18a7bc722bee1063e693fbc360ff 100644 |
| --- a/chrome/browser/ui/views/extensions/extension_popup.cc |
| +++ b/chrome/browser/ui/views/extensions/extension_popup.cc |
| @@ -57,6 +57,13 @@ ExtensionPopup::ExtensionPopup( |
| // Listen for the containing view calling window.close(); |
| 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())); |
| + } |
| } |
| ExtensionPopup::~ExtensionPopup() { |
| @@ -81,9 +88,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) { |
|
msw
2012/02/03 07:57:24
nit: Braces here are optional, not necessary.
benwells
2012/02/06 03:40:46
OK. I think with the if conditional spread over tw
|
| 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 |
|
msw
2012/02/03 07:57:24
Does this work? I think you'll need to call set_cl
benwells
2012/02/06 03:40:46
Thanks, it will need that to work on chromeos and
|
| + // 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, |
|
msw
2012/02/03 07:57:24
optional: consider replacing this statement and th
benwells
2012/02/06 03:40:46
Done.
|
| + content::Source<content::BrowserContext>(host()->profile())); |
| + } |
| break; |
| default: |
| NOTREACHED() << L"Received unexpected notification"; |