Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(375)

Unified Diff: chrome/browser/ui/views/extensions/extension_popup.cc

Issue 9235002: Enable devtools via context menu in platform apps and popup extensions. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Keep inspect popup command working Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..5c313b4d2f605f570993d38536d0793a34180817 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);
}
@@ -96,6 +103,18 @@ void ExtensionPopup::Observe(int type,
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) {
not at google - send to devlin 2012/01/23 05:43:51 <- 2 indent
benwells 2012/01/23 06:42:23 OK, I think I've fixed it and the similar code abo
+ // 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";
}

Powered by Google App Engine
This is Rietveld 408576698