| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/gtk/tabs/dragged_tab_controller_gtk.h" | 5 #include "chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 | 749 |
| 750 bool DraggedTabControllerGtk::CompleteDrag() { | 750 bool DraggedTabControllerGtk::CompleteDrag() { |
| 751 bool destroy_immediately = true; | 751 bool destroy_immediately = true; |
| 752 if (attached_tabstrip_) { | 752 if (attached_tabstrip_) { |
| 753 // We don't need to do anything other than make the tabs visible again, | 753 // We don't need to do anything other than make the tabs visible again, |
| 754 // since the dragged view is going away. | 754 // since the dragged view is going away. |
| 755 dragged_view_->AnimateToBounds(GetAnimateBounds(), | 755 dragged_view_->AnimateToBounds(GetAnimateBounds(), |
| 756 base::Bind(&DraggedTabControllerGtk::OnAnimateToBoundsComplete, | 756 base::Bind(&DraggedTabControllerGtk::OnAnimateToBoundsComplete, |
| 757 base::Unretained(this))); | 757 base::Unretained(this))); |
| 758 destroy_immediately = false; | 758 destroy_immediately = false; |
| 759 attached_tabstrip_->window()->SetDevToolsDockSide( | |
| 760 source_tabstrip_->window()->devtools_dock_side()); | |
| 761 } else { | 759 } else { |
| 762 // Compel the model to construct a new window for the detached | 760 // Compel the model to construct a new window for the detached |
| 763 // TabContents. | 761 // TabContents. |
| 764 BrowserWindowGtk* window = source_tabstrip_->window(); | 762 BrowserWindowGtk* window = source_tabstrip_->window(); |
| 765 gfx::Rect window_bounds = window->GetRestoredBounds(); | 763 gfx::Rect window_bounds = window->GetRestoredBounds(); |
| 766 window_bounds.set_origin(GetWindowCreatePoint()); | 764 window_bounds.set_origin(GetWindowCreatePoint()); |
| 767 Browser* new_browser = | 765 Browser* new_browser = |
| 768 source_tabstrip_->model()->delegate()->CreateNewStripWithContents( | 766 source_tabstrip_->model()->delegate()->CreateNewStripWithContents( |
| 769 drag_data_->get(0)->contents_, | 767 drag_data_->get(0)->contents_, |
| 770 window_bounds, | 768 window_bounds, |
| 771 dock_info_, | 769 dock_info_, |
| 772 window->IsMaximized()); | 770 window->IsMaximized()); |
| 773 TabStripModel* new_model = new_browser->tab_strip_model(); | 771 TabStripModel* new_model = new_browser->tab_strip_model(); |
| 774 new_model->SetTabPinned( | 772 new_model->SetTabPinned( |
| 775 new_model->GetIndexOfTabContents(drag_data_->get(0)->contents_), | 773 new_model->GetIndexOfTabContents(drag_data_->get(0)->contents_), |
| 776 drag_data_->get(0)->pinned_); | 774 drag_data_->get(0)->pinned_); |
| 777 for (size_t i = 1; i < drag_data_->size(); ++i) { | 775 for (size_t i = 1; i < drag_data_->size(); ++i) { |
| 778 new_model->InsertTabContentsAt(static_cast<int>(i), | 776 new_model->InsertTabContentsAt(static_cast<int>(i), |
| 779 drag_data_->get(i)->contents_, | 777 drag_data_->get(i)->contents_, |
| 780 drag_data_->GetAddTypesForDraggedTabAt(i)); | 778 drag_data_->GetAddTypesForDraggedTabAt(i)); |
| 781 } | 779 } |
| 782 RestoreSelection(new_model); | 780 RestoreSelection(new_model); |
| 783 new_browser->window()->SetDevToolsDockSide(window->devtools_dock_side()); | |
| 784 new_browser->window()->Show(); | 781 new_browser->window()->Show(); |
| 785 CleanUpHiddenFrame(); | 782 CleanUpHiddenFrame(); |
| 786 } | 783 } |
| 787 | 784 |
| 788 return destroy_immediately; | 785 return destroy_immediately; |
| 789 } | 786 } |
| 790 | 787 |
| 791 void DraggedTabControllerGtk::ResetDelegates() { | 788 void DraggedTabControllerGtk::ResetDelegates() { |
| 792 for (size_t i = 0; i < drag_data_->size(); ++i) { | 789 for (size_t i = 0; i < drag_data_->size(); ++i) { |
| 793 if (drag_data_->get(i)->contents_ && | 790 if (drag_data_->get(i)->contents_ && |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 | 890 |
| 894 bool DraggedTabControllerGtk::AreTabsConsecutive() { | 891 bool DraggedTabControllerGtk::AreTabsConsecutive() { |
| 895 for (size_t i = 1; i < drag_data_->size(); ++i) { | 892 for (size_t i = 1; i < drag_data_->size(); ++i) { |
| 896 if (drag_data_->get(i - 1)->source_model_index_ + 1 != | 893 if (drag_data_->get(i - 1)->source_model_index_ + 1 != |
| 897 drag_data_->get(i)->source_model_index_) { | 894 drag_data_->get(i)->source_model_index_) { |
| 898 return false; | 895 return false; |
| 899 } | 896 } |
| 900 } | 897 } |
| 901 return true; | 898 return true; |
| 902 } | 899 } |
| OLD | NEW |