Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Side by Side Diff: chrome/browser/gtk/tabs/tab_strip_gtk.cc

Issue 2821011: Removes phantom tabs. (Closed)
Patch Set: Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/gtk/tabs/tab_strip_gtk.h ('k') | chrome/browser/memory_details.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 943 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 } 954 }
955 } 955 }
956 956
957 if (!tab) 957 if (!tab)
958 tab = new TabGtk(this); 958 tab = new TabGtk(this);
959 959
960 // Only insert if we're not already in the list. 960 // Only insert if we're not already in the list.
961 if (!contains_tab) { 961 if (!contains_tab) {
962 TabData d = { tab, gfx::Rect() }; 962 TabData d = { tab, gfx::Rect() };
963 tab_data_.insert(tab_data_.begin() + index, d); 963 tab_data_.insert(tab_data_.begin() + index, d);
964 tab->UpdateData(contents, model_->IsPhantomTab(index), false); 964 tab->UpdateData(contents, false);
965 } 965 }
966 tab->set_mini(model_->IsMiniTab(index)); 966 tab->set_mini(model_->IsMiniTab(index));
967 tab->SetBlocked(model_->IsTabBlocked(index)); 967 tab->SetBlocked(model_->IsTabBlocked(index));
968 968
969 if (gtk_widget_get_parent(tab->widget()) != tabstrip_.get()) 969 if (gtk_widget_get_parent(tab->widget()) != tabstrip_.get())
970 gtk_fixed_put(GTK_FIXED(tabstrip_.get()), tab->widget(), 0, 0); 970 gtk_fixed_put(GTK_FIXED(tabstrip_.get()), tab->widget(), 0, 0);
971 971
972 // Don't animate the first tab; it looks weird. 972 // Don't animate the first tab; it looks weird.
973 if (GetTabCount() > 1) { 973 if (GetTabCount() > 1) {
974 StartInsertTabAnimation(index); 974 StartInsertTabAnimation(index);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 void TabStripGtk::TabMoved(TabContents* contents, 1014 void TabStripGtk::TabMoved(TabContents* contents,
1015 int from_index, 1015 int from_index,
1016 int to_index) { 1016 int to_index) {
1017 gfx::Rect start_bounds = GetIdealBounds(from_index); 1017 gfx::Rect start_bounds = GetIdealBounds(from_index);
1018 TabGtk* tab = GetTabAt(from_index); 1018 TabGtk* tab = GetTabAt(from_index);
1019 tab_data_.erase(tab_data_.begin() + from_index); 1019 tab_data_.erase(tab_data_.begin() + from_index);
1020 TabData data = {tab, gfx::Rect()}; 1020 TabData data = {tab, gfx::Rect()};
1021 tab->set_mini(model_->IsMiniTab(to_index)); 1021 tab->set_mini(model_->IsMiniTab(to_index));
1022 tab->SetBlocked(model_->IsTabBlocked(to_index)); 1022 tab->SetBlocked(model_->IsTabBlocked(to_index));
1023 tab_data_.insert(tab_data_.begin() + to_index, data); 1023 tab_data_.insert(tab_data_.begin() + to_index, data);
1024 if (tab->phantom() != model_->IsPhantomTab(to_index))
1025 tab->set_phantom(!tab->phantom());
1026 GenerateIdealBounds(); 1024 GenerateIdealBounds();
1027 StartMoveTabAnimation(from_index, to_index); 1025 StartMoveTabAnimation(from_index, to_index);
1028 } 1026 }
1029 1027
1030 void TabStripGtk::TabChangedAt(TabContents* contents, int index, 1028 void TabStripGtk::TabChangedAt(TabContents* contents, int index,
1031 TabChangeType change_type) { 1029 TabChangeType change_type) {
1032 // Index is in terms of the model. Need to make sure we adjust that index in 1030 // Index is in terms of the model. Need to make sure we adjust that index in
1033 // case we have an animation going. 1031 // case we have an animation going.
1034 TabGtk* tab = GetTabAtAdjustForAnimation(index); 1032 TabGtk* tab = GetTabAtAdjustForAnimation(index);
1035 if (change_type == TITLE_NOT_LOADING) { 1033 if (change_type == TITLE_NOT_LOADING) {
1036 if (tab->mini() && !tab->IsSelected()) 1034 if (tab->mini() && !tab->IsSelected())
1037 tab->StartMiniTabTitleAnimation(); 1035 tab->StartMiniTabTitleAnimation();
1038 // We'll receive another notification of the change asynchronously. 1036 // We'll receive another notification of the change asynchronously.
1039 return; 1037 return;
1040 } 1038 }
1041 tab->UpdateData(contents, model_->IsPhantomTab(index), 1039 tab->UpdateData(contents, change_type == LOADING_ONLY);
1042 change_type == LOADING_ONLY);
1043 tab->UpdateFromModel(); 1040 tab->UpdateFromModel();
1044 } 1041 }
1045 1042
1046 void TabStripGtk::TabReplacedAt(TabContents* old_contents,
1047 TabContents* new_contents,
1048 int index) {
1049 TabChangedAt(new_contents, index, ALL);
1050 }
1051
1052 void TabStripGtk::TabMiniStateChanged(TabContents* contents, int index) { 1043 void TabStripGtk::TabMiniStateChanged(TabContents* contents, int index) {
1053 GetTabAt(index)->set_mini(model_->IsMiniTab(index)); 1044 GetTabAt(index)->set_mini(model_->IsMiniTab(index));
1054 // Don't animate if the window isn't visible yet. The window won't be visible 1045 // Don't animate if the window isn't visible yet. The window won't be visible
1055 // when dragging a mini-tab to a new window. 1046 // when dragging a mini-tab to a new window.
1056 if (window_ && window_->window() && 1047 if (window_ && window_->window() &&
1057 GTK_WIDGET_VISIBLE(GTK_WIDGET(window_->window()))) { 1048 GTK_WIDGET_VISIBLE(GTK_WIDGET(window_->window()))) {
1058 StartMiniTabAnimation(index); 1049 StartMiniTabAnimation(index);
1059 } else { 1050 } else {
1060 Layout(); 1051 Layout();
1061 } 1052 }
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after
2033 2024
2034 // Let the middle mouse button initiate clicks as well. 2025 // Let the middle mouse button initiate clicks as well.
2035 gtk_util::SetButtonTriggersNavigation(button->widget()); 2026 gtk_util::SetButtonTriggersNavigation(button->widget());
2036 g_signal_connect(button->widget(), "clicked", 2027 g_signal_connect(button->widget(), "clicked",
2037 G_CALLBACK(OnNewTabClickedThunk), this); 2028 G_CALLBACK(OnNewTabClickedThunk), this);
2038 GTK_WIDGET_UNSET_FLAGS(button->widget(), GTK_CAN_FOCUS); 2029 GTK_WIDGET_UNSET_FLAGS(button->widget(), GTK_CAN_FOCUS);
2039 gtk_fixed_put(GTK_FIXED(tabstrip_.get()), button->widget(), 0, 0); 2030 gtk_fixed_put(GTK_FIXED(tabstrip_.get()), button->widget(), 0, 0);
2040 2031
2041 return button; 2032 return button;
2042 } 2033 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/tabs/tab_strip_gtk.h ('k') | chrome/browser/memory_details.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698