| 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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 if (!tab) { | 456 if (!tab) { |
| 457 // There is no Tab in |attached_tabstrip| that corresponds to the dragged | 457 // There is no Tab in |attached_tabstrip| that corresponds to the dragged |
| 458 // TabContents. We must now create one. | 458 // TabContents. We must now create one. |
| 459 | 459 |
| 460 // Remove ourselves as the delegate now that the dragged TabContents is | 460 // Remove ourselves as the delegate now that the dragged TabContents is |
| 461 // being inserted back into a Browser. | 461 // being inserted back into a Browser. |
| 462 dragged_contents_->set_delegate(NULL); | 462 dragged_contents_->set_delegate(NULL); |
| 463 original_delegate_ = NULL; | 463 original_delegate_ = NULL; |
| 464 | 464 |
| 465 // Return the TabContents' to normalcy. | 465 // Return the TabContents' to normalcy. |
| 466 dragged_contents_->DidCaptureContents(); | 466 dragged_contents_->set_capturing_contents(false); |
| 467 | 467 |
| 468 // We need to ask the TabStrip we're attached to to ensure that the ideal | 468 // We need to ask the TabStrip we're attached to to ensure that the ideal |
| 469 // bounds for all its tabs are correctly generated, because the calculation | 469 // bounds for all its tabs are correctly generated, because the calculation |
| 470 // in GetInsertionIndexForDraggedBounds needs them to be to figure out the | 470 // in GetInsertionIndexForDraggedBounds needs them to be to figure out the |
| 471 // appropriate insertion index. | 471 // appropriate insertion index. |
| 472 attached_tabstrip_->GenerateIdealBounds(); | 472 attached_tabstrip_->GenerateIdealBounds(); |
| 473 | 473 |
| 474 // Inserting counts as a move. We don't want the tabs to jitter when the | 474 // Inserting counts as a move. We don't want the tabs to jitter when the |
| 475 // user moves the tab immediately after attaching it. | 475 // user moves the tab immediately after attaching it. |
| 476 last_move_screen_x_ = screen_point.x(); | 476 last_move_screen_x_ = screen_point.x(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 490 DCHECK(tab); // We should now have a tab. | 490 DCHECK(tab); // We should now have a tab. |
| 491 tab->SetVisible(false); | 491 tab->SetVisible(false); |
| 492 | 492 |
| 493 // Move the corresponding window to the front. | 493 // Move the corresponding window to the front. |
| 494 attached_tabstrip_->GetViewContainer()->MoveToFront(true); | 494 attached_tabstrip_->GetViewContainer()->MoveToFront(true); |
| 495 } | 495 } |
| 496 | 496 |
| 497 void DraggedTabController::Detach() { | 497 void DraggedTabController::Detach() { |
| 498 // Prevent the TabContents' HWND from being hidden by any of the model | 498 // Prevent the TabContents' HWND from being hidden by any of the model |
| 499 // operations performed during the drag. | 499 // operations performed during the drag. |
| 500 dragged_contents_->WillCaptureContents(); | 500 dragged_contents_->set_capturing_contents(true); |
| 501 | 501 |
| 502 // Update the Model. | 502 // Update the Model. |
| 503 TabStripModel* attached_model = attached_tabstrip_->model(); | 503 TabStripModel* attached_model = attached_tabstrip_->model(); |
| 504 int index = attached_model->GetIndexOfTabContents(dragged_contents_); | 504 int index = attached_model->GetIndexOfTabContents(dragged_contents_); |
| 505 if (index >= 0 && index < attached_model->count()) { | 505 if (index >= 0 && index < attached_model->count()) { |
| 506 attached_model->DetachTabContentsAt(index); | 506 attached_model->DetachTabContentsAt(index); |
| 507 attached_tabstrip_->SchedulePaint(); | 507 attached_tabstrip_->SchedulePaint(); |
| 508 } | 508 } |
| 509 | 509 |
| 510 // If we've removed the last Tab from the TabStrip, hide the frame now. | 510 // If we've removed the last Tab from the TabStrip, hide the frame now. |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 Tab* tab = GetTabMatchingDraggedContents(attached_tabstrip_); | 786 Tab* tab = GetTabMatchingDraggedContents(attached_tabstrip_); |
| 787 if (tab) | 787 if (tab) |
| 788 tab->SetVisible(true); | 788 tab->SetVisible(true); |
| 789 } | 789 } |
| 790 CleanUpHiddenFrame(); | 790 CleanUpHiddenFrame(); |
| 791 | 791 |
| 792 if (!in_destructor_) | 792 if (!in_destructor_) |
| 793 source_tabstrip_->DestroyDragController(); | 793 source_tabstrip_->DestroyDragController(); |
| 794 } | 794 } |
| 795 | 795 |
| OLD | NEW |