Skip to content

Commit

Permalink
Scalable Status Area: Don't hide capslock notification on small screen.
Browse files Browse the repository at this point in the history
We still want to show capslock notification in small screen size since
the tray icon is not enabled here.

(cherry picked from commit 6521759)

Bug: 1161557
Change-Id: If70a727a6bf6c24f7f7493fab23a43799d0aec2c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2720503
Reviewed-by: Ahmed Mehfooz <amehfooz@chromium.org>
Commit-Queue: Andre Le <leandre@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#858150}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2738372
Cr-Commit-Position: refs/branch-heads/4430@{#175}
Cr-Branched-From: e5ce7dc-refs/heads/master@{#857950}
  • Loading branch information
Andre Le authored and Chromium LUCI CQ committed Mar 5, 2021
1 parent e43b72c commit b95dd89
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions ash/system/caps_lock_notification_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@
#include "ash/public/cpp/ash_features.h"
#include "ash/public/cpp/notification_utils.h"
#include "ash/resources/vector_icons/vector_icons.h"
#include "ash/root_window_controller.h"
#include "ash/session/session_controller_impl.h"
#include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/system/status_area_widget.h"
#include "ash/system/unified/unified_system_tray.h"
#include "ash/system/unified/unified_system_tray_model.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
#include "ui/base/l10n/l10n_util.h"
Expand All @@ -21,6 +25,7 @@

using message_center::MessageCenter;
using message_center::Notification;
using SystemTrayButtonSize = ash::UnifiedSystemTrayModel::SystemTrayButtonSize;

namespace ash {

Expand All @@ -46,9 +51,17 @@ std::unique_ptr<Notification> CreateNotification() {
message_center::SystemNotificationWarningLevel::NORMAL);
notification->set_pinned(true);

if (ash::features::IsScalableStatusAreaEnabled()) {
// Set the priority to low to prevent the notification showing as a popup
// because we already show an icon in tray for this in the feature.
SystemTrayButtonSize primary_tray_button_size =
Shell::GetPrimaryRootWindowController()
->GetStatusAreaWidget()
->unified_system_tray()
->model()
->GetSystemTrayButtonSize();
if (ash::features::IsScalableStatusAreaEnabled() &&
primary_tray_button_size != SystemTrayButtonSize::kSmall) {
// Set the priority to low to prevent the notification showing as a popup in
// medium or large size tray button because we already show an icon in tray
// for this in the feature.
notification->set_priority(message_center::LOW_PRIORITY);
}

Expand Down

0 comments on commit b95dd89

Please sign in to comment.