| Index: chrome/browser/chromeos/accessibility/select_to_speak_event_handler.cc
|
| diff --git a/chrome/browser/chromeos/accessibility/select_to_speak_event_handler.cc b/chrome/browser/chromeos/accessibility/select_to_speak_event_handler.cc
|
| index b9b9ba1577bc3fed3ace3960a068c5180831092b..40d7840550974c7d3377ab1d662b8fdc77a0a60f 100644
|
| --- a/chrome/browser/chromeos/accessibility/select_to_speak_event_handler.cc
|
| +++ b/chrome/browser/chromeos/accessibility/select_to_speak_event_handler.cc
|
| @@ -8,11 +8,12 @@
|
| #include "base/logging.h"
|
| #include "chrome/browser/speech/tts_controller.h"
|
| #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h"
|
| +#include "chrome/common/extensions/api/automation_api_constants.h"
|
| #include "content/public/browser/browser_thread.h"
|
| +#include "ui/accessibility/ax_tree_id_registry.h"
|
| #include "ui/aura/window.h"
|
| #include "ui/display/display.h"
|
| #include "ui/events/event.h"
|
| -#include "ui/views/focus/view_storage.h"
|
| #include "ui/views/view.h"
|
| #include "ui/views/widget/widget.h"
|
|
|
| @@ -121,42 +122,15 @@ void SelectToSpeakEventHandler::OnMouseEvent(ui::MouseEvent* event) {
|
|
|
| CancelEvent(event);
|
|
|
| - // Find the View to post the accessibility event on.
|
| - aura::Window* event_target = static_cast<aura::Window*>(event->target());
|
| - aura::Window* hit_window = event_target;
|
| - if (!hit_window)
|
| - return;
|
| -
|
| - views::Widget* hit_widget = views::Widget::GetWidgetForNativeView(hit_window);
|
| - while (!hit_widget) {
|
| - hit_window = hit_window->parent();
|
| - if (!hit_window)
|
| - break;
|
| -
|
| - hit_widget = views::Widget::GetWidgetForNativeView(hit_window);
|
| - }
|
| -
|
| - if (!hit_window || !hit_widget)
|
| - return;
|
| -
|
| - gfx::Point window_location = event->location();
|
| - aura::Window::ConvertPointToTarget(event_target, hit_window,
|
| - &window_location);
|
| -
|
| - views::View* root_view = hit_widget->GetRootView();
|
| - views::View* hit_view = root_view->GetEventHandlerForPoint(window_location);
|
| -
|
| - if (hit_view) {
|
| - // Send the accessibility event, then save the view so we can post the
|
| - // cancel event on the same view if possible.
|
| - hit_view->NotifyAccessibilityEvent(ax_event, true);
|
| - if (!last_view_storage_id_) {
|
| - last_view_storage_id_ =
|
| - views::ViewStorage::GetInstance()->CreateStorageID();
|
| - }
|
| - views::ViewStorage::GetInstance()->RemoveView(last_view_storage_id_);
|
| - views::ViewStorage::GetInstance()->StoreView(last_view_storage_id_,
|
| - hit_view);
|
| + ui::AXTreeIDRegistry* registry = ui::AXTreeIDRegistry::GetInstance();
|
| + ui::AXHostDelegate* delegate =
|
| + registry->GetHostDelegate(extensions::api::automation::kDesktopTreeID);
|
| + if (delegate) {
|
| + ui::AXActionData action;
|
| + action.action = ui::AX_ACTION_HIT_TEST;
|
| + action.target_point = event->root_location();
|
| + action.hit_test_event_to_fire = ax_event;
|
| + delegate->PerformAction(action);
|
| }
|
| }
|
|
|
| @@ -169,20 +143,8 @@ void SelectToSpeakEventHandler::CancelEvent(ui::Event* event) {
|
| }
|
|
|
| void SelectToSpeakEventHandler::SendCancelAXEvent() {
|
| - // If the user releases Search while the button is still down, cancel
|
| - // the Select-to-speak gesture. Try to post it on the same View that
|
| - // was last targeted, but if that's impossible, post it on the desktop.
|
| - views::View* last_view =
|
| - last_view_storage_id_
|
| - ? views::ViewStorage::GetInstance()->RetrieveView(
|
| - last_view_storage_id_)
|
| - : nullptr;
|
| - if (last_view) {
|
| - last_view->NotifyAccessibilityEvent(ui::AX_EVENT_MOUSE_CANCELED, true);
|
| - } else {
|
| - AutomationManagerAura::GetInstance()->HandleEvent(
|
| - nullptr, nullptr, ui::AX_EVENT_MOUSE_CANCELED);
|
| - }
|
| + AutomationManagerAura::GetInstance()->HandleEvent(
|
| + nullptr, nullptr, ui::AX_EVENT_MOUSE_CANCELED);
|
| }
|
|
|
| } // namespace chromeos
|
|
|