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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 bool BaseTabStrip::CanDrop(const ui::OSExchangeData& data) { | 404 bool BaseTabStrip::CanDrop(const ui::OSExchangeData& data) { |
405 return IsVisible() && !IsAnimating(); | 405 return IsVisible() && !IsAnimating(); |
406 } | 406 } |
407 | 407 |
408 bool BaseTabStrip::OnMouseDragged(const views::MouseEvent& event) { | 408 bool BaseTabStrip::OnMouseDragged(const views::MouseEvent& event) { |
409 if (drag_controller_.get()) | 409 if (drag_controller_.get()) |
410 drag_controller_->Drag(); | 410 drag_controller_->Drag(); |
411 return true; | 411 return true; |
412 } | 412 } |
413 | 413 |
414 void BaseTabStrip::OnMouseReleased(const views::MouseEvent& event, | 414 void BaseTabStrip::OnMouseReleased(const views::MouseEvent& event) { |
415 bool canceled) { | 415 EndDrag(false); |
416 EndDrag(canceled); | 416 } |
| 417 |
| 418 void BaseTabStrip::OnMouseCaptureLost() { |
| 419 EndDrag(true); |
417 } | 420 } |
418 | 421 |
419 void BaseTabStrip::StartMoveTabAnimation() { | 422 void BaseTabStrip::StartMoveTabAnimation() { |
420 PrepareForAnimation(); | 423 PrepareForAnimation(); |
421 GenerateIdealBounds(); | 424 GenerateIdealBounds(); |
422 AnimateToIdealBounds(); | 425 AnimateToIdealBounds(); |
423 } | 426 } |
424 | 427 |
425 void BaseTabStrip::StartRemoveTabAnimation(int model_index) { | 428 void BaseTabStrip::StartRemoveTabAnimation(int model_index) { |
426 PrepareForAnimation(); | 429 PrepareForAnimation(); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 // Animate the view back to its correct position. | 591 // Animate the view back to its correct position. |
589 GenerateIdealBounds(); | 592 GenerateIdealBounds(); |
590 AnimateToIdealBounds(); | 593 AnimateToIdealBounds(); |
591 } | 594 } |
592 bounds_animator_.AnimateViewTo(tab, ideal_bounds(TabIndexOfTab(tab))); | 595 bounds_animator_.AnimateViewTo(tab, ideal_bounds(TabIndexOfTab(tab))); |
593 // Install a delegate to reset the dragging state when done. We have to leave | 596 // Install a delegate to reset the dragging state when done. We have to leave |
594 // dragging true for the tab otherwise it'll draw beneath the new tab button. | 597 // dragging true for the tab otherwise it'll draw beneath the new tab button. |
595 bounds_animator_.SetAnimationDelegate( | 598 bounds_animator_.SetAnimationDelegate( |
596 tab, new ResetDraggingStateDelegate(tab), true); | 599 tab, new ResetDraggingStateDelegate(tab), true); |
597 } | 600 } |
OLD | NEW |