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

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

Issue 275023: Adds some debugging code in hopes of isolating a crasher. From the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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') | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 GetTabAt(i)->StopPulse(); 1185 GetTabAt(i)->StopPulse();
1186 } 1186 }
1187 1187
1188 void TabStrip::MaybeStartDrag(Tab* tab, const views::MouseEvent& event) { 1188 void TabStrip::MaybeStartDrag(Tab* tab, const views::MouseEvent& event) {
1189 // Don't accidentally start any drag operations during animations if the 1189 // Don't accidentally start any drag operations during animations if the
1190 // mouse is down... during an animation tabs are being resized automatically, 1190 // mouse is down... during an animation tabs are being resized automatically,
1191 // so the View system can misinterpret this easily if the mouse is down that 1191 // so the View system can misinterpret this easily if the mouse is down that
1192 // the user is dragging. 1192 // the user is dragging.
1193 if (IsAnimating() || tab->closing() || !HasAvailableDragActions()) 1193 if (IsAnimating() || tab->closing() || !HasAvailableDragActions())
1194 return; 1194 return;
1195 int index = GetIndexOfTab(tab);
1196 if (!model_->ContainsIndex(index)) {
1197 // It appears to be possible for a drag to start with an invalid tab.
1198 // This records some extra information in hopes of tracking down why.
1199 // The string contains the following, in order:
1200 // . If a drag is already in progress, a 'D'.
1201 // . Index of tab the user is dragging.
1202 // . Number of tabs.
1203 // . Size of the model.
1204 // . Indices of any tabs that are being closed.
1205 // . ! end marker.
1206 std::string tmp;
1207 if (drag_controller_.get())
1208 tmp += "D";
1209 tmp += " " + IntToString(index);
1210 tmp += " " + IntToString(GetTabCount());
1211 tmp += " " + IntToString(model_->count());
1212 for (int i = 0; i < GetTabCount(); ++i) {
1213 if (GetTabAt(i)->closing())
1214 tmp += " " + IntToString(i);
1215 }
1216 tmp += "!"; // End marker so we know we got all closing tabs.
1217
1218 volatile char tab_state[128];
1219 for (size_t i = 0; i < std::min(ARRAYSIZE_UNSAFE(tab_state),
1220 tmp.size()); ++i) {
1221 tab_state[i] = tmp[i];
1222 }
1223 CHECK(false);
1224 return;
1225 }
1195 drag_controller_.reset(new DraggedTabController(tab, this)); 1226 drag_controller_.reset(new DraggedTabController(tab, this));
1196 drag_controller_->CaptureDragInfo(gfx::Point(event.x(), event.y())); 1227 drag_controller_->CaptureDragInfo(gfx::Point(event.x(), event.y()));
1197 } 1228 }
1198 1229
1199 void TabStrip::ContinueDrag(const views::MouseEvent& event) { 1230 void TabStrip::ContinueDrag(const views::MouseEvent& event) {
1200 // We can get called even if |MaybeStartDrag| wasn't called in the event of 1231 // We can get called even if |MaybeStartDrag| wasn't called in the event of
1201 // a TabStrip animation when the mouse button is down. In this case we should 1232 // a TabStrip animation when the mouse button is down. In this case we should
1202 // _not_ continue the drag because it can lead to weird bugs. 1233 // _not_ continue the drag because it can lead to weird bugs.
1203 if (drag_controller_.get()) 1234 if (drag_controller_.get())
1204 drag_controller_->Drag(); 1235 drag_controller_->Drag();
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 &TabStrip::ResizeLayoutTabs), 1980 &TabStrip::ResizeLayoutTabs),
1950 kResizeTabsTimeMs); 1981 kResizeTabsTimeMs);
1951 } 1982 }
1952 } else { 1983 } else {
1953 // Mouse moved quickly out of the tab strip and then into it again, so 1984 // Mouse moved quickly out of the tab strip and then into it again, so
1954 // cancel the timer so that the strip doesn't move when the mouse moves 1985 // cancel the timer so that the strip doesn't move when the mouse moves
1955 // back over it. 1986 // back over it.
1956 resize_layout_factory_.RevokeAll(); 1987 resize_layout_factory_.RevokeAll();
1957 } 1988 }
1958 } 1989 }
OLDNEW
« no previous file with comments | « chrome/browser/views/tabs/tab_strip.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698