Chromium Code Reviews| Index: chrome/browser/extensions/extension_panel_event_router.h |
| diff --git a/chrome/browser/extensions/extension_panel_event_router.h b/chrome/browser/extensions/extension_panel_event_router.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1939d7e409bbad2bc37d46a0206d494098084a07 |
| --- /dev/null |
| +++ b/chrome/browser/extensions/extension_panel_event_router.h |
| @@ -0,0 +1,49 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PANEL_EVENT_ROUTER_H_ |
| +#define CHROME_BROWSER_EXTENSIONS_EXTENSION_PANEL_EVENT_ROUTER_H_ |
| + |
| +#include "base/basictypes.h" |
| + |
| +class Panel; |
| +class Profile; |
| + |
| +namespace base { |
| +class ListValue; |
| +} |
| + |
| +// The ExtensinoPanelEventRouter sends Panel window events |
|
Mihai Parparita -not on Chrome
2012/07/19 20:14:58
Typo ("Extensino")
|
| +// to listeners inside extension process renderers. |
| +class ExtensionPanelEventRouter { |
|
Mihai Parparita -not on Chrome
2012/07/19 20:14:58
In light of http://crrev.com/147083, this perhaps
stevenjb
2012/07/20 16:54:33
I think this should be extensions::PanelEventRoute
jennb
2012/07/20 18:09:37
I propose creating extension::WindowEventRouter (t
stevenjb
2012/07/20 18:26:14
That sounds great to me, thanks!
|
| + public: |
| + explicit ExtensionPanelEventRouter(Profile* profile); |
| + virtual ~ExtensionPanelEventRouter(); |
| + |
| + // Sends corresponding events to listeners in extension process renderers. |
| + void OnPanelOpened(Panel* panel); |
| + void OnPanelActiveStatusChanged(Panel* panel, bool is_active_now); |
| + void OnPanelClosed(Panel* panel); |
| + |
| + private: |
| + void DispatchEvent(const char* event_name, |
| + Profile* profile, |
| + base::ListValue* args); |
| + |
| + // The main profile that owns this event router. |
| + Profile* profile_; |
| + |
| + // The profile the currently focused panel belongs to; either the main or |
| + // incognito profile or NULL (none of the above). We remember this in order |
| + // to correctly handle focus changes between non-OTR and OTR panels. |
| + Profile* focused_profile_; |
| + |
| + // The currently focused panel. We keep this so as to avoid sending multiple |
| + // windows.onFocusChanged events with the same windowId. |
| + int focused_window_id_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ExtensionPanelEventRouter); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PANEL_EVENT_ROUTER_H_ |