Commit e5c4d21a authored by David Black's avatar David Black Committed by Commit Bot

Modify mini Assistant auto-hide behavior.

Previously, Assistant would auto-hide for any press event outside its
bounds or due to widget deactivation. Now, it will continue to do so
unless in mini state.

Bug: b:120291398
Change-Id: I06dff99094ad62782745d1f677f87744d4ad0307
Reviewed-on: https://chromium-review.googlesource.com/c/1357519
Commit-Queue: David Black <dmblack@google.com>
Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#613337}
parent 1e31da31
......@@ -76,12 +76,13 @@ void AssistantUiController::OnWidgetActivationChanged(views::Widget* widget,
bool active) {
if (active) {
container_view_->RequestFocus();
} else {
// When the Assistant widget is deactivated we should hide Assistant UI.
// We already handle press events happening outside of the UI container but
// this will also handle the case where we are deactivated without a press
// event occurring. This happens, for example, when launching Chrome OS
// feedback using keyboard shortcuts.
} else if (model_.ui_mode() != AssistantUiMode::kMiniUi) {
// When the Assistant widget is deactivated we should hide Assistant UI. We
// don't do this when in mini UI mode since Assistant in that state should
// not be obstructing much content. Note that we already handle press events
// happening outside of the UI container but this will also handle the case
// where we are deactivated without a press event occurring. This happens,
// for example, when launching Chrome OS feedback using keyboard shortcuts.
HideUi(AssistantExitPoint::kUnspecified);
}
}
......@@ -440,6 +441,13 @@ void AssistantUiController::OnEvent(const ui::Event& event) {
DCHECK(event.type() == ui::ET_MOUSE_PRESSED ||
event.type() == ui::ET_TOUCH_PRESSED);
// We're going to perform some checks below to see if the user has pressed
// outside of the Assistant or virtual keyboard bounds to hide UI for the
// user's convenience. When Assistant is in mini UI state, we shouldn't be
// obstructing much content so we can remain visible and quit early.
if (model_.ui_mode() == AssistantUiMode::kMiniUi)
return;
const ui::LocatedEvent* located_event = event.AsLocatedEvent();
const gfx::Point screen_location =
event.target() ? event.target()->GetScreenLocation(*located_event)
......
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