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 "ash/launcher/launcher_view.h" | 5 #include "ash/launcher/launcher_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/ash_constants.h" | 9 #include "ash/ash_constants.h" |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 else | 775 else |
776 last_visible_index_ = DetermineLastVisibleIndex( | 776 last_visible_index_ = DetermineLastVisibleIndex( |
777 end_position - inset - 2 * button_size); | 777 end_position - inset - 2 * button_size); |
778 last_hidden_index_ = DetermineFirstVisiblePanelIndex(end_position) - 1; | 778 last_hidden_index_ = DetermineFirstVisiblePanelIndex(end_position) - 1; |
779 bool show_overflow = | 779 bool show_overflow = |
780 ((ash::switches::UseAlternateShelfLayout() ? 0 : 1) + | 780 ((ash::switches::UseAlternateShelfLayout() ? 0 : 1) + |
781 last_visible_index_ < last_button_index || | 781 last_visible_index_ < last_button_index || |
782 last_hidden_index_ >= first_panel_index); | 782 last_hidden_index_ >= first_panel_index); |
783 | 783 |
784 // Create Space for the overflow button | 784 // Create Space for the overflow button |
785 if (show_overflow && ash::switches::UseAlternateShelfLayout()) { | 785 if (show_overflow && ash::switches::UseAlternateShelfLayout() && |
786 DCHECK(last_visible_index_ > 0); | 786 last_visible_index_ > 0) |
787 --last_visible_index_; | 787 --last_visible_index_; |
788 } | |
789 for (int i = 0; i < view_model_->view_size(); ++i) { | 788 for (int i = 0; i < view_model_->view_size(); ++i) { |
790 bool visible = i <= last_visible_index_ || i > last_hidden_index_; | 789 bool visible = i <= last_visible_index_ || i > last_hidden_index_; |
791 // Always show the app list. | 790 // Always show the app list. |
792 if (!ash::switches::UseAlternateShelfLayout()) | 791 if (!ash::switches::UseAlternateShelfLayout()) |
793 visible |= (i == last_button_index); | 792 visible |= (i == last_button_index); |
794 view_model_->view_at(i)->SetVisible(visible); | 793 view_model_->view_at(i)->SetVisible(visible); |
795 } | 794 } |
796 | 795 |
797 overflow_button_->SetVisible(show_overflow); | 796 overflow_button_->SetVisible(show_overflow); |
798 if (show_overflow) { | 797 if (show_overflow) { |
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1696 bool LauncherView::ShouldShowTooltipForView(const views::View* view) const { | 1695 bool LauncherView::ShouldShowTooltipForView(const views::View* view) const { |
1697 if (view == GetAppListButtonView() && | 1696 if (view == GetAppListButtonView() && |
1698 Shell::GetInstance()->GetAppListWindow()) | 1697 Shell::GetInstance()->GetAppListWindow()) |
1699 return false; | 1698 return false; |
1700 const LauncherItem* item = LauncherItemForView(view); | 1699 const LauncherItem* item = LauncherItemForView(view); |
1701 return (!item || delegate_->ShouldShowTooltip(*item)); | 1700 return (!item || delegate_->ShouldShowTooltip(*item)); |
1702 } | 1701 } |
1703 | 1702 |
1704 } // namespace internal | 1703 } // namespace internal |
1705 } // namespace ash | 1704 } // namespace ash |
OLD | NEW |