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/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) | |
| 10 #include "ui/chromeos/network/network_state_notifier.h" | |
| 11 #endif | |
| 12 | |
| 13 namespace ash { | 9 namespace ash { |
| 14 namespace system_notifier { | 10 namespace system_notifier { |
| 15 | 11 |
| 16 namespace { | 12 namespace { |
| 17 | 13 |
| 18 // See http://dev.chromium.org/chromium-os/chromiumos-design-docs/ | 14 // See http://dev.chromium.org/chromium-os/chromiumos-design-docs/ |
| 19 // system-notifications for the reasoning. | 15 // system-notifications for the reasoning. |
| 20 | 16 |
| 21 // |kAlwaysShownSystemNotifierIds| is the list of system notification sources | 17 // |kAlwaysShownSystemNotifierIds| is the list of system notification sources |
| 22 // 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 |
| 23 // screen. | 19 // screen. |
| 24 const char* kAlwaysShownSystemNotifierIds[] = { | 20 const char* kAlwaysShownSystemNotifierIds[] = { |
| 25 kNotifierDeprecatedAccelerator, kNotifierBattery, kNotifierDisplay, | 21 kNotifierDeprecatedAccelerator, kNotifierBattery, kNotifierDisplay, |
| 26 kNotifierDisplayError, | 22 kNotifierDisplayError, |
| 27 #if defined(OS_CHROMEOS) | 23 #if defined(OS_CHROMEOS) |
| 28 ui::NetworkStateNotifier::kNotifierNetworkError, | 24 kNotifierNetworkError, |
| 29 #endif | 25 #endif |
| 30 kNotifierPower, | 26 kNotifierPower, |
| 31 // Note: Order doesn't matter here, so keep this in alphabetic order, don't | 27 // Note: Order doesn't matter here, so keep this in alphabetic order, don't |
| 32 // just add your stuff at the end! | 28 // just add your stuff at the end! |
| 33 NULL}; | 29 NULL}; |
| 34 | 30 |
| 35 // |kAshSystemNotifiers| is the list of normal system notification sources for | 31 // |kAshSystemNotifiers| is the list of normal system notification sources for |
| 36 // ash events. These notifications can be hidden in some context. | 32 // ash events. These notifications can be hidden in some context. |
| 37 const char* kAshSystemNotifiers[] = { | 33 const char* kAshSystemNotifiers[] = { |
| 38 kNotifierBluetooth, kNotifierDisplayResolutionChange, | 34 kNotifierBluetooth, kNotifierDisplayResolutionChange, |
| 39 #if defined(OS_CHROMEOS) | 35 #if defined(OS_CHROMEOS) |
| 40 kNotifierDisk, | 36 kNotifierDisk, |
| 41 #endif | 37 #endif |
| 42 kNotifierLocale, kNotifierMultiProfileFirstRun, | 38 kNotifierLocale, kNotifierMultiProfileFirstRun, |
| 43 #if defined(OS_CHROMEOS) | 39 #if defined(OS_CHROMEOS) |
| 44 ui::NetworkStateNotifier::kNotifierNetwork, | 40 kNotifierNetwork, |
| 45 #endif | 41 #endif |
| 46 kNotifierNetworkPortalDetector, kNotifierScreenshot, kNotifierScreenCapture, | 42 kNotifierNetworkPortalDetector, kNotifierScreenshot, kNotifierScreenCapture, |
| 47 kNotifierScreenShare, kNotifierSessionLengthTimeout, | 43 kNotifierScreenShare, kNotifierSessionLengthTimeout, |
| 48 kNotifierSupervisedUser, kNotifierWebUsb, | 44 kNotifierSupervisedUser, kNotifierWebUsb, |
| 49 // Note: Order doesn't matter here, so keep this in alphabetic order, don't | 45 // Note: Order doesn't matter here, so keep this in alphabetic order, don't |
| 50 // just add your stuff at the end! | 46 // just add your stuff at the end! |
| 51 NULL}; | 47 NULL}; |
| 52 | 48 |
| 53 bool MatchSystemNotifierId(const message_center::NotifierId& notifier_id, | 49 bool MatchSystemNotifierId(const message_center::NotifierId& notifier_id, |
| 54 const char* id_list[]) { | 50 const char* id_list[]) { |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 68 const char kNotifierBluetooth[] = "ash.bluetooth"; | 64 const char kNotifierBluetooth[] = "ash.bluetooth"; |
| 69 const char kNotifierDeprecatedAccelerator[] = "ash.accelerator-controller"; | 65 const char kNotifierDeprecatedAccelerator[] = "ash.accelerator-controller"; |
| 70 const char kNotifierDisk[] = "ash.disk"; | 66 const char kNotifierDisk[] = "ash.disk"; |
| 71 const char kNotifierDisplay[] = "ash.display"; | 67 const char kNotifierDisplay[] = "ash.display"; |
| 72 const char kNotifierDisplayError[] = "ash.display.error"; | 68 const char kNotifierDisplayError[] = "ash.display.error"; |
| 73 const char kNotifierDisplayResolutionChange[] = "ash.display.resolution-change"; | 69 const char kNotifierDisplayResolutionChange[] = "ash.display.resolution-change"; |
| 74 const char kNotifierDualRole[] = "ash.dual-role"; | 70 const char kNotifierDualRole[] = "ash.dual-role"; |
| 75 const char kNotifierHats[] = "ash.hats"; | 71 const char kNotifierHats[] = "ash.hats"; |
| 76 const char kNotifierLocale[] = "ash.locale"; | 72 const char kNotifierLocale[] = "ash.locale"; |
| 77 const char kNotifierMultiProfileFirstRun[] = "ash.multi-profile.first-run"; | 73 const char kNotifierMultiProfileFirstRun[] = "ash.multi-profile.first-run"; |
| 74 const char kNotifierNetwork[] = "ui.chromeos.network"; | |
|
James Cook
2016/10/20 00:11:43
Where are these declared?
stevenjb
2016/10/20 00:57:22
They are already in the header even though they we
| |
| 75 const char kNotifierNetworkError[] = "ui.chromeos.network.error"; | |
|
James Cook
2016/10/20 00:11:43
Also, should they still start with "ui.chromeos" o
stevenjb
2016/10/20 00:57:22
Renamed to ash.
| |
| 78 const char kNotifierNetworkPortalDetector[] = "ash.network.portal-detector"; | 76 const char kNotifierNetworkPortalDetector[] = "ash.network.portal-detector"; |
| 79 const char kNotifierPower[] = "ash.power"; | 77 const char kNotifierPower[] = "ash.power"; |
| 80 const char kNotifierQuickUnlock[] = "ash.quickunlock"; | 78 const char kNotifierQuickUnlock[] = "ash.quickunlock"; |
| 81 const char kNotifierScreenshot[] = "ash.screenshot"; | 79 const char kNotifierScreenshot[] = "ash.screenshot"; |
| 82 const char kNotifierScreenCapture[] = "ash.screen-capture"; | 80 const char kNotifierScreenCapture[] = "ash.screen-capture"; |
| 83 const char kNotifierScreenShare[] = "ash.screen-share"; | 81 const char kNotifierScreenShare[] = "ash.screen-share"; |
| 84 const char kNotifierSessionLengthTimeout[] = "ash.session-length-timeout"; | 82 const char kNotifierSessionLengthTimeout[] = "ash.session-length-timeout"; |
| 85 const char kNotifierSupervisedUser[] = "ash.locally-managed-user"; | 83 const char kNotifierSupervisedUser[] = "ash.locally-managed-user"; |
| 86 const char kNotifierWebUsb[] = "ash.webusb"; | 84 const char kNotifierWebUsb[] = "ash.webusb"; |
| 87 | 85 |
| 88 bool ShouldAlwaysShowPopups(const message_center::NotifierId& notifier_id) { | 86 bool ShouldAlwaysShowPopups(const message_center::NotifierId& notifier_id) { |
| 89 return MatchSystemNotifierId(notifier_id, kAlwaysShownSystemNotifierIds); | 87 return MatchSystemNotifierId(notifier_id, kAlwaysShownSystemNotifierIds); |
| 90 } | 88 } |
| 91 | 89 |
| 92 bool IsAshSystemNotifier(const message_center::NotifierId& notifier_id) { | 90 bool IsAshSystemNotifier(const message_center::NotifierId& notifier_id) { |
| 93 return ShouldAlwaysShowPopups(notifier_id) || | 91 return ShouldAlwaysShowPopups(notifier_id) || |
| 94 MatchSystemNotifierId(notifier_id, kAshSystemNotifiers); | 92 MatchSystemNotifierId(notifier_id, kAshSystemNotifiers); |
| 95 } | 93 } |
| 96 | 94 |
| 97 } // namespace system_notifier | 95 } // namespace system_notifier |
| 98 } // namespace ash | 96 } // namespace ash |
| OLD | NEW |