| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "chrome/browser/gtk/tabs/tab_gtk.h" | 5 #include "chrome/browser/gtk/tabs/tab_gtk.h" |
| 6 | 6 |
| 7 #include "app/gfx/path.h" | 7 #include "app/gfx/path.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
| 10 #include "chrome/browser/gtk/dnd_registry.h" | 10 #include "chrome/browser/gtk/dnd_registry.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 gboolean TabGtk::OnMousePress(GtkWidget* widget, GdkEventButton* event, | 160 gboolean TabGtk::OnMousePress(GtkWidget* widget, GdkEventButton* event, |
| 161 TabGtk* tab) { | 161 TabGtk* tab) { |
| 162 if (event->button == 1) { | 162 if (event->button == 1) { |
| 163 // Store whether or not we were selected just now... we only want to be | 163 // Store whether or not we were selected just now... we only want to be |
| 164 // able to drag foreground tabs, so we don't start dragging the tab if | 164 // able to drag foreground tabs, so we don't start dragging the tab if |
| 165 // it was in the background. | 165 // it was in the background. |
| 166 bool just_selected = !tab->IsSelected(); | 166 bool just_selected = !tab->IsSelected(); |
| 167 if (just_selected) { | 167 if (just_selected) { |
| 168 tab->delegate_->SelectTab(tab); | 168 tab->delegate_->SelectTab(tab); |
| 169 } | 169 } |
| 170 } else if (event->button == 3) { |
| 171 tab->ShowContextMenu(); |
| 170 } | 172 } |
| 171 | 173 |
| 172 return TRUE; | 174 return TRUE; |
| 173 } | 175 } |
| 174 | 176 |
| 175 // static | 177 // static |
| 176 gboolean TabGtk::OnMouseRelease(GtkWidget* widget, GdkEventButton* event, | 178 gboolean TabGtk::OnMouseRelease(GtkWidget* widget, GdkEventButton* event, |
| 177 TabGtk* tab) { | 179 TabGtk* tab) { |
| 178 if (event->button == 2) { | 180 if (event->button == 2) { |
| 179 tab->delegate_->CloseTab(tab); | 181 tab->delegate_->CloseTab(tab); |
| 180 } else if (event->button == 3) { | |
| 181 tab->ShowContextMenu(); | |
| 182 } | 182 } |
| 183 | 183 |
| 184 return TRUE; | 184 return TRUE; |
| 185 } | 185 } |
| 186 | 186 |
| 187 // static | 187 // static |
| 188 gboolean TabGtk::OnEnterNotify(GtkWidget* widget, GdkEventCrossing* event, | 188 gboolean TabGtk::OnEnterNotify(GtkWidget* widget, GdkEventCrossing* event, |
| 189 TabGtk* tab) { | 189 TabGtk* tab) { |
| 190 tab->OnMouseEntered(); | 190 tab->OnMouseEntered(); |
| 191 return TRUE; | 191 return TRUE; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 if (!menu_controller_.get()) | 277 if (!menu_controller_.get()) |
| 278 menu_controller_.reset(new ContextMenuController(this)); | 278 menu_controller_.reset(new ContextMenuController(this)); |
| 279 | 279 |
| 280 menu_controller_->RunMenu(); | 280 menu_controller_->RunMenu(); |
| 281 } | 281 } |
| 282 | 282 |
| 283 void TabGtk::ContextMenuClosed() { | 283 void TabGtk::ContextMenuClosed() { |
| 284 delegate()->StopAllHighlighting(); | 284 delegate()->StopAllHighlighting(); |
| 285 menu_controller_.reset(); | 285 menu_controller_.reset(); |
| 286 } | 286 } |
| OLD | NEW |