| 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 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2334 arrow_window->SetContentsView(arrow_view); | 2338 arrow_window->SetContentsView(arrow_view); |
| 2335 } | 2339 } |
| 2336 | 2340 |
| 2337 TabStrip::DropInfo::~DropInfo() { | 2341 TabStrip::DropInfo::~DropInfo() { |
| 2338 // Close eventually deletes the window, which deletes arrow_view too. | 2342 // Close eventually deletes the window, which deletes arrow_view too. |
| 2339 arrow_window->Close(); | 2343 arrow_window->Close(); |
| 2340 } | 2344 } |
| 2341 | 2345 |
| 2342 /////////////////////////////////////////////////////////////////////////////// | 2346 /////////////////////////////////////////////////////////////////////////////// |
| 2343 | 2347 |
| 2344 bool TabStrip::IsAnimating() const { | |
| 2345 return bounds_animator_.IsAnimating(); | |
| 2346 } | |
| 2347 | |
| 2348 void TabStrip::PrepareForAnimation() { | 2348 void TabStrip::PrepareForAnimation() { |
| 2349 if (!IsDragSessionActive() && !TabDragController::IsAttachedTo(this)) { | 2349 if (!IsDragSessionActive() && !TabDragController::IsAttachedTo(this)) { |
| 2350 for (int i = 0; i < tab_count(); ++i) | 2350 for (int i = 0; i < tab_count(); ++i) |
| 2351 tab_at(i)->set_dragging(false); | 2351 tab_at(i)->set_dragging(false); |
| 2352 } | 2352 } |
| 2353 } | 2353 } |
| 2354 | 2354 |
| 2355 void TabStrip::GenerateIdealBounds() { | 2355 void TabStrip::GenerateIdealBounds() { |
| 2356 int new_tab_y = 0; | 2356 int new_tab_y = 0; |
| 2357 | 2357 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2598 if (!adjust_layout_) | 2598 if (!adjust_layout_) |
| 2599 return false; | 2599 return false; |
| 2600 | 2600 |
| 2601 #if !defined(OS_CHROMEOS) | 2601 #if !defined(OS_CHROMEOS) |
| 2602 if (ui::GetDisplayLayout() != ui::LAYOUT_TOUCH) | 2602 if (ui::GetDisplayLayout() != ui::LAYOUT_TOUCH) |
| 2603 return false; | 2603 return false; |
| 2604 #endif | 2604 #endif |
| 2605 | 2605 |
| 2606 return true; | 2606 return true; |
| 2607 } | 2607 } |
| OLD | NEW |