| 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 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 // We have "tiny tabs" if the tabs are so tiny that the unselected ones are | 810 // We have "tiny tabs" if the tabs are so tiny that the unselected ones are |
| 811 // a different size to the selected ones. | 811 // a different size to the selected ones. |
| 812 bool tiny_tabs = current_unselected_width_ != current_selected_width_; | 812 bool tiny_tabs = current_unselected_width_ != current_selected_width_; |
| 813 if (!IsAnimating() && (!in_tab_close_ || tiny_tabs)) { | 813 if (!IsAnimating() && (!in_tab_close_ || tiny_tabs)) { |
| 814 DoLayout(); | 814 DoLayout(); |
| 815 } else { | 815 } else { |
| 816 SchedulePaint(); | 816 SchedulePaint(); |
| 817 } | 817 } |
| 818 } | 818 } |
| 819 | 819 |
| 820 // Use STLSetDifference to get the indices of elements newly selected |
| 821 // and no longer selected, since selected_indices() is always sorted. |
| 820 ui::ListSelectionModel::SelectedIndices no_longer_selected = | 822 ui::ListSelectionModel::SelectedIndices no_longer_selected = |
| 821 base::STLSetDifference<ui::ListSelectionModel::SelectedIndices>( | 823 base::STLSetDifference<ui::ListSelectionModel::SelectedIndices>( |
| 822 old_selection.selected_indices(), | 824 old_selection.selected_indices(), |
| 823 new_selection.selected_indices()); | 825 new_selection.selected_indices()); |
| 824 for (size_t i = 0; i < no_longer_selected.size(); ++i) | 826 ui::ListSelectionModel::SelectedIndices newly_selected = |
| 827 base::STLSetDifference<ui::ListSelectionModel::SelectedIndices>( |
| 828 new_selection.selected_indices(), |
| 829 old_selection.selected_indices()); |
| 830 |
| 831 // Fire accessibility events that reflect the changes to selection, and |
| 832 // stop the mini tab title animation on tabs no longer selected. |
| 833 for (size_t i = 0; i < no_longer_selected.size(); ++i) { |
| 825 tab_at(no_longer_selected[i])->StopMiniTabTitleAnimation(); | 834 tab_at(no_longer_selected[i])->StopMiniTabTitleAnimation(); |
| 835 tab_at(no_longer_selected[i])->NotifyAccessibilityEvent( |
| 836 ui::AX_EVENT_SELECTION_REMOVE, true); |
| 837 } |
| 838 for (size_t i = 0; i < newly_selected.size(); ++i) { |
| 839 tab_at(newly_selected[i])->NotifyAccessibilityEvent( |
| 840 ui::AX_EVENT_SELECTION_ADD, true); |
| 841 } |
| 842 tab_at(new_selection.active())->NotifyAccessibilityEvent( |
| 843 ui::AX_EVENT_SELECTION, true); |
| 826 } | 844 } |
| 827 | 845 |
| 828 void TabStrip::TabTitleChangedNotLoading(int model_index) { | 846 void TabStrip::TabTitleChangedNotLoading(int model_index) { |
| 829 Tab* tab = tab_at(model_index); | 847 Tab* tab = tab_at(model_index); |
| 830 if (tab->data().mini && !tab->IsActive()) | 848 if (tab->data().mini && !tab->IsActive()) |
| 831 tab->StartMiniTabTitleAnimation(); | 849 tab->StartMiniTabTitleAnimation(); |
| 832 } | 850 } |
| 833 | 851 |
| 834 int TabStrip::GetModelIndexOfTab(const Tab* tab) const { | 852 int TabStrip::GetModelIndexOfTab(const Tab* tab) const { |
| 835 return tabs_.GetIndexOfView(tab); | 853 return tabs_.GetIndexOfView(tab); |
| (...skipping 1851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2687 action = TouchUMA::GESTURE_TABSWITCH_TAP; | 2705 action = TouchUMA::GESTURE_TABSWITCH_TAP; |
| 2688 TouchUMA::RecordGestureAction(action); | 2706 TouchUMA::RecordGestureAction(action); |
| 2689 break; | 2707 break; |
| 2690 } | 2708 } |
| 2691 | 2709 |
| 2692 default: | 2710 default: |
| 2693 break; | 2711 break; |
| 2694 } | 2712 } |
| 2695 event->SetHandled(); | 2713 event->SetHandled(); |
| 2696 } | 2714 } |
| OLD | NEW |