| 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 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 953 } | 953 } |
| 954 } | 954 } |
| 955 | 955 |
| 956 if (!tab) | 956 if (!tab) |
| 957 tab = new TabGtk(this); | 957 tab = new TabGtk(this); |
| 958 | 958 |
| 959 // Only insert if we're not already in the list. | 959 // Only insert if we're not already in the list. |
| 960 if (!contains_tab) { | 960 if (!contains_tab) { |
| 961 TabData d = { tab, gfx::Rect() }; | 961 TabData d = { tab, gfx::Rect() }; |
| 962 tab_data_.insert(tab_data_.begin() + index, d); | 962 tab_data_.insert(tab_data_.begin() + index, d); |
| 963 tab->UpdateData(contents, model_->IsPhantomTab(index), false); | 963 tab->UpdateData(contents, model_->IsPhantomTab(index), |
| 964 model_->IsAppTab(index), false); |
| 964 } | 965 } |
| 965 tab->set_mini(model_->IsMiniTab(index)); | 966 tab->set_mini(model_->IsMiniTab(index)); |
| 967 tab->set_app(model_->IsAppTab(index)); |
| 966 tab->SetBlocked(model_->IsTabBlocked(index)); | 968 tab->SetBlocked(model_->IsTabBlocked(index)); |
| 967 | 969 |
| 968 if (gtk_widget_get_parent(tab->widget()) != tabstrip_.get()) | 970 if (gtk_widget_get_parent(tab->widget()) != tabstrip_.get()) |
| 969 gtk_fixed_put(GTK_FIXED(tabstrip_.get()), tab->widget(), 0, 0); | 971 gtk_fixed_put(GTK_FIXED(tabstrip_.get()), tab->widget(), 0, 0); |
| 970 | 972 |
| 971 // Don't animate the first tab; it looks weird. | 973 // Don't animate the first tab; it looks weird. |
| 972 if (GetTabCount() > 1) { | 974 if (GetTabCount() > 1) { |
| 973 StartInsertTabAnimation(index); | 975 StartInsertTabAnimation(index); |
| 974 // We added the tab at 0x0, we need to force an animation step otherwise | 976 // We added the tab at 0x0, we need to force an animation step otherwise |
| 975 // if GTK paints before the animation event the tab is painted at 0x0 | 977 // if GTK paints before the animation event the tab is painted at 0x0 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1030 TabChangeType change_type) { | 1032 TabChangeType change_type) { |
| 1031 // Index is in terms of the model. Need to make sure we adjust that index in | 1033 // Index is in terms of the model. Need to make sure we adjust that index in |
| 1032 // case we have an animation going. | 1034 // case we have an animation going. |
| 1033 TabGtk* tab = GetTabAtAdjustForAnimation(index); | 1035 TabGtk* tab = GetTabAtAdjustForAnimation(index); |
| 1034 if (change_type == TITLE_NOT_LOADING) { | 1036 if (change_type == TITLE_NOT_LOADING) { |
| 1035 if (tab->mini() && !tab->IsSelected()) | 1037 if (tab->mini() && !tab->IsSelected()) |
| 1036 tab->StartMiniTabTitleAnimation(); | 1038 tab->StartMiniTabTitleAnimation(); |
| 1037 // We'll receive another notification of the change asynchronously. | 1039 // We'll receive another notification of the change asynchronously. |
| 1038 return; | 1040 return; |
| 1039 } | 1041 } |
| 1040 tab->UpdateData(contents, model_->IsPhantomTab(index), | 1042 tab->UpdateData(contents, |
| 1043 model_->IsPhantomTab(index), |
| 1044 model_->IsAppTab(index), |
| 1041 change_type == LOADING_ONLY); | 1045 change_type == LOADING_ONLY); |
| 1042 tab->UpdateFromModel(); | 1046 tab->UpdateFromModel(); |
| 1043 } | 1047 } |
| 1044 | 1048 |
| 1045 void TabStripGtk::TabReplacedAt(TabContents* old_contents, | 1049 void TabStripGtk::TabReplacedAt(TabContents* old_contents, |
| 1046 TabContents* new_contents, | 1050 TabContents* new_contents, |
| 1047 int index) { | 1051 int index) { |
| 1048 TabChangedAt(new_contents, index, ALL); | 1052 TabChangedAt(new_contents, index, ALL); |
| 1049 } | 1053 } |
| 1050 | 1054 |
| (...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2031 | 2035 |
| 2032 // Let the middle mouse button initiate clicks as well. | 2036 // Let the middle mouse button initiate clicks as well. |
| 2033 gtk_util::SetButtonTriggersNavigation(button->widget()); | 2037 gtk_util::SetButtonTriggersNavigation(button->widget()); |
| 2034 g_signal_connect(button->widget(), "clicked", | 2038 g_signal_connect(button->widget(), "clicked", |
| 2035 G_CALLBACK(OnNewTabClickedThunk), this); | 2039 G_CALLBACK(OnNewTabClickedThunk), this); |
| 2036 GTK_WIDGET_UNSET_FLAGS(button->widget(), GTK_CAN_FOCUS); | 2040 GTK_WIDGET_UNSET_FLAGS(button->widget(), GTK_CAN_FOCUS); |
| 2037 gtk_fixed_put(GTK_FIXED(tabstrip_.get()), button->widget(), 0, 0); | 2041 gtk_fixed_put(GTK_FIXED(tabstrip_.get()), button->widget(), 0, 0); |
| 2038 | 2042 |
| 2039 return button; | 2043 return button; |
| 2040 } | 2044 } |
| OLD | NEW |