OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/tabs/tab_strip_model.h" | 10 #include "chrome/browser/tabs/tab_strip_model.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 virtual void TabMiniStateChanged(TabContentsWrapper* contents, | 90 virtual void TabMiniStateChanged(TabContentsWrapper* contents, |
91 int model_index) OVERRIDE; | 91 int model_index) OVERRIDE; |
92 virtual void TabBlockedStateChanged(TabContentsWrapper* contents, | 92 virtual void TabBlockedStateChanged(TabContentsWrapper* contents, |
93 int model_index) OVERRIDE; | 93 int model_index) OVERRIDE; |
94 | 94 |
95 // NotificationObserver implementation: | 95 // NotificationObserver implementation: |
96 virtual void Observe(NotificationType type, | 96 virtual void Observe(NotificationType type, |
97 const NotificationSource& source, | 97 const NotificationSource& source, |
98 const NotificationDetails& details) OVERRIDE; | 98 const NotificationDetails& details) OVERRIDE; |
99 | 99 |
| 100 protected: |
| 101 // The context in which SetTabRendererDataFromModel is being called. |
| 102 enum TabStatus { |
| 103 NEW_TAB, |
| 104 EXISTING_TAB |
| 105 }; |
| 106 |
| 107 // Sets the TabRendererData from the TabStripModel. |
| 108 virtual void SetTabRendererDataFromModel(TabContents* contents, |
| 109 int model_index, |
| 110 TabRendererData* data, |
| 111 TabStatus tab_status); |
| 112 |
| 113 Profile* profile() const { return model_->profile(); } |
| 114 |
| 115 const BaseTabStrip* tabstrip() const { return tabstrip_; } |
| 116 |
| 117 const Browser* browser() const { return browser_; } |
| 118 |
100 private: | 119 private: |
101 class TabContextMenuContents; | 120 class TabContextMenuContents; |
102 | 121 |
103 // Invokes tabstrip_->SetTabData. | 122 // Invokes tabstrip_->SetTabData. |
104 void SetTabDataAt(TabContentsWrapper* contents, int model_index); | 123 void SetTabDataAt(TabContentsWrapper* contents, int model_index); |
105 | 124 |
106 // Sets the TabRendererData from the TabStripModel. | |
107 void SetTabRendererDataFromModel(TabContents* contents, | |
108 int model_index, | |
109 TabRendererData* data); | |
110 | |
111 void StartHighlightTabsForCommand( | 125 void StartHighlightTabsForCommand( |
112 TabStripModel::ContextMenuCommand command_id, | 126 TabStripModel::ContextMenuCommand command_id, |
113 BaseTab* tab); | 127 BaseTab* tab); |
114 void StopHighlightTabsForCommand( | 128 void StopHighlightTabsForCommand( |
115 TabStripModel::ContextMenuCommand command_id, | 129 TabStripModel::ContextMenuCommand command_id, |
116 BaseTab* tab); | 130 BaseTab* tab); |
117 | 131 |
118 Profile* profile() const { return model_->profile(); } | |
119 | |
120 TabStripModel* model_; | 132 TabStripModel* model_; |
121 | 133 |
122 BaseTabStrip* tabstrip_; | 134 BaseTabStrip* tabstrip_; |
123 | 135 |
124 // Non-owning pointer to the browser which is using this controller. | 136 // Non-owning pointer to the browser which is using this controller. |
125 Browser* browser_; | 137 Browser* browser_; |
126 | 138 |
127 // If non-NULL it means we're showing a menu for the tab. | 139 // If non-NULL it means we're showing a menu for the tab. |
128 scoped_ptr<TabContextMenuContents> context_menu_contents_; | 140 scoped_ptr<TabContextMenuContents> context_menu_contents_; |
129 | 141 |
130 NotificationRegistrar notification_registrar_; | 142 NotificationRegistrar notification_registrar_; |
131 | 143 |
132 // Helper for performing tab selection as a result of dragging over a tab. | 144 // Helper for performing tab selection as a result of dragging over a tab. |
133 HoverTabSelector hover_tab_selector_; | 145 HoverTabSelector hover_tab_selector_; |
134 | 146 |
135 DISALLOW_COPY_AND_ASSIGN(BrowserTabStripController); | 147 DISALLOW_COPY_AND_ASSIGN(BrowserTabStripController); |
136 }; | 148 }; |
137 | 149 |
138 #endif // CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ | 150 #endif // CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ |
OLD | NEW |