OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/common/system/tray/wm_system_tray_notifier.h" | 5 #include "ash/common/system/tray/wm_system_tray_notifier.h" |
6 | 6 |
7 #include "ash/common/system/accessibility_observer.h" | 7 #include "ash/common/system/accessibility_observer.h" |
8 #include "ash/common/system/date/clock_observer.h" | 8 #include "ash/common/system/date/clock_observer.h" |
9 #include "ash/common/system/ime/ime_observer.h" | |
9 #include "ash/common/system/update/update_observer.h" | 10 #include "ash/common/system/update/update_observer.h" |
10 | 11 |
12 #if defined(OS_CHROMEOS) | |
13 #include "ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_observer. h" | |
14 #endif | |
15 | |
11 namespace ash { | 16 namespace ash { |
12 | 17 |
13 WmSystemTrayNotifier::WmSystemTrayNotifier() {} | 18 WmSystemTrayNotifier::WmSystemTrayNotifier() {} |
14 | 19 |
15 WmSystemTrayNotifier::~WmSystemTrayNotifier() {} | 20 WmSystemTrayNotifier::~WmSystemTrayNotifier() {} |
16 | 21 |
17 void WmSystemTrayNotifier::AddAccessibilityObserver( | 22 void WmSystemTrayNotifier::AddAccessibilityObserver( |
18 AccessibilityObserver* observer) { | 23 AccessibilityObserver* observer) { |
19 accessibility_observers_.AddObserver(observer); | 24 accessibility_observers_.AddObserver(observer); |
20 } | 25 } |
21 | 26 |
22 void WmSystemTrayNotifier::RemoveAccessibilityObserver( | 27 void WmSystemTrayNotifier::RemoveAccessibilityObserver( |
23 AccessibilityObserver* observer) { | 28 AccessibilityObserver* observer) { |
24 accessibility_observers_.RemoveObserver(observer); | 29 accessibility_observers_.RemoveObserver(observer); |
25 } | 30 } |
26 | 31 |
32 void WmSystemTrayNotifier::NotifyAccessibilityModeChanged( | |
33 AccessibilityNotificationVisibility notify) { | |
34 FOR_EACH_OBSERVER(AccessibilityObserver, accessibility_observers_, | |
35 OnAccessibilityModeChanged(notify)); | |
36 } | |
37 | |
27 void WmSystemTrayNotifier::AddClockObserver(ClockObserver* observer) { | 38 void WmSystemTrayNotifier::AddClockObserver(ClockObserver* observer) { |
28 clock_observers_.AddObserver(observer); | 39 clock_observers_.AddObserver(observer); |
29 } | 40 } |
30 | 41 |
31 void WmSystemTrayNotifier::RemoveClockObserver(ClockObserver* observer) { | 42 void WmSystemTrayNotifier::RemoveClockObserver(ClockObserver* observer) { |
32 clock_observers_.RemoveObserver(observer); | 43 clock_observers_.RemoveObserver(observer); |
33 } | 44 } |
34 | 45 |
35 void WmSystemTrayNotifier::AddUpdateObserver(UpdateObserver* observer) { | |
36 update_observers_.AddObserver(observer); | |
37 } | |
38 | |
39 void WmSystemTrayNotifier::RemoveUpdateObserver(UpdateObserver* observer) { | |
40 update_observers_.RemoveObserver(observer); | |
41 } | |
42 | |
43 void WmSystemTrayNotifier::NotifyAccessibilityModeChanged( | |
44 AccessibilityNotificationVisibility notify) { | |
45 FOR_EACH_OBSERVER(AccessibilityObserver, accessibility_observers_, | |
46 OnAccessibilityModeChanged(notify)); | |
47 } | |
48 | |
49 void WmSystemTrayNotifier::NotifyRefreshClock() { | 46 void WmSystemTrayNotifier::NotifyRefreshClock() { |
50 FOR_EACH_OBSERVER(ClockObserver, clock_observers_, Refresh()); | 47 FOR_EACH_OBSERVER(ClockObserver, clock_observers_, Refresh()); |
51 } | 48 } |
52 | 49 |
53 void WmSystemTrayNotifier::NotifyDateFormatChanged() { | 50 void WmSystemTrayNotifier::NotifyDateFormatChanged() { |
54 FOR_EACH_OBSERVER(ClockObserver, clock_observers_, OnDateFormatChanged()); | 51 FOR_EACH_OBSERVER(ClockObserver, clock_observers_, OnDateFormatChanged()); |
55 } | 52 } |
56 | 53 |
57 void WmSystemTrayNotifier::NotifySystemClockTimeUpdated() { | 54 void WmSystemTrayNotifier::NotifySystemClockTimeUpdated() { |
58 FOR_EACH_OBSERVER(ClockObserver, clock_observers_, | 55 FOR_EACH_OBSERVER(ClockObserver, clock_observers_, |
59 OnSystemClockTimeUpdated()); | 56 OnSystemClockTimeUpdated()); |
60 } | 57 } |
61 | 58 |
62 void WmSystemTrayNotifier::NotifySystemClockCanSetTimeChanged( | 59 void WmSystemTrayNotifier::NotifySystemClockCanSetTimeChanged( |
63 bool can_set_time) { | 60 bool can_set_time) { |
64 FOR_EACH_OBSERVER(ClockObserver, clock_observers_, | 61 FOR_EACH_OBSERVER(ClockObserver, clock_observers_, |
65 OnSystemClockCanSetTimeChanged(can_set_time)); | 62 OnSystemClockCanSetTimeChanged(can_set_time)); |
66 } | 63 } |
67 | 64 |
65 void WmSystemTrayNotifier::AddIMEObserver(IMEObserver* observer) { | |
66 ime_observers_.AddObserver(observer); | |
67 } | |
68 | |
69 void WmSystemTrayNotifier::RemoveIMEObserver(IMEObserver* observer) { | |
70 ime_observers_.RemoveObserver(observer); | |
71 } | |
72 | |
73 void WmSystemTrayNotifier::NotifyRefreshIME() { | |
74 FOR_EACH_OBSERVER(IMEObserver, ime_observers_, OnIMERefresh()); | |
75 } | |
76 | |
77 void WmSystemTrayNotifier::NotifyRefreshIMEMenu(bool is_active) { | |
78 FOR_EACH_OBSERVER(IMEObserver, ime_observers_, | |
79 OnIMEMenuActivationChanged(is_active)); | |
80 } | |
81 | |
82 void WmSystemTrayNotifier::AddUpdateObserver(UpdateObserver* observer) { | |
83 update_observers_.AddObserver(observer); | |
84 } | |
85 | |
86 void WmSystemTrayNotifier::RemoveUpdateObserver(UpdateObserver* observer) { | |
87 update_observers_.RemoveObserver(observer); | |
88 } | |
89 | |
68 void WmSystemTrayNotifier::NotifyUpdateRecommended(const UpdateInfo& info) { | 90 void WmSystemTrayNotifier::NotifyUpdateRecommended(const UpdateInfo& info) { |
69 FOR_EACH_OBSERVER(UpdateObserver, update_observers_, | 91 FOR_EACH_OBSERVER(UpdateObserver, update_observers_, |
70 OnUpdateRecommended(info)); | 92 OnUpdateRecommended(info)); |
71 } | 93 } |
72 | 94 |
95 ///////////////////////////////////////////////////////////////////////// | |
msw
2016/06/21 17:50:20
optional nit: remove or make this 80 chars, perhap
James Cook
2016/06/21 17:59:54
I took out this decoration. I tried adding per-sec
| |
96 | |
97 #if defined(OS_CHROMEOS) | |
98 | |
99 void WmSystemTrayNotifier::AddVirtualKeyboardObserver( | |
100 VirtualKeyboardObserver* observer) { | |
101 virtual_keyboard_observers_.AddObserver(observer); | |
102 } | |
103 | |
104 void WmSystemTrayNotifier::RemoveVirtualKeyboardObserver( | |
105 VirtualKeyboardObserver* observer) { | |
106 virtual_keyboard_observers_.RemoveObserver(observer); | |
107 } | |
108 | |
109 void WmSystemTrayNotifier::NotifyVirtualKeyboardSuppressionChanged( | |
110 bool suppressed) { | |
111 FOR_EACH_OBSERVER(VirtualKeyboardObserver, virtual_keyboard_observers_, | |
112 OnKeyboardSuppressionChanged(suppressed)); | |
113 } | |
114 | |
115 #endif // defined(OS_CHROMEOS) | |
116 | |
73 } // namespace ash | 117 } // namespace ash |
OLD | NEW |