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/base_tab_strip.h" | 5 #include "chrome/browser/ui/views/tabs/base_tab_strip.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/ui/title_prefix_matcher.h" | 8 #include "chrome/browser/ui/title_prefix_matcher.h" |
9 #include "chrome/browser/ui/view_ids.h" | 9 #include "chrome/browser/ui/view_ids.h" |
10 #include "chrome/browser/ui/views/tabs/dragged_tab_controller.h" | 10 #include "chrome/browser/ui/views/tabs/dragged_tab_controller.h" |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 bool BaseTabStrip::CanDrop(const ui::OSExchangeData& data) { | 400 bool BaseTabStrip::CanDrop(const ui::OSExchangeData& data) { |
401 return IsVisible() && !IsAnimating(); | 401 return IsVisible() && !IsAnimating(); |
402 } | 402 } |
403 | 403 |
404 bool BaseTabStrip::OnMouseDragged(const views::MouseEvent& event) { | 404 bool BaseTabStrip::OnMouseDragged(const views::MouseEvent& event) { |
405 if (drag_controller_.get()) | 405 if (drag_controller_.get()) |
406 drag_controller_->Drag(); | 406 drag_controller_->Drag(); |
407 return true; | 407 return true; |
408 } | 408 } |
409 | 409 |
410 void BaseTabStrip::OnMouseReleased(const views::MouseEvent& event, | 410 void BaseTabStrip::OnMouseReleased(const views::MouseEvent& event) { |
411 bool canceled) { | 411 EndDrag(false); |
412 EndDrag(canceled); | 412 } |
| 413 |
| 414 void BaseTabStrip::OnMouseCaptureLost() { |
| 415 EndDrag(true); |
413 } | 416 } |
414 | 417 |
415 void BaseTabStrip::StartMoveTabAnimation() { | 418 void BaseTabStrip::StartMoveTabAnimation() { |
416 PrepareForAnimation(); | 419 PrepareForAnimation(); |
417 GenerateIdealBounds(); | 420 GenerateIdealBounds(); |
418 AnimateToIdealBounds(); | 421 AnimateToIdealBounds(); |
419 } | 422 } |
420 | 423 |
421 void BaseTabStrip::StartRemoveTabAnimation(int model_index) { | 424 void BaseTabStrip::StartRemoveTabAnimation(int model_index) { |
422 PrepareForAnimation(); | 425 PrepareForAnimation(); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 // Animate the view back to its correct position. | 587 // Animate the view back to its correct position. |
585 GenerateIdealBounds(); | 588 GenerateIdealBounds(); |
586 AnimateToIdealBounds(); | 589 AnimateToIdealBounds(); |
587 } | 590 } |
588 bounds_animator_.AnimateViewTo(tab, ideal_bounds(TabIndexOfTab(tab))); | 591 bounds_animator_.AnimateViewTo(tab, ideal_bounds(TabIndexOfTab(tab))); |
589 // Install a delegate to reset the dragging state when done. We have to leave | 592 // Install a delegate to reset the dragging state when done. We have to leave |
590 // dragging true for the tab otherwise it'll draw beneath the new tab button. | 593 // dragging true for the tab otherwise it'll draw beneath the new tab button. |
591 bounds_animator_.SetAnimationDelegate( | 594 bounds_animator_.SetAnimationDelegate( |
592 tab, new ResetDraggingStateDelegate(tab), true); | 595 tab, new ResetDraggingStateDelegate(tab), true); |
593 } | 596 } |
OLD | NEW |