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 #include "chrome/browser/gtk/tabs/tab_strip_gtk.h" | 5 #include "chrome/browser/gtk/tabs/tab_strip_gtk.h" |
6 | 6 |
7 #include "base/gfx/gtk_util.h" | 7 #include "base/gfx/gtk_util.h" |
8 #include "base/gfx/point.h" | 8 #include "base/gfx/point.h" |
9 #include "chrome/browser/browser.h" | 9 #include "chrome/browser/browser.h" |
10 #include "chrome/browser/gtk/tabs/tab_button_gtk.h" | 10 #include "chrome/browser/gtk/tabs/tab_button_gtk.h" |
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1210 !tab->closing()) { | 1210 !tab->closing()) { |
1211 tabstrip->model()->SelectTabContentsAt(tabstrip->hover_index_, true); | 1211 tabstrip->model()->SelectTabContentsAt(tabstrip->hover_index_, true); |
1212 } | 1212 } |
1213 | 1213 |
1214 return TRUE; | 1214 return TRUE; |
1215 } | 1215 } |
1216 | 1216 |
1217 // static | 1217 // static |
1218 gboolean TabStripGtk::OnMouseRelease(GtkWidget* widget, GdkEventButton* event, | 1218 gboolean TabStripGtk::OnMouseRelease(GtkWidget* widget, GdkEventButton* event, |
1219 TabStripGtk* tabstrip) { | 1219 TabStripGtk* tabstrip) { |
1220 // TODO(jhawkins): Handle middle click. | |
1221 if (event->button == 2) | |
1222 return TRUE; | |
1223 | |
1224 gfx::Point point(event->x, event->y); | 1220 gfx::Point point(event->x, event->y); |
1225 if (tabstrip->hover_index_ != -1) { | 1221 if (tabstrip->hover_index_ != -1) { |
1226 tabstrip->GetTabAt(tabstrip->hover_index_)->OnMouseRelease(event); | 1222 tabstrip->GetTabAt(tabstrip->hover_index_)->OnMouseRelease(event); |
1227 } else { | 1223 } else { |
1228 tabstrip->newtab_button_.get()->OnMouseRelease(); | 1224 tabstrip->newtab_button_.get()->OnMouseRelease(); |
1229 } | 1225 } |
1230 | 1226 |
1231 return TRUE; | 1227 return TRUE; |
1232 } | 1228 } |
1233 | 1229 |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1467 return TabStripModel::kNoTab; | 1463 return TabStripModel::kNoTab; |
1468 } | 1464 } |
1469 | 1465 |
1470 int TabStripGtk::NormalizeIndexToAttachedTabStrip(int index) { | 1466 int TabStripGtk::NormalizeIndexToAttachedTabStrip(int index) { |
1471 if (index >= model_->count()) | 1467 if (index >= model_->count()) |
1472 return model_->count() - 1; | 1468 return model_->count() - 1; |
1473 if (index == TabStripModel::kNoTab) | 1469 if (index == TabStripModel::kNoTab) |
1474 return 0; | 1470 return 0; |
1475 return index; | 1471 return index; |
1476 } | 1472 } |
OLD | NEW |