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_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "chrome/browser/prefs/pref_change_registrar.h" | 11 #include "chrome/browser/prefs/pref_change_registrar.h" |
| 12 #include "chrome/browser/ui/search/search_model_observer.h" |
| 13 #include "chrome/browser/ui/search/toolbar_search_animator_observer.h" |
12 #include "chrome/browser/ui/tabs/hover_tab_selector.h" | 14 #include "chrome/browser/ui/tabs/hover_tab_selector.h" |
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
14 #include "chrome/browser/ui/views/tabs/tab_strip_controller.h" | 16 #include "chrome/browser/ui/views/tabs/tab_strip_controller.h" |
15 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
16 | 18 |
17 class BaseTab; | 19 class BaseTab; |
18 class Browser; | 20 class Browser; |
19 class TabContents; | 21 class TabContents; |
20 class TabStrip; | 22 class TabStrip; |
21 class TabStripSelectionModel; | 23 class TabStripSelectionModel; |
22 struct TabRendererData; | 24 struct TabRendererData; |
23 | 25 |
24 namespace content { | 26 namespace content { |
25 class WebContents; | 27 class WebContents; |
26 } | 28 } |
27 | 29 |
28 // An implementation of TabStripController that sources data from the | 30 // An implementation of TabStripController that sources data from the |
29 // TabContentses in a TabStripModel. | 31 // TabContentses in a TabStripModel. |
30 class BrowserTabStripController : public TabStripController, | 32 class BrowserTabStripController |
31 public TabStripModelObserver, | 33 : public TabStripController, |
32 public content::NotificationObserver { | 34 public TabStripModelObserver, |
| 35 public content::NotificationObserver, |
| 36 public chrome::search::SearchModelObserver, |
| 37 public chrome::search::ToolbarSearchAnimatorObserver { |
33 public: | 38 public: |
34 BrowserTabStripController(Browser* browser, TabStripModel* model); | 39 BrowserTabStripController(Browser* browser, TabStripModel* model); |
35 virtual ~BrowserTabStripController(); | 40 virtual ~BrowserTabStripController(); |
36 | 41 |
37 void InitFromModel(TabStrip* tabstrip); | 42 void InitFromModel(TabStrip* tabstrip); |
38 | 43 |
39 TabStripModel* model() const { return model_; } | 44 TabStripModel* model() const { return model_; } |
40 | 45 |
41 bool IsCommandEnabledForTab(TabStripModel::ContextMenuCommand command_id, | 46 bool IsCommandEnabledForTab(TabStripModel::ContextMenuCommand command_id, |
42 BaseTab* tab) const; | 47 BaseTab* tab) const; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 TabContents* old_contents, | 96 TabContents* old_contents, |
92 TabContents* new_contents, | 97 TabContents* new_contents, |
93 int model_index) OVERRIDE; | 98 int model_index) OVERRIDE; |
94 virtual void TabPinnedStateChanged(TabContents* contents, | 99 virtual void TabPinnedStateChanged(TabContents* contents, |
95 int model_index) OVERRIDE; | 100 int model_index) OVERRIDE; |
96 virtual void TabMiniStateChanged(TabContents* contents, | 101 virtual void TabMiniStateChanged(TabContents* contents, |
97 int model_index) OVERRIDE; | 102 int model_index) OVERRIDE; |
98 virtual void TabBlockedStateChanged(TabContents* contents, | 103 virtual void TabBlockedStateChanged(TabContents* contents, |
99 int model_index) OVERRIDE; | 104 int model_index) OVERRIDE; |
100 | 105 |
| 106 // chrome::search::SearchModelObserver implementation: |
| 107 virtual void ModeChanged(const chrome::search::Mode& mode) OVERRIDE; |
| 108 |
| 109 // chrome::search::ToolbarSearchAnimatorObserver implementation: |
| 110 virtual void OnToolbarBackgroundAnimatorProgressed() OVERRIDE; |
| 111 virtual void OnToolbarBackgroundAnimatorCanceled( |
| 112 TabContents* tab_contents) OVERRIDE; |
| 113 |
101 // content::NotificationObserver implementation: | 114 // content::NotificationObserver implementation: |
102 virtual void Observe(int type, | 115 virtual void Observe(int type, |
103 const content::NotificationSource& source, | 116 const content::NotificationSource& source, |
104 const content::NotificationDetails& details) OVERRIDE; | 117 const content::NotificationDetails& details) OVERRIDE; |
105 | 118 |
106 protected: | 119 protected: |
107 // The context in which SetTabRendererDataFromModel is being called. | 120 // The context in which SetTabRendererDataFromModel is being called. |
108 enum TabStatus { | 121 enum TabStatus { |
109 NEW_TAB, | 122 NEW_TAB, |
110 EXISTING_TAB | 123 EXISTING_TAB |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 166 |
154 // Helper for performing tab selection as a result of dragging over a tab. | 167 // Helper for performing tab selection as a result of dragging over a tab. |
155 HoverTabSelector hover_tab_selector_; | 168 HoverTabSelector hover_tab_selector_; |
156 | 169 |
157 PrefChangeRegistrar local_pref_registrar_; | 170 PrefChangeRegistrar local_pref_registrar_; |
158 | 171 |
159 DISALLOW_COPY_AND_ASSIGN(BrowserTabStripController); | 172 DISALLOW_COPY_AND_ASSIGN(BrowserTabStripController); |
160 }; | 173 }; |
161 | 174 |
162 #endif // CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ | 175 #endif // CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ |
OLD | NEW |