| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_API_TABS_TABS_EVENT_ROUTER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_EVENT_ROUTER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_EVENT_ROUTER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_EVENT_ROUTER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 100 |
| 101 // Triggers a tab updated event if the favicon URL changes. | 101 // Triggers a tab updated event if the favicon URL changes. |
| 102 void FaviconUrlUpdated(content::WebContents* contents); | 102 void FaviconUrlUpdated(content::WebContents* contents); |
| 103 | 103 |
| 104 // The DispatchEvent methods forward events to the |profile|'s event router. | 104 // The DispatchEvent methods forward events to the |profile|'s event router. |
| 105 // The TabsEventRouter listens to events for all profiles, | 105 // The TabsEventRouter listens to events for all profiles, |
| 106 // so we avoid duplication by dropping events destined for other profiles. | 106 // so we avoid duplication by dropping events destined for other profiles. |
| 107 void DispatchEvent(Profile* profile, | 107 void DispatchEvent(Profile* profile, |
| 108 events::HistogramValue histogram_value, | 108 events::HistogramValue histogram_value, |
| 109 const std::string& event_name, | 109 const std::string& event_name, |
| 110 scoped_ptr<base::ListValue> args, | 110 std::unique_ptr<base::ListValue> args, |
| 111 EventRouter::UserGestureState user_gesture); | 111 EventRouter::UserGestureState user_gesture); |
| 112 | 112 |
| 113 void DispatchEventsAcrossIncognito( | 113 void DispatchEventsAcrossIncognito( |
| 114 Profile* profile, | 114 Profile* profile, |
| 115 const std::string& event_name, | 115 const std::string& event_name, |
| 116 scoped_ptr<base::ListValue> event_args, | 116 std::unique_ptr<base::ListValue> event_args, |
| 117 scoped_ptr<base::ListValue> cross_incognito_args); | 117 std::unique_ptr<base::ListValue> cross_incognito_args); |
| 118 | 118 |
| 119 // Packages |changed_property_names| as a tab updated event for the tab | 119 // Packages |changed_property_names| as a tab updated event for the tab |
| 120 // |contents| and dispatches the event to the extension. | 120 // |contents| and dispatches the event to the extension. |
| 121 void DispatchTabUpdatedEvent( | 121 void DispatchTabUpdatedEvent( |
| 122 content::WebContents* contents, | 122 content::WebContents* contents, |
| 123 const std::set<std::string> changed_property_names); | 123 const std::set<std::string> changed_property_names); |
| 124 | 124 |
| 125 // Register ourselves to receive the various notifications we are interested | 125 // Register ourselves to receive the various notifications we are interested |
| 126 // in for a tab. Also create tab entry to observe web contents notifications. | 126 // in for a tab. Also create tab entry to observe web contents notifications. |
| 127 void RegisterForTabNotifications(content::WebContents* contents); | 127 void RegisterForTabNotifications(content::WebContents* contents); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 // Event router that the WebContents's noficiations are forwarded to. | 178 // Event router that the WebContents's noficiations are forwarded to. |
| 179 TabsEventRouter* router_; | 179 TabsEventRouter* router_; |
| 180 | 180 |
| 181 DISALLOW_COPY_AND_ASSIGN(TabEntry); | 181 DISALLOW_COPY_AND_ASSIGN(TabEntry); |
| 182 }; | 182 }; |
| 183 | 183 |
| 184 // Gets the TabEntry for the given |contents|. Returns TabEntry* if found, | 184 // Gets the TabEntry for the given |contents|. Returns TabEntry* if found, |
| 185 // nullptr if not. | 185 // nullptr if not. |
| 186 TabEntry* GetTabEntry(content::WebContents* contents); | 186 TabEntry* GetTabEntry(content::WebContents* contents); |
| 187 | 187 |
| 188 using TabEntryMap = std::map<int, scoped_ptr<TabEntry>>; | 188 using TabEntryMap = std::map<int, std::unique_ptr<TabEntry>>; |
| 189 TabEntryMap tab_entries_; | 189 TabEntryMap tab_entries_; |
| 190 | 190 |
| 191 // The main profile that owns this event router. | 191 // The main profile that owns this event router. |
| 192 Profile* profile_; | 192 Profile* profile_; |
| 193 | 193 |
| 194 ScopedObserver<favicon::FaviconDriver, TabsEventRouter> | 194 ScopedObserver<favicon::FaviconDriver, TabsEventRouter> |
| 195 favicon_scoped_observer_; | 195 favicon_scoped_observer_; |
| 196 | 196 |
| 197 BrowserTabStripTracker browser_tab_strip_tracker_; | 197 BrowserTabStripTracker browser_tab_strip_tracker_; |
| 198 | 198 |
| 199 DISALLOW_COPY_AND_ASSIGN(TabsEventRouter); | 199 DISALLOW_COPY_AND_ASSIGN(TabsEventRouter); |
| 200 }; | 200 }; |
| 201 | 201 |
| 202 } // namespace extensions | 202 } // namespace extensions |
| 203 | 203 |
| 204 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_EVENT_ROUTER_H_ | 204 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_EVENT_ROUTER_H_ |
| OLD | NEW |