Skip to content

Commit

Permalink
Fix NotificationCenter activation
Browse files Browse the repository at this point in the history
We need to make sure a `TrayBubbleView` with
`set_can_activate_on_click_or_tap_` is set
as activatable on gesture taps and touch presses
along with mouse presses.

Bug: 329712701

(cherry picked from commit 44f48f1)

Change-Id: Iec1009a9d3f52619b0868a2d39afd4edb8720cca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5379168
Reviewed-by: Shuming Hao <shuminghao@google.com>
Commit-Queue: Ahmed Mehfooz <amehfooz@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1274576}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5383666
Cr-Commit-Position: refs/branch-heads/6367@{#43}
Cr-Branched-From: d158c6d-refs/heads/main@{#1274542}
  • Loading branch information
amehfooz32 authored and Chromium LUCI CQ committed Mar 20, 2024
1 parent 6f6236f commit ed2b09d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
19 changes: 7 additions & 12 deletions ash/system/tray/tray_bubble_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -252,24 +252,19 @@ void TrayBubbleView::RerouteEventHandler::OnKeyEvent(ui::KeyEvent* event) {
}
}

void TrayBubbleView::RerouteEventHandler::OnMouseEvent(
ui::MouseEvent* mouse_event) {
if (tray_bubble_view_->set_can_activate_on_click_or_tap_ &&
mouse_event->type() == ui::ET_MOUSE_PRESSED) {
tray_bubble_view_->SetCanActivate(true);
}
}

void TrayBubbleView::RerouteEventHandler::OnTouchEvent(
ui::TouchEvent* mouse_event) {
void TrayBubbleView::RerouteEventHandler::OnEvent(ui::Event* event) {
if (!tray_bubble_view_->set_can_activate_on_click_or_tap_) {
EventHandler::OnEvent(event);
return;
}

if (tray_bubble_view_->set_can_activate_on_click_or_tap_ &&
mouse_event->type() == ui::ET_MOUSE_PRESSED) {
if (event->type() == ui::ET_MOUSE_PRESSED ||
event->type() == ui::ET_TOUCH_PRESSED ||
event->type() == ui::ET_GESTURE_TAP) {
tray_bubble_view_->SetCanActivate(true);
}

EventHandler::OnEvent(event);
}

TrayBubbleView::TrayBubbleView(const InitParams& init_params)
Expand Down
3 changes: 1 addition & 2 deletions ash/system/tray/tray_bubble_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,7 @@ class ASH_EXPORT TrayBubbleView : public views::BubbleDialogDelegateView,

// Overridden from ui::EventHandler
void OnKeyEvent(ui::KeyEvent* event) override;
void OnMouseEvent(ui::MouseEvent* event) override;
void OnTouchEvent(ui::TouchEvent* event) override;
void OnEvent(ui::Event* event) override;

private:
// TrayBubbleView to which key events are going to be rerouted. Not owned.
Expand Down

0 comments on commit ed2b09d

Please sign in to comment.