Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: ash/system/system_notifier.cc

Issue 2072013002: mash: Move tray settings and deps to common. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Undo 'git cl format' and nullptr changes. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #include "ash/system/system_notifier.h"
6
7 #include "base/logging.h"
8
9 #if defined(OS_CHROMEOS)
10 #include "ui/chromeos/network/network_state_notifier.h"
11 #endif
12
13 namespace ash {
14 namespace system_notifier {
15
16 namespace {
17
18 // See http://dev.chromium.org/chromium-os/chromiumos-design-docs/
19 // system-notifications for the reasoning.
20
21 // |kAlwaysShownSystemNotifierIds| is the list of system notification sources
22 // which can appear regardless of the situation, such like login screen or lock
23 // screen.
24 const char* kAlwaysShownSystemNotifierIds[] = {
25 kNotifierDeprecatedAccelerator,
26 kNotifierBattery,
27 kNotifierDisplay,
28 kNotifierDisplayError,
29 #if defined(OS_CHROMEOS)
30 ui::NetworkStateNotifier::kNotifierNetworkError,
31 #endif
32 kNotifierPower,
33 // Note: Order doesn't matter here, so keep this in alphabetic order, don't
34 // just add your stuff at the end!
35 NULL};
36
37 // |kAshSystemNotifiers| is the list of normal system notification sources for
38 // ash events. These notifications can be hidden in some context.
39 const char* kAshSystemNotifiers[] = {
40 kNotifierBluetooth,
41 kNotifierDisplayResolutionChange,
42 kNotifierLocale,
43 kNotifierMultiProfileFirstRun,
44 #if defined(OS_CHROMEOS)
45 ui::NetworkStateNotifier::kNotifierNetwork,
46 #endif
47 kNotifierNetworkPortalDetector,
48 kNotifierScreenshot,
49 kNotifierScreenCapture,
50 kNotifierScreenShare,
51 kNotifierSessionLengthTimeout,
52 kNotifierSupervisedUser,
53 kNotifierWebUsb,
54 // Note: Order doesn't matter here, so keep this in alphabetic order, don't
55 // just add your stuff at the end!
56 NULL
57 };
58
59 bool MatchSystemNotifierId(const message_center::NotifierId& notifier_id,
60 const char* id_list[]) {
61 if (notifier_id.type != message_center::NotifierId::SYSTEM_COMPONENT)
62 return false;
63
64 for (size_t i = 0; id_list[i] != NULL; ++i) {
65 if (notifier_id.id == id_list[i])
66 return true;
67 }
68 return false;
69 }
70
71 } // namespace
72
73 const char kNotifierBattery[] = "ash.battery";
74 const char kNotifierBluetooth[] = "ash.bluetooth";
75 const char kNotifierDeprecatedAccelerator[] = "ash.accelerator-controller";
76 const char kNotifierDisplay[] = "ash.display";
77 const char kNotifierDisplayError[] = "ash.display.error";
78 const char kNotifierDisplayResolutionChange[] = "ash.display.resolution-change";
79 const char kNotifierDualRole[] = "ash.dual-role";
80 const char kNotifierHats[] = "ash.hats";
81 const char kNotifierLocale[] = "ash.locale";
82 const char kNotifierMultiProfileFirstRun[] = "ash.multi-profile.first-run";
83 const char kNotifierNetworkPortalDetector[] = "ash.network.portal-detector";
84 const char kNotifierPower[] = "ash.power";
85 const char kNotifierScreenshot[] = "ash.screenshot";
86 const char kNotifierScreenCapture[] = "ash.screen-capture";
87 const char kNotifierScreenShare[] = "ash.screen-share";
88 const char kNotifierSessionLengthTimeout[] = "ash.session-length-timeout";
89 const char kNotifierSupervisedUser[] = "ash.locally-managed-user";
90 const char kNotifierWebUsb[] = "ash.webusb";
91
92 bool ShouldAlwaysShowPopups(const message_center::NotifierId& notifier_id) {
93 return MatchSystemNotifierId(notifier_id, kAlwaysShownSystemNotifierIds);
94 }
95
96 bool IsAshSystemNotifier(const message_center::NotifierId& notifier_id) {
97 return ShouldAlwaysShowPopups(notifier_id) ||
98 MatchSystemNotifierId(notifier_id, kAshSystemNotifiers);
99 }
100
101 } // namespace system_notifier
102 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698