OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ |
6 #define CHROME_BROWSER_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ | 6 #define CHROME_BROWSER_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "chrome/browser/tabs/tab_strip_model.h" | 10 #include "chrome/browser/tabs/tab_strip_model.h" |
11 #include "chrome/browser/views/tabs/tab_strip_controller.h" | 11 #include "chrome/browser/views/tabs/tab_strip_controller.h" |
12 #include "chrome/common/notification_registrar.h" | 12 #include "chrome/common/notification_registrar.h" |
13 | 13 |
14 class BaseTab; | 14 class BaseTab; |
15 class BaseTabStrip; | 15 class BaseTabStrip; |
| 16 class Browser; |
16 | 17 |
17 struct TabRendererData; | 18 struct TabRendererData; |
18 | 19 |
19 // An implementation of TabStripController that sources data from the | 20 // An implementation of TabStripController that sources data from the |
20 // TabContentses in a TabStripModel. | 21 // TabContentses in a TabStripModel. |
21 class BrowserTabStripController : public TabStripController, | 22 class BrowserTabStripController : public TabStripController, |
22 public TabStripModelObserver, | 23 public TabStripModelObserver, |
23 public NotificationObserver { | 24 public NotificationObserver { |
24 public: | 25 public: |
25 explicit BrowserTabStripController(TabStripModel* model); | 26 BrowserTabStripController(Browser* browser, TabStripModel* model); |
26 virtual ~BrowserTabStripController(); | 27 virtual ~BrowserTabStripController(); |
27 | 28 |
28 void InitFromModel(BaseTabStrip* tabstrip); | 29 void InitFromModel(BaseTabStrip* tabstrip); |
29 | 30 |
30 TabStripModel* model() const { return model_; } | 31 TabStripModel* model() const { return model_; } |
31 | 32 |
32 bool IsCommandEnabledForTab(TabStripModel::ContextMenuCommand command_id, | 33 bool IsCommandEnabledForTab(TabStripModel::ContextMenuCommand command_id, |
33 BaseTab* tab) const; | 34 BaseTab* tab) const; |
34 bool IsCommandCheckedForTab(TabStripModel::ContextMenuCommand command_id, | 35 bool IsCommandCheckedForTab(TabStripModel::ContextMenuCommand command_id, |
35 BaseTab* tab) const; | 36 BaseTab* tab) const; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 void StopHighlightTabsForCommand( | 98 void StopHighlightTabsForCommand( |
98 TabStripModel::ContextMenuCommand command_id, | 99 TabStripModel::ContextMenuCommand command_id, |
99 BaseTab* tab); | 100 BaseTab* tab); |
100 | 101 |
101 Profile* profile() const { return model_->profile(); } | 102 Profile* profile() const { return model_->profile(); } |
102 | 103 |
103 TabStripModel* model_; | 104 TabStripModel* model_; |
104 | 105 |
105 BaseTabStrip* tabstrip_; | 106 BaseTabStrip* tabstrip_; |
106 | 107 |
| 108 // Non-owning pointer to the browser which is using this controller. |
| 109 Browser* browser_; |
| 110 |
107 // If non-NULL it means we're showing a menu for the tab. | 111 // If non-NULL it means we're showing a menu for the tab. |
108 scoped_ptr<TabContextMenuContents> context_menu_contents_; | 112 scoped_ptr<TabContextMenuContents> context_menu_contents_; |
109 | 113 |
110 NotificationRegistrar notification_registrar_; | 114 NotificationRegistrar notification_registrar_; |
111 | 115 |
112 DISALLOW_COPY_AND_ASSIGN(BrowserTabStripController); | 116 DISALLOW_COPY_AND_ASSIGN(BrowserTabStripController); |
113 }; | 117 }; |
114 | 118 |
115 #endif // CHROME_BROWSER_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ | 119 #endif // CHROME_BROWSER_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ |
116 | 120 |
OLD | NEW |