Commit c28af2de authored by Tim Song's avatar Tim Song Committed by Commit Bot

Ash Tray: Stop rerouting key events when message center is activated.

The quick settings bubble currently intercepts all key events when it is not
activated, but this behaviour breaks text input for notifications in the new
message center bubble.

TEST=manually verified
BUG=1040738

Change-Id: Ib465fe7dee85ddd8a018c39197953de0ba79b844
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2001758Reviewed-by: default avatarYoshiki Iguchi <yoshiki@chromium.org>
Commit-Queue: Tim Song <tengs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#731822}
parent 2db632df
......@@ -239,4 +239,11 @@ void UnifiedMessageCenterBubble::OnWidgetDestroying(views::Widget* widget) {
tray_->CloseBubble();
}
void UnifiedMessageCenterBubble::OnWidgetActivationChanged(
views::Widget* widget,
bool active) {
if (active)
tray_->bubble()->OnMessageCenterActivated();
}
} // namespace ash
......@@ -74,6 +74,7 @@ class ASH_EXPORT UnifiedMessageCenterBubble : public TrayBubbleBase,
// views::WidgetObserver:
void OnWidgetDestroying(views::Widget* widget) override;
void OnWidgetActivationChanged(views::Widget* widget, bool active) override;
UnifiedMessageCenterView* message_center_view() {
return message_center_view_;
......
......@@ -351,6 +351,10 @@ bool TrayBubbleView::IsAnchoredToStatusArea() const {
return true;
}
void TrayBubbleView::StopReroutingEvents() {
reroute_event_handler_.reset();
}
ax::mojom::Role TrayBubbleView::GetAccessibleWindowRole() {
// We override the role because the base class sets it to alert dialog.
// This would make screen readers announce the whole of the system tray
......
......@@ -145,6 +145,10 @@ class ASH_EXPORT TrayBubbleView : public views::BubbleDialogDelegateView,
// area.
virtual bool IsAnchoredToStatusArea() const;
// Stops rerouting key events to this view. If this view is not currently
// rerouting events, then this function will be idempotent.
void StopReroutingEvents();
Delegate* delegate() { return delegate_; }
void set_gesture_dragging(bool dragging) { is_gesture_dragging_ = dragging; }
......
......@@ -285,6 +285,13 @@ void UnifiedSystemTrayBubble::FocusEntered(bool reverse) {
unified_view_->FocusEntered(reverse);
}
void UnifiedSystemTrayBubble::OnMessageCenterActivated() {
// When the message center is activated, we no longer need to reroute key
// events to this bubble. Otherwise, we interfere with notifications that may
// require key input like inline replies. See crbug.com/1040738.
bubble_view_->StopReroutingEvents();
}
void UnifiedSystemTrayBubble::OnDisplayConfigurationChanged() {
UpdateBubbleBounds();
}
......
......@@ -102,6 +102,9 @@ class ASH_EXPORT UnifiedSystemTrayBubble
// Inform UnifiedSystemTrayView of focus being acquired.
void FocusEntered(bool reverse);
// Called when the message center widget is activated.
void OnMessageCenterActivated();
// TrayBubbleBase:
TrayBackgroundView* GetTray() const override;
TrayBubbleView* GetBubbleView() const override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment