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> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/scoped_observer.h" | 13 #include "base/scoped_observer.h" |
14 #include "chrome/browser/extensions/api/tabs/tabs_api.h" | 14 #include "chrome/browser/extensions/api/tabs/tabs_api.h" |
15 #include "chrome/browser/memory/tab_manager_observer.h" | |
15 #include "chrome/browser/ui/browser_list_observer.h" | 16 #include "chrome/browser/ui/browser_list_observer.h" |
16 #include "chrome/browser/ui/browser_tab_strip_tracker.h" | 17 #include "chrome/browser/ui/browser_tab_strip_tracker.h" |
17 #include "chrome/browser/ui/browser_tab_strip_tracker_delegate.h" | 18 #include "chrome/browser/ui/browser_tab_strip_tracker_delegate.h" |
18 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | 19 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
19 #include "components/favicon/core/favicon_driver_observer.h" | 20 #include "components/favicon/core/favicon_driver_observer.h" |
20 #include "components/zoom/zoom_observer.h" | 21 #include "components/zoom/zoom_observer.h" |
21 #include "content/public/browser/web_contents_observer.h" | 22 #include "content/public/browser/web_contents_observer.h" |
22 #include "extensions/browser/event_router.h" | 23 #include "extensions/browser/event_router.h" |
23 | 24 |
24 namespace content { | 25 namespace content { |
25 class WebContents; | 26 class WebContents; |
26 } | 27 } |
27 | 28 |
28 namespace favicon { | 29 namespace favicon { |
29 class FaviconDriver; | 30 class FaviconDriver; |
30 } | 31 } |
31 | 32 |
32 namespace extensions { | 33 namespace extensions { |
33 | 34 |
34 // The TabsEventRouter listens to tab events and routes them to listeners inside | 35 // The TabsEventRouter listens to tab events and routes them to listeners inside |
35 // extension process renderers. | 36 // extension process renderers. |
36 // TabsEventRouter will only route events from windows/tabs within a profile to | 37 // TabsEventRouter will only route events from windows/tabs within a profile to |
37 // extension processes in the same profile. | 38 // extension processes in the same profile. |
38 class TabsEventRouter : public TabStripModelObserver, | 39 class TabsEventRouter : public TabStripModelObserver, |
39 public BrowserTabStripTrackerDelegate, | 40 public BrowserTabStripTrackerDelegate, |
40 public chrome::BrowserListObserver, | 41 public chrome::BrowserListObserver, |
41 public favicon::FaviconDriverObserver, | 42 public favicon::FaviconDriverObserver, |
42 public zoom::ZoomObserver { | 43 public zoom::ZoomObserver, |
44 public memory::TabManagerObserver { | |
43 public: | 45 public: |
44 explicit TabsEventRouter(Profile* profile); | 46 explicit TabsEventRouter(Profile* profile); |
45 ~TabsEventRouter() override; | 47 ~TabsEventRouter() override; |
46 | 48 |
47 // BrowserTabStripTrackerDelegate: | 49 // BrowserTabStripTrackerDelegate: |
48 bool ShouldTrackBrowser(Browser* browser) override; | 50 bool ShouldTrackBrowser(Browser* browser) override; |
49 | 51 |
50 // chrome::BrowserListObserver: | 52 // chrome::BrowserListObserver: |
51 void OnBrowserSetLastActive(Browser* browser) override; | 53 void OnBrowserSetLastActive(Browser* browser) override; |
52 | 54 |
(...skipping 28 matching lines...) Expand all Loading... | |
81 void OnZoomChanged( | 83 void OnZoomChanged( |
82 const zoom::ZoomController::ZoomChangedEventData& data) override; | 84 const zoom::ZoomController::ZoomChangedEventData& data) override; |
83 | 85 |
84 // favicon::FaviconDriverObserver: | 86 // favicon::FaviconDriverObserver: |
85 void OnFaviconUpdated(favicon::FaviconDriver* favicon_driver, | 87 void OnFaviconUpdated(favicon::FaviconDriver* favicon_driver, |
86 NotificationIconType notification_icon_type, | 88 NotificationIconType notification_icon_type, |
87 const GURL& icon_url, | 89 const GURL& icon_url, |
88 bool icon_url_changed, | 90 bool icon_url_changed, |
89 const gfx::Image& image) override; | 91 const gfx::Image& image) override; |
90 | 92 |
93 // TabManagerObserver | |
94 void OnDiscardedStateChange(content::WebContents* contents, | |
Georges Khalil
2016/07/13 15:52:10
nit: memory::TabManagerObserver:
Anderson Silva
2016/07/14 15:13:13
Done.
| |
95 bool is_discarded) override; | |
96 | |
91 private: | 97 private: |
92 // "Synthetic" event. Called from TabInsertedAt if new tab is detected. | 98 // "Synthetic" event. Called from TabInsertedAt if new tab is detected. |
93 void TabCreatedAt(content::WebContents* contents, int index, bool active); | 99 void TabCreatedAt(content::WebContents* contents, int index, bool active); |
94 | 100 |
95 // Internal processing of tab updated events. Intended to be called when | 101 // Internal processing of tab updated events. Intended to be called when |
96 // there's any changed property. | 102 // there's any changed property. |
97 class TabEntry; | 103 class TabEntry; |
98 void TabUpdated(TabEntry* entry, | 104 void TabUpdated(TabEntry* entry, |
99 std::set<std::string> changed_property_names); | 105 std::set<std::string> changed_property_names); |
100 | 106 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 favicon_scoped_observer_; | 201 favicon_scoped_observer_; |
196 | 202 |
197 BrowserTabStripTracker browser_tab_strip_tracker_; | 203 BrowserTabStripTracker browser_tab_strip_tracker_; |
198 | 204 |
199 DISALLOW_COPY_AND_ASSIGN(TabsEventRouter); | 205 DISALLOW_COPY_AND_ASSIGN(TabsEventRouter); |
200 }; | 206 }; |
201 | 207 |
202 } // namespace extensions | 208 } // namespace extensions |
203 | 209 |
204 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_EVENT_ROUTER_H_ | 210 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_EVENT_ROUTER_H_ |
OLD | NEW |