Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / views / tabs / tab_strip_controller.h
blob95940f1114a8d335a48ace5705a4fd3c14327b5c
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_STRIP_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_CONTROLLER_H_
8 #include "base/strings/string16.h"
9 #include "chrome/browser/ui/views/tabs/tab_strip_types.h"
10 #include "ui/base/ui_base_types.h"
12 class GURL;
13 class Tab;
14 class TabStrip;
16 namespace gfx {
17 class Point;
20 namespace ui {
21 class ListSelectionModel;
24 // Model/Controller for the TabStrip.
25 // NOTE: All indices used by this class are in model coordinates.
26 class TabStripController {
27 public:
28 virtual ~TabStripController() {}
30 // Returns the selection model of the tabstrip.
31 virtual const ui::ListSelectionModel& GetSelectionModel() = 0;
33 // Returns the number of tabs in the model.
34 virtual int GetCount() const = 0;
36 // Returns true if |index| is a valid model index.
37 virtual bool IsValidIndex(int index) const = 0;
39 // Returns true if the tab at |index| is the active tab. The active tab is the
40 // one whose content is shown.
41 virtual bool IsActiveTab(int index) const = 0;
43 // Returns the index of the active tab.
44 virtual int GetActiveIndex() const = 0;
46 // Returns true if the selected index is selected.
47 virtual bool IsTabSelected(int index) const = 0;
49 // Returns true if the selected index is pinned.
50 virtual bool IsTabPinned(int index) const = 0;
52 // Returns true if the selected index is the new tab page.
53 virtual bool IsNewTabPage(int index) const = 0;
55 // Select the tab at the specified index in the model.
56 virtual void SelectTab(int index) = 0;
58 // Extends the selection from the anchor to the specified index in the model.
59 virtual void ExtendSelectionTo(int index) = 0;
61 // Toggles the selection of the specified index in the model.
62 virtual void ToggleSelected(int index) = 0;
64 // Adds the selection the anchor to |index|.
65 virtual void AddSelectionFromAnchorTo(int index) = 0;
67 // Closes the tab at the specified index in the model.
68 virtual void CloseTab(int index, CloseTabSource source) = 0;
70 // Shows a context menu for the tab at the specified point in screen coords.
71 virtual void ShowContextMenuForTab(Tab* tab,
72 const gfx::Point& p,
73 ui::MenuSourceType source_type) = 0;
75 // Updates the loading animations of all the tabs.
76 virtual void UpdateLoadingAnimations() = 0;
78 // Returns true if the associated TabStrip's delegate supports tab moving or
79 // detaching. Used by the Frame to determine if dragging on the Tab
80 // itself should move the window in cases where there's only one
81 // non drag-able Tab.
82 virtual int HasAvailableDragActions() const = 0;
84 // Notifies controller of a drop index update.
85 virtual void OnDropIndexUpdate(int index, bool drop_before) = 0;
87 // Performs a drop at the specified location.
88 virtual void PerformDrop(bool drop_before, int index, const GURL& url) = 0;
90 // Return true if this tab strip is compatible with the provided tab strip.
91 // Compatible tab strips can transfer tabs during drag and drop.
92 virtual bool IsCompatibleWith(TabStrip* other) const = 0;
94 // Creates the new tab.
95 virtual void CreateNewTab() = 0;
97 // Creates a new tab, and loads |location| in the tab. If |location| is a
98 // valid URL, then simply loads the URL, otherwise this can open a
99 // search-result page for |location|.
100 virtual void CreateNewTabWithLocation(const base::string16& location) = 0;
102 // Returns true if the tab strip is in an incognito window.
103 virtual bool IsIncognito() = 0;
105 // Invoked if the layout type might have changed.
106 virtual void LayoutTypeMaybeChanged() = 0;
108 // Notifies controller that the user started dragging this tabstrip's tabs.
109 virtual void OnStartedDraggingTabs() = 0;
111 // Notifies controller that the user stopped dragging this tabstrip's tabs.
112 // This is also called when the tabs that the user is dragging were detached
113 // from this tabstrip but the user is still dragging the tabs.
114 virtual void OnStoppedDraggingTabs() = 0;
116 // Determines if the file type of the URL is supported. Should invoke
117 // TabStrip::FileSupported to report the result.
118 virtual void CheckFileSupported(const GURL& url) = 0;
121 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_CONTROLLER_H_