OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/system/system_notifier.h" | 5 #include "ash/system/system_notifier.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace ash { | 9 namespace ash { |
10 namespace system_notifier { | 10 namespace system_notifier { |
(...skipping 14 matching lines...) Expand all Loading... |
25 // just add your stuff at the end! | 25 // just add your stuff at the end! |
26 NULL}; | 26 NULL}; |
27 | 27 |
28 // |kAshSystemNotifiers| is the list of normal system notification sources for | 28 // |kAshSystemNotifiers| is the list of normal system notification sources for |
29 // ash events. These notifications can be hidden in some context. | 29 // ash events. These notifications can be hidden in some context. |
30 const char* kAshSystemNotifiers[] = { | 30 const char* kAshSystemNotifiers[] = { |
31 kNotifierBluetooth, kNotifierCapsLock, kNotifierDisplayResolutionChange, | 31 kNotifierBluetooth, kNotifierCapsLock, kNotifierDisplayResolutionChange, |
32 kNotifierDisk, kNotifierLocale, kNotifierMultiProfileFirstRun, | 32 kNotifierDisk, kNotifierLocale, kNotifierMultiProfileFirstRun, |
33 kNotifierNetwork, kNotifierNetworkPortalDetector, kNotifierScreenshot, | 33 kNotifierNetwork, kNotifierNetworkPortalDetector, kNotifierScreenshot, |
34 kNotifierScreenCapture, kNotifierScreenShare, kNotifierSessionLengthTimeout, | 34 kNotifierScreenCapture, kNotifierScreenShare, kNotifierSessionLengthTimeout, |
35 kNotifierSupervisedUser, kNotifierWebUsb, kNotifierSms, | 35 kNotifierSms, kNotifierSupervisedUser, kNotifierWebUsb, kNotifierWifiToggle, |
36 // Note: Order doesn't matter here, so keep this in alphabetic order, don't | 36 // Note: Order doesn't matter here, so keep this in alphabetic order, don't |
37 // just add your stuff at the end! | 37 // just add your stuff at the end! |
38 NULL}; | 38 NULL}; |
39 | 39 |
40 bool MatchSystemNotifierId(const message_center::NotifierId& notifier_id, | 40 bool MatchSystemNotifierId(const message_center::NotifierId& notifier_id, |
41 const char* id_list[]) { | 41 const char* id_list[]) { |
42 if (notifier_id.type != message_center::NotifierId::SYSTEM_COMPONENT) | 42 if (notifier_id.type != message_center::NotifierId::SYSTEM_COMPONENT) |
43 return false; | 43 return false; |
44 | 44 |
45 for (size_t i = 0; id_list[i] != NULL; ++i) { | 45 for (size_t i = 0; id_list[i] != NULL; ++i) { |
(...skipping 24 matching lines...) Expand all Loading... |
70 const char kNotifierNetworkPortalDetector[] = "ash.network.portal-detector"; | 70 const char kNotifierNetworkPortalDetector[] = "ash.network.portal-detector"; |
71 const char kNotifierPinUnlock[] = "ash.pinunlock"; | 71 const char kNotifierPinUnlock[] = "ash.pinunlock"; |
72 const char kNotifierPower[] = "ash.power"; | 72 const char kNotifierPower[] = "ash.power"; |
73 const char kNotifierScreenshot[] = "ash.screenshot"; | 73 const char kNotifierScreenshot[] = "ash.screenshot"; |
74 const char kNotifierScreenCapture[] = "ash.screen-capture"; | 74 const char kNotifierScreenCapture[] = "ash.screen-capture"; |
75 const char kNotifierScreenShare[] = "ash.screen-share"; | 75 const char kNotifierScreenShare[] = "ash.screen-share"; |
76 const char kNotifierSessionLengthTimeout[] = "ash.session-length-timeout"; | 76 const char kNotifierSessionLengthTimeout[] = "ash.session-length-timeout"; |
77 const char kNotifierSms[] = "ash.sms"; | 77 const char kNotifierSms[] = "ash.sms"; |
78 const char kNotifierSupervisedUser[] = "ash.locally-managed-user"; | 78 const char kNotifierSupervisedUser[] = "ash.locally-managed-user"; |
79 const char kNotifierWebUsb[] = "ash.webusb"; | 79 const char kNotifierWebUsb[] = "ash.webusb"; |
| 80 const char kNotifierWifiToggle[] = "ash.wifi-toggle"; |
80 | 81 |
81 bool ShouldAlwaysShowPopups(const message_center::NotifierId& notifier_id) { | 82 bool ShouldAlwaysShowPopups(const message_center::NotifierId& notifier_id) { |
82 return MatchSystemNotifierId(notifier_id, kAlwaysShownSystemNotifierIds); | 83 return MatchSystemNotifierId(notifier_id, kAlwaysShownSystemNotifierIds); |
83 } | 84 } |
84 | 85 |
85 bool IsAshSystemNotifier(const message_center::NotifierId& notifier_id) { | 86 bool IsAshSystemNotifier(const message_center::NotifierId& notifier_id) { |
86 return ShouldAlwaysShowPopups(notifier_id) || | 87 return ShouldAlwaysShowPopups(notifier_id) || |
87 MatchSystemNotifierId(notifier_id, kAshSystemNotifiers); | 88 MatchSystemNotifierId(notifier_id, kAshSystemNotifiers); |
88 } | 89 } |
89 | 90 |
90 } // namespace system_notifier | 91 } // namespace system_notifier |
91 } // namespace ash | 92 } // namespace ash |
OLD | NEW |