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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 ui::ThrobAnimation& GetThrobAnimation() { | 90 ui::ThrobAnimation& GetThrobAnimation() { |
91 if (!animation_.is_animating()) { | 91 if (!animation_.is_animating()) { |
92 animation_.Reset(); | 92 animation_.Reset(); |
93 animation_.StartThrobbing(-1 /*throb indefinitely*/); | 93 animation_.StartThrobbing(-1 /*throb indefinitely*/); |
94 } | 94 } |
95 return animation_; | 95 return animation_; |
96 } | 96 } |
97 | 97 |
98 // ui::AnimationDelegate | 98 // ui::AnimationDelegate |
99 void AnimationProgressed(const ui::Animation* animation) { | 99 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE { |
100 if (animation != &animation_) | 100 if (animation != &animation_) |
101 return; | 101 return; |
102 if (!animation_.is_animating()) | 102 if (!animation_.is_animating()) |
103 return; | 103 return; |
104 FOR_EACH_OBSERVER(Observer, observers_, AnimationProgressed()); | 104 FOR_EACH_OBSERVER(Observer, observers_, AnimationProgressed()); |
105 } | 105 } |
106 | 106 |
107 ui::ThrobAnimation animation_; | 107 ui::ThrobAnimation animation_; |
108 ObserverList<Observer> observers_; | 108 ObserverList<Observer> observers_; |
109 | 109 |
110 DISALLOW_COPY_AND_ASSIGN(LauncherButtonAnimation); | 110 DISALLOW_COPY_AND_ASSIGN(LauncherButtonAnimation); |
111 }; | 111 }; |
112 | 112 |
113 } // namespace | 113 } // namespace |
114 | 114 |
115 namespace ash { | 115 namespace ash { |
116 namespace internal { | 116 namespace internal { |
117 | 117 |
118 //////////////////////////////////////////////////////////////////////////////// | 118 //////////////////////////////////////////////////////////////////////////////// |
119 // LauncherButton::BarView | 119 // LauncherButton::BarView |
120 | 120 |
121 class LauncherButton::BarView : public views::ImageView, | 121 class LauncherButton::BarView : public views::ImageView, |
122 public LauncherButtonAnimation::Observer { | 122 public LauncherButtonAnimation::Observer { |
123 public: | 123 public: |
124 BarView(LauncherButton* host) | 124 BarView(LauncherButton* host) |
125 : host_(host), | 125 : host_(host), |
126 show_attention_(false) { | 126 show_attention_(false) { |
127 } | 127 } |
128 | 128 |
129 ~BarView() { | 129 virtual ~BarView() { |
130 if (show_attention_) | 130 if (show_attention_) |
131 LauncherButtonAnimation::GetInstance()->RemoveObserver(this); | 131 LauncherButtonAnimation::GetInstance()->RemoveObserver(this); |
132 } | 132 } |
133 | 133 |
134 // View | 134 // View |
135 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE { | 135 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE { |
136 // Allow Mouse...() messages to go to the parent view. | 136 // Allow Mouse...() messages to go to the parent view. |
137 return false; | 137 return false; |
138 } | 138 } |
139 | 139 |
(...skipping 380 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 |