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

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: Created 7 years, 4 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 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 last_visible_index_ = DetermineLastVisibleIndex( 785 last_visible_index_ = DetermineLastVisibleIndex(
786 end_position - inset - 2 * button_size); 786 end_position - inset - 2 * button_size);
787 last_hidden_index_ = DetermineFirstVisiblePanelIndex(end_position) - 1; 787 last_hidden_index_ = DetermineFirstVisiblePanelIndex(end_position) - 1;
788 bool show_overflow = 788 bool show_overflow =
789 ((ash::switches::UseAlternateShelfLayout() ? 0 : 1) + 789 ((ash::switches::UseAlternateShelfLayout() ? 0 : 1) +
790 last_visible_index_ < last_button_index || 790 last_visible_index_ < last_button_index ||
791 last_hidden_index_ >= first_panel_index); 791 last_hidden_index_ >= first_panel_index);
792 792
793 // Create Space for the overflow button 793 // Create Space for the overflow button
794 if (show_overflow && ash::switches::UseAlternateShelfLayout() && 794 if (show_overflow && ash::switches::UseAlternateShelfLayout() &&
795 last_visible_index_ > 0) 795 last_visible_index_ > 0 && last_visible_index_ < last_button_index)
James Cook 2013/08/22 00:19:12 Should this be part of a separate CL, or is it nee
Harry McCleave 2013/08/27 00:37:00 This fixes an issue asserted by a unit test, if th
796 --last_visible_index_; 796 --last_visible_index_;
797 for (int i = 0; i < view_model_->view_size(); ++i) { 797 for (int i = 0; i < view_model_->view_size(); ++i) {
798 bool visible = i <= last_visible_index_ || i > last_hidden_index_; 798 bool visible = i <= last_visible_index_ || i > last_hidden_index_;
799 // Always show the app list. 799 // Always show the app list.
800 if (!ash::switches::UseAlternateShelfLayout()) 800 if (!ash::switches::UseAlternateShelfLayout())
801 visible |= (i == last_button_index); 801 visible |= (i == last_button_index);
802 view_model_->view_at(i)->SetVisible(visible); 802 view_model_->view_at(i)->SetVisible(visible);
803 } 803 }
804 804
805 overflow_button_->SetVisible(show_overflow); 805 overflow_button_->SetVisible(show_overflow);
806 if (show_overflow) { 806 if (show_overflow) {
807 DCHECK_NE(0, view_model_->view_size()); 807 DCHECK_NE(0, view_model_->view_size());
808 if (last_visible_index_ == -1) { 808 if (last_visible_index_ == -1) {
809 x = shelf->SelectValueForShelfAlignment(inset, 0, 0, inset); 809 x = shelf->SelectValueForShelfAlignment(inset, 0, 0, inset);
810 y = shelf->SelectValueForShelfAlignment(0, inset, inset, 0); 810 y = shelf->SelectValueForShelfAlignment(0, inset, inset, 0);
811 } else if (last_visible_index_ == last_button_index) { 811 } else if (last_visible_index_ == last_button_index
812 && !ash::switches::UseAlternateShelfLayout()) {
812 x = view_model_->ideal_bounds(last_visible_index_).x(); 813 x = view_model_->ideal_bounds(last_visible_index_).x();
813 y = view_model_->ideal_bounds(last_visible_index_).y(); 814 y = view_model_->ideal_bounds(last_visible_index_).y();
814 } else { 815 } else {
815 x = shelf->PrimaryAxisValue( 816 x = shelf->PrimaryAxisValue(
816 view_model_->ideal_bounds(last_visible_index_).right(), 817 view_model_->ideal_bounds(last_visible_index_).right(),
817 view_model_->ideal_bounds(last_visible_index_).x()); 818 view_model_->ideal_bounds(last_visible_index_).x());
818 y = shelf->PrimaryAxisValue( 819 y = shelf->PrimaryAxisValue(
819 view_model_->ideal_bounds(last_visible_index_).y(), 820 view_model_->ideal_bounds(last_visible_index_).y(),
820 view_model_->ideal_bounds(last_visible_index_).bottom()); 821 view_model_->ideal_bounds(last_visible_index_).bottom());
821 } 822 }
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
1706 bool LauncherView::ShouldShowTooltipForView(const views::View* view) const { 1707 bool LauncherView::ShouldShowTooltipForView(const views::View* view) const {
1707 if (view == GetAppListButtonView() && 1708 if (view == GetAppListButtonView() &&
1708 Shell::GetInstance()->GetAppListWindow()) 1709 Shell::GetInstance()->GetAppListWindow())
1709 return false; 1710 return false;
1710 const LauncherItem* item = LauncherItemForView(view); 1711 const LauncherItem* item = LauncherItemForView(view);
1711 return (!item || delegate_->ShouldShowTooltip(*item)); 1712 return (!item || delegate_->ShouldShowTooltip(*item));
1712 } 1713 }
1713 1714
1714 } // namespace internal 1715 } // namespace internal
1715 } // namespace ash 1716 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698