| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_GTK_TABS_TAB_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_TABS_TAB_GTK_H_ |
| 6 #define CHROME_BROWSER_GTK_TABS_TAB_GTK_H_ | 6 #define CHROME_BROWSER_GTK_TABS_TAB_GTK_H_ |
| 7 | 7 |
| 8 #include "app/gtk_signal.h" |
| 8 #include "app/theme_provider.h" | 9 #include "app/theme_provider.h" |
| 9 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 10 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 11 #include "chrome/browser/gtk/tabs/tab_renderer_gtk.h" | 12 #include "chrome/browser/gtk/tabs/tab_renderer_gtk.h" |
| 12 #include "chrome/browser/tabs/tab_strip_model.h" | 13 #include "chrome/browser/tabs/tab_strip_model.h" |
| 13 | 14 |
| 14 namespace gfx { | 15 namespace gfx { |
| 15 class Path; | 16 class Path; |
| 16 } | 17 } |
| 17 | 18 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 private: | 107 private: |
| 107 class ContextMenuController; | 108 class ContextMenuController; |
| 108 class TabGtkObserverHelper; | 109 class TabGtkObserverHelper; |
| 109 friend class ContextMenuController; | 110 friend class ContextMenuController; |
| 110 | 111 |
| 111 // MessageLoop::Observer implementation: | 112 // MessageLoop::Observer implementation: |
| 112 virtual void WillProcessEvent(GdkEvent* event); | 113 virtual void WillProcessEvent(GdkEvent* event); |
| 113 virtual void DidProcessEvent(GdkEvent* event); | 114 virtual void DidProcessEvent(GdkEvent* event); |
| 114 | 115 |
| 115 // button-press-event handler that handles mouse clicks. | 116 // button-press-event handler that handles mouse clicks. |
| 116 static gboolean OnButtonPressEvent(GtkWidget* widget, GdkEventButton* event, | 117 CHROMEGTK_CALLBACK_1(TabGtk, gboolean, OnButtonPressEvent, GdkEventButton*); |
| 117 TabGtk* tab); | |
| 118 | 118 |
| 119 // button-release-event handler that handles mouse click releases. | 119 // button-release-event handler that handles mouse click releases. |
| 120 static gboolean OnButtonReleaseEvent(GtkWidget* widget, GdkEventButton* event, | 120 CHROMEGTK_CALLBACK_1(TabGtk, gboolean, OnButtonReleaseEvent, GdkEventButton*); |
| 121 TabGtk* tab); | |
| 122 | 121 |
| 123 // drag-begin is emitted when the drag is started. We connect so that we can | 122 // drag-begin is emitted when the drag is started. We connect so that we can |
| 124 // set the drag icon to a transparent pixbuf. | 123 // set the drag icon to a transparent pixbuf. |
| 125 static void OnDragBegin(GtkWidget* widget, GdkDragContext* context, | 124 CHROMEGTK_CALLBACK_1(TabGtk, void, OnDragBegin, GdkDragContext*); |
| 126 TabGtk* tab); | |
| 127 | 125 |
| 128 // drag-failed is emitted when the drag is finished. In our case the signal | 126 // drag-failed is emitted when the drag is finished. In our case the signal |
| 129 // does not imply failure as we don't use the drag-n-drop API to transfer drop | 127 // does not imply failure as we don't use the drag-n-drop API to transfer drop |
| 130 // data. | 128 // data. |
| 131 static gboolean OnDragFailed(GtkWidget* widget, GdkDragContext* context, | 129 CHROMEGTK_CALLBACK_2(TabGtk, gboolean, OnDragFailed, GdkDragContext*, |
| 132 GtkDragResult result, TabGtk* tab); | 130 GtkDragResult); |
| 133 | 131 |
| 134 // When a drag is ending, a fake button release event is passed to the drag | 132 // When a drag is ending, a fake button release event is passed to the drag |
| 135 // widget to fake letting go of the mouse button. We need a callback for | 133 // widget to fake letting go of the mouse button. We need a callback for |
| 136 // this event because it is the only way to catch drag end events when the | 134 // this event because it is the only way to catch drag end events when the |
| 137 // user presses space or return. | 135 // user presses space or return. |
| 138 static gboolean OnDragButtonReleased(GtkWidget* widget, | 136 CHROMEGTK_CALLBACK_1(TabGtk, gboolean, OnDragButtonReleased, GdkEventButton*); |
| 139 GdkEventButton* event, | |
| 140 TabGtk* tab); | |
| 141 | 137 |
| 142 // Shows the context menu. | 138 // Shows the context menu. |
| 143 void ShowContextMenu(); | 139 void ShowContextMenu(); |
| 144 | 140 |
| 145 // Invoked when the context menu closes. | 141 // Invoked when the context menu closes. |
| 146 void ContextMenuClosed(); | 142 void ContextMenuClosed(); |
| 147 | 143 |
| 148 // Sets whether the tooltip should be shown or not, depending on the size of | 144 // Sets whether the tooltip should be shown or not, depending on the size of |
| 149 // the tab. | 145 // the tab. |
| 150 void UpdateTooltipState(); | 146 void UpdateTooltipState(); |
| (...skipping 52 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 | 199 // 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 | 200 // 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 | 201 // a task to end the drag and only run it if GTK+ didn't send us the |
| 206 // drag-failed event. | 202 // drag-failed event. |
| 207 ScopedRunnableMethodFactory<TabGtk> drag_end_factory_; | 203 ScopedRunnableMethodFactory<TabGtk> drag_end_factory_; |
| 208 | 204 |
| 209 DISALLOW_COPY_AND_ASSIGN(TabGtk); | 205 DISALLOW_COPY_AND_ASSIGN(TabGtk); |
| 210 }; | 206 }; |
| 211 | 207 |
| 212 #endif // CHROME_BROWSER_GTK_TABS_TAB_GTK_H_ | 208 #endif // CHROME_BROWSER_GTK_TABS_TAB_GTK_H_ |
| OLD | NEW |