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

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

Issue 119633002: Close ExtensionPopup on tab switches; add test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unnecessary NULL checks. Created 7 years 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
« no previous file with comments | « chrome/browser/ui/views/extensions/extension_popup.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4920c42ee170abd9a4a72f74da47a8bee5b21041..bb881e7d0895a442895e0517abbea17c8a5f1c27 100644
--- a/chrome/browser/ui/views/extensions/extension_popup.cc
+++ b/chrome/browser/ui/views/extensions/extension_popup.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/host_desktop.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/devtools_manager.h"
@@ -94,11 +95,15 @@ ExtensionPopup::ExtensionPopup(extensions::ExtensionViewHost* host,
content::Source<BrowserContext>(host->browser_context()));
content::DevToolsManager::GetInstance()->AddAgentStateCallback(
devtools_callback_);
+
+ host_->view()->browser()->tab_strip_model()->AddObserver(this);
}
ExtensionPopup::~ExtensionPopup() {
content::DevToolsManager::GetInstance()->RemoveAgentStateCallback(
devtools_callback_);
+
+ host_->view()->browser()->tab_strip_model()->RemoveObserver(this);
}
void ExtensionPopup::Observe(int type,
@@ -192,6 +197,13 @@ void ExtensionPopup::OnWindowActivated(aura::Window* gained_active,
}
#endif
+void ExtensionPopup::ActiveTabChanged(content::WebContents* old_contents,
+ content::WebContents* new_contents,
+ int index,
+ int reason) {
+ GetWidget()->Close();
+}
+
// static
ExtensionPopup* ExtensionPopup::ShowPopup(const GURL& url,
Browser* browser,
« no previous file with comments | « chrome/browser/ui/views/extensions/extension_popup.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698