Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ash / system / system_notifier.cc
blob2910862a5a194ad27924408a55265ab5526cee1d
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 namespace ash {
10 namespace system_notifier {
12 namespace {
14 // See http://dev.chromium.org/chromium-os/chromiumos-design-docs/
15 // system-notifications for the reasoning.
16 const char* kAlwaysShownNotifierIds[] = {
17 kNotifierDisplay,
18 kNotifierDisplayError,
19 kNotifierNetworkError,
20 kNotifierPower,
21 // Note: Order doesn't matter here, so keep this in alphabetic order, don't
22 // just add your stuff at the end!
23 NULL
26 const char* kAshSystemNotifiers[] = {
27 kNotifierBluetooth,
28 kNotifierDisplay,
29 kNotifierDisplayError,
30 kNotifierDisplayResolutionChange,
31 kNotifierLocale,
32 kNotifierMultiProfileFirstRun,
33 kNotifierNetwork,
34 kNotifierNetworkError,
35 kNotifierNetworkPortalDetector,
36 kNotifierPower,
37 kNotifierScreenshot,
38 kNotifierScreenCapture,
39 kNotifierScreenShare,
40 kNotifierSessionLengthTimeout,
41 kNotifierSupervisedUser,
42 // Note: Order doesn't matter here, so keep this in alphabetic order, don't
43 // just add your stuff at the end!
44 NULL
47 bool MatchSystemNotifierId(const message_center::NotifierId& notifier_id,
48 const char* id_list[]) {
49 if (notifier_id.type != message_center::NotifierId::SYSTEM_COMPONENT)
50 return false;
52 for (size_t i = 0; id_list[i] != NULL; ++i) {
53 if (notifier_id.id == id_list[i])
54 return true;
56 return false;
59 } // namespace
61 const char kNotifierBluetooth[] = "ash.bluetooth";
62 const char kNotifierDisplay[] = "ash.display";
63 const char kNotifierDisplayError[] = "ash.display.error";
64 const char kNotifierDisplayResolutionChange[] = "ash.display.resolution-change";
65 const char kNotifierLocale[] = "ash.locale";
66 const char kNotifierMultiProfileFirstRun[] = "ash.multi-profile.first-run";
67 const char kNotifierNetwork[] = "ash.network";
68 const char kNotifierNetworkError[] = "ash.network.error";
69 const char kNotifierNetworkPortalDetector[] = "ash.network.portal-detector";
70 const char kNotifierPower[] = "ash.power";
71 const char kNotifierScreenshot[] = "ash.screenshot";
72 const char kNotifierScreenCapture[] = "ash.screen-capture";
73 const char kNotifierScreenShare[] = "ash.screen-share";
74 const char kNotifierSessionLengthTimeout[] = "ash.session-length-timeout";
75 const char kNotifierSupervisedUser[] = "ash.locally-managed-user";
77 bool ShouldAlwaysShowPopups(const message_center::NotifierId& notifier_id) {
78 return MatchSystemNotifierId(notifier_id, kAlwaysShownNotifierIds);
81 bool IsAshSystemNotifier(const message_center::NotifierId& notifier_id) {
82 return MatchSystemNotifierId(notifier_id, kAshSystemNotifiers);
85 } // namespace system_notifier
86 } // namespace ash