| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/wm/workspace/alternate_frame_caption_button.h" | 5 #include "ash/wm/workspace/alternate_frame_caption_button.h" |
| 6 | 6 |
| 7 #include "ui/base/animation/slide_animation.h" | 7 #include "ui/gfx/animation/slide_animation.h" |
| 8 #include "ui/gfx/canvas.h" | 8 #include "ui/gfx/canvas.h" |
| 9 | 9 |
| 10 namespace ash { | 10 namespace ash { |
| 11 | 11 |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 // The width and height of the region of the button which does not overlap | 14 // The width and height of the region of the button which does not overlap |
| 15 // with other buttons. | 15 // with other buttons. |
| 16 const int kSize = 32; | 16 const int kSize = 32; |
| 17 | 17 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 const char AlternateFrameCaptionButton::kViewClassName[] = | 89 const char AlternateFrameCaptionButton::kViewClassName[] = |
| 90 "AlternateFrameCaptionButton"; | 90 "AlternateFrameCaptionButton"; |
| 91 | 91 |
| 92 AlternateFrameCaptionButton::AlternateFrameCaptionButton( | 92 AlternateFrameCaptionButton::AlternateFrameCaptionButton( |
| 93 views::ButtonListener* listener, | 93 views::ButtonListener* listener, |
| 94 Action action) | 94 Action action) |
| 95 : views::CustomButton(listener), | 95 : views::CustomButton(listener), |
| 96 action_(action), | 96 action_(action), |
| 97 hidden_bubble_radius_(0), | 97 hidden_bubble_radius_(0), |
| 98 shown_bubble_radius_(0), | 98 shown_bubble_radius_(0), |
| 99 bubble_animation_(new ui::SlideAnimation(this)) { | 99 bubble_animation_(new gfx::SlideAnimation(this)) { |
| 100 } | 100 } |
| 101 | 101 |
| 102 AlternateFrameCaptionButton::~AlternateFrameCaptionButton() { | 102 AlternateFrameCaptionButton::~AlternateFrameCaptionButton() { |
| 103 } | 103 } |
| 104 | 104 |
| 105 // static | 105 // static |
| 106 int AlternateFrameCaptionButton::GetXOverlap() { | 106 int AlternateFrameCaptionButton::GetXOverlap() { |
| 107 return kFinalBurstBubbleRadius - kSize / 2; | 107 return kFinalBurstBubbleRadius - kSize / 2; |
| 108 } | 108 } |
| 109 | 109 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 // Else: The bubble is currently fading out. Wait till the hide animation | 209 // Else: The bubble is currently fading out. Wait till the hide animation |
| 210 // completes before starting an animation to show a new bubble. | 210 // completes before starting an animation to show a new bubble. |
| 211 } | 211 } |
| 212 } | 212 } |
| 213 | 213 |
| 214 void AlternateFrameCaptionButton::StateChanged() { | 214 void AlternateFrameCaptionButton::StateChanged() { |
| 215 MaybeStartNewBubbleAnimation(); | 215 MaybeStartNewBubbleAnimation(); |
| 216 } | 216 } |
| 217 | 217 |
| 218 void AlternateFrameCaptionButton::AnimationProgressed( | 218 void AlternateFrameCaptionButton::AnimationProgressed( |
| 219 const ui::Animation* animation) { | 219 const gfx::Animation* animation) { |
| 220 SchedulePaint(); | 220 SchedulePaint(); |
| 221 } | 221 } |
| 222 | 222 |
| 223 void AlternateFrameCaptionButton::AnimationEnded( | 223 void AlternateFrameCaptionButton::AnimationEnded( |
| 224 const ui::Animation* animation) { | 224 const gfx::Animation* animation) { |
| 225 // The bubble animation was postponed if the button became pressed when the | 225 // The bubble animation was postponed if the button became pressed when the |
| 226 // bubble was fading out. Do the animation now. | 226 // bubble was fading out. Do the animation now. |
| 227 MaybeStartNewBubbleAnimation(); | 227 MaybeStartNewBubbleAnimation(); |
| 228 } | 228 } |
| 229 | 229 |
| 230 } // namespace ash | 230 } // namespace ash |
| OLD | NEW |