Infobar material design refresh: layout
[chromium-blink-merge.git] / chrome / browser / ui / views / tabs / tab_controller.h
blob3e8807be7b45ea6864b425b352a0ef765a75122f
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_TAB_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_VIEWS_TABS_TAB_CONTROLLER_H_
8 #include "chrome/browser/ui/views/tabs/tab_strip_types.h"
10 class Tab;
12 namespace gfx {
13 class Point;
15 namespace ui {
16 class ListSelectionModel;
17 class LocatedEvent;
18 class MouseEvent;
20 namespace views {
21 class View;
24 // Controller for tabs.
25 class TabController {
26 public:
27 virtual const ui::ListSelectionModel& GetSelectionModel() = 0;
29 // Returns true if multiple selection is supported.
30 virtual bool SupportsMultipleSelection() = 0;
32 // Returns true if we should force the close buttons of the inactive tabs
33 // to be hidden.
34 virtual bool ShouldHideCloseButtonForInactiveTabs() = 0;
36 // Selects the tab.
37 virtual void SelectTab(Tab* tab) = 0;
39 // Extends the selection from the anchor to |tab|.
40 virtual void ExtendSelectionTo(Tab* tab) = 0;
42 // Toggles whether |tab| is selected.
43 virtual void ToggleSelected(Tab* tab) = 0;
45 // Adds the selection from the anchor to |tab|.
46 virtual void AddSelectionFromAnchorTo(Tab* tab) = 0;
48 // Closes the tab.
49 virtual void CloseTab(Tab* tab, CloseTabSource source) = 0;
51 // Toggles whether tab-wide audio muting is active.
52 virtual void ToggleTabAudioMute(Tab* tab) = 0;
54 // Shows a context menu for the tab at the specified point in screen coords.
55 virtual void ShowContextMenuForTab(Tab* tab,
56 const gfx::Point& p,
57 ui::MenuSourceType source_type) = 0;
59 // Returns true if |tab| is the active tab. The active tab is the one whose
60 // content is shown in the browser.
61 virtual bool IsActiveTab(const Tab* tab) const = 0;
63 // Returns true if the specified Tab is selected.
64 virtual bool IsTabSelected(const Tab* tab) const = 0;
66 // Returns true if the specified Tab is pinned.
67 virtual bool IsTabPinned(const Tab* tab) const = 0;
69 // Potentially starts a drag for the specified Tab.
70 virtual void MaybeStartDrag(
71 Tab* tab,
72 const ui::LocatedEvent& event,
73 const ui::ListSelectionModel& original_selection) = 0;
75 // Continues dragging a Tab.
76 virtual void ContinueDrag(views::View* view,
77 const ui::LocatedEvent& event) = 0;
79 // Ends dragging a Tab. Returns whether the tab has been destroyed.
80 virtual bool EndDrag(EndDragReason reason) = 0;
82 // Returns the tab that contains the specified coordinates, in terms of |tab|,
83 // or NULL if there is no tab that contains the specified point.
84 virtual Tab* GetTabAt(Tab* tab,
85 const gfx::Point& tab_in_tab_coordinates) = 0;
87 // Invoked when a mouse event occurs on |source|.
88 virtual void OnMouseEventInTab(views::View* source,
89 const ui::MouseEvent& event) = 0;
91 // Returns true if |tab| needs to be painted. If false is returned the tab is
92 // not painted. If true is returned the tab should be painted and |clip| is
93 // set to the clip (if |clip| is empty means no clip).
94 virtual bool ShouldPaintTab(const Tab* tab, gfx::Rect* clip) = 0;
96 // Returns true if tabs painted in the rectangular light-bar style.
97 virtual bool IsImmersiveStyle() const = 0;
99 // Adds private information to the tab's accessibility state.
100 virtual void UpdateTabAccessibilityState(const Tab* tab,
101 ui::AXViewState* state) = 0;
103 protected:
104 virtual ~TabController() {}
107 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_CONTROLLER_H_