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

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

Issue 99224: Reverting 14948. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 7 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/tabs/tab_strip_model_unittest.cc ('k') | no next file » | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "base/gfx/size.h" 7 #include "base/gfx/size.h"
8 #include "chrome/browser/metrics/user_metrics.h" 8 #include "chrome/browser/metrics/user_metrics.h"
9 #include "chrome/browser/profile.h" 9 #include "chrome/browser/profile.h"
10 #include "chrome/browser/tab_contents/tab_contents.h" 10 #include "chrome/browser/tab_contents/tab_contents.h"
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 TabContents* contents = model_->GetTabContentsAt(tab_index); 897 TabContents* contents = model_->GetTabContentsAt(tab_index);
898 if (contents) 898 if (contents)
899 UserMetrics::RecordAction(L"CloseTab_Mouse", contents->profile()); 899 UserMetrics::RecordAction(L"CloseTab_Mouse", contents->profile());
900 Tab* last_tab = GetTabAt(GetTabCount() - 1); 900 Tab* last_tab = GetTabAt(GetTabCount() - 1);
901 // Limit the width available to the TabStrip for laying out Tabs, so that 901 // Limit the width available to the TabStrip for laying out Tabs, so that
902 // Tabs are not resized until a later time (when the mouse pointer leaves 902 // Tabs are not resized until a later time (when the mouse pointer leaves
903 // the TabStrip). 903 // the TabStrip).
904 available_width_for_tabs_ = GetAvailableWidthForTabs(last_tab); 904 available_width_for_tabs_ = GetAvailableWidthForTabs(last_tab);
905 resize_layout_scheduled_ = true; 905 resize_layout_scheduled_ = true;
906 AddMessageLoopObserver(); 906 AddMessageLoopObserver();
907 // Note that the next call might not close the tab (because of unload
908 // hanlders or if the delegate veto the close).
909 model_->CloseTabContentsAt(tab_index); 907 model_->CloseTabContentsAt(tab_index);
910 } 908 }
911 } 909 }
912 910
913 bool TabStrip::IsCommandEnabledForTab( 911 bool TabStrip::IsCommandEnabledForTab(
914 TabStripModel::ContextMenuCommand command_id, const Tab* tab) const { 912 TabStripModel::ContextMenuCommand command_id, const Tab* tab) const {
915 int index = GetIndexOfTab(tab); 913 int index = GetIndexOfTab(tab);
916 if (model_->ContainsIndex(index)) 914 if (model_->ContainsIndex(index))
917 return model_->IsContextMenuCommandEnabled(index, command_id); 915 return model_->IsContextMenuCommandEnabled(index, command_id);
918 return false; 916 return false;
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
1521 // If the TabContents being detached was removed as a result of a drag 1519 // If the TabContents being detached was removed as a result of a drag
1522 // gesture from its corresponding Tab, we don't want to remove the Tab from 1520 // gesture from its corresponding Tab, we don't want to remove the Tab from
1523 // the child list, because if we do so it'll stop receiving events and the 1521 // the child list, because if we do so it'll stop receiving events and the
1524 // drag will stall. So we only remove if a drag isn't active, or the Tab 1522 // drag will stall. So we only remove if a drag isn't active, or the Tab
1525 // was for some other TabContents. 1523 // was for some other TabContents.
1526 if (!IsDragSessionActive() || !drag_controller_->IsDragSourceTab(removed)) { 1524 if (!IsDragSessionActive() || !drag_controller_->IsDragSourceTab(removed)) {
1527 removed->GetParent()->RemoveChildView(removed); 1525 removed->GetParent()->RemoveChildView(removed);
1528 delete removed; 1526 delete removed;
1529 } 1527 }
1530 } 1528 }
OLDNEW
« no previous file with comments | « chrome/browser/tabs/tab_strip_model_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698