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/shelf/shelf_button.h" | 5 #include "ash/shelf/shelf_button.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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 gfx::ThrobAnimation& GetThrobAnimation() { | 83 gfx::ThrobAnimation& GetThrobAnimation() { |
84 if (!animation_.is_animating()) { | 84 if (!animation_.is_animating()) { |
85 animation_.Reset(); | 85 animation_.Reset(); |
86 animation_.StartThrobbing(-1 /*throb indefinitely*/); | 86 animation_.StartThrobbing(-1 /*throb indefinitely*/); |
87 } | 87 } |
88 return animation_; | 88 return animation_; |
89 } | 89 } |
90 | 90 |
91 // gfx::AnimationDelegate | 91 // gfx::AnimationDelegate |
92 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE { | 92 virtual void AnimationProgressed(const gfx::Animation* animation) override { |
93 if (animation != &animation_) | 93 if (animation != &animation_) |
94 return; | 94 return; |
95 if (!animation_.is_animating()) | 95 if (!animation_.is_animating()) |
96 return; | 96 return; |
97 FOR_EACH_OBSERVER(Observer, observers_, AnimationProgressed()); | 97 FOR_EACH_OBSERVER(Observer, observers_, AnimationProgressed()); |
98 } | 98 } |
99 | 99 |
100 gfx::ThrobAnimation animation_; | 100 gfx::ThrobAnimation animation_; |
101 ObserverList<Observer> observers_; | 101 ObserverList<Observer> observers_; |
102 | 102 |
(...skipping 16 matching lines...) Expand all Loading... |
119 // Make sure the events reach the parent view for handling. | 119 // Make sure the events reach the parent view for handling. |
120 set_interactive(false); | 120 set_interactive(false); |
121 } | 121 } |
122 | 122 |
123 virtual ~BarView() { | 123 virtual ~BarView() { |
124 if (show_attention_) | 124 if (show_attention_) |
125 ShelfButtonAnimation::GetInstance()->RemoveObserver(this); | 125 ShelfButtonAnimation::GetInstance()->RemoveObserver(this); |
126 } | 126 } |
127 | 127 |
128 // views::View: | 128 // views::View: |
129 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 129 virtual void OnPaint(gfx::Canvas* canvas) override { |
130 if (show_attention_) { | 130 if (show_attention_) { |
131 int alpha = ShelfButtonAnimation::GetInstance()->GetAlpha(); | 131 int alpha = ShelfButtonAnimation::GetInstance()->GetAlpha(); |
132 canvas->SaveLayerAlpha(alpha); | 132 canvas->SaveLayerAlpha(alpha); |
133 views::ImageView::OnPaint(canvas); | 133 views::ImageView::OnPaint(canvas); |
134 canvas->Restore(); | 134 canvas->Restore(); |
135 } else { | 135 } else { |
136 views::ImageView::OnPaint(canvas); | 136 views::ImageView::OnPaint(canvas); |
137 } | 137 } |
138 } | 138 } |
139 | 139 |
140 // ShelfButtonAnimation::Observer | 140 // ShelfButtonAnimation::Observer |
141 virtual void AnimationProgressed() OVERRIDE { | 141 virtual void AnimationProgressed() override { |
142 UpdateBounds(); | 142 UpdateBounds(); |
143 SchedulePaint(); | 143 SchedulePaint(); |
144 } | 144 } |
145 | 145 |
146 void SetBarBoundsRect(const gfx::Rect& bounds) { | 146 void SetBarBoundsRect(const gfx::Rect& bounds) { |
147 base_bounds_ = bounds; | 147 base_bounds_ = bounds; |
148 UpdateBounds(); | 148 UpdateBounds(); |
149 } | 149 } |
150 | 150 |
151 void ShowAttention(bool show) { | 151 void ShowAttention(bool show) { |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 views::ImageView::CENTER, | 541 views::ImageView::CENTER, |
542 views::ImageView::CENTER, | 542 views::ImageView::CENTER, |
543 views::ImageView::LEADING)); | 543 views::ImageView::LEADING)); |
544 bar_->SchedulePaint(); | 544 bar_->SchedulePaint(); |
545 } | 545 } |
546 | 546 |
547 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL); | 547 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL); |
548 } | 548 } |
549 | 549 |
550 } // namespace ash | 550 } // namespace ash |
OLD | NEW |