Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: ash/launcher/launcher_button.cc

Issue 23190045: Switch ObserverList::size() to ObserverList::might_have_observers() Pt.1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pure merge Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ash/system/chromeos/network/network_icon_animation.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | ash/system/chromeos/network/network_icon_animation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698