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_TAB_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_TAB_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_TABS_TAB_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TABS_TAB_CONTROLLER_H_ |
7 | 7 |
| 8 #include "base/callback_forward.h" |
8 #include "chrome/browser/ui/views/tabs/tab_strip_types.h" | 9 #include "chrome/browser/ui/views/tabs/tab_strip_types.h" |
9 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
10 #include "ui/base/ui_base_types.h" | 11 #include "ui/base/ui_base_types.h" |
11 | 12 |
12 class Tab; | 13 class Tab; |
13 | 14 |
14 namespace gfx { | 15 namespace gfx { |
| 16 class Path; |
15 class Point; | 17 class Point; |
16 class Size; | 18 class Size; |
17 } | 19 } |
18 namespace ui { | 20 namespace ui { |
19 struct AXViewState; | 21 struct AXViewState; |
20 class ListSelectionModel; | 22 class ListSelectionModel; |
21 class LocatedEvent; | 23 class LocatedEvent; |
22 class MouseEvent; | 24 class MouseEvent; |
23 } | 25 } |
24 namespace views { | 26 namespace views { |
25 class View; | 27 class View; |
26 } | 28 } |
27 | 29 |
28 // Controller for tabs. | 30 // Controller for tabs. |
29 class TabController { | 31 class TabController { |
30 public: | 32 public: |
31 virtual const ui::ListSelectionModel& GetSelectionModel() const = 0; | 33 virtual const ui::ListSelectionModel& GetSelectionModel() const = 0; |
32 | 34 |
33 // Returns true if multiple selection is supported. | 35 // Returns true if multiple selection is supported. |
34 virtual bool SupportsMultipleSelection() = 0; | 36 virtual bool SupportsMultipleSelection() = 0; |
35 | 37 |
36 // Returns true if we should force the close buttons of the inactive tabs | 38 // Returns true if we should force the close buttons of the inactive tabs |
37 // to be hidden. | 39 // to be hidden. |
38 virtual bool ShouldHideCloseButtonForInactiveTabs() = 0; | 40 virtual bool ShouldHideCloseButtonForInactiveTabs() = 0; |
39 | 41 |
| 42 // Returns true if ShouldPaintTab() could return a non-empty clip path. |
| 43 virtual bool MaySetClip() = 0; |
| 44 |
40 // Selects the tab. | 45 // Selects the tab. |
41 virtual void SelectTab(Tab* tab) = 0; | 46 virtual void SelectTab(Tab* tab) = 0; |
42 | 47 |
43 // Extends the selection from the anchor to |tab|. | 48 // Extends the selection from the anchor to |tab|. |
44 virtual void ExtendSelectionTo(Tab* tab) = 0; | 49 virtual void ExtendSelectionTo(Tab* tab) = 0; |
45 | 50 |
46 // Toggles whether |tab| is selected. | 51 // Toggles whether |tab| is selected. |
47 virtual void ToggleSelected(Tab* tab) = 0; | 52 virtual void ToggleSelected(Tab* tab) = 0; |
48 | 53 |
49 // Adds the selection from the anchor to |tab|. | 54 // Adds the selection from the anchor to |tab|. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 90 |
86 // Returns the tab that contains the specified coordinates, in terms of |tab|, | 91 // Returns the tab that contains the specified coordinates, in terms of |tab|, |
87 // or NULL if there is no tab that contains the specified point. | 92 // or NULL if there is no tab that contains the specified point. |
88 virtual Tab* GetTabAt(Tab* tab, | 93 virtual Tab* GetTabAt(Tab* tab, |
89 const gfx::Point& tab_in_tab_coordinates) = 0; | 94 const gfx::Point& tab_in_tab_coordinates) = 0; |
90 | 95 |
91 // Invoked when a mouse event occurs on |source|. | 96 // Invoked when a mouse event occurs on |source|. |
92 virtual void OnMouseEventInTab(views::View* source, | 97 virtual void OnMouseEventInTab(views::View* source, |
93 const ui::MouseEvent& event) = 0; | 98 const ui::MouseEvent& event) = 0; |
94 | 99 |
95 // Returns true if |tab| needs to be painted. If false is returned the tab is | 100 // Returns whether |tab| needs to be painted. When this returns true, |clip| |
96 // not painted. If true is returned the tab should be painted and |clip| is | 101 // is set to the path which should be clipped out of the current tab's region |
97 // set to the clip (if |clip| is empty means no clip). | 102 // (for hit testing or painting), if any. |clip| is only non-empty when |
98 virtual bool ShouldPaintTab(const Tab* tab, gfx::Rect* clip) = 0; | 103 // stacking tabs; if it is empty, no clipping is needed. |border_callback| is |
| 104 // a callback which returns a tab's border given its size, and is used in |
| 105 // computing |clip|. |
| 106 virtual bool ShouldPaintTab( |
| 107 const Tab* tab, |
| 108 const base::Callback<gfx::Path(const gfx::Size&)>& border_callback, |
| 109 gfx::Path* clip) = 0; |
99 | 110 |
100 // Returns true if tab loading throbbers can be painted to a composited layer. | 111 // Returns true if tab loading throbbers can be painted to a composited layer. |
101 // This can only be done when the TabController can guarantee that nothing | 112 // This can only be done when the TabController can guarantee that nothing |
102 // in the same window will redraw on top of the the favicon area of any tab. | 113 // in the same window will redraw on top of the the favicon area of any tab. |
103 virtual bool CanPaintThrobberToLayer() const = 0; | 114 virtual bool CanPaintThrobberToLayer() const = 0; |
104 | 115 |
105 // Returns true if tabs should be painted in the rectangular light-bar style. | 116 // Returns true if tabs should be painted in the rectangular light-bar style. |
106 virtual bool IsImmersiveStyle() const = 0; | 117 virtual bool IsImmersiveStyle() const = 0; |
107 | 118 |
108 // Returns COLOR_TOOLBAR_TOP_SEPARATOR[,_INACTIVE] depending on the activation | 119 // Returns COLOR_TOOLBAR_TOP_SEPARATOR[,_INACTIVE] depending on the activation |
109 // state of the window. | 120 // state of the window. |
110 virtual SkColor GetToolbarTopSeparatorColor() const = 0; | 121 virtual SkColor GetToolbarTopSeparatorColor() const = 0; |
111 | 122 |
112 // Returns the resource ID for the image to use as the tab background. | 123 // Returns the resource ID for the image to use as the tab background. |
113 // |custom_image| is an outparam set to true if either the tab or the frame | 124 // |custom_image| is an outparam set to true if either the tab or the frame |
114 // background images have been customized; see implementation comments. | 125 // background images have been customized; see implementation comments. |
115 virtual int GetBackgroundResourceId(bool* custom_image) const = 0; | 126 virtual int GetBackgroundResourceId(bool* custom_image) const = 0; |
116 | 127 |
117 // Adds private information to the tab's accessibility state. | 128 // Adds private information to the tab's accessibility state. |
118 virtual void UpdateTabAccessibilityState(const Tab* tab, | 129 virtual void UpdateTabAccessibilityState(const Tab* tab, |
119 ui::AXViewState* state) = 0; | 130 ui::AXViewState* state) = 0; |
120 | 131 |
121 protected: | 132 protected: |
122 virtual ~TabController() {} | 133 virtual ~TabController() {} |
123 }; | 134 }; |
124 | 135 |
125 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_CONTROLLER_H_ | 136 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_CONTROLLER_H_ |
OLD | NEW |