| 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 <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // extension processes in the same profile. | 29 // extension processes in the same profile. |
| 30 class TabsEventRouter : public TabStripModelObserver, | 30 class TabsEventRouter : public TabStripModelObserver, |
| 31 public chrome::BrowserListObserver, | 31 public chrome::BrowserListObserver, |
| 32 public content::NotificationObserver, | 32 public content::NotificationObserver, |
| 33 public ZoomObserver { | 33 public ZoomObserver { |
| 34 public: | 34 public: |
| 35 explicit TabsEventRouter(Profile* profile); | 35 explicit TabsEventRouter(Profile* profile); |
| 36 virtual ~TabsEventRouter(); | 36 virtual ~TabsEventRouter(); |
| 37 | 37 |
| 38 // chrome::BrowserListObserver | 38 // chrome::BrowserListObserver |
| 39 virtual void OnBrowserAdded(Browser* browser) OVERRIDE; | 39 virtual void OnBrowserAdded(Browser* browser) override; |
| 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) override; |
| 51 virtual void ActiveTabChanged(content::WebContents* old_contents, | 51 virtual void ActiveTabChanged(content::WebContents* old_contents, |
| 52 content::WebContents* new_contents, | 52 content::WebContents* new_contents, |
| 53 int index, | 53 int index, |
| 54 int reason) OVERRIDE; | 54 int reason) override; |
| 55 virtual void TabSelectionChanged( | 55 virtual void TabSelectionChanged( |
| 56 TabStripModel* tab_strip_model, | 56 TabStripModel* tab_strip_model, |
| 57 const ui::ListSelectionModel& old_model) OVERRIDE; | 57 const ui::ListSelectionModel& old_model) override; |
| 58 virtual void TabMoved(content::WebContents* contents, | 58 virtual void TabMoved(content::WebContents* contents, |
| 59 int from_index, | 59 int from_index, |
| 60 int to_index) OVERRIDE; | 60 int to_index) override; |
| 61 virtual void TabChangedAt(content::WebContents* contents, | 61 virtual void TabChangedAt(content::WebContents* contents, |
| 62 int index, | 62 int index, |
| 63 TabChangeType change_type) OVERRIDE; | 63 TabChangeType change_type) override; |
| 64 virtual void TabReplacedAt(TabStripModel* tab_strip_model, | 64 virtual void TabReplacedAt(TabStripModel* tab_strip_model, |
| 65 content::WebContents* old_contents, | 65 content::WebContents* old_contents, |
| 66 content::WebContents* new_contents, | 66 content::WebContents* new_contents, |
| 67 int index) OVERRIDE; | 67 int index) override; |
| 68 virtual void TabPinnedStateChanged(content::WebContents* contents, | 68 virtual void TabPinnedStateChanged(content::WebContents* contents, |
| 69 int index) OVERRIDE; | 69 int index) override; |
| 70 | 70 |
| 71 // content::NotificationObserver. | 71 // content::NotificationObserver. |
| 72 virtual void Observe(int type, | 72 virtual void Observe(int type, |
| 73 const content::NotificationSource& source, | 73 const content::NotificationSource& source, |
| 74 const content::NotificationDetails& details) OVERRIDE; | 74 const content::NotificationDetails& details) override; |
| 75 | 75 |
| 76 // ZoomObserver. | 76 // ZoomObserver. |
| 77 virtual void OnZoomChanged( | 77 virtual void OnZoomChanged( |
| 78 const ZoomController::ZoomChangedEventData& data) OVERRIDE; | 78 const ZoomController::ZoomChangedEventData& data) override; |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 // "Synthetic" event. Called from TabInsertedAt if new tab is detected. | 81 // "Synthetic" event. Called from TabInsertedAt if new tab is detected. |
| 82 void TabCreatedAt(content::WebContents* contents, int index, bool active); | 82 void TabCreatedAt(content::WebContents* contents, int index, bool active); |
| 83 | 83 |
| 84 // Internal processing of tab updated events. Is called by both TabChangedAt | 84 // Internal processing of tab updated events. Is called by both TabChangedAt |
| 85 // and Observe/NAV_ENTRY_COMMITTED. | 85 // and Observe/NAV_ENTRY_COMMITTED. |
| 86 void TabUpdated(content::WebContents* contents, bool did_navigate); | 86 void TabUpdated(content::WebContents* contents, bool did_navigate); |
| 87 | 87 |
| 88 // Triggers a tab updated event if the favicon URL changes. | 88 // Triggers a tab updated event if the favicon URL changes. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 // The main profile that owns this event router. | 170 // The main profile that owns this event router. |
| 171 Profile* profile_; | 171 Profile* profile_; |
| 172 | 172 |
| 173 DISALLOW_COPY_AND_ASSIGN(TabsEventRouter); | 173 DISALLOW_COPY_AND_ASSIGN(TabsEventRouter); |
| 174 }; | 174 }; |
| 175 | 175 |
| 176 } // namespace extensions | 176 } // namespace extensions |
| 177 | 177 |
| 178 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_EVENT_ROUTER_H_ | 178 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_EVENT_ROUTER_H_ |
| OLD | NEW |