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

Side by Side Diff: chrome/browser/views/tabs/tab_strip.cc

Issue 1141005: Revert r42156, r42157, r42160. Allow dynamic switching in and out of sidetabs... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/views/tabs/tab_strip.h ('k') | chrome/test/test_browser_window.h » ('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/views/tabs/tab_strip.h" 5 #include "chrome/browser/views/tabs/tab_strip.h"
6 6
7 #include "app/drag_drop_types.h" 7 #include "app/drag_drop_types.h"
8 #include "app/gfx/canvas.h" 8 #include "app/gfx/canvas.h"
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/os_exchange_data.h" 10 #include "app/os_exchange_data.h"
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 needs_resize_layout_(false), 737 needs_resize_layout_(false),
738 current_unselected_width_(Tab::GetStandardSize().width()), 738 current_unselected_width_(Tab::GetStandardSize().width()),
739 current_selected_width_(Tab::GetStandardSize().width()), 739 current_selected_width_(Tab::GetStandardSize().width()),
740 available_width_for_tabs_(-1) { 740 available_width_for_tabs_(-1) {
741 Init(); 741 Init();
742 } 742 }
743 743
744 TabStrip::~TabStrip() { 744 TabStrip::~TabStrip() {
745 active_animation_.reset(NULL); 745 active_animation_.reset(NULL);
746 746
747 model_->RemoveObserver(this); 747 // TODO(beng): (1031854) Restore this line once XPFrame/VistaFrame are dead.
748 // model_->RemoveObserver(this);
748 749
749 // TODO(beng): remove this if it doesn't work to fix the TabSelectedAt bug. 750 // TODO(beng): remove this if it doesn't work to fix the TabSelectedAt bug.
750 drag_controller_.reset(NULL); 751 drag_controller_.reset(NULL);
751 752
752 // Make sure we unhook ourselves as a message loop observer so that we don't 753 // Make sure we unhook ourselves as a message loop observer so that we don't
753 // crash in the case where the user closes the window after closing a tab 754 // crash in the case where the user closes the window after closing a tab
754 // but before moving the mouse. 755 // but before moving the mouse.
755 RemoveMessageLoopObserver(); 756 RemoveMessageLoopObserver();
756 757
757 // The children (tabs) may callback to us from their destructor. Delete them 758 // The children (tabs) may callback to us from their destructor. Delete them
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 } 811 }
811 LoadNewTabButtonImage(); 812 LoadNewTabButtonImage();
812 newtab_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_NEWTAB)); 813 newtab_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_NEWTAB));
813 AddChildView(newtab_button_); 814 AddChildView(newtab_button_);
814 } 815 }
815 816
816 bool TabStrip::IsCompatibleWith(TabStrip* other) const { 817 bool TabStrip::IsCompatibleWith(TabStrip* other) const {
817 return model_->profile() == other->model()->profile(); 818 return model_->profile() == other->model()->profile();
818 } 819 }
819 820
820 void TabStrip::InitFromModel() {
821 // Walk the model, calling our insertion observer method for each item within
822 // it.
823 for (int i = 0; i < model_->count(); ++i) {
824 TabInsertedAt(model_->GetTabContentsAt(i), i,
825 i == model_->selected_index());
826 }
827 }
828
829 //////////////////////////////////////////////////////////////////////////////// 821 ////////////////////////////////////////////////////////////////////////////////
830 // TabStrip, BaseTabStrip implementation: 822 // TabStrip, BaseTabStrip implementation:
831 823
832 int TabStrip::GetPreferredHeight() { 824 int TabStrip::GetPreferredHeight() {
833 return GetPreferredSize().height(); 825 return GetPreferredSize().height();
834 } 826 }
835 827
836 void TabStrip::SetBackgroundOffset(const gfx::Point& offset) { 828 void TabStrip::SetBackgroundOffset(const gfx::Point& offset) {
837 int tab_count = GetTabCount(); 829 int tab_count = GetTabCount();
838 for (int i = 0; i < tab_count; ++i) 830 for (int i = 0; i < tab_count; ++i)
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
1310 } 1302 }
1311 1303
1312 bool TabStrip::IsCommandEnabledForTab( 1304 bool TabStrip::IsCommandEnabledForTab(
1313 TabStripModel::ContextMenuCommand command_id, const Tab* tab) const { 1305 TabStripModel::ContextMenuCommand command_id, const Tab* tab) const {
1314 int index = GetIndexOfTab(tab); 1306 int index = GetIndexOfTab(tab);
1315 if (model_->ContainsIndex(index)) 1307 if (model_->ContainsIndex(index))
1316 return model_->IsContextMenuCommandEnabled(index, command_id); 1308 return model_->IsContextMenuCommandEnabled(index, command_id);
1317 return false; 1309 return false;
1318 } 1310 }
1319 1311
1320 bool TabStrip::IsCommandCheckedForTab(
1321 TabStripModel::ContextMenuCommand command_id, const Tab* tab) const {
1322 // TODO(beng): move to TabStripModel, see note in IsTabPinned.
1323 if (command_id == TabStripModel::CommandTogglePinned)
1324 return IsTabPinned(tab);
1325
1326 int index = GetIndexOfTab(tab);
1327 if (model_->ContainsIndex(index))
1328 return model_->IsContextMenuCommandChecked(index, command_id);
1329 return false;
1330 }
1331
1332 void TabStrip::ExecuteCommandForTab( 1312 void TabStrip::ExecuteCommandForTab(
1333 TabStripModel::ContextMenuCommand command_id, Tab* tab) { 1313 TabStripModel::ContextMenuCommand command_id, Tab* tab) {
1334 int index = GetIndexOfTab(tab); 1314 int index = GetIndexOfTab(tab);
1335 if (model_->ContainsIndex(index)) 1315 if (model_->ContainsIndex(index))
1336 model_->ExecuteContextMenuCommand(index, command_id); 1316 model_->ExecuteContextMenuCommand(index, command_id);
1337 } 1317 }
1338 1318
1339 void TabStrip::StartHighlightTabsForCommand( 1319 void TabStrip::StartHighlightTabsForCommand(
1340 TabStripModel::ContextMenuCommand command_id, Tab* tab) { 1320 TabStripModel::ContextMenuCommand command_id, Tab* tab) {
1341 if (command_id == TabStripModel::CommandCloseTabsOpenedBy) { 1321 if (command_id == TabStripModel::CommandCloseTabsOpenedBy) {
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
2070 } 2050 }
2071 } 2051 }
2072 2052
2073 bool TabStrip::HasPhantomTabs() const { 2053 bool TabStrip::HasPhantomTabs() const {
2074 for (int i = 0; i < GetTabCount(); ++i) { 2054 for (int i = 0; i < GetTabCount(); ++i) {
2075 if (GetTabAt(i)->phantom()) 2055 if (GetTabAt(i)->phantom())
2076 return true; 2056 return true;
2077 } 2057 }
2078 return false; 2058 return false;
2079 } 2059 }
OLDNEW
« no previous file with comments | « chrome/browser/views/tabs/tab_strip.h ('k') | chrome/test/test_browser_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698