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

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

Issue 1687016: Fix HighlightCloseButton crash.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 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 | « 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) 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/animation_container.h" 7 #include "app/animation_container.h"
8 #include "app/drag_drop_types.h" 8 #include "app/drag_drop_types.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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 // the mouse is currently over to show the "hot" state of the close button. 202 // the mouse is currently over to show the "hot" state of the close button.
203 void HighlightCloseButton() { 203 void HighlightCloseButton() {
204 if (tabstrip_->available_width_for_tabs_ == -1 || 204 if (tabstrip_->available_width_for_tabs_ == -1 ||
205 tabstrip_->IsDragSessionActive()) { 205 tabstrip_->IsDragSessionActive()) {
206 // This function is not required (and indeed may crash!) for removes 206 // This function is not required (and indeed may crash!) for removes
207 // spawned by non-mouse closes and drag-detaches. 207 // spawned by non-mouse closes and drag-detaches.
208 return; 208 return;
209 } 209 }
210 210
211 #if defined(OS_WIN) 211 #if defined(OS_WIN)
212 views::Widget* widget = tabstrip_->GetWidget();
213 // This can be null during shutdown. See http://crbug.com/42737.
214 if (!widget)
215 return;
212 // Force the close button (that slides under the mouse) to highlight by 216 // Force the close button (that slides under the mouse) to highlight by
213 // saying the mouse just moved, but sending the same coordinates. 217 // saying the mouse just moved, but sending the same coordinates.
214 DWORD pos = GetMessagePos(); 218 DWORD pos = GetMessagePos();
215 POINT cursor_point = {GET_X_LPARAM(pos), GET_Y_LPARAM(pos)}; 219 POINT cursor_point = {GET_X_LPARAM(pos), GET_Y_LPARAM(pos)};
216 views::Widget* widget = tabstrip_->GetWidget();
217 MapWindowPoints(NULL, widget->GetNativeView(), &cursor_point, 1); 220 MapWindowPoints(NULL, widget->GetNativeView(), &cursor_point, 1);
218 221
219 static_cast<views::WidgetWin*>(widget)->ResetLastMouseMoveFlag(); 222 static_cast<views::WidgetWin*>(widget)->ResetLastMouseMoveFlag();
220 // Return to message loop - otherwise we may disrupt some operation that's 223 // Return to message loop - otherwise we may disrupt some operation that's
221 // in progress. 224 // in progress.
222 SendMessage(widget->GetNativeView(), WM_MOUSEMOVE, 0, 225 SendMessage(widget->GetNativeView(), WM_MOUSEMOVE, 0,
223 MAKELPARAM(cursor_point.x, cursor_point.y)); 226 MAKELPARAM(cursor_point.x, cursor_point.y));
224 #else 227 #else
225 NOTIMPLEMENTED(); 228 NOTIMPLEMENTED();
226 #endif 229 #endif
(...skipping 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after
1783 return tab_data_.size(); 1786 return tab_data_.size();
1784 } 1787 }
1785 1788
1786 int TabStrip::TabDataIndexOfTab(Tab* tab) const { 1789 int TabStrip::TabDataIndexOfTab(Tab* tab) const {
1787 for (size_t i = 0; i < tab_data_.size(); ++i) { 1790 for (size_t i = 0; i < tab_data_.size(); ++i) {
1788 if (tab_data_[i].tab == tab) 1791 if (tab_data_[i].tab == tab)
1789 return i; 1792 return i;
1790 } 1793 }
1791 return -1; 1794 return -1;
1792 } 1795 }
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