OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/tab_strip.h" | 5 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windowsx.h> | 8 #include <windowsx.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 return; | 938 return; |
939 immersive_style_ = enable; | 939 immersive_style_ = enable; |
940 if (immersive_style_) { | 940 if (immersive_style_) { |
941 // Dominant colors are only updated automatically when the tab strip is | 941 // Dominant colors are only updated automatically when the tab strip is |
942 // already using immersive style. Compute the initial values. | 942 // already using immersive style. Compute the initial values. |
943 for (int i = 0; i < tab_count(); ++i) | 943 for (int i = 0; i < tab_count(); ++i) |
944 tab_at(i)->UpdateIconDominantColor(); | 944 tab_at(i)->UpdateIconDominantColor(); |
945 } | 945 } |
946 } | 946 } |
947 | 947 |
| 948 bool TabStrip::IsAnimating() const { |
| 949 return bounds_animator_.IsAnimating(); |
| 950 } |
| 951 |
| 952 void TabStrip::StopAnimating(bool layout) { |
| 953 if (!IsAnimating()) |
| 954 return; |
| 955 |
| 956 bounds_animator_.Cancel(); |
| 957 |
| 958 if (layout) |
| 959 DoLayout(); |
| 960 } |
| 961 |
948 const ui::ListSelectionModel& TabStrip::GetSelectionModel() { | 962 const ui::ListSelectionModel& TabStrip::GetSelectionModel() { |
949 return controller_->GetSelectionModel(); | 963 return controller_->GetSelectionModel(); |
950 } | 964 } |
951 | 965 |
952 bool TabStrip::SupportsMultipleSelection() { | 966 bool TabStrip::SupportsMultipleSelection() { |
953 // TODO: currently only allow single selection in touch layout mode. | 967 // TODO: currently only allow single selection in touch layout mode. |
954 return touch_layout_.get() == NULL; | 968 return touch_layout_.get() == NULL; |
955 } | 969 } |
956 | 970 |
957 void TabStrip::SelectTab(Tab* tab) { | 971 void TabStrip::SelectTab(Tab* tab) { |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1612 | 1626 |
1613 // Don't animate the new tab button when dragging tabs. Otherwise it looks | 1627 // Don't animate the new tab button when dragging tabs. Otherwise it looks |
1614 // like the new tab button magically appears from beyond the end of the tab | 1628 // like the new tab button magically appears from beyond the end of the tab |
1615 // strip. | 1629 // strip. |
1616 if (TabDragController::IsAttachedTo(this)) { | 1630 if (TabDragController::IsAttachedTo(this)) { |
1617 bounds_animator_.StopAnimatingView(newtab_button_); | 1631 bounds_animator_.StopAnimatingView(newtab_button_); |
1618 newtab_button_->SetBoundsRect(newtab_button_bounds_); | 1632 newtab_button_->SetBoundsRect(newtab_button_bounds_); |
1619 } | 1633 } |
1620 } | 1634 } |
1621 | 1635 |
1622 void TabStrip::StopAnimating(bool layout) { | |
1623 if (!IsAnimating()) | |
1624 return; | |
1625 | |
1626 bounds_animator_.Cancel(); | |
1627 | |
1628 if (layout) | |
1629 DoLayout(); | |
1630 } | |
1631 | |
1632 void TabStrip::AnimateToIdealBounds() { | 1636 void TabStrip::AnimateToIdealBounds() { |
1633 for (int i = 0; i < tab_count(); ++i) { | 1637 for (int i = 0; i < tab_count(); ++i) { |
1634 Tab* tab = tab_at(i); | 1638 Tab* tab = tab_at(i); |
1635 if (!tab->dragging()) | 1639 if (!tab->dragging()) |
1636 bounds_animator_.AnimateViewTo(tab, ideal_bounds(i)); | 1640 bounds_animator_.AnimateViewTo(tab, ideal_bounds(i)); |
1637 } | 1641 } |
1638 | 1642 |
1639 bounds_animator_.AnimateViewTo(newtab_button_, newtab_button_bounds_); | 1643 bounds_animator_.AnimateViewTo(newtab_button_, newtab_button_bounds_); |
1640 } | 1644 } |
1641 | 1645 |
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2342 arrow_window->SetContentsView(arrow_view); | 2346 arrow_window->SetContentsView(arrow_view); |
2343 } | 2347 } |
2344 | 2348 |
2345 TabStrip::DropInfo::~DropInfo() { | 2349 TabStrip::DropInfo::~DropInfo() { |
2346 // Close eventually deletes the window, which deletes arrow_view too. | 2350 // Close eventually deletes the window, which deletes arrow_view too. |
2347 arrow_window->Close(); | 2351 arrow_window->Close(); |
2348 } | 2352 } |
2349 | 2353 |
2350 /////////////////////////////////////////////////////////////////////////////// | 2354 /////////////////////////////////////////////////////////////////////////////// |
2351 | 2355 |
2352 bool TabStrip::IsAnimating() const { | |
2353 return bounds_animator_.IsAnimating(); | |
2354 } | |
2355 | |
2356 void TabStrip::PrepareForAnimation() { | 2356 void TabStrip::PrepareForAnimation() { |
2357 if (!IsDragSessionActive() && !TabDragController::IsAttachedTo(this)) { | 2357 if (!IsDragSessionActive() && !TabDragController::IsAttachedTo(this)) { |
2358 for (int i = 0; i < tab_count(); ++i) | 2358 for (int i = 0; i < tab_count(); ++i) |
2359 tab_at(i)->set_dragging(false); | 2359 tab_at(i)->set_dragging(false); |
2360 } | 2360 } |
2361 } | 2361 } |
2362 | 2362 |
2363 void TabStrip::GenerateIdealBounds() { | 2363 void TabStrip::GenerateIdealBounds() { |
2364 int new_tab_y = 0; | 2364 int new_tab_y = 0; |
2365 | 2365 |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2606 if (!adjust_layout_) | 2606 if (!adjust_layout_) |
2607 return false; | 2607 return false; |
2608 | 2608 |
2609 #if !defined(OS_CHROMEOS) | 2609 #if !defined(OS_CHROMEOS) |
2610 if (ui::GetDisplayLayout() != ui::LAYOUT_TOUCH) | 2610 if (ui::GetDisplayLayout() != ui::LAYOUT_TOUCH) |
2611 return false; | 2611 return false; |
2612 #endif | 2612 #endif |
2613 | 2613 |
2614 return true; | 2614 return true; |
2615 } | 2615 } |
OLD | NEW |