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

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

Issue 16246: CRASH at Tab::OnMouseReleased... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 11 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/dragged_tab_controller.h ('k') | chrome/browser/views/tabs/tab.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) 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 <math.h> 5 #include <math.h>
6 #include <set> 6 #include <set>
7 7
8 #include "chrome/browser/views/tabs/dragged_tab_controller.h" 8 #include "chrome/browser/views/tabs/dragged_tab_controller.h"
9 9
10 #include "chrome/browser/browser_window.h" 10 #include "chrome/browser/browser_window.h"
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 // attached to the source tabstrip. 348 // attached to the source tabstrip.
349 if (source_tab_->IsVisible() && CanStartDrag()) 349 if (source_tab_->IsVisible() && CanStartDrag())
350 Attach(source_tabstrip_, gfx::Point()); 350 Attach(source_tabstrip_, gfx::Point());
351 351
352 if (!source_tab_->IsVisible()) { 352 if (!source_tab_->IsVisible()) {
353 SaveFocus(); 353 SaveFocus();
354 ContinueDragging(); 354 ContinueDragging();
355 } 355 }
356 } 356 }
357 357
358 void DraggedTabController::EndDrag(bool canceled) { 358 bool DraggedTabController::EndDrag(bool canceled) {
359 EndDragImpl(canceled ? CANCELED : NORMAL); 359 return EndDragImpl(canceled ? CANCELED : NORMAL);
360 } 360 }
361 361
362 Tab* DraggedTabController::GetDragSourceTabForContents( 362 Tab* DraggedTabController::GetDragSourceTabForContents(
363 TabContents* contents) const { 363 TabContents* contents) const {
364 if (attached_tabstrip_ == source_tabstrip_) 364 if (attached_tabstrip_ == source_tabstrip_)
365 return contents == dragged_contents_ ? source_tab_ : NULL; 365 return contents == dragged_contents_ ? source_tab_ : NULL;
366 return NULL; 366 return NULL;
367 } 367 }
368 368
369 bool DraggedTabController::IsDragSourceTab(Tab* tab) const { 369 bool DraggedTabController::IsDragSourceTab(Tab* tab) const {
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 return gfx::Point(x, y); 914 return gfx::Point(x, y);
915 } 915 }
916 916
917 917
918 Tab* DraggedTabController::GetTabMatchingDraggedContents( 918 Tab* DraggedTabController::GetTabMatchingDraggedContents(
919 TabStrip* tabstrip) const { 919 TabStrip* tabstrip) const {
920 int index = tabstrip->model()->GetIndexOfTabContents(dragged_contents_); 920 int index = tabstrip->model()->GetIndexOfTabContents(dragged_contents_);
921 return index == TabStripModel::kNoTab ? NULL : tabstrip->GetTabAt(index); 921 return index == TabStripModel::kNoTab ? NULL : tabstrip->GetTabAt(index);
922 } 922 }
923 923
924 void DraggedTabController::EndDragImpl(EndDragType type) { 924 bool DraggedTabController::EndDragImpl(EndDragType type) {
925 bring_to_front_timer_.Stop(); 925 bring_to_front_timer_.Stop();
926 926
927 // Hide the current dock controllers. 927 // Hide the current dock controllers.
928 for (size_t i = 0; i < dock_controllers_.size(); ++i) { 928 for (size_t i = 0; i < dock_controllers_.size(); ++i) {
929 // Be sure and clear the controller first, that way if Hide ends up 929 // Be sure and clear the controller first, that way if Hide ends up
930 // deleting the controller it won't call us back. 930 // deleting the controller it won't call us back.
931 dock_controllers_[i]->clear_controller(); 931 dock_controllers_[i]->clear_controller();
932 dock_controllers_[i]->Hide(); 932 dock_controllers_[i]->Hide();
933 } 933 }
934 dock_controllers_.clear(); 934 dock_controllers_.clear();
(...skipping 17 matching lines...) Expand all
952 // attempt to do any cleanup other than resetting the delegate (if we're 952 // attempt to do any cleanup other than resetting the delegate (if we're
953 // still the delegate). 953 // still the delegate).
954 if (dragged_contents_ && dragged_contents_->delegate() == this) 954 if (dragged_contents_ && dragged_contents_->delegate() == this)
955 dragged_contents_->set_delegate(NULL); 955 dragged_contents_->set_delegate(NULL);
956 dragged_contents_ = NULL; 956 dragged_contents_ = NULL;
957 attached_tabstrip_ = NULL; 957 attached_tabstrip_ = NULL;
958 } 958 }
959 // If we're not destroyed now, we'll be destroyed asynchronously later. 959 // If we're not destroyed now, we'll be destroyed asynchronously later.
960 if (destroy_now) 960 if (destroy_now)
961 source_tabstrip_->DestroyDragController(); 961 source_tabstrip_->DestroyDragController();
962
963 return destroy_now;
962 } 964 }
963 965
964 void DraggedTabController::RevertDrag() { 966 void DraggedTabController::RevertDrag() {
965 // We save this here because code below will modify |attached_tabstrip_|. 967 // We save this here because code below will modify |attached_tabstrip_|.
966 bool restore_frame = attached_tabstrip_ != source_tabstrip_; 968 bool restore_frame = attached_tabstrip_ != source_tabstrip_;
967 if (attached_tabstrip_) { 969 if (attached_tabstrip_) {
968 int index = attached_tabstrip_->model()->GetIndexOfTabContents( 970 int index = attached_tabstrip_->model()->GetIndexOfTabContents(
969 dragged_contents_); 971 dragged_contents_);
970 if (attached_tabstrip_ != source_tabstrip_) { 972 if (attached_tabstrip_ != source_tabstrip_) {
971 // The Tab was inserted into another TabStrip. We need to put it back 973 // The Tab was inserted into another TabStrip. We need to put it back
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 // Move the window to the front. 1193 // Move the window to the front.
1192 SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, 1194 SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0,
1193 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); 1195 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
1194 1196
1195 // The previous call made the window appear on top of the dragged window, 1197 // The previous call made the window appear on top of the dragged window,
1196 // move the dragged window to the front. 1198 // move the dragged window to the front.
1197 SetWindowPos(view_->GetWidget()->GetHWND(), HWND_TOP, 0, 0, 0, 0, 1199 SetWindowPos(view_->GetWidget()->GetHWND(), HWND_TOP, 0, 0, 0, 0,
1198 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); 1200 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
1199 } 1201 }
1200 } 1202 }
OLDNEW
« no previous file with comments | « chrome/browser/views/tabs/dragged_tab_controller.h ('k') | chrome/browser/views/tabs/tab.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698