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 4920c42ee170abd9a4a72f74da47a8bee5b21041..c063bdf7fff496a3890dedc73cfbd0e5c93bea33 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,19 @@ ExtensionPopup::ExtensionPopup(extensions::ExtensionViewHost* host, |
| content::Source<BrowserContext>(host->browser_context())); |
| content::DevToolsManager::GetInstance()->AddAgentStateCallback( |
| devtools_callback_); |
| + |
| + Browser* browser = host_->view()->browser(); |
| + if (browser && browser->tab_strip_model()) |
|
sky
2013/12/20 00:14:51
Can browser really be NULL here? browser->tab_stri
msw
2013/12/20 00:46:28
Done, I removed both checks. I tracked down that t
|
| + browser->tab_strip_model()->AddObserver(this); |
| } |
| ExtensionPopup::~ExtensionPopup() { |
| content::DevToolsManager::GetInstance()->RemoveAgentStateCallback( |
| devtools_callback_); |
| + |
| + Browser* browser = host_->view()->browser(); |
| + if (browser && browser->tab_strip_model()) |
| + browser->tab_strip_model()->RemoveObserver(this); |
| } |
| void ExtensionPopup::Observe(int type, |
| @@ -192,6 +201,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, |