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 22 matching lines...) Expand all Loading... |
33 const int kIconSize = 32; | 33 const int kIconSize = 32; |
34 const int kHopSpacing = 2; | 34 const int kHopSpacing = 2; |
35 const int kIconPad = 8; | 35 const int kIconPad = 8; |
36 const int kAlternateIconPad = 5; | 36 const int kAlternateIconPad = 5; |
37 const int kAlternateIconPadVertical = 6; | 37 const int kAlternateIconPadVertical = 6; |
38 const int kHopUpMS = 0; | 38 const int kHopUpMS = 0; |
39 const int kHopDownMS = 200; | 39 const int kHopDownMS = 200; |
40 const int kAttentionThrobDurationMS = 800; | 40 const int kAttentionThrobDurationMS = 800; |
41 | 41 |
42 bool ShouldHop(int state) { | 42 bool ShouldHop(int state) { |
43 return state & ash::internal::ShelfButton::STATE_HOVERED || | 43 return state & ash::ShelfButton::STATE_HOVERED || |
44 state & ash::internal::ShelfButton::STATE_ACTIVE || | 44 state & ash::ShelfButton::STATE_ACTIVE || |
45 state & ash::internal::ShelfButton::STATE_FOCUSED; | 45 state & ash::ShelfButton::STATE_FOCUSED; |
46 } | 46 } |
47 | 47 |
48 // Simple AnimationDelegate that owns a single ThrobAnimation instance to | 48 // Simple AnimationDelegate that owns a single ThrobAnimation instance to |
49 // keep all Draw Attention animations in sync. | 49 // keep all Draw Attention animations in sync. |
50 class ShelfButtonAnimation : public gfx::AnimationDelegate { | 50 class ShelfButtonAnimation : public gfx::AnimationDelegate { |
51 public: | 51 public: |
52 class Observer { | 52 class Observer { |
53 public: | 53 public: |
54 virtual void AnimationProgressed() = 0; | 54 virtual void AnimationProgressed() = 0; |
55 | 55 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 109 |
110 gfx::ThrobAnimation animation_; | 110 gfx::ThrobAnimation animation_; |
111 ObserverList<Observer> observers_; | 111 ObserverList<Observer> observers_; |
112 | 112 |
113 DISALLOW_COPY_AND_ASSIGN(ShelfButtonAnimation); | 113 DISALLOW_COPY_AND_ASSIGN(ShelfButtonAnimation); |
114 }; | 114 }; |
115 | 115 |
116 } // namespace | 116 } // namespace |
117 | 117 |
118 namespace ash { | 118 namespace ash { |
119 namespace internal { | |
120 | 119 |
121 //////////////////////////////////////////////////////////////////////////////// | 120 //////////////////////////////////////////////////////////////////////////////// |
122 // ShelfButton::BarView | 121 // ShelfButton::BarView |
123 | 122 |
124 class ShelfButton::BarView : public views::ImageView, | 123 class ShelfButton::BarView : public views::ImageView, |
125 public ShelfButtonAnimation::Observer { | 124 public ShelfButtonAnimation::Observer { |
126 public: | 125 public: |
127 BarView(ShelfButton* host) | 126 BarView(ShelfButton* host) |
128 : host_(host), | 127 : host_(host), |
129 show_attention_(false) { | 128 show_attention_(false) { |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 views::ImageView::TRAILING, | 582 views::ImageView::TRAILING, |
584 views::ImageView::CENTER, | 583 views::ImageView::CENTER, |
585 views::ImageView::CENTER, | 584 views::ImageView::CENTER, |
586 views::ImageView::LEADING)); | 585 views::ImageView::LEADING)); |
587 bar_->SchedulePaint(); | 586 bar_->SchedulePaint(); |
588 } | 587 } |
589 | 588 |
590 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL); | 589 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL); |
591 } | 590 } |
592 | 591 |
593 } // namespace internal | |
594 } // namespace ash | 592 } // namespace ash |
OLD | NEW |