| OLD | NEW |
| 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 | 6 |
| 7 #include "chrome/browser/views/tabs/dragged_tab_controller.h" | 7 #include "chrome/browser/views/tabs/dragged_tab_controller.h" |
| 8 | 8 |
| 9 #include "chrome/browser/browser_window.h" | 9 #include "chrome/browser/browser_window.h" |
| 10 #include "chrome/browser/frame_util.h" | 10 #include "chrome/browser/frame_util.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 ChangeDraggedContents( | 96 ChangeDraggedContents( |
| 97 source_tabstrip_->model()->GetTabContentsAt(source_model_index_)); | 97 source_tabstrip_->model()->GetTabContentsAt(source_model_index_)); |
| 98 // Listen for Esc key presses. | 98 // Listen for Esc key presses. |
| 99 MessageLoopForUI::current()->AddObserver(this); | 99 MessageLoopForUI::current()->AddObserver(this); |
| 100 } | 100 } |
| 101 | 101 |
| 102 DraggedTabController::~DraggedTabController() { | 102 DraggedTabController::~DraggedTabController() { |
| 103 in_destructor_ = true; | 103 in_destructor_ = true; |
| 104 CleanUpSourceTab(); | 104 CleanUpSourceTab(); |
| 105 MessageLoopForUI::current()->RemoveObserver(this); | 105 MessageLoopForUI::current()->RemoveObserver(this); |
| 106 // Need to delete the view here manually _before_ we reset the dragged |
| 107 // contents to NULL, otherwise if the view is animating to its destination |
| 108 // bounds, it won't be able to clean up properly since its cleanup routine |
| 109 // uses GetIndexForDraggedContents, which will be invalid. |
| 110 view_.reset(NULL); |
| 106 ChangeDraggedContents(NULL); // This removes our observer. | 111 ChangeDraggedContents(NULL); // This removes our observer. |
| 107 } | 112 } |
| 108 | 113 |
| 109 void DraggedTabController::CaptureDragInfo(const gfx::Point& mouse_offset) { | 114 void DraggedTabController::CaptureDragInfo(const gfx::Point& mouse_offset) { |
| 110 start_screen_point_ = GetCursorScreenPoint(); | 115 start_screen_point_ = GetCursorScreenPoint(); |
| 111 mouse_offset_ = mouse_offset; | 116 mouse_offset_ = mouse_offset; |
| 112 } | 117 } |
| 113 | 118 |
| 114 void DraggedTabController::Drag() { | 119 void DraggedTabController::Drag() { |
| 115 // Before we get to dragging anywhere, ensure that we consider ourselves | 120 // Before we get to dragging anywhere, ensure that we consider ourselves |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 Tab* tab = GetTabMatchingDraggedContents(attached_tabstrip_); | 787 Tab* tab = GetTabMatchingDraggedContents(attached_tabstrip_); |
| 783 if (tab) | 788 if (tab) |
| 784 tab->SetVisible(true); | 789 tab->SetVisible(true); |
| 785 } | 790 } |
| 786 CleanUpHiddenFrame(); | 791 CleanUpHiddenFrame(); |
| 787 | 792 |
| 788 if (!in_destructor_) | 793 if (!in_destructor_) |
| 789 source_tabstrip_->DestroyDragController(); | 794 source_tabstrip_->DestroyDragController(); |
| 790 } | 795 } |
| 791 | 796 |
| OLD | NEW |