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

Side by Side Diff: chrome/browser/status_icons/status_icon.cc

Issue 2435533004: Reduce usage of FOR_EACH_OBSERVER macro in chrome/browser/signin (Closed)
Patch Set: braces Created 4 years, 2 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
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 "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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/signin_manager_factory.cc ('k') | chrome/browser/status_icons/status_icon_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698