| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 public ExtensionToolbarModel::Observer, | 41 public ExtensionToolbarModel::Observer, |
| 42 public content::NotificationObserver { | 42 public content::NotificationObserver { |
| 43 public: | 43 public: |
| 44 explicit ExtensionBrowserEventRouter(Profile* profile); | 44 explicit ExtensionBrowserEventRouter(Profile* profile); |
| 45 virtual ~ExtensionBrowserEventRouter(); | 45 virtual ~ExtensionBrowserEventRouter(); |
| 46 | 46 |
| 47 // Must be called once. Subsequent calls have no effect. | 47 // Must be called once. Subsequent calls have no effect. |
| 48 void Init(ExtensionToolbarModel* model); | 48 void Init(ExtensionToolbarModel* model); |
| 49 | 49 |
| 50 // BrowserList::Observer | 50 // BrowserList::Observer |
| 51 virtual void OnBrowserAdded(const Browser* browser) OVERRIDE; | 51 virtual void OnBrowserAdded(Browser* browser) OVERRIDE; |
| 52 virtual void OnBrowserRemoved(const Browser* browser) OVERRIDE; | 52 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE; |
| 53 virtual void OnBrowserSetLastActive(const Browser* browser) OVERRIDE; | 53 virtual void OnBrowserSetLastActive(Browser* browser) OVERRIDE; |
| 54 | 54 |
| 55 #if defined(TOOLKIT_VIEWS) | 55 #if defined(TOOLKIT_VIEWS) |
| 56 virtual void OnNativeFocusChange(gfx::NativeView focused_before, | 56 virtual void OnNativeFocusChange(gfx::NativeView focused_before, |
| 57 gfx::NativeView focused_now) OVERRIDE; | 57 gfx::NativeView focused_now) OVERRIDE; |
| 58 #elif defined(TOOLKIT_GTK) | 58 #elif defined(TOOLKIT_GTK) |
| 59 virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE; | 59 virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE; |
| 60 #endif | 60 #endif |
| 61 | 61 |
| 62 // Called from Observe() on BROWSER_WINDOW_READY (not a part of | 62 // Called from Observe() on BROWSER_WINDOW_READY (not a part of |
| 63 // BrowserList::Observer). | 63 // BrowserList::Observer). |
| 64 void OnBrowserWindowReady(const Browser* browser); | 64 void OnBrowserWindowReady(Browser* browser); |
| 65 | 65 |
| 66 // TabStripModelObserver | 66 // TabStripModelObserver |
| 67 virtual void TabInsertedAt(TabContentsWrapper* contents, int index, | 67 virtual void TabInsertedAt(TabContentsWrapper* contents, int index, |
| 68 bool active) OVERRIDE; | 68 bool active) OVERRIDE; |
| 69 virtual void TabClosingAt(TabStripModel* tab_strip_model, | 69 virtual void TabClosingAt(TabStripModel* tab_strip_model, |
| 70 TabContentsWrapper* contents, | 70 TabContentsWrapper* contents, |
| 71 int index) OVERRIDE; | 71 int index) OVERRIDE; |
| 72 virtual void TabDetachedAt(TabContentsWrapper* contents, int index) OVERRIDE; | 72 virtual void TabDetachedAt(TabContentsWrapper* contents, int index) OVERRIDE; |
| 73 virtual void ActiveTabChanged(TabContentsWrapper* old_contents, | 73 virtual void ActiveTabChanged(TabContentsWrapper* old_contents, |
| 74 TabContentsWrapper* new_contents, | 74 TabContentsWrapper* new_contents, |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 // chrome.pageActions["name"].addListener(function(actionId, info){}) | 155 // chrome.pageActions["name"].addListener(function(actionId, info){}) |
| 156 void DispatchOldPageActionEvent(Profile* profile, | 156 void DispatchOldPageActionEvent(Profile* profile, |
| 157 const std::string& extension_id, | 157 const std::string& extension_id, |
| 158 const std::string& page_action_id, | 158 const std::string& page_action_id, |
| 159 int tab_id, | 159 int tab_id, |
| 160 const std::string& url, | 160 const std::string& url, |
| 161 int button); | 161 int button); |
| 162 | 162 |
| 163 // Register ourselves to receive the various notifications we are interested | 163 // Register ourselves to receive the various notifications we are interested |
| 164 // in for a browser. | 164 // in for a browser. |
| 165 void RegisterForBrowserNotifications(const Browser* browser); | 165 void RegisterForBrowserNotifications(Browser* browser); |
| 166 | 166 |
| 167 // Register ourselves to receive the various notifications we are interested | 167 // Register ourselves to receive the various notifications we are interested |
| 168 // in for a tab. | 168 // in for a tab. |
| 169 void RegisterForTabNotifications(content::WebContents* contents); | 169 void RegisterForTabNotifications(content::WebContents* contents); |
| 170 | 170 |
| 171 // Removes notifications added in RegisterForTabNotifications. | 171 // Removes notifications added in RegisterForTabNotifications. |
| 172 void UnregisterForTabNotifications(content::WebContents* contents); | 172 void UnregisterForTabNotifications(content::WebContents* contents); |
| 173 | 173 |
| 174 content::NotificationRegistrar registrar_; | 174 content::NotificationRegistrar registrar_; |
| 175 | 175 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 Profile* focused_profile_; | 231 Profile* focused_profile_; |
| 232 | 232 |
| 233 // The currently focused window. We keep this so as to avoid sending multiple | 233 // The currently focused window. We keep this so as to avoid sending multiple |
| 234 // windows.onFocusChanged events with the same windowId. | 234 // windows.onFocusChanged events with the same windowId. |
| 235 int focused_window_id_; | 235 int focused_window_id_; |
| 236 | 236 |
| 237 DISALLOW_COPY_AND_ASSIGN(ExtensionBrowserEventRouter); | 237 DISALLOW_COPY_AND_ASSIGN(ExtensionBrowserEventRouter); |
| 238 }; | 238 }; |
| 239 | 239 |
| 240 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_EVENT_ROUTER_H_ | 240 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_EVENT_ROUTER_H_ |
| OLD | NEW |