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 "chrome/browser/status_icons/status_icon.h" | 5 #include "chrome/browser/status_icons/status_icon.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "chrome/browser/status_icons/status_icon_observer.h" | 10 #include "chrome/browser/status_icons/status_icon_observer.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 void StatusIcon::RemoveObserver(StatusIconObserver* observer) { | 22 void StatusIcon::RemoveObserver(StatusIconObserver* observer) { |
23 observers_.RemoveObserver(observer); | 23 observers_.RemoveObserver(observer); |
24 } | 24 } |
25 | 25 |
26 bool StatusIcon::HasObservers() const { | 26 bool StatusIcon::HasObservers() const { |
27 return observers_.might_have_observers(); | 27 return observers_.might_have_observers(); |
28 } | 28 } |
29 | 29 |
30 void StatusIcon::DispatchClickEvent() { | 30 void StatusIcon::DispatchClickEvent() { |
31 FOR_EACH_OBSERVER(StatusIconObserver, observers_, OnStatusIconClicked()); | 31 for (StatusIconObserver& observer : observers_) |
| 32 observer.OnStatusIconClicked(); |
32 } | 33 } |
33 | 34 |
34 #if defined(OS_WIN) | 35 #if defined(OS_WIN) |
35 void StatusIcon::DispatchBalloonClickEvent() { | 36 void StatusIcon::DispatchBalloonClickEvent() { |
36 FOR_EACH_OBSERVER(StatusIconObserver, observers_, OnBalloonClicked()); | 37 for (StatusIconObserver& observer : observers_) |
| 38 observer.OnBalloonClicked(); |
37 } | 39 } |
38 #endif | 40 #endif |
39 | 41 |
40 void StatusIcon::ForceVisible() {} | 42 void StatusIcon::ForceVisible() {} |
41 | 43 |
42 void StatusIcon::SetContextMenu(std::unique_ptr<StatusIconMenuModel> menu) { | 44 void StatusIcon::SetContextMenu(std::unique_ptr<StatusIconMenuModel> menu) { |
43 // The UI may been showing a menu for the current model, don't destroy it | 45 // The UI may been showing a menu for the current model, don't destroy it |
44 // until we've notified the UI of the change. | 46 // until we've notified the UI of the change. |
45 std::unique_ptr<StatusIconMenuModel> old_menu = | 47 std::unique_ptr<StatusIconMenuModel> old_menu = |
46 std::move(context_menu_contents_); | 48 std::move(context_menu_contents_); |
47 context_menu_contents_ = std::move(menu); | 49 context_menu_contents_ = std::move(menu); |
48 UpdatePlatformContextMenu(context_menu_contents_.get()); | 50 UpdatePlatformContextMenu(context_menu_contents_.get()); |
49 } | 51 } |
OLD | NEW |