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_SIDE_TAB_STRIP_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_TABS_SIDE_TAB_STRIP_H_ |
6 #define CHROME_BROWSER_VIEWS_TABS_SIDE_TAB_STRIP_H_ | 6 #define CHROME_BROWSER_VIEWS_TABS_SIDE_TAB_STRIP_H_ |
7 | 7 |
8 #include "chrome/browser/tabs/tab_strip_model.h" | 8 #include "chrome/browser/tabs/tab_strip_model.h" |
9 #include "chrome/browser/views/tabs/base_tab_strip.h" | 9 #include "chrome/browser/views/tabs/base_tab_strip.h" |
10 #include "chrome/browser/views/tabs/side_tab.h" | 10 #include "chrome/browser/views/tabs/side_tab.h" |
11 | 11 |
12 class Profile; | 12 class Profile; |
13 class SideTabStripModel; | 13 class SideTabStripModel; |
14 | 14 |
15 class SideTabStrip : public BaseTabStrip, | 15 class SideTabStrip : public BaseTabStrip, |
16 public SideTabModel { | 16 public SideTabModel { |
17 public: | 17 public: |
18 SideTabStrip(); | 18 SideTabStrip(); |
19 virtual ~SideTabStrip(); | 19 virtual ~SideTabStrip(); |
20 | 20 |
21 // Associate a model with this SideTabStrip. The SideTabStrip owns its model. | 21 // Associate a model with this SideTabStrip. The SideTabStrip owns its model. |
22 void SetModel(SideTabStripModel* model); | 22 void SetModel(SideTabStripModel* model); |
23 | 23 |
24 // Whether or not the browser has been run with the "enable-vertical-tabs" | 24 // Whether or not the browser has been run with the "enable-vertical-tabs" |
25 // command line flag that allows the SideTabStrip to be optionally shown. | 25 // command line flag that allows the SideTabStrip to be optionally shown. |
26 static bool Available(); | 26 static bool Available(); |
27 | 27 |
28 // Whether or not the vertical tabstrip is shown. Only valid if Available() | |
29 // returns true. | |
30 static bool Visible(Profile* profile); | |
31 | |
32 // Notifies the SideTabStrip that a tab was added in the model at |index|. | 28 // Notifies the SideTabStrip that a tab was added in the model at |index|. |
33 void AddTabAt(int index); | 29 void AddTabAt(int index); |
34 | 30 |
35 // Notifies the SideTabStrip that a tab was removed from the model at |index|. | 31 // Notifies the SideTabStrip that a tab was removed from the model at |index|. |
36 void RemoveTabAt(int index); | 32 void RemoveTabAt(int index); |
37 | 33 |
38 // Notifies the SideTabStrip that a tab was selected in the model at |index|. | 34 // Notifies the SideTabStrip that a tab was selected in the model at |index|. |
39 void SelectTabAt(int index); | 35 void SelectTabAt(int index); |
40 | 36 |
41 // Notifies the SideTabStrip that the tab at |index| needs to be redisplayed | 37 // Notifies the SideTabStrip that the tab at |index| needs to be redisplayed |
42 // since some of its metadata has changed. | 38 // since some of its metadata has changed. |
43 void UpdateTabAt(int index); | 39 void UpdateTabAt(int index); |
44 | 40 |
45 // SideTabModel implementation: | 41 // SideTabModel implementation: |
46 virtual string16 GetTitle(SideTab* tab) const; | 42 virtual string16 GetTitle(SideTab* tab) const; |
47 virtual SkBitmap GetIcon(SideTab* tab) const; | 43 virtual SkBitmap GetIcon(SideTab* tab) const; |
48 virtual bool IsSelected(SideTab* tab) const; | 44 virtual bool IsSelected(SideTab* tab) const; |
49 virtual void SelectTab(SideTab* tab); | 45 virtual void SelectTab(SideTab* tab); |
50 virtual void CloseTab(SideTab* tab); | 46 virtual void CloseTab(SideTab* tab); |
| 47 virtual void ShowContextMenu(SideTab* tab, const gfx::Point& p); |
51 | 48 |
52 // BaseTabStrip implementation: | 49 // BaseTabStrip implementation: |
53 virtual int GetPreferredHeight(); | 50 virtual int GetPreferredHeight(); |
54 virtual void SetBackgroundOffset(const gfx::Point& offset); | 51 virtual void SetBackgroundOffset(const gfx::Point& offset); |
55 virtual bool IsPositionInWindowCaption(const gfx::Point& point); | 52 virtual bool IsPositionInWindowCaption(const gfx::Point& point); |
56 virtual void SetDraggedTabBounds(int tab_index, | 53 virtual void SetDraggedTabBounds(int tab_index, |
57 const gfx::Rect& tab_bounds); | 54 const gfx::Rect& tab_bounds); |
58 virtual bool IsDragSessionActive() const; | 55 virtual bool IsDragSessionActive() const; |
59 virtual void UpdateLoadingAnimations(); | 56 virtual void UpdateLoadingAnimations(); |
60 virtual bool IsAnimating() const; | 57 virtual bool IsAnimating() const; |
61 virtual TabStrip* AsTabStrip(); | 58 virtual TabStrip* AsTabStrip(); |
62 | 59 |
63 // views::View overrides: | 60 // views::View overrides: |
64 virtual void Layout(); | 61 virtual void Layout(); |
65 virtual gfx::Size GetPreferredSize(); | 62 virtual gfx::Size GetPreferredSize(); |
66 | 63 |
67 private: | 64 private: |
68 // Returns the model index of the specified |tab|. | 65 // Returns the model index of the specified |tab|. |
69 int GetIndexOfSideTab(SideTab* tab) const; | 66 int GetIndexOfSideTab(SideTab* tab) const; |
70 | 67 |
71 // Returns the SideTab at the specified |index|. | 68 // Returns the SideTab at the specified |index|. |
72 SideTab* GetSideTabAt(int index) const; | 69 SideTab* GetSideTabAt(int index) const; |
73 | 70 |
74 scoped_ptr<SideTabStripModel> model_; | 71 scoped_ptr<SideTabStripModel> model_; |
75 | 72 |
76 DISALLOW_COPY_AND_ASSIGN(SideTabStrip); | 73 DISALLOW_COPY_AND_ASSIGN(SideTabStrip); |
77 }; | 74 }; |
78 | 75 |
79 #endif // CHROME_BROWSER_VIEWS_TABS_SIDE_TAB_STRIP_H_ | 76 #endif // CHROME_BROWSER_VIEWS_TABS_SIDE_TAB_STRIP_H_ |
OLD | NEW |