| 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_button.h" | 5 #include "ash/launcher/launcher_button.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/launcher/launcher_button_host.h" | 9 #include "ash/launcher/launcher_button_host.h" |
| 10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 | 293 |
| 294 void LauncherButton::AddState(State state) { | 294 void LauncherButton::AddState(State state) { |
| 295 if (!(state_ & state)) { | 295 if (!(state_ & state)) { |
| 296 if (ShouldHop(state) || !ShouldHop(state_)) { | 296 if (ShouldHop(state) || !ShouldHop(state_)) { |
| 297 ui::ScopedLayerAnimationSettings scoped_setter( | 297 ui::ScopedLayerAnimationSettings scoped_setter( |
| 298 icon_view_->layer()->GetAnimator()); | 298 icon_view_->layer()->GetAnimator()); |
| 299 scoped_setter.SetTransitionDuration( | 299 scoped_setter.SetTransitionDuration( |
| 300 base::TimeDelta::FromMilliseconds(kHopUpMS)); | 300 base::TimeDelta::FromMilliseconds(kHopUpMS)); |
| 301 } | 301 } |
| 302 state_ |= state; | 302 state_ |= state; |
| 303 UpdateState(); | 303 Layout(); |
| 304 if (state & STATE_ATTENTION) | 304 if (state & STATE_ATTENTION) |
| 305 bar_->ShowAttention(true); | 305 bar_->ShowAttention(true); |
| 306 } | 306 } |
| 307 } | 307 } |
| 308 | 308 |
| 309 void LauncherButton::ClearState(State state) { | 309 void LauncherButton::ClearState(State state) { |
| 310 if (state_ & state) { | 310 if (state_ & state) { |
| 311 if (!ShouldHop(state) || ShouldHop(state_)) { | 311 if (!ShouldHop(state) || ShouldHop(state_)) { |
| 312 ui::ScopedLayerAnimationSettings scoped_setter( | 312 ui::ScopedLayerAnimationSettings scoped_setter( |
| 313 icon_view_->layer()->GetAnimator()); | 313 icon_view_->layer()->GetAnimator()); |
| 314 scoped_setter.SetTweenType(ui::Tween::LINEAR); | 314 scoped_setter.SetTweenType(ui::Tween::LINEAR); |
| 315 scoped_setter.SetTransitionDuration( | 315 scoped_setter.SetTransitionDuration( |
| 316 base::TimeDelta::FromMilliseconds(kHopDownMS)); | 316 base::TimeDelta::FromMilliseconds(kHopDownMS)); |
| 317 } | 317 } |
| 318 state_ &= ~state; | 318 state_ &= ~state; |
| 319 UpdateState(); | 319 Layout(); |
| 320 if (state & STATE_ATTENTION) | 320 if (state & STATE_ATTENTION) |
| 321 bar_->ShowAttention(false); | 321 bar_->ShowAttention(false); |
| 322 } | 322 } |
| 323 } | 323 } |
| 324 | 324 |
| 325 gfx::Rect LauncherButton::GetIconBounds() const { | 325 gfx::Rect LauncherButton::GetIconBounds() const { |
| 326 return icon_view_->bounds(); | 326 return icon_view_->bounds(); |
| 327 } | 327 } |
| 328 | 328 |
| 329 void LauncherButton::ShowContextMenu(const gfx::Point& p, | 329 void LauncherButton::ShowContextMenu(const gfx::Point& p, |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 views::ImageView::TRAILING, | 520 views::ImageView::TRAILING, |
| 521 views::ImageView::CENTER, | 521 views::ImageView::CENTER, |
| 522 views::ImageView::CENTER, | 522 views::ImageView::CENTER, |
| 523 views::ImageView::LEADING)); | 523 views::ImageView::LEADING)); |
| 524 bar_->SchedulePaint(); | 524 bar_->SchedulePaint(); |
| 525 SchedulePaint(); | 525 SchedulePaint(); |
| 526 } | 526 } |
| 527 | 527 |
| 528 } // namespace internal | 528 } // namespace internal |
| 529 } // namespace ash | 529 } // namespace ash |
| OLD | NEW |