| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "app/gtk_dnd_util.h" | 9 #include "app/gtk_dnd_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1077 | 1077 |
| 1078 return GetIndexOfTab(tab) == model_->selected_index(); | 1078 return GetIndexOfTab(tab) == model_->selected_index(); |
| 1079 } | 1079 } |
| 1080 | 1080 |
| 1081 bool TabStripGtk::IsTabDetached(const TabGtk* tab) const { | 1081 bool TabStripGtk::IsTabDetached(const TabGtk* tab) const { |
| 1082 if (drag_controller_.get()) | 1082 if (drag_controller_.get()) |
| 1083 return drag_controller_->IsTabDetached(tab); | 1083 return drag_controller_->IsTabDetached(tab); |
| 1084 return false; | 1084 return false; |
| 1085 } | 1085 } |
| 1086 | 1086 |
| 1087 bool TabStripGtk::IsToolbarVisible(const TabGtk* tab) const { | |
| 1088 return model_->IsToolbarVisible(GetIndexOfTab(tab)); | |
| 1089 } | |
| 1090 | |
| 1091 void TabStripGtk::GetCurrentTabWidths(double* unselected_width, | 1087 void TabStripGtk::GetCurrentTabWidths(double* unselected_width, |
| 1092 double* selected_width) const { | 1088 double* selected_width) const { |
| 1093 *unselected_width = current_unselected_width_; | 1089 *unselected_width = current_unselected_width_; |
| 1094 *selected_width = current_selected_width_; | 1090 *selected_width = current_selected_width_; |
| 1095 } | 1091 } |
| 1096 | 1092 |
| 1097 bool TabStripGtk::IsTabPinned(const TabGtk* tab) const { | 1093 bool TabStripGtk::IsTabPinned(const TabGtk* tab) const { |
| 1098 if (tab->closing()) | 1094 if (tab->closing()) |
| 1099 return false; | 1095 return false; |
| 1100 | 1096 |
| 1101 return model_->IsTabPinned(GetIndexOfTab(tab)); | 1097 return model_->IsTabPinned(GetIndexOfTab(tab)); |
| 1102 } | 1098 } |
| 1103 | 1099 |
| 1104 bool TabStripGtk::IsAppTab(const TabGtk* tab) const { | |
| 1105 if (tab->closing()) | |
| 1106 return false; | |
| 1107 | |
| 1108 return model_->IsAppTab(GetIndexOfTab(tab)); | |
| 1109 } | |
| 1110 | |
| 1111 void TabStripGtk::SelectTab(TabGtk* tab) { | 1100 void TabStripGtk::SelectTab(TabGtk* tab) { |
| 1112 int index = GetIndexOfTab(tab); | 1101 int index = GetIndexOfTab(tab); |
| 1113 if (model_->ContainsIndex(index)) | 1102 if (model_->ContainsIndex(index)) |
| 1114 model_->SelectTabContentsAt(index, true); | 1103 model_->SelectTabContentsAt(index, true); |
| 1115 } | 1104 } |
| 1116 | 1105 |
| 1117 void TabStripGtk::CloseTab(TabGtk* tab) { | 1106 void TabStripGtk::CloseTab(TabGtk* tab) { |
| 1118 int tab_index = GetIndexOfTab(tab); | 1107 int tab_index = GetIndexOfTab(tab); |
| 1119 if (model_->ContainsIndex(tab_index)) { | 1108 if (model_->ContainsIndex(tab_index)) { |
| 1120 TabGtk* last_tab = GetTabAt(GetTabCount() - 1); | 1109 TabGtk* last_tab = GetTabAt(GetTabCount() - 1); |
| (...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2044 | 2033 |
| 2045 // Let the middle mouse button initiate clicks as well. | 2034 // Let the middle mouse button initiate clicks as well. |
| 2046 gtk_util::SetButtonTriggersNavigation(button->widget()); | 2035 gtk_util::SetButtonTriggersNavigation(button->widget()); |
| 2047 g_signal_connect(button->widget(), "clicked", | 2036 g_signal_connect(button->widget(), "clicked", |
| 2048 G_CALLBACK(OnNewTabClickedThunk), this); | 2037 G_CALLBACK(OnNewTabClickedThunk), this); |
| 2049 GTK_WIDGET_UNSET_FLAGS(button->widget(), GTK_CAN_FOCUS); | 2038 GTK_WIDGET_UNSET_FLAGS(button->widget(), GTK_CAN_FOCUS); |
| 2050 gtk_fixed_put(GTK_FIXED(tabstrip_.get()), button->widget(), 0, 0); | 2039 gtk_fixed_put(GTK_FIXED(tabstrip_.get()), button->widget(), 0, 0); |
| 2051 | 2040 |
| 2052 return button; | 2041 return button; |
| 2053 } | 2042 } |
| OLD | NEW |