| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/views/tabs/dragged_tab_controller.h" | 5 #include "chrome/browser/ui/views/tabs/dragged_tab_controller.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 // otherwise our dragged_contents() may be replaced and subsequently | 609 // otherwise our dragged_contents() may be replaced and subsequently |
| 610 // collected/destroyed while the drag is in process, leading to | 610 // collected/destroyed while the drag is in process, leading to |
| 611 // nasty crashes. | 611 // nasty crashes. |
| 612 original_delegate_ = dragged_contents_->tab_contents()->delegate(); | 612 original_delegate_ = dragged_contents_->tab_contents()->delegate(); |
| 613 dragged_contents_->tab_contents()->set_delegate(this); | 613 dragged_contents_->tab_contents()->set_delegate(this); |
| 614 } | 614 } |
| 615 } | 615 } |
| 616 | 616 |
| 617 void DraggedTabController::SaveFocus() { | 617 void DraggedTabController::SaveFocus() { |
| 618 if (!old_focused_view_) { | 618 if (!old_focused_view_) { |
| 619 old_focused_view_ = source_tabstrip_->GetRootView()->GetFocusedView(); | 619 old_focused_view_ = source_tabstrip_->GetFocusManager()->GetFocusedView(); |
| 620 source_tabstrip_->GetRootView()->FocusView(source_tabstrip_); | 620 source_tabstrip_->GetFocusManager()->SetFocusedView(source_tabstrip_); |
| 621 } | 621 } |
| 622 } | 622 } |
| 623 | 623 |
| 624 void DraggedTabController::RestoreFocus() { | 624 void DraggedTabController::RestoreFocus() { |
| 625 if (old_focused_view_ && attached_tabstrip_ == source_tabstrip_) | 625 if (old_focused_view_ && attached_tabstrip_ == source_tabstrip_) |
| 626 old_focused_view_->GetRootView()->FocusView(old_focused_view_); | 626 old_focused_view_->GetFocusManager()->SetFocusedView(old_focused_view_); |
| 627 old_focused_view_ = NULL; | 627 old_focused_view_ = NULL; |
| 628 } | 628 } |
| 629 | 629 |
| 630 bool DraggedTabController::CanStartDrag() const { | 630 bool DraggedTabController::CanStartDrag() const { |
| 631 // Determine if the mouse has moved beyond a minimum elasticity distance in | 631 // Determine if the mouse has moved beyond a minimum elasticity distance in |
| 632 // any direction from the starting point. | 632 // any direction from the starting point. |
| 633 static const int kMinimumDragDistance = 10; | 633 static const int kMinimumDragDistance = 10; |
| 634 gfx::Point screen_point = GetCursorScreenPoint(); | 634 gfx::Point screen_point = GetCursorScreenPoint(); |
| 635 int x_offset = abs(screen_point.x() - start_screen_point_.x()); | 635 int x_offset = abs(screen_point.x() - start_screen_point_.x()); |
| 636 int y_offset = abs(screen_point.y() - start_screen_point_.y()); | 636 int y_offset = abs(screen_point.y() - start_screen_point_.y()); |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1349 #else | 1349 #else |
| 1350 NOTIMPLEMENTED(); | 1350 NOTIMPLEMENTED(); |
| 1351 #endif | 1351 #endif |
| 1352 } | 1352 } |
| 1353 } | 1353 } |
| 1354 | 1354 |
| 1355 TabStripModel* DraggedTabController::GetModel(BaseTabStrip* tabstrip) const { | 1355 TabStripModel* DraggedTabController::GetModel(BaseTabStrip* tabstrip) const { |
| 1356 return static_cast<BrowserTabStripController*>(tabstrip->controller())-> | 1356 return static_cast<BrowserTabStripController*>(tabstrip->controller())-> |
| 1357 model(); | 1357 model(); |
| 1358 } | 1358 } |
| OLD | NEW |