Commit c903aa21 authored by Kevin Strohbehn's avatar Kevin Strohbehn Committed by Commit Bot

Destroy touch controller when search box isn't being interacted with

Bug: 869638
Change-Id: Ifea913dd4df2c94487173e87eba2bd860802c6c9
Reviewed-on: https://chromium-review.googlesource.com/1168475
Commit-Queue: Kevin Strohbehn <ginko@google.com>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarWeidong Guo <weidongg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581926}
parent 2678f7c0
...@@ -588,6 +588,7 @@ void AppListView::HandleClickOrTap(ui::LocatedEvent* event) { ...@@ -588,6 +588,7 @@ void AppListView::HandleClickOrTap(ui::LocatedEvent* event) {
auto* const keyboard_controller = keyboard::KeyboardController::Get(); auto* const keyboard_controller = keyboard::KeyboardController::Get();
if (keyboard_controller->enabled() && if (keyboard_controller->enabled() &&
keyboard_controller->IsKeyboardVisible()) { keyboard_controller->IsKeyboardVisible()) {
search_box_view_->NotifyGestureEvent();
keyboard_controller->HideKeyboardByUser(); keyboard_controller->HideKeyboardByUser();
return; return;
} }
...@@ -1011,6 +1012,9 @@ void AppListView::OnGestureEvent(ui::GestureEvent* event) { ...@@ -1011,6 +1012,9 @@ void AppListView::OnGestureEvent(ui::GestureEvent* event) {
break; break;
case ui::ET_SCROLL_FLING_START: case ui::ET_SCROLL_FLING_START:
case ui::ET_GESTURE_SCROLL_BEGIN: case ui::ET_GESTURE_SCROLL_BEGIN:
// If the search box is active when we start our drag, let it know.
if (search_box_view_->is_search_box_active())
search_box_view_->NotifyGestureEvent();
// Avoid scrolling events for the app list in tablet mode. // Avoid scrolling events for the app list in tablet mode.
if (is_side_shelf_ || IsHomeLauncherEnabledInTabletMode()) if (is_side_shelf_ || IsHomeLauncherEnabledInTabletMode())
return; return;
......
...@@ -267,6 +267,8 @@ void SearchBoxViewBase::SetSearchBoxActive(bool active, ...@@ -267,6 +267,8 @@ void SearchBoxViewBase::SetSearchBoxActive(bool active,
if (active) { if (active) {
search_box_->RequestFocus(); search_box_->RequestFocus();
RecordSearchBoxActivationHistogram(event_type); RecordSearchBoxActivationHistogram(event_type);
} else {
search_box_->DestroyTouchSelection();
} }
search_box_right_space_->SetVisible(!active); search_box_right_space_->SetVisible(!active);
...@@ -311,6 +313,10 @@ void SearchBoxViewBase::OnMouseEvent(ui::MouseEvent* event) { ...@@ -311,6 +313,10 @@ void SearchBoxViewBase::OnMouseEvent(ui::MouseEvent* event) {
HandleSearchBoxEvent(event); HandleSearchBoxEvent(event);
} }
void SearchBoxViewBase::NotifyGestureEvent() {
search_box_->DestroyTouchSelection();
}
ax::mojom::Role SearchBoxViewBase::GetAccessibleWindowRole() const { ax::mojom::Role SearchBoxViewBase::GetAccessibleWindowRole() const {
// Default role of root view is ax::mojom::Role::kWindow which traps ChromeVox // Default role of root view is ax::mojom::Role::kWindow which traps ChromeVox
// focus within the root view. Assign ax::mojom::Role::kGroup here to allow // focus within the root view. Assign ax::mojom::Role::kGroup here to allow
......
...@@ -89,6 +89,10 @@ class SEARCH_BOX_EXPORT SearchBoxViewBase : public views::WidgetDelegateView, ...@@ -89,6 +89,10 @@ class SEARCH_BOX_EXPORT SearchBoxViewBase : public views::WidgetDelegateView,
void OnGestureEvent(ui::GestureEvent* event) override; void OnGestureEvent(ui::GestureEvent* event) override;
void OnMouseEvent(ui::MouseEvent* event) override; void OnMouseEvent(ui::MouseEvent* event) override;
// Allows for search box to be notified of gestures occurring outside, without
// deactivating the searchbox.
void NotifyGestureEvent();
// Overridden from views::WidgetDelegate: // Overridden from views::WidgetDelegate:
ax::mojom::Role GetAccessibleWindowRole() const override; ax::mojom::Role GetAccessibleWindowRole() const override;
bool ShouldAdvanceFocusToTopLevelWidget() const override; bool ShouldAdvanceFocusToTopLevelWidget() 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