| 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 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 last_visible_index_ = DetermineLastVisibleIndex( | 798 last_visible_index_ = DetermineLastVisibleIndex( |
| 799 end_position - inset - 2 * button_size); | 799 end_position - inset - 2 * button_size); |
| 800 last_hidden_index_ = DetermineFirstVisiblePanelIndex(end_position) - 1; | 800 last_hidden_index_ = DetermineFirstVisiblePanelIndex(end_position) - 1; |
| 801 bool show_overflow = | 801 bool show_overflow = |
| 802 ((ash::switches::UseAlternateShelfLayout() ? 0 : 1) + | 802 ((ash::switches::UseAlternateShelfLayout() ? 0 : 1) + |
| 803 last_visible_index_ < last_button_index || | 803 last_visible_index_ < last_button_index || |
| 804 last_hidden_index_ >= first_panel_index); | 804 last_hidden_index_ >= first_panel_index); |
| 805 | 805 |
| 806 // Create Space for the overflow button | 806 // Create Space for the overflow button |
| 807 if (show_overflow && ash::switches::UseAlternateShelfLayout() && | 807 if (show_overflow && ash::switches::UseAlternateShelfLayout() && |
| 808 last_visible_index_ > 0) | 808 last_visible_index_ > 0 && last_visible_index_ < last_button_index) |
| 809 --last_visible_index_; | 809 --last_visible_index_; |
| 810 for (int i = 0; i < view_model_->view_size(); ++i) { | 810 for (int i = 0; i < view_model_->view_size(); ++i) { |
| 811 bool visible = i <= last_visible_index_ || i > last_hidden_index_; | 811 bool visible = i <= last_visible_index_ || i > last_hidden_index_; |
| 812 // Always show the app list. | 812 // Always show the app list. |
| 813 if (!ash::switches::UseAlternateShelfLayout()) | 813 if (!ash::switches::UseAlternateShelfLayout()) |
| 814 visible |= (i == last_button_index); | 814 visible |= (i == last_button_index); |
| 815 view_model_->view_at(i)->SetVisible(visible); | 815 view_model_->view_at(i)->SetVisible(visible); |
| 816 } | 816 } |
| 817 | 817 |
| 818 overflow_button_->SetVisible(show_overflow); | 818 overflow_button_->SetVisible(show_overflow); |
| 819 if (show_overflow) { | 819 if (show_overflow) { |
| 820 DCHECK_NE(0, view_model_->view_size()); | 820 DCHECK_NE(0, view_model_->view_size()); |
| 821 if (last_visible_index_ == -1) { | 821 if (last_visible_index_ == -1) { |
| 822 x = shelf->SelectValueForShelfAlignment(inset, 0, 0, inset); | 822 x = shelf->SelectValueForShelfAlignment(inset, 0, 0, inset); |
| 823 y = shelf->SelectValueForShelfAlignment(0, inset, inset, 0); | 823 y = shelf->SelectValueForShelfAlignment(0, inset, inset, 0); |
| 824 } else if (last_visible_index_ == last_button_index) { | 824 } else if (last_visible_index_ == last_button_index |
| 825 && !ash::switches::UseAlternateShelfLayout()) { |
| 825 x = view_model_->ideal_bounds(last_visible_index_).x(); | 826 x = view_model_->ideal_bounds(last_visible_index_).x(); |
| 826 y = view_model_->ideal_bounds(last_visible_index_).y(); | 827 y = view_model_->ideal_bounds(last_visible_index_).y(); |
| 827 } else { | 828 } else { |
| 828 x = shelf->PrimaryAxisValue( | 829 x = shelf->PrimaryAxisValue( |
| 829 view_model_->ideal_bounds(last_visible_index_).right(), | 830 view_model_->ideal_bounds(last_visible_index_).right(), |
| 830 view_model_->ideal_bounds(last_visible_index_).x()); | 831 view_model_->ideal_bounds(last_visible_index_).x()); |
| 831 y = shelf->PrimaryAxisValue( | 832 y = shelf->PrimaryAxisValue( |
| 832 view_model_->ideal_bounds(last_visible_index_).y(), | 833 view_model_->ideal_bounds(last_visible_index_).y(), |
| 833 view_model_->ideal_bounds(last_visible_index_).bottom()); | 834 view_model_->ideal_bounds(last_visible_index_).bottom()); |
| 834 } | 835 } |
| (...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1880 break; | 1881 break; |
| 1881 case ash::SHELF_ALIGNMENT_TOP: | 1882 case ash::SHELF_ALIGNMENT_TOP: |
| 1882 distance = coordinate.y() - bounds.bottom(); | 1883 distance = coordinate.y() - bounds.bottom(); |
| 1883 break; | 1884 break; |
| 1884 } | 1885 } |
| 1885 return distance > 0 ? distance : 0; | 1886 return distance > 0 ? distance : 0; |
| 1886 } | 1887 } |
| 1887 | 1888 |
| 1888 } // namespace internal | 1889 } // namespace internal |
| 1889 } // namespace ash | 1890 } // namespace ash |
| OLD | NEW |