diff options
author | mukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-12 01:52:21 +0000 |
---|---|---|
committer | mukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-12 01:52:21 +0000 |
commit | b78d79a574bf2171b3d55b0fcb0274b99b6b0518 (patch) | |
tree | 546b6c5e081928295985973e7be2543a2b69437c /ash/system/system_notifier.cc | |
parent | 85ac048edc06d358ae5562aaf91e07a44db924a7 (diff) | |
download | chromium_src-b78d79a574bf2171b3d55b0fcb0274b99b6b0518.zip chromium_src-b78d79a574bf2171b3d55b0fcb0274b99b6b0518.tar.gz chromium_src-b78d79a574bf2171b3d55b0fcb0274b99b6b0518.tar.bz2 |
Introduces NotificationBlocker.
This CL replaces the existing blocking code by the new notification
blocker implementations. The new implementation detects the current
status more precisely, and each platform can implement different
blocking behaviors.
BUG=256404, 260060
TEST=covered by new tests
R=dewittj@chromium.org, stevenjb@chromium.org
Review URL: https://chromiumcodereview.appspot.com/23694021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@222698 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/system/system_notifier.cc')
-rw-r--r-- | ash/system/system_notifier.cc | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/ash/system/system_notifier.cc b/ash/system/system_notifier.cc index a765ee1..554c0f9 100644 --- a/ash/system/system_notifier.cc +++ b/ash/system/system_notifier.cc @@ -7,6 +7,19 @@ #include "base/logging.h" namespace ash { +namespace system_notifier { + +namespace { + +// See http://dev.chromium.org/chromium-os/chromiumos-design-docs/ +// system-notifications for the reasoning. +const AshSystemComponentNotifierType kAlwaysShownNotifierIds[] = { + NOTIFIER_DISPLAY, + NOTIFIER_DISPLAY_ERROR, + NOTIFIER_POWER, +}; + +} // namespace std::string SystemComponentTypeToString(AshSystemComponentNotifierType type) { if (type == NOTIFIER_SCREENSHOT) @@ -17,4 +30,16 @@ std::string SystemComponentTypeToString(AshSystemComponentNotifierType type) { return std::string(); } -} // namespace +bool ShouldAlwaysShowPopups(const message_center::NotifierId& notifier_id) { + if (notifier_id.type != message_center::NotifierId::SYSTEM_COMPONENT) + return false; + + for (size_t i = 0; i < arraysize(kAlwaysShownNotifierIds); ++i) { + if (notifier_id.system_component_type == kAlwaysShownNotifierIds[i]) + return true; + } + return false; +} + +} // namespace system_notifier +} // namespace ash |