| 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/ui/browser_list_observer.h" | 15 #include "chrome/browser/ui/browser_list_observer.h" |
| 16 #include "chrome/browser/ui/browser_tab_strip_tracker.h" | 16 #include "chrome/browser/ui/browser_tab_strip_tracker.h" |
| 17 #include "chrome/browser/ui/browser_tab_strip_tracker_delegate.h" | 17 #include "chrome/browser/ui/browser_tab_strip_tracker_delegate.h" |
| 18 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | 18 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
| 19 #include "components/favicon/core/favicon_driver_observer.h" | 19 #include "components/favicon/core/favicon_driver_observer.h" |
| 20 #include "components/ui/zoom/zoom_observer.h" | 20 #include "components/zoom/zoom_observer.h" |
| 21 #include "content/public/browser/web_contents_observer.h" | 21 #include "content/public/browser/web_contents_observer.h" |
| 22 #include "extensions/browser/event_router.h" | 22 #include "extensions/browser/event_router.h" |
| 23 | 23 |
| 24 namespace content { | 24 namespace content { |
| 25 class WebContents; | 25 class WebContents; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace favicon { | 28 namespace favicon { |
| 29 class FaviconDriver; | 29 class FaviconDriver; |
| 30 } | 30 } |
| 31 | 31 |
| 32 namespace extensions { | 32 namespace extensions { |
| 33 | 33 |
| 34 // The TabsEventRouter listens to tab events and routes them to listeners inside | 34 // The TabsEventRouter listens to tab events and routes them to listeners inside |
| 35 // extension process renderers. | 35 // extension process renderers. |
| 36 // TabsEventRouter will only route events from windows/tabs within a profile to | 36 // TabsEventRouter will only route events from windows/tabs within a profile to |
| 37 // extension processes in the same profile. | 37 // extension processes in the same profile. |
| 38 class TabsEventRouter : public TabStripModelObserver, | 38 class TabsEventRouter : public TabStripModelObserver, |
| 39 public BrowserTabStripTrackerDelegate, | 39 public BrowserTabStripTrackerDelegate, |
| 40 public chrome::BrowserListObserver, | 40 public chrome::BrowserListObserver, |
| 41 public favicon::FaviconDriverObserver, | 41 public favicon::FaviconDriverObserver, |
| 42 public ui_zoom::ZoomObserver { | 42 public zoom::ZoomObserver { |
| 43 public: | 43 public: |
| 44 explicit TabsEventRouter(Profile* profile); | 44 explicit TabsEventRouter(Profile* profile); |
| 45 ~TabsEventRouter() override; | 45 ~TabsEventRouter() override; |
| 46 | 46 |
| 47 // BrowserTabStripTrackerDelegate: | 47 // BrowserTabStripTrackerDelegate: |
| 48 bool ShouldTrackBrowser(Browser* browser) override; | 48 bool ShouldTrackBrowser(Browser* browser) override; |
| 49 | 49 |
| 50 // chrome::BrowserListObserver: | 50 // chrome::BrowserListObserver: |
| 51 void OnBrowserSetLastActive(Browser* browser) override; | 51 void OnBrowserSetLastActive(Browser* browser) override; |
| 52 | 52 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 72 TabChangeType change_type) override; | 72 TabChangeType change_type) override; |
| 73 void TabReplacedAt(TabStripModel* tab_strip_model, | 73 void TabReplacedAt(TabStripModel* tab_strip_model, |
| 74 content::WebContents* old_contents, | 74 content::WebContents* old_contents, |
| 75 content::WebContents* new_contents, | 75 content::WebContents* new_contents, |
| 76 int index) override; | 76 int index) override; |
| 77 void TabPinnedStateChanged(content::WebContents* contents, | 77 void TabPinnedStateChanged(content::WebContents* contents, |
| 78 int index) override; | 78 int index) override; |
| 79 | 79 |
| 80 // ZoomObserver: | 80 // ZoomObserver: |
| 81 void OnZoomChanged( | 81 void OnZoomChanged( |
| 82 const ui_zoom::ZoomController::ZoomChangedEventData& data) override; | 82 const zoom::ZoomController::ZoomChangedEventData& data) override; |
| 83 | 83 |
| 84 // favicon::FaviconDriverObserver: | 84 // favicon::FaviconDriverObserver: |
| 85 void OnFaviconUpdated(favicon::FaviconDriver* favicon_driver, | 85 void OnFaviconUpdated(favicon::FaviconDriver* favicon_driver, |
| 86 NotificationIconType notification_icon_type, | 86 NotificationIconType notification_icon_type, |
| 87 const GURL& icon_url, | 87 const GURL& icon_url, |
| 88 bool icon_url_changed, | 88 bool icon_url_changed, |
| 89 const gfx::Image& image) override; | 89 const gfx::Image& image) override; |
| 90 | 90 |
| 91 private: | 91 private: |
| 92 // "Synthetic" event. Called from TabInsertedAt if new tab is detected. | 92 // "Synthetic" event. Called from TabInsertedAt if new tab is detected. |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |