| 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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 return started_drag; | 368 return started_drag; |
| 369 } | 369 } |
| 370 | 370 |
| 371 BaseTab* BaseTabStrip::GetTabAt(BaseTab* tab, | 371 BaseTab* BaseTabStrip::GetTabAt(BaseTab* tab, |
| 372 const gfx::Point& tab_in_tab_coordinates) { | 372 const gfx::Point& tab_in_tab_coordinates) { |
| 373 gfx::Point local_point = tab_in_tab_coordinates; | 373 gfx::Point local_point = tab_in_tab_coordinates; |
| 374 ConvertPointToView(tab, this, &local_point); | 374 ConvertPointToView(tab, this, &local_point); |
| 375 return GetTabAtLocal(local_point); | 375 return GetTabAtLocal(local_point); |
| 376 } | 376 } |
| 377 | 377 |
| 378 void BaseTabStrip::ClickActiveTab(const BaseTab* tab) const { |
| 379 DCHECK(IsActiveTab(tab)); |
| 380 int index = GetModelIndexOfBaseTab(tab); |
| 381 if (controller() && IsValidModelIndex(index)) |
| 382 controller()->ClickActiveTab(index); |
| 383 } |
| 384 |
| 378 void BaseTabStrip::Layout() { | 385 void BaseTabStrip::Layout() { |
| 379 // Only do a layout if our size changed. | 386 // Only do a layout if our size changed. |
| 380 if (last_layout_size_ == size()) | 387 if (last_layout_size_ == size()) |
| 381 return; | 388 return; |
| 382 DoLayout(); | 389 DoLayout(); |
| 383 } | 390 } |
| 384 | 391 |
| 385 bool BaseTabStrip::OnMouseDragged(const views::MouseEvent& event) { | 392 bool BaseTabStrip::OnMouseDragged(const views::MouseEvent& event) { |
| 386 if (drag_controller_.get()) | 393 if (drag_controller_.get()) |
| 387 drag_controller_->Drag(); | 394 drag_controller_->Drag(); |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 // Animate the view back to its correct position. | 594 // Animate the view back to its correct position. |
| 588 GenerateIdealBounds(); | 595 GenerateIdealBounds(); |
| 589 AnimateToIdealBounds(); | 596 AnimateToIdealBounds(); |
| 590 } | 597 } |
| 591 bounds_animator_.AnimateViewTo(tab, ideal_bounds(TabIndexOfTab(tab))); | 598 bounds_animator_.AnimateViewTo(tab, ideal_bounds(TabIndexOfTab(tab))); |
| 592 // Install a delegate to reset the dragging state when done. We have to leave | 599 // Install a delegate to reset the dragging state when done. We have to leave |
| 593 // dragging true for the tab otherwise it'll draw beneath the new tab button. | 600 // dragging true for the tab otherwise it'll draw beneath the new tab button. |
| 594 bounds_animator_.SetAnimationDelegate( | 601 bounds_animator_.SetAnimationDelegate( |
| 595 tab, new ResetDraggingStateDelegate(tab), true); | 602 tab, new ResetDraggingStateDelegate(tab), true); |
| 596 } | 603 } |
| OLD | NEW |