Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: ash/launcher/launcher_view.cc

Issue 22793011: ash:Shelf - Enable Alternate Shelf and Side Shelf by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits + extra test case Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 last_visible_index_ = DetermineLastVisibleIndex( 792 last_visible_index_ = DetermineLastVisibleIndex(
793 end_position - inset - 2 * button_size); 793 end_position - inset - 2 * button_size);
794 last_hidden_index_ = DetermineFirstVisiblePanelIndex(end_position) - 1; 794 last_hidden_index_ = DetermineFirstVisiblePanelIndex(end_position) - 1;
795 bool show_overflow = 795 bool show_overflow =
796 ((ash::switches::UseAlternateShelfLayout() ? 0 : 1) + 796 ((ash::switches::UseAlternateShelfLayout() ? 0 : 1) +
797 last_visible_index_ < last_button_index || 797 last_visible_index_ < last_button_index ||
798 last_hidden_index_ >= first_panel_index); 798 last_hidden_index_ >= first_panel_index);
799 799
800 // Create Space for the overflow button 800 // Create Space for the overflow button
801 if (show_overflow && ash::switches::UseAlternateShelfLayout() && 801 if (show_overflow && ash::switches::UseAlternateShelfLayout() &&
802 last_visible_index_ > 0) 802 last_visible_index_ > 0 && last_visible_index_ < last_button_index)
803 --last_visible_index_; 803 --last_visible_index_;
804 for (int i = 0; i < view_model_->view_size(); ++i) { 804 for (int i = 0; i < view_model_->view_size(); ++i) {
805 bool visible = i <= last_visible_index_ || i > last_hidden_index_; 805 bool visible = i <= last_visible_index_ || i > last_hidden_index_;
806 // Always show the app list. 806 // Always show the app list.
807 if (!ash::switches::UseAlternateShelfLayout()) 807 if (!ash::switches::UseAlternateShelfLayout())
808 visible |= (i == last_button_index); 808 visible |= (i == last_button_index);
809 view_model_->view_at(i)->SetVisible(visible); 809 view_model_->view_at(i)->SetVisible(visible);
810 } 810 }
811 811
812 overflow_button_->SetVisible(show_overflow); 812 overflow_button_->SetVisible(show_overflow);
813 if (show_overflow) { 813 if (show_overflow) {
814 DCHECK_NE(0, view_model_->view_size()); 814 DCHECK_NE(0, view_model_->view_size());
815 if (last_visible_index_ == -1) { 815 if (last_visible_index_ == -1) {
816 x = shelf->SelectValueForShelfAlignment(inset, 0, 0, inset); 816 x = shelf->SelectValueForShelfAlignment(inset, 0, 0, inset);
817 y = shelf->SelectValueForShelfAlignment(0, inset, inset, 0); 817 y = shelf->SelectValueForShelfAlignment(0, inset, inset, 0);
818 } else if (last_visible_index_ == last_button_index) { 818 } else if (last_visible_index_ == last_button_index
819 && !ash::switches::UseAlternateShelfLayout()) {
819 x = view_model_->ideal_bounds(last_visible_index_).x(); 820 x = view_model_->ideal_bounds(last_visible_index_).x();
820 y = view_model_->ideal_bounds(last_visible_index_).y(); 821 y = view_model_->ideal_bounds(last_visible_index_).y();
821 } else { 822 } else {
822 x = shelf->PrimaryAxisValue( 823 x = shelf->PrimaryAxisValue(
823 view_model_->ideal_bounds(last_visible_index_).right(), 824 view_model_->ideal_bounds(last_visible_index_).right(),
824 view_model_->ideal_bounds(last_visible_index_).x()); 825 view_model_->ideal_bounds(last_visible_index_).x());
825 y = shelf->PrimaryAxisValue( 826 y = shelf->PrimaryAxisValue(
826 view_model_->ideal_bounds(last_visible_index_).y(), 827 view_model_->ideal_bounds(last_visible_index_).y(),
827 view_model_->ideal_bounds(last_visible_index_).bottom()); 828 view_model_->ideal_bounds(last_visible_index_).bottom());
828 } 829 }
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after
1837 break; 1838 break;
1838 case ash::SHELF_ALIGNMENT_TOP: 1839 case ash::SHELF_ALIGNMENT_TOP:
1839 distance = coordinate.y() - bounds.bottom(); 1840 distance = coordinate.y() - bounds.bottom();
1840 break; 1841 break;
1841 } 1842 }
1842 return distance > 0 ? distance : 0; 1843 return distance > 0 ? distance : 0;
1843 } 1844 }
1844 1845
1845 } // namespace internal 1846 } // namespace internal
1846 } // namespace ash 1847 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698