| Index: chrome/browser/ui/panels/panel.cc
|
| diff --git a/chrome/browser/ui/panels/panel.cc b/chrome/browser/ui/panels/panel.cc
|
| index 90f4ded2cef105fd4aa850791d8110303d52c14d..2659bc7cf3f02f0bcd97fc9384f0cab910d36d98 100644
|
| --- a/chrome/browser/ui/panels/panel.cc
|
| +++ b/chrome/browser/ui/panels/panel.cc
|
| @@ -9,6 +9,9 @@
|
| #include "base/utf_string_conversions.h"
|
| #include "chrome/app/chrome_command_ids.h"
|
| #include "chrome/browser/extensions/api/tabs/tabs_constants.h"
|
| +#include "chrome/browser/extensions/extension_panel_event_router.h"
|
| +#include "chrome/browser/extensions/extension_service.h"
|
| +#include "chrome/browser/extensions/extension_system.h"
|
| #include "chrome/browser/extensions/extension_window_controller.h"
|
| #include "chrome/browser/lifetime/application_lifetime.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| @@ -151,6 +154,11 @@ void Panel::Initialize(Profile* profile, const GURL& url,
|
|
|
| // Prevent the browser process from shutting down while this window is open.
|
| browser::StartKeepAlive();
|
| +
|
| + // Send extension event about newly created panel.
|
| + ExtensionPanelEventRouter* event_router = GetEventRouter();
|
| + if (event_router)
|
| + event_router->OnPanelOpened(this);
|
| }
|
|
|
| void Panel::InitCommandState() {
|
| @@ -181,6 +189,11 @@ void Panel::InitCommandState() {
|
| void Panel::OnNativePanelClosed() {
|
| manager()->OnPanelClosed(this);
|
| DCHECK(!panel_strip_);
|
| +
|
| + // Send extension event about closed panel.
|
| + ExtensionPanelEventRouter* event_router = GetEventRouter();
|
| + if (event_router)
|
| + event_router->OnPanelClosed(this);
|
| }
|
|
|
| PanelManager* Panel::manager() const {
|
| @@ -610,6 +623,11 @@ void Panel::OnActiveStateChanged(bool active) {
|
| if (panel_strip_)
|
| panel_strip_->OnPanelActiveStateChanged(this);
|
|
|
| + // Send extension event about focus change.
|
| + ExtensionPanelEventRouter* event_router = GetEventRouter();
|
| + if (event_router)
|
| + event_router->OnPanelActiveStatusChanged(this, active);
|
| +
|
| content::NotificationService::current()->Notify(
|
| chrome::NOTIFICATION_PANEL_CHANGED_ACTIVE_STATUS,
|
| content::Source<Panel>(this),
|
| @@ -725,3 +743,9 @@ void Panel::LoadingStateChanged(bool is_loading) {
|
| native_panel_->UpdatePanelLoadingAnimations(is_loading);
|
| UpdateTitleBar();
|
| }
|
| +
|
| +ExtensionPanelEventRouter* Panel::GetEventRouter() {
|
| + ExtensionService* service =
|
| + extensions::ExtensionSystem::Get(profile())->extension_service();
|
| + return service ? service->GetPanelEventRouter() : NULL;
|
| +}
|
|
|