Commit 864dabc9 authored by James Cook's avatar James Cook Committed by Commit Bot

cros: Move some touch a11y code out of ui/chromeos into ash

Now that we have //ash/components we're trying to clean up //ui to get
it back to its original state of being low-level UI libraries.

This code was written during the Athena days (when we were trying to
avoid using ash). It is only used inside //ash, so move it there.

Bug: none
Test: ash_unittests, ui_chromeos_unittests
Change-Id: I2484d2d54a8ad99b855719c968708c3008ba52a0
Reviewed-on: https://chromium-review.googlesource.com/917439Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#536754}
parent b36af4e1
...@@ -66,6 +66,10 @@ component("ash") { ...@@ -66,6 +66,10 @@ component("ash") {
"accessibility/focus_ring_controller.h", "accessibility/focus_ring_controller.h",
"accessibility/focus_ring_layer.cc", "accessibility/focus_ring_layer.cc",
"accessibility/focus_ring_layer.h", "accessibility/focus_ring_layer.h",
"accessibility/touch_accessibility_enabler.cc",
"accessibility/touch_accessibility_enabler.h",
"accessibility/touch_exploration_controller.cc",
"accessibility/touch_exploration_controller.h",
"animation/animation_change_type.h", "animation/animation_change_type.h",
"app_list/app_list_delegate_impl.cc", "app_list/app_list_delegate_impl.cc",
"app_list/app_list_delegate_impl.h", "app_list/app_list_delegate_impl.h",
...@@ -1350,6 +1354,8 @@ test("ash_unittests") { ...@@ -1350,6 +1354,8 @@ test("ash_unittests") {
"accelerators/spoken_feedback_toggler_unittest.cc", "accelerators/spoken_feedback_toggler_unittest.cc",
"accessibility/accessibility_controller_unittest.cc", "accessibility/accessibility_controller_unittest.cc",
"accessibility/accessibility_focus_ring_controller_unittest.cc", "accessibility/accessibility_focus_ring_controller_unittest.cc",
"accessibility/touch_accessibility_enabler_unittest.cc",
"accessibility/touch_exploration_controller_unittest.cc",
"app_list/app_list_presenter_delegate_unittest.cc", "app_list/app_list_presenter_delegate_unittest.cc",
"ash_touch_exploration_manager_chromeos_unittest.cc", "ash_touch_exploration_manager_chromeos_unittest.cc",
"autoclick/autoclick_unittest.cc", "autoclick/autoclick_unittest.cc",
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "ui/chromeos/touch_accessibility_enabler.h" #include "ash/accessibility/touch_accessibility_enabler.h"
#include <math.h> #include <math.h>
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "ui/events/event_processor.h" #include "ui/events/event_processor.h"
#include "ui/events/event_utils.h" #include "ui/events/event_utils.h"
namespace ui { namespace ash {
namespace { namespace {
...@@ -147,7 +147,7 @@ void TouchAccessibilityEnabler::StartTimer() { ...@@ -147,7 +147,7 @@ void TouchAccessibilityEnabler::StartTimer() {
return; return;
timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kTimerDelayInMS), timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kTimerDelayInMS),
this, &ui::TouchAccessibilityEnabler::OnTimer); this, &TouchAccessibilityEnabler::OnTimer);
} }
void TouchAccessibilityEnabler::CancelTimer() { void TouchAccessibilityEnabler::CancelTimer() {
...@@ -184,4 +184,4 @@ void TouchAccessibilityEnabler::ResetToNoFingersDown() { ...@@ -184,4 +184,4 @@ void TouchAccessibilityEnabler::ResetToNoFingersDown() {
CancelTimer(); CancelTimer();
} }
} // namespace ui } // namespace ash
...@@ -2,15 +2,15 @@ ...@@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef UI_CHROMEOS_TOUCH_ACCESSIBILITY_ENABLER_H_ #ifndef ASH_ACCESSIBILITY_TOUCH_ACCESSIBILITY_ENABLER_H_
#define UI_CHROMEOS_TOUCH_ACCESSIBILITY_ENABLER_H_ #define ASH_ACCESSIBILITY_TOUCH_ACCESSIBILITY_ENABLER_H_
#include "ash/ash_export.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/time/tick_clock.h" #include "base/time/tick_clock.h"
#include "base/timer/timer.h" #include "base/timer/timer.h"
#include "base/values.h" #include "base/values.h"
#include "ui/chromeos/ui_chromeos_export.h"
#include "ui/events/event.h" #include "ui/events/event.h"
#include "ui/events/event_handler.h" #include "ui/events/event_handler.h"
#include "ui/events/gesture_detection/gesture_detector.h" #include "ui/events/gesture_detection/gesture_detector.h"
...@@ -19,11 +19,7 @@ namespace aura { ...@@ -19,11 +19,7 @@ namespace aura {
class Window; class Window;
} }
namespace ui { namespace ash {
class Event;
class EventHandler;
class TouchEvent;
// A delegate to handle commands in response to detected accessibility gesture // A delegate to handle commands in response to detected accessibility gesture
// events. // events.
...@@ -50,10 +46,10 @@ class TouchAccessibilityEnablerDelegate { ...@@ -50,10 +46,10 @@ class TouchAccessibilityEnablerDelegate {
// TouchAccessibilityEnabler triggers turning spoken feedback on or off // TouchAccessibilityEnabler triggers turning spoken feedback on or off
// by holding down two fingers on the touch screen for several seconds. // by holding down two fingers on the touch screen for several seconds.
class UI_CHROMEOS_EXPORT TouchAccessibilityEnabler : public ui::EventHandler { class ASH_EXPORT TouchAccessibilityEnabler : public ui::EventHandler {
public: public:
TouchAccessibilityEnabler(aura::Window* root_window, TouchAccessibilityEnabler(aura::Window* root_window,
ui::TouchAccessibilityEnablerDelegate* delegate); TouchAccessibilityEnablerDelegate* delegate);
~TouchAccessibilityEnabler() override; ~TouchAccessibilityEnabler() override;
bool IsInNoFingersDownForTesting() { return state_ == NO_FINGERS_DOWN; } bool IsInNoFingersDownForTesting() { return state_ == NO_FINGERS_DOWN; }
...@@ -109,7 +105,7 @@ class UI_CHROMEOS_EXPORT TouchAccessibilityEnabler : public ui::EventHandler { ...@@ -109,7 +105,7 @@ class UI_CHROMEOS_EXPORT TouchAccessibilityEnabler : public ui::EventHandler {
aura::Window* root_window_; aura::Window* root_window_;
// Called when we detect a long-press of two fingers. Not owned. // Called when we detect a long-press of two fingers. Not owned.
ui::TouchAccessibilityEnablerDelegate* delegate_; TouchAccessibilityEnablerDelegate* delegate_;
// The current state. // The current state.
State state_; State state_;
...@@ -140,6 +136,6 @@ class UI_CHROMEOS_EXPORT TouchAccessibilityEnabler : public ui::EventHandler { ...@@ -140,6 +136,6 @@ class UI_CHROMEOS_EXPORT TouchAccessibilityEnabler : public ui::EventHandler {
DISALLOW_COPY_AND_ASSIGN(TouchAccessibilityEnabler); DISALLOW_COPY_AND_ASSIGN(TouchAccessibilityEnabler);
}; };
} // namespace ui } // namespace ash
#endif // UI_CHROMEOS_TOUCH_ACCESSIBILITY_ENABLER_H_ #endif // ASH_ACCESSIBILITY_TOUCH_ACCESSIBILITY_ENABLER_H_
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "ui/chromeos/touch_accessibility_enabler.h" #include "ash/accessibility/touch_accessibility_enabler.h"
#include "ash/accessibility/touch_exploration_controller.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/test/simple_test_tick_clock.h" #include "base/test/simple_test_tick_clock.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "ui/aura/test/aura_test_base.h" #include "ui/aura/test/aura_test_base.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/chromeos/touch_exploration_controller.h"
#include "ui/events/event.h" #include "ui/events/event.h"
#include "ui/events/event_utils.h" #include "ui/events/event_utils.h"
#include "ui/events/gestures/gesture_provider_aura.h" #include "ui/events/gestures/gesture_provider_aura.h"
...@@ -17,12 +17,12 @@ ...@@ -17,12 +17,12 @@
#include "ui/events/test/events_test_utils.h" #include "ui/events/test/events_test_utils.h"
#include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/point.h"
namespace ui { namespace ash {
namespace { namespace {
class MockTouchAccessibilityEnablerDelegate class MockTouchAccessibilityEnablerDelegate
: public ui::TouchAccessibilityEnablerDelegate { : public TouchAccessibilityEnablerDelegate {
public: public:
MockTouchAccessibilityEnablerDelegate() {} MockTouchAccessibilityEnablerDelegate() {}
~MockTouchAccessibilityEnablerDelegate() override {} ~MockTouchAccessibilityEnablerDelegate() override {}
...@@ -60,7 +60,7 @@ class TouchAccessibilityEnablerTest : public aura::test::AuraTestBase { ...@@ -60,7 +60,7 @@ class TouchAccessibilityEnablerTest : public aura::test::AuraTestBase {
void SetUp() override { void SetUp() override {
aura::test::AuraTestBase::SetUp(); aura::test::AuraTestBase::SetUp();
generator_.reset(new test::EventGenerator(root_window())); generator_.reset(new ui::test::EventGenerator(root_window()));
simulated_clock_ = new base::SimpleTestTickClock(); simulated_clock_ = new base::SimpleTestTickClock();
// Tests fail if time is ever 0. // Tests fail if time is ever 0.
...@@ -85,7 +85,7 @@ class TouchAccessibilityEnablerTest : public aura::test::AuraTestBase { ...@@ -85,7 +85,7 @@ class TouchAccessibilityEnablerTest : public aura::test::AuraTestBase {
return simulated_clock_->NowTicks(); return simulated_clock_->NowTicks();
} }
std::unique_ptr<test::EventGenerator> generator_; std::unique_ptr<ui::test::EventGenerator> generator_;
// Owned by |ui|. // Owned by |ui|.
base::SimpleTestTickClock* simulated_clock_ = nullptr; base::SimpleTestTickClock* simulated_clock_ = nullptr;
MockTouchAccessibilityEnablerDelegate delegate_; MockTouchAccessibilityEnablerDelegate delegate_;
...@@ -223,4 +223,4 @@ TEST_F(TouchAccessibilityEnablerTest, MovingFingerPastSlopCancelsDetection) { ...@@ -223,4 +223,4 @@ TEST_F(TouchAccessibilityEnablerTest, MovingFingerPastSlopCancelsDetection) {
EXPECT_TRUE(enabler_->IsInWaitForNoFingersForTesting()); EXPECT_TRUE(enabler_->IsInWaitForNoFingersForTesting());
} }
} // namespace ui } // namespace ash
...@@ -2,15 +2,15 @@ ...@@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_ #ifndef ASH_ACCESSIBILITY_TOUCH_EXPLORATION_CONTROLLER_H_
#define UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_ #define ASH_ACCESSIBILITY_TOUCH_EXPLORATION_CONTROLLER_H_
#include "ash/ash_export.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/timer/timer.h" #include "base/timer/timer.h"
#include "base/values.h" #include "base/values.h"
#include "ui/accessibility/ax_enums.mojom.h" #include "ui/accessibility/ax_enums.mojom.h"
#include "ui/chromeos/ui_chromeos_export.h"
#include "ui/events/event.h" #include "ui/events/event.h"
#include "ui/events/event_rewriter.h" #include "ui/events/event_rewriter.h"
#include "ui/events/gesture_detection/gesture_detector.h" #include "ui/events/gesture_detection/gesture_detector.h"
...@@ -22,12 +22,15 @@ class Window; ...@@ -22,12 +22,15 @@ class Window;
} }
namespace ui { namespace ui {
class Event; class Event;
class GestureEvent; class GestureEvent;
class GestureProviderAura; class GestureProviderAura;
class TouchAccessibilityEnabler;
class TouchEvent; class TouchEvent;
} // namespace ui
namespace ash {
class TouchAccessibilityEnabler;
// A delegate to handle commands in response to detected accessibility gesture // A delegate to handle commands in response to detected accessibility gesture
// events. // events.
...@@ -179,14 +182,14 @@ class TouchExplorationControllerDelegate { ...@@ -179,14 +182,14 @@ class TouchExplorationControllerDelegate {
// //
// The caller is expected to retain ownership of instances of this class and // The caller is expected to retain ownership of instances of this class and
// destroy them before |root_window| is destroyed. // destroy them before |root_window| is destroyed.
class UI_CHROMEOS_EXPORT TouchExplorationController class ASH_EXPORT TouchExplorationController
: public ui::EventRewriter, : public ui::EventRewriter,
public ui::GestureProviderAuraClient, public ui::GestureProviderAuraClient,
public ui::GestureConsumer { public ui::GestureConsumer {
public: public:
explicit TouchExplorationController( explicit TouchExplorationController(
aura::Window* root_window, aura::Window* root_window,
ui::TouchExplorationControllerDelegate* delegate, TouchExplorationControllerDelegate* delegate,
base::WeakPtr<TouchAccessibilityEnabler> touch_accessibility_enabler); base::WeakPtr<TouchAccessibilityEnabler> touch_accessibility_enabler);
~TouchExplorationController() override; ~TouchExplorationController() override;
...@@ -462,7 +465,7 @@ class UI_CHROMEOS_EXPORT TouchExplorationController ...@@ -462,7 +465,7 @@ class UI_CHROMEOS_EXPORT TouchExplorationController
aura::Window* root_window_; aura::Window* root_window_;
// Handles volume control. Not owned. // Handles volume control. Not owned.
ui::TouchExplorationControllerDelegate* delegate_; TouchExplorationControllerDelegate* delegate_;
// A set of touch ids for fingers currently touching the screen. // A set of touch ids for fingers currently touching the screen.
std::vector<int> current_touch_ids_; std::vector<int> current_touch_ids_;
...@@ -553,6 +556,6 @@ class UI_CHROMEOS_EXPORT TouchExplorationController ...@@ -553,6 +556,6 @@ class UI_CHROMEOS_EXPORT TouchExplorationController
DISALLOW_COPY_AND_ASSIGN(TouchExplorationController); DISALLOW_COPY_AND_ASSIGN(TouchExplorationController);
}; };
} // namespace ui } // namespace ash
#endif // UI_CHROMEOS_TOUCH_EXPLORATION_CONTROLLER_H_ #endif // ASH_ACCESSIBILITY_TOUCH_EXPLORATION_CONTROLLER_H_
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "ui/chromeos/touch_exploration_controller.h" #include "ash/accessibility/touch_exploration_controller.h"
#include <math.h> #include <math.h>
#include <stddef.h> #include <stddef.h>
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
using EventList = std::vector<std::unique_ptr<ui::Event>>; using EventList = std::vector<std::unique_ptr<ui::Event>>;
namespace ui { namespace ash {
namespace { namespace {
...@@ -39,9 +39,7 @@ class EventCapturer : public ui::EventHandler { ...@@ -39,9 +39,7 @@ class EventCapturer : public ui::EventHandler {
EventCapturer() {} EventCapturer() {}
~EventCapturer() override {} ~EventCapturer() override {}
void Reset() { void Reset() { events_.clear(); }
events_.clear();
}
void OnEvent(ui::Event* event) override { void OnEvent(ui::Event* event) override {
if (event->IsMouseEvent() || event->IsTouchEvent() || if (event->IsMouseEvent() || event->IsTouchEvent() ||
...@@ -75,7 +73,7 @@ int Factorial(int n) { ...@@ -75,7 +73,7 @@ int Factorial(int n) {
} }
class MockTouchExplorationControllerDelegate class MockTouchExplorationControllerDelegate
: public ui::TouchExplorationControllerDelegate { : public TouchExplorationControllerDelegate {
public: public:
void SetOutputLevel(int volume) override { void SetOutputLevel(int volume) override {
volume_changes_.push_back(volume); volume_changes_.push_back(volume);
...@@ -217,7 +215,7 @@ class TouchExplorationTest : public aura::test::AuraTestBase { ...@@ -217,7 +215,7 @@ class TouchExplorationTest : public aura::test::AuraTestBase {
aura::test::AuraTestBase::SetUp(); aura::test::AuraTestBase::SetUp();
cursor_client_.reset(new aura::test::TestCursorClient(root_window())); cursor_client_.reset(new aura::test::TestCursorClient(root_window()));
root_window()->AddPreTargetHandler(&event_capturer_); root_window()->AddPreTargetHandler(&event_capturer_);
generator_.reset(new test::EventGenerator(root_window())); generator_.reset(new ui::test::EventGenerator(root_window()));
simulated_clock_ = new base::SimpleTestTickClock(); simulated_clock_ = new base::SimpleTestTickClock();
// Tests fail if time is ever 0. // Tests fail if time is ever 0.
...@@ -249,8 +247,7 @@ class TouchExplorationTest : public aura::test::AuraTestBase { ...@@ -249,8 +247,7 @@ class TouchExplorationTest : public aura::test::AuraTestBase {
const EventList& all_events = GetCapturedEvents(); const EventList& all_events = GetCapturedEvents();
std::vector<ui::LocatedEvent*> located_events; std::vector<ui::LocatedEvent*> located_events;
for (size_t i = 0; i < all_events.size(); ++i) { for (size_t i = 0; i < all_events.size(); ++i) {
if (all_events[i]->IsMouseEvent() || if (all_events[i]->IsMouseEvent() || all_events[i]->IsTouchEvent() ||
all_events[i]->IsTouchEvent() ||
all_events[i]->IsGestureEvent()) { all_events[i]->IsGestureEvent()) {
located_events.push_back( located_events.push_back(
static_cast<ui::LocatedEvent*>(all_events[i].get())); static_cast<ui::LocatedEvent*>(all_events[i].get()));
...@@ -279,9 +276,7 @@ class TouchExplorationTest : public aura::test::AuraTestBase { ...@@ -279,9 +276,7 @@ class TouchExplorationTest : public aura::test::AuraTestBase {
return events; return events;
} }
void ClearCapturedEvents() { void ClearCapturedEvents() { event_capturer_.Reset(); }
event_capturer_.Reset();
}
void AdvanceSimulatedTimePastTapDelay() { void AdvanceSimulatedTimePastTapDelay() {
simulated_clock_->Advance(gesture_detector_config_.double_tap_timeout); simulated_clock_->Advance(gesture_detector_config_.double_tap_timeout);
...@@ -307,10 +302,8 @@ class TouchExplorationTest : public aura::test::AuraTestBase { ...@@ -307,10 +302,8 @@ class TouchExplorationTest : public aura::test::AuraTestBase {
if (!on && touch_exploration_controller_.get()) { if (!on && touch_exploration_controller_.get()) {
touch_exploration_controller_.reset(); touch_exploration_controller_.reset();
} else if (on && !touch_exploration_controller_.get()) { } else if (on && !touch_exploration_controller_.get()) {
touch_exploration_controller_.reset( touch_exploration_controller_.reset(new TouchExplorationControllerTestApi(
new ui::TouchExplorationControllerTestApi( new TouchExplorationController(root_window(), &delegate_, nullptr)));
new TouchExplorationController(root_window(), &delegate_,
nullptr)));
cursor_client()->ShowCursor(); cursor_client()->ShowCursor();
cursor_client()->DisableMouseEvents(); cursor_client()->DisableMouseEvents();
} }
...@@ -374,8 +367,7 @@ class TouchExplorationTest : public aura::test::AuraTestBase { ...@@ -374,8 +367,7 @@ class TouchExplorationTest : public aura::test::AuraTestBase {
bool IsInTouchToMouseMode() { bool IsInTouchToMouseMode() {
aura::client::CursorClient* cursor_client = aura::client::CursorClient* cursor_client =
aura::client::GetCursorClient(root_window()); aura::client::GetCursorClient(root_window());
return cursor_client && return cursor_client && cursor_client->IsMouseEventsEnabled() &&
cursor_client->IsMouseEventsEnabled() &&
!cursor_client->IsCursorVisible(); !cursor_client->IsCursorVisible();
} }
...@@ -427,7 +419,7 @@ class TouchExplorationTest : public aura::test::AuraTestBase { ...@@ -427,7 +419,7 @@ class TouchExplorationTest : public aura::test::AuraTestBase {
touch_exploration_controller_->SetLiftActivationBounds(bounds); touch_exploration_controller_->SetLiftActivationBounds(bounds);
} }
std::unique_ptr<test::EventGenerator> generator_; std::unique_ptr<ui::test::EventGenerator> generator_;
ui::GestureDetector::Config gesture_detector_config_; ui::GestureDetector::Config gesture_detector_config_;
// Owned by |ui|. // Owned by |ui|.
base::SimpleTestTickClock* simulated_clock_; base::SimpleTestTickClock* simulated_clock_;
...@@ -1380,20 +1372,20 @@ TEST_F(TouchExplorationTest, DISABLED_AllFingerPermutations) { ...@@ -1380,20 +1372,20 @@ TEST_F(TouchExplorationTest, DISABLED_AllFingerPermutations) {
// A copy of all events list which can be modified without destrying events. // A copy of all events list which can be modified without destrying events.
std::vector<ui::TouchEvent*> queued_events; std::vector<ui::TouchEvent*> queued_events;
for (int touch_id = 0; touch_id < 3; touch_id++){ for (int touch_id = 0; touch_id < 3; touch_id++) {
int x = 10*touch_id + 1; int x = 10 * touch_id + 1;
int y = 10*touch_id + 2; int y = 10 * touch_id + 2;
all_events.push_back(std::make_unique<TouchEvent>( all_events.push_back(std::make_unique<ui::TouchEvent>(
ui::ET_TOUCH_PRESSED, gfx::Point(x++, y++), Now(), ui::ET_TOUCH_PRESSED, gfx::Point(x++, y++), Now(),
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
touch_id))); touch_id)));
queued_events.push_back(all_events.back().get()); queued_events.push_back(all_events.back().get());
all_events.push_back(std::make_unique<TouchEvent>( all_events.push_back(std::make_unique<ui::TouchEvent>(
ui::ET_TOUCH_MOVED, gfx::Point(x++, y++), Now(), ui::ET_TOUCH_MOVED, gfx::Point(x++, y++), Now(),
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
touch_id))); touch_id)));
queued_events.push_back(all_events.back().get()); queued_events.push_back(all_events.back().get());
all_events.push_back(std::make_unique<TouchEvent>( all_events.push_back(std::make_unique<ui::TouchEvent>(
ui::ET_TOUCH_RELEASED, gfx::Point(x, y), Now(), ui::ET_TOUCH_RELEASED, gfx::Point(x, y), Now(),
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
touch_id))); touch_id)));
...@@ -1461,7 +1453,7 @@ TEST_F(TouchExplorationTest, DISABLED_AllFingerPermutations) { ...@@ -1461,7 +1453,7 @@ TEST_F(TouchExplorationTest, DISABLED_AllFingerPermutations) {
// |next_dispatch| has to be put in this container so that its time // |next_dispatch| has to be put in this container so that its time
// stamp can be changed to this point in the test, when it is being // stamp can be changed to this point in the test, when it is being
// dispatched.. // dispatched..
EventTestApi test_dispatch(next_dispatch); ui::EventTestApi test_dispatch(next_dispatch);
test_dispatch.set_time_stamp(Now()); test_dispatch.set_time_stamp(Now());
generator_->Dispatch(next_dispatch); generator_->Dispatch(next_dispatch);
queued_events.erase(queued_events.begin() + index); queued_events.erase(queued_events.begin() + index);
...@@ -1469,16 +1461,16 @@ TEST_F(TouchExplorationTest, DISABLED_AllFingerPermutations) { ...@@ -1469,16 +1461,16 @@ TEST_F(TouchExplorationTest, DISABLED_AllFingerPermutations) {
// Keep track of what fingers have been pressed, to release // Keep track of what fingers have been pressed, to release
// only those fingers at the end, so the check for being in // only those fingers at the end, so the check for being in
// no fingers down can be accurate. // no fingers down can be accurate.
if (next_dispatch->type() == ET_TOUCH_PRESSED) { if (next_dispatch->type() == ui::ET_TOUCH_PRESSED) {
fingers_pressed[next_dispatch->pointer_details().id] = true; fingers_pressed[next_dispatch->pointer_details().id] = true;
} else if (next_dispatch->type() == ET_TOUCH_RELEASED) { } else if (next_dispatch->type() == ui::ET_TOUCH_RELEASED) {
fingers_pressed[next_dispatch->pointer_details().id] = false; fingers_pressed[next_dispatch->pointer_details().id] = false;
} }
} }
ASSERT_EQ(queued_events.size(), 0u); ASSERT_EQ(queued_events.size(), 0u);
// Release fingers recorded as pressed. // Release fingers recorded as pressed.
for(int j = 0; j < int(fingers_pressed.size()); j++){ for (int j = 0; j < int(fingers_pressed.size()); j++) {
if (fingers_pressed[j] == true) { if (fingers_pressed[j] == true) {
generator_->ReleaseTouchId(j); generator_->ReleaseTouchId(j);
fingers_pressed[j] = false; fingers_pressed[j] = false;
...@@ -1894,8 +1886,7 @@ TEST_F(TouchExplorationTest, EnterEarconPlays) { ...@@ -1894,8 +1886,7 @@ TEST_F(TouchExplorationTest, EnterEarconPlays) {
locations.push_back(bottom_edge); locations.push_back(bottom_edge);
for (std::vector<gfx::Point>::const_iterator point = locations.begin(); for (std::vector<gfx::Point>::const_iterator point = locations.begin();
point != locations.end(); point != locations.end(); ++point) {
++point) {
ui::TouchEvent touch_event( ui::TouchEvent touch_event(
ui::ET_TOUCH_PRESSED, *point, Now(), ui::ET_TOUCH_PRESSED, *point, Now(),
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1)); ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
...@@ -1938,8 +1929,7 @@ TEST_F(TouchExplorationTest, ExitEarconPlays) { ...@@ -1938,8 +1929,7 @@ TEST_F(TouchExplorationTest, ExitEarconPlays) {
locations.push_back(bottom_edge); locations.push_back(bottom_edge);
for (std::vector<gfx::Point>::const_iterator point = locations.begin(); for (std::vector<gfx::Point>::const_iterator point = locations.begin();
point != locations.end(); point != locations.end(); ++point) {
++point) {
generator_->PressTouch(); generator_->PressTouch();
generator_->MoveTouch(initial_press); generator_->MoveTouch(initial_press);
generator_->MoveTouch(*point); generator_->MoveTouch(*point);
...@@ -2124,4 +2114,4 @@ TEST_F(TouchExplorationTest, AlreadyHeldFingersGetCanceled) { ...@@ -2124,4 +2114,4 @@ TEST_F(TouchExplorationTest, AlreadyHeldFingersGetCanceled) {
ASSERT_EQ(1U, events.size()); ASSERT_EQ(1U, events.size());
} }
} // namespace ui } // namespace ash
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "ash/accessibility/accessibility_controller.h" #include "ash/accessibility/accessibility_controller.h"
#include "ash/accessibility/accessibility_delegate.h" #include "ash/accessibility/accessibility_delegate.h"
#include "ash/accessibility/accessibility_focus_ring_controller.h" #include "ash/accessibility/accessibility_focus_ring_controller.h"
#include "ash/accessibility/touch_exploration_controller.h"
#include "ash/keyboard/keyboard_observer_register.h" #include "ash/keyboard/keyboard_observer_register.h"
#include "ash/public/cpp/app_types.h" #include "ash/public/cpp/app_types.h"
#include "ash/root_window_controller.h" #include "ash/root_window_controller.h"
...@@ -21,7 +22,6 @@ ...@@ -21,7 +22,6 @@
#include "chromeos/audio/cras_audio_handler.h" #include "chromeos/audio/cras_audio_handler.h"
#include "chromeos/chromeos_switches.h" #include "chromeos/chromeos_switches.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
#include "ui/chromeos/touch_exploration_controller.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
#include "ui/keyboard/keyboard_controller.h" #include "ui/keyboard/keyboard_controller.h"
#include "ui/wm/public/activation_client.h" #include "ui/wm/public/activation_client.h"
...@@ -197,14 +197,14 @@ void AshTouchExplorationManager::UpdateTouchExplorationState() { ...@@ -197,14 +197,14 @@ void AshTouchExplorationManager::UpdateTouchExplorationState() {
if (!touch_accessibility_enabler_) { if (!touch_accessibility_enabler_) {
// Always enable gesture to toggle spoken feedback. // Always enable gesture to toggle spoken feedback.
touch_accessibility_enabler_.reset(new ui::TouchAccessibilityEnabler( touch_accessibility_enabler_.reset(new TouchAccessibilityEnabler(
root_window_controller_->GetRootWindow(), this)); root_window_controller_->GetRootWindow(), this));
} }
if (spoken_feedback_enabled) { if (spoken_feedback_enabled) {
if (!touch_exploration_controller_.get()) { if (!touch_exploration_controller_.get()) {
touch_exploration_controller_ = touch_exploration_controller_ =
std::make_unique<ui::TouchExplorationController>( std::make_unique<TouchExplorationController>(
root_window_controller_->GetRootWindow(), this, root_window_controller_->GetRootWindow(), this,
touch_accessibility_enabler_->GetWeakPtr()); touch_accessibility_enabler_->GetWeakPtr());
} }
......
...@@ -7,13 +7,13 @@ ...@@ -7,13 +7,13 @@
#include <memory> #include <memory>
#include "ash/accessibility/touch_accessibility_enabler.h"
#include "ash/accessibility/touch_exploration_controller.h"
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/shell_observer.h" #include "ash/shell_observer.h"
#include "ash/system/accessibility_observer.h" #include "ash/system/accessibility_observer.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/scoped_observer.h" #include "base/scoped_observer.h"
#include "ui/chromeos/touch_accessibility_enabler.h"
#include "ui/chromeos/touch_exploration_controller.h"
#include "ui/display/display_observer.h" #include "ui/display/display_observer.h"
#include "ui/keyboard/keyboard_controller_observer.h" #include "ui/keyboard/keyboard_controller_observer.h"
#include "ui/wm/public/activation_change_observer.h" #include "ui/wm/public/activation_change_observer.h"
...@@ -35,8 +35,8 @@ class RootWindowController; ...@@ -35,8 +35,8 @@ class RootWindowController;
// the system. // the system.
class ASH_EXPORT AshTouchExplorationManager class ASH_EXPORT AshTouchExplorationManager
: public AccessibilityObserver, : public AccessibilityObserver,
public ui::TouchExplorationControllerDelegate, public TouchExplorationControllerDelegate,
public ui::TouchAccessibilityEnablerDelegate, public TouchAccessibilityEnablerDelegate,
public display::DisplayObserver, public display::DisplayObserver,
public ::wm::ActivationChangeObserver, public ::wm::ActivationChangeObserver,
public keyboard::KeyboardControllerObserver, public keyboard::KeyboardControllerObserver,
...@@ -92,8 +92,8 @@ class ASH_EXPORT AshTouchExplorationManager ...@@ -92,8 +92,8 @@ class ASH_EXPORT AshTouchExplorationManager
void UpdateTouchExplorationState(); void UpdateTouchExplorationState();
bool VolumeAdjustSoundEnabled(); bool VolumeAdjustSoundEnabled();
std::unique_ptr<ui::TouchExplorationController> touch_exploration_controller_; std::unique_ptr<TouchExplorationController> touch_exploration_controller_;
std::unique_ptr<ui::TouchAccessibilityEnabler> touch_accessibility_enabler_; std::unique_ptr<TouchAccessibilityEnabler> touch_accessibility_enabler_;
RootWindowController* root_window_controller_; RootWindowController* root_window_controller_;
chromeos::CrasAudioHandler* audio_handler_; chromeos::CrasAudioHandler* audio_handler_;
ScopedObserver<keyboard::KeyboardController, ScopedObserver<keyboard::KeyboardController,
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <queue> #include <queue>
#include <vector> #include <vector>
#include "ash/accessibility/touch_exploration_controller.h"
#include "ash/ash_constants.h" #include "ash/ash_constants.h"
#include "ash/ash_touch_exploration_manager_chromeos.h" #include "ash/ash_touch_exploration_manager_chromeos.h"
#include "ash/focus_cycler.h" #include "ash/focus_cycler.h"
...@@ -72,7 +73,6 @@ ...@@ -72,7 +73,6 @@
#include "ui/aura/window_observer.h" #include "ui/aura/window_observer.h"
#include "ui/aura/window_tracker.h" #include "ui/aura/window_tracker.h"
#include "ui/base/models/menu_model.h" #include "ui/base/models/menu_model.h"
#include "ui/chromeos/touch_exploration_controller.h"
#include "ui/compositor/layer.h" #include "ui/compositor/layer.h"
#include "ui/display/types/display_constants.h" #include "ui/display/types/display_constants.h"
#include "ui/events/event_utils.h" #include "ui/events/event_utils.h"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "ui/chromeos/touch_exploration_controller.h" #include "ash/accessibility/touch_exploration_controller.h"
#include "ash/accessibility/accessibility_delegate.h" #include "ash/accessibility/accessibility_delegate.h"
#include "ash/public/cpp/accessibility_types.h" #include "ash/public/cpp/accessibility_types.h"
......
...@@ -26,10 +26,6 @@ component("chromeos") { ...@@ -26,10 +26,6 @@ component("chromeos") {
"ime/input_method_menu_manager.h", "ime/input_method_menu_manager.h",
"ime/mode_indicator_view.cc", "ime/mode_indicator_view.cc",
"ime/mode_indicator_view.h", "ime/mode_indicator_view.h",
"touch_accessibility_enabler.cc",
"touch_accessibility_enabler.h",
"touch_exploration_controller.cc",
"touch_exploration_controller.h",
"user_activity_power_manager_notifier.cc", "user_activity_power_manager_notifier.cc",
"user_activity_power_manager_notifier.h", "user_activity_power_manager_notifier.h",
] ]
...@@ -70,8 +66,6 @@ test("ui_chromeos_unittests") { ...@@ -70,8 +66,6 @@ test("ui_chromeos_unittests") {
"ime/input_method_menu_item_unittest.cc", "ime/input_method_menu_item_unittest.cc",
"ime/input_method_menu_manager_unittest.cc", "ime/input_method_menu_manager_unittest.cc",
"run_all_unittests.cc", "run_all_unittests.cc",
"touch_accessibility_enabler_unittest.cc",
"touch_exploration_controller_unittest.cc",
] ]
deps = [ deps = [
":chromeos", ":chromeos",
......
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