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/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/launcher/launcher_button_host.h" | 10 #include "ash/launcher/launcher_button_host.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 static LauncherButtonAnimation* s_instance = new LauncherButtonAnimation(); | 60 static LauncherButtonAnimation* s_instance = new LauncherButtonAnimation(); |
61 return s_instance; | 61 return s_instance; |
62 } | 62 } |
63 | 63 |
64 void AddObserver(Observer* observer) { | 64 void AddObserver(Observer* observer) { |
65 observers_.AddObserver(observer); | 65 observers_.AddObserver(observer); |
66 } | 66 } |
67 | 67 |
68 void RemoveObserver(Observer* observer) { | 68 void RemoveObserver(Observer* observer) { |
69 observers_.RemoveObserver(observer); | 69 observers_.RemoveObserver(observer); |
70 if (observers_.size() == 0) | 70 if (!observers_.might_have_observers()) |
71 animation_.Stop(); | 71 animation_.Stop(); |
72 } | 72 } |
73 | 73 |
74 int GetAlpha() { | 74 int GetAlpha() { |
75 return GetThrobAnimation().CurrentValueBetween(0, 255); | 75 return GetThrobAnimation().CurrentValueBetween(0, 255); |
76 } | 76 } |
77 | 77 |
78 double GetAnimation() { | 78 double GetAnimation() { |
79 return GetThrobAnimation().GetCurrentValue(); | 79 return GetThrobAnimation().GetCurrentValue(); |
80 } | 80 } |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 shelf_layout_manager_->PrimaryAxisValue(views::ImageView::CENTER, | 562 shelf_layout_manager_->PrimaryAxisValue(views::ImageView::CENTER, |
563 views::ImageView::LEADING)); | 563 views::ImageView::LEADING)); |
564 icon_view_->SetVerticalAlignment( | 564 icon_view_->SetVerticalAlignment( |
565 shelf_layout_manager_->PrimaryAxisValue(views::ImageView::LEADING, | 565 shelf_layout_manager_->PrimaryAxisValue(views::ImageView::LEADING, |
566 views::ImageView::CENTER)); | 566 views::ImageView::CENTER)); |
567 SchedulePaint(); | 567 SchedulePaint(); |
568 } | 568 } |
569 | 569 |
570 } // namespace internal | 570 } // namespace internal |
571 } // namespace ash | 571 } // namespace ash |
OLD | NEW |