| 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 #if defined(OS_CHROMEOS) | 9 #if defined(OS_CHROMEOS) |
| 10 #include "ui/chromeos/network/network_state_notifier.h" | 10 #include "ui/chromeos/network/network_state_notifier.h" |
| 11 #endif | 11 #endif |
| 12 | 12 |
| 13 namespace ash { | 13 namespace ash { |
| 14 namespace system_notifier { | 14 namespace system_notifier { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 // See http://dev.chromium.org/chromium-os/chromiumos-design-docs/ | 18 // See http://dev.chromium.org/chromium-os/chromiumos-design-docs/ |
| 19 // system-notifications for the reasoning. | 19 // system-notifications for the reasoning. |
| 20 | 20 |
| 21 // |kAlwaysShownSystemNotifierIds| is the list of system notification sources | 21 // |kAlwaysShownSystemNotifierIds| is the list of system notification sources |
| 22 // which can appear regardless of the situation, such like login screen or lock | 22 // which can appear regardless of the situation, such like login screen or lock |
| 23 // screen. | 23 // screen. |
| 24 const char* kAlwaysShownSystemNotifierIds[] = { | 24 const char* kAlwaysShownSystemNotifierIds[] = { |
| 25 kNotifierDeprecatedAccelerator, | 25 kNotifierDeprecatedAccelerator, kNotifierBattery, kNotifierDisplay, |
| 26 kNotifierBattery, | |
| 27 kNotifierDisplay, | |
| 28 kNotifierDisplayError, | 26 kNotifierDisplayError, |
| 29 #if defined(OS_CHROMEOS) | 27 #if defined(OS_CHROMEOS) |
| 30 ui::NetworkStateNotifier::kNotifierNetworkError, | 28 ui::NetworkStateNotifier::kNotifierNetworkError, |
| 31 #endif | 29 #endif |
| 32 kNotifierPower, | 30 kNotifierPower, |
| 33 // Note: Order doesn't matter here, so keep this in alphabetic order, don't | 31 // Note: Order doesn't matter here, so keep this in alphabetic order, don't |
| 34 // just add your stuff at the end! | 32 // just add your stuff at the end! |
| 35 NULL}; | 33 NULL}; |
| 36 | 34 |
| 37 // |kAshSystemNotifiers| is the list of normal system notification sources for | 35 // |kAshSystemNotifiers| is the list of normal system notification sources for |
| 38 // ash events. These notifications can be hidden in some context. | 36 // ash events. These notifications can be hidden in some context. |
| 39 const char* kAshSystemNotifiers[] = { | 37 const char* kAshSystemNotifiers[] = { |
| 40 kNotifierBluetooth, | 38 kNotifierBluetooth, kNotifierDisplayResolutionChange, |
| 41 kNotifierDisplayResolutionChange, | |
| 42 #if defined(OS_CHROMEOS) | 39 #if defined(OS_CHROMEOS) |
| 43 kNotifierDisk, | 40 kNotifierDisk, |
| 44 #endif | 41 #endif |
| 45 kNotifierLocale, | 42 kNotifierLocale, kNotifierMultiProfileFirstRun, |
| 46 kNotifierMultiProfileFirstRun, | |
| 47 #if defined(OS_CHROMEOS) | 43 #if defined(OS_CHROMEOS) |
| 48 ui::NetworkStateNotifier::kNotifierNetwork, | 44 ui::NetworkStateNotifier::kNotifierNetwork, |
| 49 #endif | 45 #endif |
| 50 kNotifierNetworkPortalDetector, | 46 kNotifierNetworkPortalDetector, kNotifierScreenshot, kNotifierScreenCapture, |
| 51 kNotifierScreenshot, | 47 kNotifierScreenShare, kNotifierSessionLengthTimeout, |
| 52 kNotifierScreenCapture, | 48 kNotifierSupervisedUser, kNotifierWebUsb, |
| 53 kNotifierScreenShare, | 49 // Note: Order doesn't matter here, so keep this in alphabetic order, don't |
| 54 kNotifierSessionLengthTimeout, | 50 // just add your stuff at the end! |
| 55 kNotifierSupervisedUser, | 51 NULL}; |
| 56 kNotifierWebUsb, | |
| 57 // Note: Order doesn't matter here, so keep this in alphabetic order, don't | |
| 58 // just add your stuff at the end! | |
| 59 NULL | |
| 60 }; | |
| 61 | 52 |
| 62 bool MatchSystemNotifierId(const message_center::NotifierId& notifier_id, | 53 bool MatchSystemNotifierId(const message_center::NotifierId& notifier_id, |
| 63 const char* id_list[]) { | 54 const char* id_list[]) { |
| 64 if (notifier_id.type != message_center::NotifierId::SYSTEM_COMPONENT) | 55 if (notifier_id.type != message_center::NotifierId::SYSTEM_COMPONENT) |
| 65 return false; | 56 return false; |
| 66 | 57 |
| 67 for (size_t i = 0; id_list[i] != NULL; ++i) { | 58 for (size_t i = 0; id_list[i] != NULL; ++i) { |
| 68 if (notifier_id.id == id_list[i]) | 59 if (notifier_id.id == id_list[i]) |
| 69 return true; | 60 return true; |
| 70 } | 61 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 97 return MatchSystemNotifierId(notifier_id, kAlwaysShownSystemNotifierIds); | 88 return MatchSystemNotifierId(notifier_id, kAlwaysShownSystemNotifierIds); |
| 98 } | 89 } |
| 99 | 90 |
| 100 bool IsAshSystemNotifier(const message_center::NotifierId& notifier_id) { | 91 bool IsAshSystemNotifier(const message_center::NotifierId& notifier_id) { |
| 101 return ShouldAlwaysShowPopups(notifier_id) || | 92 return ShouldAlwaysShowPopups(notifier_id) || |
| 102 MatchSystemNotifierId(notifier_id, kAshSystemNotifiers); | 93 MatchSystemNotifierId(notifier_id, kAshSystemNotifiers); |
| 103 } | 94 } |
| 104 | 95 |
| 105 } // namespace system_notifier | 96 } // namespace system_notifier |
| 106 } // namespace ash | 97 } // namespace ash |
| OLD | NEW |