| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 gfx::NativeView focused_now) OVERRIDE; | 56 gfx::NativeView focused_now) OVERRIDE; |
| 57 #elif defined(TOOLKIT_GTK) | 57 #elif defined(TOOLKIT_GTK) |
| 58 virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE; | 58 virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE; |
| 59 #endif | 59 #endif |
| 60 | 60 |
| 61 // Called from Observe() on BROWSER_WINDOW_READY (not a part of | 61 // Called from Observe() on BROWSER_WINDOW_READY (not a part of |
| 62 // BrowserList::Observer). | 62 // BrowserList::Observer). |
| 63 void OnBrowserWindowReady(Browser* browser); | 63 void OnBrowserWindowReady(Browser* browser); |
| 64 | 64 |
| 65 // TabStripModelObserver | 65 // TabStripModelObserver |
| 66 virtual void TabInsertedAt(TabContentsWrapper* contents, int index, | 66 virtual void TabInsertedAt(TabContents* contents, int index, |
| 67 bool active) OVERRIDE; | 67 bool active) OVERRIDE; |
| 68 virtual void TabClosingAt(TabStripModel* tab_strip_model, | 68 virtual void TabClosingAt(TabStripModel* tab_strip_model, |
| 69 TabContentsWrapper* contents, | 69 TabContents* contents, |
| 70 int index) OVERRIDE; | 70 int index) OVERRIDE; |
| 71 virtual void TabDetachedAt(TabContentsWrapper* contents, int index) OVERRIDE; | 71 virtual void TabDetachedAt(TabContents* contents, int index) OVERRIDE; |
| 72 virtual void ActiveTabChanged(TabContentsWrapper* old_contents, | 72 virtual void ActiveTabChanged(TabContents* old_contents, |
| 73 TabContentsWrapper* new_contents, | 73 TabContents* new_contents, |
| 74 int index, | 74 int index, |
| 75 bool user_gesture) OVERRIDE; | 75 bool user_gesture) OVERRIDE; |
| 76 virtual void TabSelectionChanged( | 76 virtual void TabSelectionChanged( |
| 77 TabStripModel* tab_strip_model, | 77 TabStripModel* tab_strip_model, |
| 78 const TabStripSelectionModel& old_model) OVERRIDE; | 78 const TabStripSelectionModel& old_model) OVERRIDE; |
| 79 virtual void TabMoved(TabContentsWrapper* contents, int from_index, | 79 virtual void TabMoved(TabContents* contents, int from_index, |
| 80 int to_index) OVERRIDE; | 80 int to_index) OVERRIDE; |
| 81 virtual void TabChangedAt(TabContentsWrapper* contents, int index, | 81 virtual void TabChangedAt(TabContents* contents, int index, |
| 82 TabChangeType change_type) OVERRIDE; | 82 TabChangeType change_type) OVERRIDE; |
| 83 virtual void TabReplacedAt(TabStripModel* tab_strip_model, | 83 virtual void TabReplacedAt(TabStripModel* tab_strip_model, |
| 84 TabContentsWrapper* old_contents, | 84 TabContents* old_contents, |
| 85 TabContentsWrapper* new_contents, | 85 TabContents* new_contents, |
| 86 int index) OVERRIDE; | 86 int index) OVERRIDE; |
| 87 virtual void TabPinnedStateChanged(TabContentsWrapper* contents, | 87 virtual void TabPinnedStateChanged(TabContents* contents, |
| 88 int index) OVERRIDE; | 88 int index) OVERRIDE; |
| 89 virtual void TabStripEmpty() OVERRIDE; | 89 virtual void TabStripEmpty() OVERRIDE; |
| 90 | 90 |
| 91 // Page Action execute event. | 91 // Page Action execute event. |
| 92 void PageActionExecuted(Profile* profile, | 92 void PageActionExecuted(Profile* profile, |
| 93 const std::string& extension_id, | 93 const std::string& extension_id, |
| 94 const std::string& page_action_id, | 94 const std::string& page_action_id, |
| 95 int tab_id, | 95 int tab_id, |
| 96 const std::string& url, | 96 const std::string& url, |
| 97 int button); | 97 int button); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 }; | 209 }; |
| 210 | 210 |
| 211 // Gets the TabEntry for the given |contents|. Returns TabEntry* if | 211 // Gets the TabEntry for the given |contents|. Returns TabEntry* if |
| 212 // found, NULL if not. | 212 // found, NULL if not. |
| 213 TabEntry* GetTabEntry(const content::WebContents* contents); | 213 TabEntry* GetTabEntry(const content::WebContents* contents); |
| 214 | 214 |
| 215 // Called when either a browser or page action is executed. Figures out which | 215 // Called when either a browser or page action is executed. Figures out which |
| 216 // event to send based on what the extension wants. | 216 // event to send based on what the extension wants. |
| 217 void ExtensionActionExecuted(Profile* profile, | 217 void ExtensionActionExecuted(Profile* profile, |
| 218 const std::string& extension_id, | 218 const std::string& extension_id, |
| 219 TabContentsWrapper* tab_contents); | 219 TabContents* tab_contents); |
| 220 | 220 |
| 221 std::map<int, TabEntry> tab_entries_; | 221 std::map<int, TabEntry> tab_entries_; |
| 222 | 222 |
| 223 // The main profile that owns this event router. | 223 // The main profile that owns this event router. |
| 224 Profile* profile_; | 224 Profile* profile_; |
| 225 | 225 |
| 226 // The profile the currently focused window belongs to; either the main or | 226 // The profile the currently focused window belongs to; either the main or |
| 227 // incognito profile or NULL (none of the above). We remember this in order | 227 // incognito profile or NULL (none of the above). We remember this in order |
| 228 // to correctly handle focus changes between non-OTR and OTR windows. | 228 // to correctly handle focus changes between non-OTR and OTR windows. |
| 229 Profile* focused_profile_; | 229 Profile* focused_profile_; |
| 230 | 230 |
| 231 // The currently focused window. We keep this so as to avoid sending multiple | 231 // The currently focused window. We keep this so as to avoid sending multiple |
| 232 // windows.onFocusChanged events with the same windowId. | 232 // windows.onFocusChanged events with the same windowId. |
| 233 int focused_window_id_; | 233 int focused_window_id_; |
| 234 | 234 |
| 235 DISALLOW_COPY_AND_ASSIGN(ExtensionBrowserEventRouter); | 235 DISALLOW_COPY_AND_ASSIGN(ExtensionBrowserEventRouter); |
| 236 }; | 236 }; |
| 237 | 237 |
| 238 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_EVENT_ROUTER_H_ | 238 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_EVENT_ROUTER_H_ |
| OLD | NEW |