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"
10 namespace system_notifier
{
14 // See http://dev.chromium.org/chromium-os/chromiumos-design-docs/
15 // system-notifications for the reasoning.
16 const char* kAlwaysShownNotifierIds
[] = {
18 kNotifierDisplayError
,
19 kNotifierNetworkError
,
24 const char* kAshSystemNotifiers
[] = {
26 kNotifierDisplayResolutionChange
,
27 kNotifierDisplayError
,
29 kNotifierLocallyManagedUser
,
30 kNotifierMultiProfileFirstRun
,
32 kNotifierNetworkError
,
33 kNotifierNetworkPortalDetector
,
35 kNotifierScreenCapture
,
37 kNotifierSessionLengthTimeout
,
43 bool MatchSystemNotifierId(const message_center::NotifierId
& notifier_id
,
44 const char* id_list
[]) {
45 if (notifier_id
.type
!= message_center::NotifierId::SYSTEM_COMPONENT
)
48 for (size_t i
= 0; id_list
[i
] != NULL
; ++i
) {
49 if (notifier_id
.id
== id_list
[i
])
57 const char kNotifierBluetooth
[] = "ash.bluetooth";
58 const char kNotifierDisplay
[] = "ash.display";
59 const char kNotifierDisplayResolutionChange
[] = "ash.display.resolution-change";
60 const char kNotifierDisplayError
[] = "ash.display.error";
61 const char kNotifierLocale
[] = "ash.locale";
62 const char kNotifierLocallyManagedUser
[] = "ash.locally-managed-user";
63 const char kNotifierMultiProfileFirstRun
[] = "ash.multi-profile.first-run";
64 const char kNotifierNetwork
[] = "ash.network";
65 const char kNotifierNetworkError
[] = "ash.network.error";
66 const char kNotifierNetworkPortalDetector
[] = "ash.network.portal-detector";
67 const char kNotifierPower
[] = "ash.power";
68 const char kNotifierScreenshot
[] = "ash.screenshot";
69 const char kNotifierScreenCapture
[] = "ash.screen-capture";
70 const char kNotifierScreenShare
[] = "ash.screen-share";
71 const char kNotifierSessionLengthTimeout
[] = "ash.session-length-timeout";
73 bool ShouldAlwaysShowPopups(const message_center::NotifierId
& notifier_id
) {
74 return MatchSystemNotifierId(notifier_id
, kAlwaysShownNotifierIds
);
77 bool IsAshSystemNotifier(const message_center::NotifierId
& notifier_id
) {
78 return MatchSystemNotifierId(notifier_id
, kAshSystemNotifiers
);
81 } // namespace system_notifier