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