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
3 // found in the LICENSE file.
5 #include "ash/system/system_notifier.h"
7 #include "base/logging.h"
9 #if defined(OS_CHROMEOS)
10 #include "ui/chromeos/network/network_state_notifier.h"
14 namespace system_notifier {
18 // See http://dev.chromium.org/chromium-os/chromiumos-design-docs/
19 // system-notifications for the reasoning.
20 const char* kAlwaysShownNotifierIds[] = {
22 kNotifierDisplayError,
23 #if defined(OS_CHROMEOS)
24 ui::NetworkStateNotifier::kNotifierNetworkError,
27 // Note: Order doesn't matter here, so keep this in alphabetic order, don't
28 // just add your stuff at the end!
32 const char* kAshSystemNotifiers[] = {
35 kNotifierDisplayError,
36 kNotifierDisplayResolutionChange,
38 kNotifierMultiProfileFirstRun,
39 #if defined(OS_CHROMEOS)
40 ui::NetworkStateNotifier::kNotifierNetwork,
41 ui::NetworkStateNotifier::kNotifierNetworkError,
43 kNotifierNetworkPortalDetector,
46 kNotifierScreenCapture,
48 kNotifierSessionLengthTimeout,
49 kNotifierSupervisedUser,
50 // Note: Order doesn't matter here, so keep this in alphabetic order, don't
51 // just add your stuff at the end!
55 bool MatchSystemNotifierId(const message_center::NotifierId& notifier_id,
56 const char* id_list[]) {
57 if (notifier_id.type != message_center::NotifierId::SYSTEM_COMPONENT)
60 for (size_t i = 0; id_list[i] != NULL; ++i) {
61 if (notifier_id.id == id_list[i])
69 const char kNotifierBluetooth[] = "ash.bluetooth";
70 const char kNotifierDisplay[] = "ash.display";
71 const char kNotifierDisplayError[] = "ash.display.error";
72 const char kNotifierDisplayResolutionChange[] = "ash.display.resolution-change";
73 const char kNotifierLocale[] = "ash.locale";
74 const char kNotifierMultiProfileFirstRun[] = "ash.multi-profile.first-run";
75 const char kNotifierNetworkPortalDetector[] = "ash.network.portal-detector";
76 const char kNotifierPower[] = "ash.power";
77 const char kNotifierScreenshot[] = "ash.screenshot";
78 const char kNotifierScreenCapture[] = "ash.screen-capture";
79 const char kNotifierScreenShare[] = "ash.screen-share";
80 const char kNotifierSessionLengthTimeout[] = "ash.session-length-timeout";
81 const char kNotifierSupervisedUser[] = "ash.locally-managed-user";
83 bool ShouldAlwaysShowPopups(const message_center::NotifierId& notifier_id) {
84 return MatchSystemNotifierId(notifier_id, kAlwaysShownNotifierIds);
87 bool IsAshSystemNotifier(const message_center::NotifierId& notifier_id) {
88 return MatchSystemNotifierId(notifier_id, kAshSystemNotifiers);
91 } // namespace system_notifier