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

Unified Diff: chrome/browser/extensions/extension_panel_event_router.h

Issue 10777004: Support chrome.windows extension API events for browserless Panels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix mac unit_test failure Created 8 years, 5 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/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_

Powered by Google App Engine
This is Rietveld 408576698