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

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

Issue 150064: Fix crash in delayed tab resizing. If the Resize Relayout code is called afte... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 5 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 | « no previous file | 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 "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/gfx/path.h" 9 #include "app/gfx/path.h"
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 } else if ((min_unselected_width > min_selected_width) && 1184 } else if ((min_unselected_width > min_selected_width) &&
1185 (desired_tab_width < min_unselected_width)) { 1185 (desired_tab_width < min_unselected_width)) {
1186 // Selected width = (total width - (unselected width * (num_tabs - 1))) 1186 // Selected width = (total width - (unselected width * (num_tabs - 1)))
1187 *selected_width = std::max(available_width - total_offset - 1187 *selected_width = std::max(available_width - total_offset -
1188 (min_unselected_width * (tab_count - 1)), min_selected_width); 1188 (min_unselected_width * (tab_count - 1)), min_selected_width);
1189 } 1189 }
1190 } 1190 }
1191 } 1191 }
1192 1192
1193 void TabStrip::ResizeLayoutTabs() { 1193 void TabStrip::ResizeLayoutTabs() {
1194 // We've been called back after the TabStrip has been emptied out (probably
1195 // just prior to the window being destroyed). We need to do nothing here or
1196 // else GetTabAt below will crash.
1197 if (GetTabCount() == 0)
1198 return;
1199
1194 resize_layout_factory_.RevokeAll(); 1200 resize_layout_factory_.RevokeAll();
1195 1201
1196 // It is critically important that this is unhooked here, otherwise we will 1202 // It is critically important that this is unhooked here, otherwise we will
1197 // keep spying on messages forever. 1203 // keep spying on messages forever.
1198 RemoveMessageLoopObserver(); 1204 RemoveMessageLoopObserver();
1199 1205
1200 available_width_for_tabs_ = -1; 1206 available_width_for_tabs_ = -1;
1201 double unselected, selected; 1207 double unselected, selected;
1202 GetDesiredTabWidths(GetTabCount(), &unselected, &selected); 1208 GetDesiredTabWidths(GetTabCount(), &unselected, &selected);
1203 Tab* first_tab = GetTabAt(0); 1209 Tab* first_tab = GetTabAt(0);
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
1572 &TabStrip::ResizeLayoutTabs), 1578 &TabStrip::ResizeLayoutTabs),
1573 kResizeTabsTimeMs); 1579 kResizeTabsTimeMs);
1574 } 1580 }
1575 } else { 1581 } else {
1576 // Mouse moved quickly out of the tab strip and then into it again, so 1582 // Mouse moved quickly out of the tab strip and then into it again, so
1577 // cancel the timer so that the strip doesn't move when the mouse moves 1583 // cancel the timer so that the strip doesn't move when the mouse moves
1578 // back over it. 1584 // back over it.
1579 resize_layout_factory_.RevokeAll(); 1585 resize_layout_factory_.RevokeAll();
1580 } 1586 }
1581 } 1587 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698