media: Specify WebRTC owners in media OWNERS file.
[chromium-blink-merge.git] / ash / system / system_notifier.cc
blob6bf6884ee446bcc12ca79f066d610083c3b68390
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"
11 #endif
13 namespace ash {
14 namespace system_notifier {
16 namespace {
18 // See http://dev.chromium.org/chromium-os/chromiumos-design-docs/
19 // system-notifications for the reasoning.
20 const char* kAlwaysShownNotifierIds[] = {
21 kNotifierDisplay,
22 kNotifierDisplayError,
23 #if defined(OS_CHROMEOS)
24 ui::NetworkStateNotifier::kNotifierNetworkError,
25 #endif
26 kNotifierPower,
27 // Note: Order doesn't matter here, so keep this in alphabetic order, don't
28 // just add your stuff at the end!
29 NULL
32 const char* kAshSystemNotifiers[] = {
33 kNotifierBluetooth,
34 kNotifierDisplay,
35 kNotifierDisplayError,
36 kNotifierDisplayResolutionChange,
37 kNotifierLocale,
38 kNotifierMultiProfileFirstRun,
39 #if defined(OS_CHROMEOS)
40 ui::NetworkStateNotifier::kNotifierNetwork,
41 ui::NetworkStateNotifier::kNotifierNetworkError,
42 #endif
43 kNotifierNetworkPortalDetector,
44 kNotifierPower,
45 kNotifierScreenshot,
46 kNotifierScreenCapture,
47 kNotifierScreenShare,
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!
52 NULL
55 bool MatchSystemNotifierId(const message_center::NotifierId& notifier_id,
56 const char* id_list[]) {
57 if (notifier_id.type != message_center::NotifierId::SYSTEM_COMPONENT)
58 return false;
60 for (size_t i = 0; id_list[i] != NULL; ++i) {
61 if (notifier_id.id == id_list[i])
62 return true;
64 return false;
67 } // namespace
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
92 } // namespace ash