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 | 7 |
8 #include "base/scoped_ptr.h" | |
9 | |
8 #include "chrome/browser/tabs/tab_strip_model.h" | 10 #include "chrome/browser/tabs/tab_strip_model.h" |
9 #include "chrome/browser/views/tabs/side_tab_strip_model.h" | 11 #include "chrome/browser/views/tabs/side_tab_strip_model.h" |
10 | 12 |
11 class SideTabStrip; | 13 class SideTabStrip; |
12 | 14 |
13 // An implementation of SideTabStripModel that sources data from | 15 // An implementation of SideTabStripModel that sources data from |
14 // the TabContentses in a TabStripModel. | 16 // the TabContentses in a TabStripModel. |
15 class BrowserTabStripController : public SideTabStripModel, | 17 class BrowserTabStripController : public SideTabStripModel, |
16 public TabStripModelObserver { | 18 public TabStripModelObserver { |
17 public: | 19 public: |
18 BrowserTabStripController(TabStripModel* model, SideTabStrip* tabstrip); | 20 BrowserTabStripController(TabStripModel* model, SideTabStrip* tabstrip); |
19 virtual ~BrowserTabStripController(); | 21 virtual ~BrowserTabStripController(); |
20 | 22 |
23 void InitFromModel(); | |
24 | |
25 bool IsCommandEnabledForTab(TabStripModel::ContextMenuCommand command_id, | |
26 int tab_index) const; | |
27 bool IsCommandCheckedForTab(TabStripModel::ContextMenuCommand command_id, | |
28 int tab_index) const; | |
29 void ExecuteCommandForTab(TabStripModel::ContextMenuCommand command_id, | |
30 int tab_index); | |
31 | |
21 // SideTabStripModel implementation: | 32 // SideTabStripModel implementation: |
22 virtual SkBitmap GetIcon(int index) const; | 33 virtual SkBitmap GetIcon(int index) const; |
23 virtual string16 GetTitle(int index) const; | 34 virtual string16 GetTitle(int index) const; |
24 virtual bool IsSelected(int index) const; | 35 virtual bool IsSelected(int index) const; |
25 virtual NetworkState GetNetworkState(int index) const; | 36 virtual NetworkState GetNetworkState(int index) const; |
26 virtual void SelectTab(int index); | 37 virtual void SelectTab(int index); |
27 virtual void CloseTab(int index); | 38 virtual void CloseTab(int index); |
39 virtual void ShowContextMenu(int index, const gfx::Point& p); | |
28 | 40 |
29 // TabStripModelObserver implementation: | 41 // TabStripModelObserver implementation: |
30 virtual void TabInsertedAt(TabContents* contents, int index, | 42 virtual void TabInsertedAt(TabContents* contents, int index, |
31 bool foreground); | 43 bool foreground); |
32 virtual void TabDetachedAt(TabContents* contents, int index); | 44 virtual void TabDetachedAt(TabContents* contents, int index); |
33 virtual void TabSelectedAt(TabContents* old_contents, | 45 virtual void TabSelectedAt(TabContents* old_contents, |
34 TabContents* contents, int index, | 46 TabContents* contents, int index, |
35 bool user_gesture); | 47 bool user_gesture); |
36 virtual void TabMoved(TabContents* contents, int from_index, | 48 virtual void TabMoved(TabContents* contents, int from_index, |
37 int to_index); | 49 int to_index); |
38 virtual void TabChangedAt(TabContents* contents, int index, | 50 virtual void TabChangedAt(TabContents* contents, int index, |
39 TabChangeType change_type); | 51 TabChangeType change_type); |
40 virtual void TabReplacedAt(TabContents* old_contents, | 52 virtual void TabReplacedAt(TabContents* old_contents, |
41 TabContents* new_contents, int index); | 53 TabContents* new_contents, int index); |
42 virtual void TabPinnedStateChanged(TabContents* contents, int index); | 54 virtual void TabPinnedStateChanged(TabContents* contents, int index); |
43 virtual void TabBlockedStateChanged(TabContents* contents, int index); | 55 virtual void TabBlockedStateChanged(TabContents* contents, int index); |
44 | 56 |
45 private: | 57 private: |
46 TabStripModel* model_; | 58 TabStripModel* model_; |
47 SideTabStrip* tabstrip_; | 59 SideTabStrip* tabstrip_; |
48 | 60 |
61 // If non-NULL it means we're showing a menu for the tab. | |
62 class TabContextMenuContents; | |
sky
2010/03/19 16:14:02
move class definition before all fields.
| |
63 scoped_ptr<TabContextMenuContents> context_menu_contents_; | |
64 | |
49 DISALLOW_COPY_AND_ASSIGN(BrowserTabStripController); | 65 DISALLOW_COPY_AND_ASSIGN(BrowserTabStripController); |
50 }; | 66 }; |
51 | 67 |
52 #endif // CHROME_BROWSER_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ | 68 #endif // CHROME_BROWSER_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ |
53 | 69 |
OLD | NEW |