Chromium Code Reviews| 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 #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 kNotifierAcceleratorController, | |
| 25 kNotifierBattery, | 26 kNotifierBattery, |
| 26 kNotifierDisplay, | 27 kNotifierDisplay, |
| 27 kNotifierDisplayError, | 28 kNotifierDisplayError, |
| 28 #if defined(OS_CHROMEOS) | 29 #if defined(OS_CHROMEOS) |
| 29 ui::NetworkStateNotifier::kNotifierNetworkError, | 30 ui::NetworkStateNotifier::kNotifierNetworkError, |
| 30 kNotifierOobeScreen, | 31 kNotifierOobeScreen, |
| 31 #endif | 32 #endif |
| 32 kNotifierPower, | 33 kNotifierPower, |
| 33 // Note: Order doesn't matter here, so keep this in alphabetic order, don't | 34 // Note: Order doesn't matter here, so keep this in alphabetic order, don't |
| 34 // just add your stuff at the end! | 35 // just add your stuff at the end! |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 62 | 63 |
| 63 for (size_t i = 0; id_list[i] != NULL; ++i) { | 64 for (size_t i = 0; id_list[i] != NULL; ++i) { |
| 64 if (notifier_id.id == id_list[i]) | 65 if (notifier_id.id == id_list[i]) |
| 65 return true; | 66 return true; |
| 66 } | 67 } |
| 67 return false; | 68 return false; |
| 68 } | 69 } |
| 69 | 70 |
| 70 } // namespace | 71 } // namespace |
| 71 | 72 |
| 73 const char kNotifierAcceleratorController[] = "ash.accelerator-controller"; | |
|
oshima
2015/06/19 21:21:45
kNotifierDeprecatedAccelerator ?
afakhry
2015/06/19 22:14:19
Done.
| |
| 72 const char kNotifierBattery[] = "ash.battery"; | 74 const char kNotifierBattery[] = "ash.battery"; |
| 73 const char kNotifierBluetooth[] = "ash.bluetooth"; | 75 const char kNotifierBluetooth[] = "ash.bluetooth"; |
| 74 const char kNotifierDisplay[] = "ash.display"; | 76 const char kNotifierDisplay[] = "ash.display"; |
| 75 const char kNotifierDisplayError[] = "ash.display.error"; | 77 const char kNotifierDisplayError[] = "ash.display.error"; |
| 76 const char kNotifierDisplayResolutionChange[] = "ash.display.resolution-change"; | 78 const char kNotifierDisplayResolutionChange[] = "ash.display.resolution-change"; |
| 77 const char kNotifierLocale[] = "ash.locale"; | 79 const char kNotifierLocale[] = "ash.locale"; |
| 78 const char kNotifierMultiProfileFirstRun[] = "ash.multi-profile.first-run"; | 80 const char kNotifierMultiProfileFirstRun[] = "ash.multi-profile.first-run"; |
| 79 const char kNotifierNetworkPortalDetector[] = "ash.network.portal-detector"; | 81 const char kNotifierNetworkPortalDetector[] = "ash.network.portal-detector"; |
| 80 const char kNotifierOobeScreen[] = "ash.oobe-screen"; | 82 const char kNotifierOobeScreen[] = "ash.oobe-screen"; |
| 81 const char kNotifierPower[] = "ash.power"; | 83 const char kNotifierPower[] = "ash.power"; |
| 82 const char kNotifierScreenshot[] = "ash.screenshot"; | 84 const char kNotifierScreenshot[] = "ash.screenshot"; |
| 83 const char kNotifierScreenCapture[] = "ash.screen-capture"; | 85 const char kNotifierScreenCapture[] = "ash.screen-capture"; |
| 84 const char kNotifierScreenShare[] = "ash.screen-share"; | 86 const char kNotifierScreenShare[] = "ash.screen-share"; |
| 85 const char kNotifierSessionLengthTimeout[] = "ash.session-length-timeout"; | 87 const char kNotifierSessionLengthTimeout[] = "ash.session-length-timeout"; |
| 86 const char kNotifierSupervisedUser[] = "ash.locally-managed-user"; | 88 const char kNotifierSupervisedUser[] = "ash.locally-managed-user"; |
| 87 | 89 |
| 88 bool ShouldAlwaysShowPopups(const message_center::NotifierId& notifier_id) { | 90 bool ShouldAlwaysShowPopups(const message_center::NotifierId& notifier_id) { |
| 89 return MatchSystemNotifierId(notifier_id, kAlwaysShownSystemNotifierIds); | 91 return MatchSystemNotifierId(notifier_id, kAlwaysShownSystemNotifierIds); |
| 90 } | 92 } |
| 91 | 93 |
| 92 bool IsAshSystemNotifier(const message_center::NotifierId& notifier_id) { | 94 bool IsAshSystemNotifier(const message_center::NotifierId& notifier_id) { |
| 93 return ShouldAlwaysShowPopups(notifier_id) || | 95 return ShouldAlwaysShowPopups(notifier_id) || |
| 94 MatchSystemNotifierId(notifier_id, kAshSystemNotifiers); | 96 MatchSystemNotifierId(notifier_id, kAshSystemNotifiers); |
| 95 } | 97 } |
| 96 | 98 |
| 97 } // namespace system_notifier | 99 } // namespace system_notifier |
| 98 } // namespace ash | 100 } // namespace ash |
| OLD | NEW |