Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / views / tabs / tab_controller.h
blobd20a178673dd12214ce7b9997e494d5d2129f23d
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 // Selects the tab.
33 virtual void SelectTab(Tab* tab) = 0;
35 // Extends the selection from the anchor to |tab|.
36 virtual void ExtendSelectionTo(Tab* tab) = 0;
38 // Toggles whether |tab| is selected.
39 virtual void ToggleSelected(Tab* tab) = 0;
41 // Adds the selection from the anchor to |tab|.
42 virtual void AddSelectionFromAnchorTo(Tab* tab) = 0;
44 // Closes the tab.
45 virtual void CloseTab(Tab* tab, CloseTabSource source) = 0;
47 // Shows a context menu for the tab at the specified point in screen coords.
48 virtual void ShowContextMenuForTab(Tab* tab,
49 const gfx::Point& p,
50 ui::MenuSourceType source_type) = 0;
52 // Returns true if |tab| is the active tab. The active tab is the one whose
53 // content is shown in the browser.
54 virtual bool IsActiveTab(const Tab* tab) const = 0;
56 // Returns true if the specified Tab is selected.
57 virtual bool IsTabSelected(const Tab* tab) const = 0;
59 // Returns true if the specified Tab is pinned.
60 virtual bool IsTabPinned(const Tab* tab) const = 0;
62 // Potentially starts a drag for the specified Tab.
63 virtual void MaybeStartDrag(
64 Tab* tab,
65 const ui::LocatedEvent& event,
66 const ui::ListSelectionModel& original_selection) = 0;
68 // Continues dragging a Tab.
69 virtual void ContinueDrag(views::View* view,
70 const ui::LocatedEvent& event) = 0;
72 // Ends dragging a Tab. Returns whether the tab has been destroyed.
73 virtual bool EndDrag(EndDragReason reason) = 0;
75 // Returns the tab that contains the specified coordinates, in terms of |tab|,
76 // or NULL if there is no tab that contains the specified point.
77 virtual Tab* GetTabAt(Tab* tab,
78 const gfx::Point& tab_in_tab_coordinates) = 0;
80 // Invoked when a mouse event occurs on |source|.
81 virtual void OnMouseEventInTab(views::View* source,
82 const ui::MouseEvent& event) = 0;
84 // Returns true if |tab| needs to be painted. If false is returned the tab is
85 // not painted. If true is returned the tab should be painted and |clip| is
86 // set to the clip (if |clip| is empty means no clip).
87 virtual bool ShouldPaintTab(const Tab* tab, gfx::Rect* clip) = 0;
89 // Returns true if tabs painted in the rectangular light-bar style.
90 virtual bool IsImmersiveStyle() const = 0;
92 protected:
93 virtual ~TabController() {}
96 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_CONTROLLER_H_