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/common/system/system_notifier.h" | 5 #include "ash/common/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 { |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 // See http://dev.chromium.org/chromium-os/chromiumos-design-docs/ | 14 // See http://dev.chromium.org/chromium-os/chromiumos-design-docs/ |
15 // system-notifications for the reasoning. | 15 // system-notifications for the reasoning. |
16 | 16 |
17 // |kAlwaysShownSystemNotifierIds| is the list of system notification sources | 17 // |kAlwaysShownSystemNotifierIds| is the list of system notification sources |
18 // which can appear regardless of the situation, such like login screen or lock | 18 // which can appear regardless of the situation, such like login screen or lock |
19 // screen. | 19 // screen. |
20 const char* kAlwaysShownSystemNotifierIds[] = { | 20 const char* kAlwaysShownSystemNotifierIds[] = { |
21 kNotifierAccessibility, kNotifierDeprecatedAccelerator, kNotifierBattery, | 21 kNotifierAccessibility, kNotifierDeprecatedAccelerator, kNotifierBattery, |
22 kNotifierDisplay, kNotifierDisplayError, | 22 kNotifierDisplay, kNotifierDisplayError, kNotifierNetworkError, |
23 kNotifierNetworkError, | 23 kNotifierPower, kNotifierSms, |
24 kNotifierPower, | |
25 // Note: Order doesn't matter here, so keep this in alphabetic order, don't | 24 // Note: Order doesn't matter here, so keep this in alphabetic order, don't |
26 // just add your stuff at the end! | 25 // just add your stuff at the end! |
27 NULL}; | 26 NULL}; |
28 | 27 |
29 // |kAshSystemNotifiers| is the list of normal system notification sources for | 28 // |kAshSystemNotifiers| is the list of normal system notification sources for |
30 // ash events. These notifications can be hidden in some context. | 29 // ash events. These notifications can be hidden in some context. |
31 const char* kAshSystemNotifiers[] = { | 30 const char* kAshSystemNotifiers[] = { |
32 kNotifierBluetooth, kNotifierDisplayResolutionChange, kNotifierDisk, | 31 kNotifierBluetooth, kNotifierDisplayResolutionChange, kNotifierDisk, |
33 kNotifierLocale, kNotifierMultiProfileFirstRun, kNotifierNetwork, | 32 kNotifierLocale, kNotifierMultiProfileFirstRun, kNotifierNetwork, |
34 kNotifierNetworkPortalDetector, kNotifierScreenshot, kNotifierScreenCapture, | 33 kNotifierNetworkPortalDetector, kNotifierScreenshot, kNotifierScreenCapture, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 const char kNotifierMultiProfileFirstRun[] = "ash.multi-profile.first-run"; | 65 const char kNotifierMultiProfileFirstRun[] = "ash.multi-profile.first-run"; |
67 const char kNotifierNetwork[] = "ash.network"; | 66 const char kNotifierNetwork[] = "ash.network"; |
68 const char kNotifierNetworkError[] = "ash.network.error"; | 67 const char kNotifierNetworkError[] = "ash.network.error"; |
69 const char kNotifierNetworkPortalDetector[] = "ash.network.portal-detector"; | 68 const char kNotifierNetworkPortalDetector[] = "ash.network.portal-detector"; |
70 const char kNotifierPower[] = "ash.power"; | 69 const char kNotifierPower[] = "ash.power"; |
71 const char kNotifierQuickUnlock[] = "ash.quickunlock"; | 70 const char kNotifierQuickUnlock[] = "ash.quickunlock"; |
72 const char kNotifierScreenshot[] = "ash.screenshot"; | 71 const char kNotifierScreenshot[] = "ash.screenshot"; |
73 const char kNotifierScreenCapture[] = "ash.screen-capture"; | 72 const char kNotifierScreenCapture[] = "ash.screen-capture"; |
74 const char kNotifierScreenShare[] = "ash.screen-share"; | 73 const char kNotifierScreenShare[] = "ash.screen-share"; |
75 const char kNotifierSessionLengthTimeout[] = "ash.session-length-timeout"; | 74 const char kNotifierSessionLengthTimeout[] = "ash.session-length-timeout"; |
| 75 const char kNotifierSms[] = "ash.sms"; |
76 const char kNotifierSupervisedUser[] = "ash.locally-managed-user"; | 76 const char kNotifierSupervisedUser[] = "ash.locally-managed-user"; |
77 const char kNotifierWebUsb[] = "ash.webusb"; | 77 const char kNotifierWebUsb[] = "ash.webusb"; |
78 | 78 |
79 bool ShouldAlwaysShowPopups(const message_center::NotifierId& notifier_id) { | 79 bool ShouldAlwaysShowPopups(const message_center::NotifierId& notifier_id) { |
80 return MatchSystemNotifierId(notifier_id, kAlwaysShownSystemNotifierIds); | 80 return MatchSystemNotifierId(notifier_id, kAlwaysShownSystemNotifierIds); |
81 } | 81 } |
82 | 82 |
83 bool IsAshSystemNotifier(const message_center::NotifierId& notifier_id) { | 83 bool IsAshSystemNotifier(const message_center::NotifierId& notifier_id) { |
84 return ShouldAlwaysShowPopups(notifier_id) || | 84 return ShouldAlwaysShowPopups(notifier_id) || |
85 MatchSystemNotifierId(notifier_id, kAshSystemNotifiers); | 85 MatchSystemNotifierId(notifier_id, kAshSystemNotifiers); |
86 } | 86 } |
87 | 87 |
88 } // namespace system_notifier | 88 } // namespace system_notifier |
89 } // namespace ash | 89 } // namespace ash |
OLD | NEW |