OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_EVENT_ROUTER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_EVENT_ROUTER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_EVENT_ROUTER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_EVENT_ROUTER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "chrome/browser/extensions/extension_tabs_module.h" | 14 #include "chrome/browser/extensions/extension_tabs_module.h" |
15 #include "chrome/browser/tabs/tab_strip_model_observer.h" | 15 #include "chrome/browser/tabs/tab_strip_model_observer.h" |
16 #include "chrome/browser/ui/browser_list.h" | 16 #include "chrome/browser/ui/browser_list.h" |
17 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
18 #if defined(TOOLKIT_VIEWS) | 18 #if defined(TOOLKIT_VIEWS) |
19 #include "views/focus/widget_focus_manager.h" | 19 #include "views/focus/widget_focus_manager.h" |
20 #elif defined(TOOLKIT_GTK) | 20 #elif defined(TOOLKIT_GTK) |
21 #include "ui/base/x/active_window_watcher_x.h" | 21 #include "ui/base/x/active_window_watcher_x_observer.h" |
22 #endif | 22 #endif |
23 | 23 |
24 // The ExtensionBrowserEventRouter listens to Browser window & tab events | 24 // The ExtensionBrowserEventRouter listens to Browser window & tab events |
25 // and routes them to listeners inside extension process renderers. | 25 // and routes them to listeners inside extension process renderers. |
26 // ExtensionBrowserEventRouter listens to *all* events, but will only route | 26 // ExtensionBrowserEventRouter listens to *all* events, but will only route |
27 // events from windows/tabs within a profile to extension processes in the same | 27 // events from windows/tabs within a profile to extension processes in the same |
28 // profile. | 28 // profile. |
29 class ExtensionBrowserEventRouter : public TabStripModelObserver, | 29 class ExtensionBrowserEventRouter : public TabStripModelObserver, |
30 #if defined(TOOLKIT_VIEWS) | 30 #if defined(TOOLKIT_VIEWS) |
31 public views::WidgetFocusChangeListener, | 31 public views::WidgetFocusChangeListener, |
32 #elif defined(TOOLKIT_GTK) | 32 #elif defined(TOOLKIT_GTK) |
33 public ui::ActiveWindowWatcherX::Observer, | 33 public ui::ActiveWindowWatcherXObserver, |
34 #endif | 34 #endif |
35 public BrowserList::Observer, | 35 public BrowserList::Observer, |
36 public content::NotificationObserver { | 36 public content::NotificationObserver { |
37 public: | 37 public: |
38 explicit ExtensionBrowserEventRouter(Profile* profile); | 38 explicit ExtensionBrowserEventRouter(Profile* profile); |
39 virtual ~ExtensionBrowserEventRouter(); | 39 virtual ~ExtensionBrowserEventRouter(); |
40 | 40 |
41 // Must be called once. Subsequent calls have no effect. | 41 // Must be called once. Subsequent calls have no effect. |
42 void Init(); | 42 void Init(); |
43 | 43 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 Profile* focused_profile_; | 214 Profile* focused_profile_; |
215 | 215 |
216 // The currently focused window. We keep this so as to avoid sending multiple | 216 // The currently focused window. We keep this so as to avoid sending multiple |
217 // windows.onFocusChanged events with the same windowId. | 217 // windows.onFocusChanged events with the same windowId. |
218 int focused_window_id_; | 218 int focused_window_id_; |
219 | 219 |
220 DISALLOW_COPY_AND_ASSIGN(ExtensionBrowserEventRouter); | 220 DISALLOW_COPY_AND_ASSIGN(ExtensionBrowserEventRouter); |
221 }; | 221 }; |
222 | 222 |
223 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_EVENT_ROUTER_H_ | 223 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_EVENT_ROUTER_H_ |
OLD | NEW |