| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_GTK_TABS_TAB_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_TABS_TAB_GTK_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_TABS_TAB_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_TABS_TAB_GTK_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 } | 21 } |
| 22 | 22 |
| 23 class TabGtk : public TabRendererGtk, | 23 class TabGtk : public TabRendererGtk, |
| 24 public MessageLoopForUI::Observer { | 24 public MessageLoopForUI::Observer { |
| 25 public: | 25 public: |
| 26 // An interface implemented by an object that can help this Tab complete | 26 // An interface implemented by an object that can help this Tab complete |
| 27 // various actions. The index parameter is the index of this Tab in the | 27 // various actions. The index parameter is the index of this Tab in the |
| 28 // TabRenderer::Model. | 28 // TabRenderer::Model. |
| 29 class TabDelegate { | 29 class TabDelegate { |
| 30 public: | 30 public: |
| 31 // Returns true if the specified Tab is active. |
| 32 virtual bool IsTabActive(const TabGtk* tab) const = 0; |
| 33 |
| 31 // Returns true if the specified Tab is selected. | 34 // Returns true if the specified Tab is selected. |
| 32 virtual bool IsTabSelected(const TabGtk* tab) const = 0; | 35 virtual bool IsTabSelected(const TabGtk* tab) const = 0; |
| 33 | 36 |
| 34 // Returns true if the specified Tab is pinned. | 37 // Returns true if the specified Tab is pinned. |
| 35 virtual bool IsTabPinned(const TabGtk* tab) const = 0; | 38 virtual bool IsTabPinned(const TabGtk* tab) const = 0; |
| 36 | 39 |
| 37 // Returns true if the specified Tab is detached. | 40 // Returns true if the specified Tab is detached. |
| 38 virtual bool IsTabDetached(const TabGtk* tab) const = 0; | 41 virtual bool IsTabDetached(const TabGtk* tab) const = 0; |
| 39 | 42 |
| 40 // Selects the specified Tab. | 43 // Activate the specified Tab. |
| 41 virtual void SelectTab(TabGtk* tab) = 0; | 44 virtual void ActivateTab(TabGtk* tab) = 0; |
| 45 |
| 46 // Toggle selection of the specified Tab. |
| 47 virtual void ToggleTabSelection(TabGtk* tab) = 0; |
| 48 |
| 49 // Extends selection from the anchor to the specified Tab. |
| 50 virtual void ExtendTabSelection(TabGtk* tab) = 0; |
| 42 | 51 |
| 43 // Closes the specified Tab. | 52 // Closes the specified Tab. |
| 44 virtual void CloseTab(TabGtk* tab) = 0; | 53 virtual void CloseTab(TabGtk* tab) = 0; |
| 45 | 54 |
| 46 // Returns true if the specified command is enabled for the specified Tab. | 55 // Returns true if the specified command is enabled for the specified Tab. |
| 47 virtual bool IsCommandEnabledForTab( | 56 virtual bool IsCommandEnabledForTab( |
| 48 TabStripModel::ContextMenuCommand command_id, | 57 TabStripModel::ContextMenuCommand command_id, |
| 49 const TabGtk* tab) const = 0; | 58 const TabGtk* tab) const = 0; |
| 50 | 59 |
| 51 // Executes the specified command for the specified Tab. | 60 // Executes the specified command for the specified Tab. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 73 | 82 |
| 74 // Returns true if the associated TabStrip's delegate supports tab moving or | 83 // Returns true if the associated TabStrip's delegate supports tab moving or |
| 75 // detaching. Used by the Frame to determine if dragging on the Tab | 84 // detaching. Used by the Frame to determine if dragging on the Tab |
| 76 // itself should move the window in cases where there's only one | 85 // itself should move the window in cases where there's only one |
| 77 // non drag-able Tab. | 86 // non drag-able Tab. |
| 78 virtual bool HasAvailableDragActions() const = 0; | 87 virtual bool HasAvailableDragActions() const = 0; |
| 79 | 88 |
| 80 // Returns the theme provider for icons and colors. | 89 // Returns the theme provider for icons and colors. |
| 81 virtual ui::ThemeProvider* GetThemeProvider() = 0; | 90 virtual ui::ThemeProvider* GetThemeProvider() = 0; |
| 82 | 91 |
| 92 virtual TabStripModel* model() const = 0; |
| 93 virtual int GetIndexOfTab(const TabGtk* tab) const = 0; |
| 94 |
| 83 protected: | 95 protected: |
| 84 virtual ~TabDelegate() {} | 96 virtual ~TabDelegate() {} |
| 85 }; | 97 }; |
| 86 | 98 |
| 87 explicit TabGtk(TabDelegate* delegate); | 99 explicit TabGtk(TabDelegate* delegate); |
| 88 virtual ~TabGtk(); | 100 virtual ~TabGtk(); |
| 89 | 101 |
| 90 // Access the delegate. | 102 // Access the delegate. |
| 91 TabDelegate* delegate() const { return delegate_; } | 103 TabDelegate* delegate() const { return delegate_; } |
| 92 | 104 |
| 93 GtkWidget* widget() const { return event_box_; } | 105 GtkWidget* widget() const { return event_box_; } |
| 94 | 106 |
| 95 // Used to set/check whether this Tab is being animated closed. | 107 // Used to set/check whether this Tab is being animated closed. |
| 96 void set_closing(bool closing) { closing_ = closing; } | 108 void set_closing(bool closing) { closing_ = closing; } |
| 97 bool closing() const { return closing_; } | 109 bool closing() const { return closing_; } |
| 98 | 110 |
| 99 // Used to set/check whether this Tab is being dragged. | 111 // Used to set/check whether this Tab is being dragged. |
| 100 void set_dragging(bool dragging) { dragging_ = dragging; } | 112 void set_dragging(bool dragging) { dragging_ = dragging; } |
| 101 bool dragging() const { return dragging_; } | 113 bool dragging() const { return dragging_; } |
| 102 | 114 |
| 103 // TabRendererGtk overrides: | 115 // TabRendererGtk overrides: |
| 116 virtual bool IsActive() const; |
| 104 virtual bool IsSelected() const; | 117 virtual bool IsSelected() const; |
| 105 virtual bool IsVisible() const; | 118 virtual bool IsVisible() const; |
| 106 virtual void SetVisible(bool visible) const; | 119 virtual void SetVisible(bool visible) const; |
| 107 virtual void CloseButtonClicked(); | 120 virtual void CloseButtonClicked(); |
| 108 virtual void UpdateData(TabContents* contents, bool app, bool loading_only); | 121 virtual void UpdateData(TabContents* contents, bool app, bool loading_only); |
| 109 virtual void SetBounds(const gfx::Rect& bounds); | 122 virtual void SetBounds(const gfx::Rect& bounds); |
| 110 | 123 |
| 111 private: | 124 private: |
| 112 class ContextMenuController; | 125 class ContextMenuController; |
| 113 class TabGtkObserverHelper; | 126 class TabGtkObserverHelper; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 // mouse release event on the the dragged widget, otherwise, we don't know | 216 // mouse release event on the the dragged widget, otherwise, we don't know |
| 204 // when the drag has ended when the user presses space or enter. We queue | 217 // when the drag has ended when the user presses space or enter. We queue |
| 205 // a task to end the drag and only run it if GTK+ didn't send us the | 218 // a task to end the drag and only run it if GTK+ didn't send us the |
| 206 // drag-failed event. | 219 // drag-failed event. |
| 207 ScopedRunnableMethodFactory<TabGtk> drag_end_factory_; | 220 ScopedRunnableMethodFactory<TabGtk> drag_end_factory_; |
| 208 | 221 |
| 209 DISALLOW_COPY_AND_ASSIGN(TabGtk); | 222 DISALLOW_COPY_AND_ASSIGN(TabGtk); |
| 210 }; | 223 }; |
| 211 | 224 |
| 212 #endif // CHROME_BROWSER_UI_GTK_TABS_TAB_GTK_H_ | 225 #endif // CHROME_BROWSER_UI_GTK_TABS_TAB_GTK_H_ |
| OLD | NEW |