Chromium Code Reviews| 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::AddIMEObserver(IMEObserver* observer) { | |
|
msw
2016/06/21 01:27:24
nit: order after *clock*observer (to match decls)
James Cook
2016/06/21 17:31:01
Done.
| |
| 33 ime_observers_.AddObserver(observer); | |
| 34 } | |
| 35 | |
| 36 void WmSystemTrayNotifier::RemoveIMEObserver(IMEObserver* observer) { | |
| 37 ime_observers_.RemoveObserver(observer); | |
| 38 } | |
| 39 | |
| 27 void WmSystemTrayNotifier::AddClockObserver(ClockObserver* observer) { | 40 void WmSystemTrayNotifier::AddClockObserver(ClockObserver* observer) { |
| 28 clock_observers_.AddObserver(observer); | 41 clock_observers_.AddObserver(observer); |
| 29 } | 42 } |
| 30 | 43 |
| 31 void WmSystemTrayNotifier::RemoveClockObserver(ClockObserver* observer) { | 44 void WmSystemTrayNotifier::RemoveClockObserver(ClockObserver* observer) { |
| 32 clock_observers_.RemoveObserver(observer); | 45 clock_observers_.RemoveObserver(observer); |
| 33 } | 46 } |
| 34 | 47 |
| 35 void WmSystemTrayNotifier::AddUpdateObserver(UpdateObserver* observer) { | 48 void WmSystemTrayNotifier::AddUpdateObserver(UpdateObserver* observer) { |
| 36 update_observers_.AddObserver(observer); | 49 update_observers_.AddObserver(observer); |
| 37 } | 50 } |
| 38 | 51 |
| 39 void WmSystemTrayNotifier::RemoveUpdateObserver(UpdateObserver* observer) { | 52 void WmSystemTrayNotifier::RemoveUpdateObserver(UpdateObserver* observer) { |
| 40 update_observers_.RemoveObserver(observer); | 53 update_observers_.RemoveObserver(observer); |
| 41 } | 54 } |
| 42 | 55 |
| 56 #if defined(OS_CHROMEOS) | |
| 57 void WmSystemTrayNotifier::AddVirtualKeyboardObserver( | |
| 58 VirtualKeyboardObserver* observer) { | |
| 59 virtual_keyboard_observers_.AddObserver(observer); | |
| 60 } | |
| 61 | |
| 62 void WmSystemTrayNotifier::RemoveVirtualKeyboardObserver( | |
| 63 VirtualKeyboardObserver* observer) { | |
| 64 virtual_keyboard_observers_.RemoveObserver(observer); | |
| 65 } | |
| 66 #endif // defined(OS_CHROMEOS) | |
| 67 | |
| 43 void WmSystemTrayNotifier::NotifyAccessibilityModeChanged( | 68 void WmSystemTrayNotifier::NotifyAccessibilityModeChanged( |
| 44 AccessibilityNotificationVisibility notify) { | 69 AccessibilityNotificationVisibility notify) { |
| 45 FOR_EACH_OBSERVER(AccessibilityObserver, accessibility_observers_, | 70 FOR_EACH_OBSERVER(AccessibilityObserver, accessibility_observers_, |
| 46 OnAccessibilityModeChanged(notify)); | 71 OnAccessibilityModeChanged(notify)); |
| 47 } | 72 } |
| 48 | 73 |
| 49 void WmSystemTrayNotifier::NotifyRefreshClock() { | 74 void WmSystemTrayNotifier::NotifyRefreshClock() { |
| 50 FOR_EACH_OBSERVER(ClockObserver, clock_observers_, Refresh()); | 75 FOR_EACH_OBSERVER(ClockObserver, clock_observers_, Refresh()); |
| 51 } | 76 } |
| 52 | 77 |
| 78 void WmSystemTrayNotifier::NotifyRefreshIME() { | |
|
msw
2016/06/21 01:27:24
ditto nit: order after notify*clock
James Cook
2016/06/21 17:31:01
Done.
| |
| 79 FOR_EACH_OBSERVER(IMEObserver, ime_observers_, OnIMERefresh()); | |
| 80 } | |
| 81 | |
| 82 void WmSystemTrayNotifier::NotifyRefreshIMEMenu(bool is_active) { | |
| 83 FOR_EACH_OBSERVER(IMEObserver, ime_observers_, | |
| 84 OnIMEMenuActivationChanged(is_active)); | |
| 85 } | |
| 86 | |
| 53 void WmSystemTrayNotifier::NotifyDateFormatChanged() { | 87 void WmSystemTrayNotifier::NotifyDateFormatChanged() { |
| 54 FOR_EACH_OBSERVER(ClockObserver, clock_observers_, OnDateFormatChanged()); | 88 FOR_EACH_OBSERVER(ClockObserver, clock_observers_, OnDateFormatChanged()); |
| 55 } | 89 } |
| 56 | 90 |
| 57 void WmSystemTrayNotifier::NotifySystemClockTimeUpdated() { | 91 void WmSystemTrayNotifier::NotifySystemClockTimeUpdated() { |
| 58 FOR_EACH_OBSERVER(ClockObserver, clock_observers_, | 92 FOR_EACH_OBSERVER(ClockObserver, clock_observers_, |
| 59 OnSystemClockTimeUpdated()); | 93 OnSystemClockTimeUpdated()); |
| 60 } | 94 } |
| 61 | 95 |
| 62 void WmSystemTrayNotifier::NotifySystemClockCanSetTimeChanged( | 96 void WmSystemTrayNotifier::NotifySystemClockCanSetTimeChanged( |
| 63 bool can_set_time) { | 97 bool can_set_time) { |
| 64 FOR_EACH_OBSERVER(ClockObserver, clock_observers_, | 98 FOR_EACH_OBSERVER(ClockObserver, clock_observers_, |
| 65 OnSystemClockCanSetTimeChanged(can_set_time)); | 99 OnSystemClockCanSetTimeChanged(can_set_time)); |
| 66 } | 100 } |
| 67 | 101 |
| 68 void WmSystemTrayNotifier::NotifyUpdateRecommended(const UpdateInfo& info) { | 102 void WmSystemTrayNotifier::NotifyUpdateRecommended(const UpdateInfo& info) { |
| 69 FOR_EACH_OBSERVER(UpdateObserver, update_observers_, | 103 FOR_EACH_OBSERVER(UpdateObserver, update_observers_, |
| 70 OnUpdateRecommended(info)); | 104 OnUpdateRecommended(info)); |
| 71 } | 105 } |
| 72 | 106 |
| 107 #if defined(OS_CHROMEOS) | |
| 108 void WmSystemTrayNotifier::NotifyVirtualKeyboardSuppressionChanged( | |
| 109 bool suppressed) { | |
| 110 FOR_EACH_OBSERVER(VirtualKeyboardObserver, virtual_keyboard_observers_, | |
| 111 OnKeyboardSuppressionChanged(suppressed)); | |
| 112 } | |
| 113 #endif // defined(OS_CHROMEOS) | |
| 114 | |
| 73 } // namespace ash | 115 } // namespace ash |
| OLD | NEW |