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

Unified Diff: ash/shelf/shelf_button.cc

Issue 140323010: Ash:Shelf - Cleanup of Alternate Shelf (part 1) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase + remove AlternateShelf from variable names Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: ash/shelf/shelf_button.cc
diff --git a/ash/shelf/shelf_button.cc b/ash/shelf/shelf_button.cc
index dd3e3e90f6a2a62619ec51a841204f5dc3802b0d..902100ad28366a7beabf2ad36f15063c2c948f00 100644
--- a/ash/shelf/shelf_button.cc
+++ b/ash/shelf/shelf_button.cc
@@ -32,9 +32,8 @@ namespace {
const int kBarSize = 3;
const int kIconSize = 32;
const int kHopSpacing = 2;
-const int kIconPad = 8;
-const int kAlternateIconPad = 5;
-const int kAlternateIconPadVertical = 6;
+const int kIconPad = 5;
+const int kIconPadVertical = 6;
const int kHopUpMS = 0;
const int kHopDownMS = 200;
const int kAttentionThrobDurationMS = 800;
@@ -298,13 +297,6 @@ const gfx::ImageSkia& ShelfButton::GetImage() const {
void ShelfButton::AddState(State state) {
if (!(state_ & state)) {
- if (!ash::switches::UseAlternateShelfLayout() &&
- (ShouldHop(state) || !ShouldHop(state_))) {
- ui::ScopedLayerAnimationSettings scoped_setter(
- icon_view_->layer()->GetAnimator());
- scoped_setter.SetTransitionDuration(
- base::TimeDelta::FromMilliseconds(kHopUpMS));
- }
state_ |= state;
Layout();
if (state & STATE_ATTENTION)
@@ -314,14 +306,6 @@ void ShelfButton::AddState(State state) {
void ShelfButton::ClearState(State state) {
if (state_ & state) {
- if (!ash::switches::UseAlternateShelfLayout() &&
- (!ShouldHop(state) || ShouldHop(state_))) {
- ui::ScopedLayerAnimationSettings scoped_setter(
- icon_view_->layer()->GetAnimator());
- scoped_setter.SetTweenType(gfx::Tween::LINEAR);
- scoped_setter.SetTransitionDuration(
- base::TimeDelta::FromMilliseconds(kHopDownMS));
- }
state_ &= ~state;
Layout();
if (state & STATE_ATTENTION)
@@ -400,11 +384,9 @@ void ShelfButton::GetAccessibleState(ui::AccessibleViewState* state) {
void ShelfButton::Layout() {
const gfx::Rect button_bounds(GetContentsBounds());
int icon_pad = kIconPad;
- if (ash::switches::UseAlternateShelfLayout()) {
- icon_pad =
- shelf_layout_manager_->GetAlignment() != SHELF_ALIGNMENT_BOTTOM ?
- kAlternateIconPadVertical : kAlternateIconPad;
- }
+ icon_pad =
+ shelf_layout_manager_->GetAlignment() != SHELF_ALIGNMENT_BOTTOM ?
+ kIconPadVertical : kIconPad;
int x_offset = shelf_layout_manager_->PrimaryAxisValue(0, icon_pad);
int y_offset = shelf_layout_manager_->PrimaryAxisValue(icon_pad, 0);
@@ -421,13 +403,6 @@ void ShelfButton::Layout() {
if (SHELF_ALIGNMENT_TOP == shelf_layout_manager_->GetAlignment())
y_offset = button_bounds.height() - (kIconSize + icon_pad);
- if (ShouldHop(state_) && !ash::switches::UseAlternateShelfLayout()) {
- x_offset += shelf_layout_manager_->SelectValueForShelfAlignment(
- 0, kHopSpacing, -kHopSpacing, 0);
- y_offset += shelf_layout_manager_->SelectValueForShelfAlignment(
- -kHopSpacing, 0, 0, kHopSpacing);
- }
-
// Center icon with respect to the secondary axis, and ensure
// that the icon doesn't occlude the bar highlight.
if (shelf_layout_manager_->IsHorizontalAlignment()) {
@@ -545,19 +520,10 @@ void ShelfButton::UpdateBar() {
}
int bar_id = 0;
- if (ash::switches::UseAlternateShelfLayout()) {
- if (state_ & STATE_ACTIVE)
- bar_id = IDR_AURA_LAUNCHER_UNDERLINE_ACTIVE_ALTERNATE;
- else if (state_ & STATE_RUNNING)
- bar_id = IDR_AURA_LAUNCHER_UNDERLINE_RUNNING_ALTERNATE;
- } else {
- if (state_ & (STATE_ACTIVE | STATE_ATTENTION))
- bar_id = IDR_AURA_LAUNCHER_UNDERLINE_ACTIVE;
James Cook 2014/01/23 18:02:35 Are these resources now unused? Can they be delete
Harry McCleave 2014/01/24 22:48:47 Yes they are unused I have added their removal to
- else if (state_ & (STATE_HOVERED | STATE_FOCUSED))
- bar_id = IDR_AURA_LAUNCHER_UNDERLINE_HOVER;
- else
- bar_id = IDR_AURA_LAUNCHER_UNDERLINE_RUNNING;
- }
+ if (state_ & STATE_ACTIVE)
+ bar_id = IDR_AURA_LAUNCHER_UNDERLINE_ACTIVE_ALTERNATE;
+ else if (state_ & STATE_RUNNING)
+ bar_id = IDR_AURA_LAUNCHER_UNDERLINE_RUNNING_ALTERNATE;
if (bar_id != 0) {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();

Powered by Google App Engine
This is Rietveld 408576698