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_BROWSER_EVENT_ROUTER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_BROWSER_EVENT_ROUTER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_BROWSER_EVENT_ROUTER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_BROWSER_EVENT_ROUTER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE; | 40 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE; |
41 virtual void OnBrowserSetLastActive(Browser* browser) OVERRIDE; | 41 virtual void OnBrowserSetLastActive(Browser* browser) OVERRIDE; |
42 | 42 |
43 // TabStripModelObserver | 43 // TabStripModelObserver |
44 virtual void TabInsertedAt(content::WebContents* contents, int index, | 44 virtual void TabInsertedAt(content::WebContents* contents, int index, |
45 bool active) OVERRIDE; | 45 bool active) OVERRIDE; |
46 virtual void TabClosingAt(TabStripModel* tab_strip_model, | 46 virtual void TabClosingAt(TabStripModel* tab_strip_model, |
47 content::WebContents* contents, | 47 content::WebContents* contents, |
48 int index) OVERRIDE; | 48 int index) OVERRIDE; |
49 virtual void TabDetachedAt(content::WebContents* contents, | 49 virtual void TabDetachedAt(content::WebContents* contents, |
50 int index) OVERRIDE; | 50 int index, |
| 51 bool closing_all) OVERRIDE; |
51 virtual void ActiveTabChanged(content::WebContents* old_contents, | 52 virtual void ActiveTabChanged(content::WebContents* old_contents, |
52 content::WebContents* new_contents, | 53 content::WebContents* new_contents, |
53 int index, | 54 int index, |
54 int reason) OVERRIDE; | 55 int reason) OVERRIDE; |
55 virtual void TabSelectionChanged( | 56 virtual void TabSelectionChanged( |
56 TabStripModel* tab_strip_model, | 57 TabStripModel* tab_strip_model, |
57 const ui::ListSelectionModel& old_model) OVERRIDE; | 58 const ui::ListSelectionModel& old_model) OVERRIDE; |
58 virtual void TabMoved(content::WebContents* contents, | 59 virtual void TabMoved(content::WebContents* contents, |
59 int from_index, | 60 int from_index, |
60 int to_index) OVERRIDE; | 61 int to_index) OVERRIDE; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 124 |
124 void DispatchSimpleBrowserEvent(Profile* profile, | 125 void DispatchSimpleBrowserEvent(Profile* profile, |
125 const int window_id, | 126 const int window_id, |
126 const char* event_name); | 127 const char* event_name); |
127 | 128 |
128 // Packages |changed_properties| as a tab updated event for the tab |contents| | 129 // Packages |changed_properties| as a tab updated event for the tab |contents| |
129 // and dispatches the event to the extension. | 130 // and dispatches the event to the extension. |
130 void DispatchTabUpdatedEvent(content::WebContents* contents, | 131 void DispatchTabUpdatedEvent(content::WebContents* contents, |
131 scoped_ptr<DictionaryValue> changed_properties); | 132 scoped_ptr<DictionaryValue> changed_properties); |
132 | 133 |
| 134 void DispatchTabDetached(content::WebContents* contents, int index); |
| 135 |
| 136 // Send Tab removed event and stop listening for notifications on said |
| 137 // |contents|. |
| 138 void DispatchTabRemovedAndUnregisterNotifications( |
| 139 content::WebContents* contents, |
| 140 int tab_id, |
| 141 bool window_closing); |
| 142 |
133 // Called to dispatch a deprecated style page action click event that was | 143 // Called to dispatch a deprecated style page action click event that was |
134 // registered like: | 144 // registered like: |
135 // chrome.pageActions["name"].addListener(function(actionId, info){}) | 145 // chrome.pageActions["name"].addListener(function(actionId, info){}) |
136 void DispatchOldPageActionEvent(Profile* profile, | 146 void DispatchOldPageActionEvent(Profile* profile, |
137 const std::string& extension_id, | 147 const std::string& extension_id, |
138 const std::string& page_action_id, | 148 const std::string& page_action_id, |
139 int tab_id, | 149 int tab_id, |
140 const std::string& url, | 150 const std::string& url, |
141 int button); | 151 int button); |
142 | 152 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 | 212 |
203 // The main profile that owns this event router. | 213 // The main profile that owns this event router. |
204 Profile* profile_; | 214 Profile* profile_; |
205 | 215 |
206 DISALLOW_COPY_AND_ASSIGN(BrowserEventRouter); | 216 DISALLOW_COPY_AND_ASSIGN(BrowserEventRouter); |
207 }; | 217 }; |
208 | 218 |
209 } // namespace extensions | 219 } // namespace extensions |
210 | 220 |
211 #endif // CHROME_BROWSER_EXTENSIONS_BROWSER_EVENT_ROUTER_H_ | 221 #endif // CHROME_BROWSER_EXTENSIONS_BROWSER_EVENT_ROUTER_H_ |
OLD | NEW |