Commit 07e9f15a authored by Kevin Schoedel's avatar Kevin Schoedel Committed by Commit Bot

Provide an interface for accessibility earcons.

TouchExplorationController provides audio feedback for certain actions.
This provides an interface for a platform-specific implementation of
these sounds.

Bug: b/73383411
Test: manual and touch_exploration_controller_unittest
Change-Id: Ic6a6e4163ee651bf2446b6ebb3121f4372c32b17
Reviewed-on: https://chromium-review.googlesource.com/1153505Reviewed-by: default avatarLuke Halliwell <halliwell@chromium.org>
Commit-Queue: Kevin Schoedel <kpschoedel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579033}
parent dcf17fe2
...@@ -289,6 +289,8 @@ cast_source_set("browser") { ...@@ -289,6 +289,8 @@ cast_source_set("browser") {
sources += [ sources += [
"accessibility/accessibility_manager.cc", "accessibility/accessibility_manager.cc",
"accessibility/accessibility_manager.h", "accessibility/accessibility_manager.h",
"accessibility/accessibility_sound_delegate.h",
"accessibility/accessibility_sound_delegate_stub.h",
"accessibility/touch_exploration_controller.cc", "accessibility/touch_exploration_controller.cc",
"accessibility/touch_exploration_controller.h", "accessibility/touch_exploration_controller.h",
"accessibility/touch_exploration_manager.cc", "accessibility/touch_exploration_manager.cc",
......
...@@ -96,5 +96,11 @@ void AccessibilityManager::OnTripleTap(const gfx::Point& tap_location) { ...@@ -96,5 +96,11 @@ void AccessibilityManager::OnTripleTap(const gfx::Point& tap_location) {
!magnification_controller_->IsEnabled()); !magnification_controller_->IsEnabled());
} }
void AccessibilityManager::SetAccessibilitySoundDelegate(
std::unique_ptr<AccessibilitySoundDelegate> delegate) {
touch_exploration_manager_->SetAccessibilitySoundDelegate(
std::move(delegate));
}
} // namespace shell } // namespace shell
} // namespace chromecast } // namespace chromecast
...@@ -74,6 +74,10 @@ class AccessibilityManager : public TripleTapDetectorDelegate { ...@@ -74,6 +74,10 @@ class AccessibilityManager : public TripleTapDetectorDelegate {
// TripleTapDetectorDelegate implementation // TripleTapDetectorDelegate implementation
void OnTripleTap(const gfx::Point& tap_location) override; void OnTripleTap(const gfx::Point& tap_location) override;
// Sets the delegate for earcons.
void SetAccessibilitySoundDelegate(
std::unique_ptr<AccessibilitySoundDelegate> delegate);
private: private:
std::unique_ptr<FocusRingController> focus_ring_controller_; std::unique_ptr<FocusRingController> focus_ring_controller_;
std::unique_ptr<AccessibilityFocusRingController> std::unique_ptr<AccessibilityFocusRingController>
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMECAST_BROWSER_ACCESSIBILITY_ACCESSIBILITY_SOUND_DELEGATE_H_
#define CHROMECAST_BROWSER_ACCESSIBILITY_ACCESSIBILITY_SOUND_DELEGATE_H_
namespace chromecast {
namespace shell {
// Provides audio feedback for TouchExplorationController.
class AccessibilitySoundDelegate {
public:
AccessibilitySoundDelegate() {}
virtual ~AccessibilitySoundDelegate() {}
virtual void PlayPassthroughEarcon() = 0;
virtual void PlayEnterScreenEarcon() = 0;
virtual void PlayExitScreenEarcon() = 0;
virtual void PlayTouchTypeEarcon() = 0;
};
} // namespace shell
} // namespace chromecast
#endif // CHROMECAST_BROWSER_ACCESSIBILITY_ACCESSIBILITY_SOUND_DELEGATE_H_
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMECAST_BROWSER_ACCESSIBILITY_ACCESSIBILITY_SOUND_DELEGATE_STUB_H_
#define CHROMECAST_BROWSER_ACCESSIBILITY_ACCESSIBILITY_SOUND_DELEGATE_STUB_H_
#include "chromecast/browser/accessibility/accessibility_sound_delegate.h"
namespace chromecast {
namespace shell {
class AccessibilitySoundDelegateStub : public AccessibilitySoundDelegate {
public:
AccessibilitySoundDelegateStub() = default;
~AccessibilitySoundDelegateStub() override = default;
void PlayPassthroughEarcon() override {}
void PlayEnterScreenEarcon() override {}
void PlayExitScreenEarcon() override {}
void PlayTouchTypeEarcon() override {}
};
} // namespace shell
} // namespace chromecast
#endif // CHROMECAST_BROWSER_ACCESSIBILITY_ACCESSIBILITY_SOUND_DELEGATE_STUB_H_
...@@ -40,9 +40,11 @@ void SetTouchAccessibilityFlag(ui::Event* event) { ...@@ -40,9 +40,11 @@ void SetTouchAccessibilityFlag(ui::Event* event) {
TouchExplorationController::TouchExplorationController( TouchExplorationController::TouchExplorationController(
aura::Window* root_window, aura::Window* root_window,
TouchExplorationControllerDelegate* delegate) TouchExplorationControllerDelegate* delegate,
AccessibilitySoundDelegate* accessibility_sound_delegate)
: root_window_(root_window), : root_window_(root_window),
delegate_(delegate), delegate_(delegate),
accessibility_sound_delegate_(accessibility_sound_delegate),
state_(NO_FINGERS_DOWN), state_(NO_FINGERS_DOWN),
anchor_point_state_(ANCHOR_POINT_NONE), anchor_point_state_(ANCHOR_POINT_NONE),
gesture_provider_(new ui::GestureProviderAura(this, this)), gesture_provider_(new ui::GestureProviderAura(this, this)),
...@@ -193,7 +195,7 @@ ui::EventRewriteStatus TouchExplorationController::RewriteEvent( ...@@ -193,7 +195,7 @@ ui::EventRewriteStatus TouchExplorationController::RewriteEvent(
VLOG(1) << "Leaving screen"; VLOG(1) << "Leaving screen";
// Indicates to the user that they are leaving the screen. // Indicates to the user that they are leaving the screen.
delegate_->PlayExitScreenEarcon(); accessibility_sound_delegate_->PlayExitScreenEarcon();
if (current_touch_ids_.size() == 0) { if (current_touch_ids_.size() == 0) {
SET_STATE(NO_FINGERS_DOWN); SET_STATE(NO_FINGERS_DOWN);
...@@ -307,7 +309,7 @@ ui::EventRewriteStatus TouchExplorationController::InNoFingersDown( ...@@ -307,7 +309,7 @@ ui::EventRewriteStatus TouchExplorationController::InNoFingersDown(
// handle it. // handle it.
int edge = FindEdgesWithinInset(event.location(), kLeavingScreenEdge); int edge = FindEdgesWithinInset(event.location(), kLeavingScreenEdge);
if (edge != NO_EDGE) { if (edge != NO_EDGE) {
delegate_->PlayEnterScreenEarcon(); accessibility_sound_delegate_->PlayEnterScreenEarcon();
SET_STATE(EDGE_PASSTHROUGH); SET_STATE(EDGE_PASSTHROUGH);
return ui::EVENT_REWRITE_CONTINUE; return ui::EVENT_REWRITE_CONTINUE;
} }
...@@ -711,7 +713,7 @@ void TouchExplorationController::MaybeSendSimulatedTapInLiftActivationBounds( ...@@ -711,7 +713,7 @@ void TouchExplorationController::MaybeSendSimulatedTapInLiftActivationBounds(
if (lift_activation_bounds_.Contains(anchor_location.x(), if (lift_activation_bounds_.Contains(anchor_location.x(),
anchor_location.y()) && anchor_location.y()) &&
lift_activation_bounds_.Contains(location)) { lift_activation_bounds_.Contains(location)) {
delegate_->PlayTouchTypeEarcon(); accessibility_sound_delegate_->PlayTouchTypeEarcon();
SendSimulatedTap(); SendSimulatedTap();
} }
} }
...@@ -849,7 +851,7 @@ void TouchExplorationController::OnPassthroughTimerFired() { ...@@ -849,7 +851,7 @@ void TouchExplorationController::OnPassthroughTimerFired() {
if (sound_timer_.IsRunning()) if (sound_timer_.IsRunning())
sound_timer_.Stop(); sound_timer_.Stop();
delegate_->PlayPassthroughEarcon(); accessibility_sound_delegate_->PlayPassthroughEarcon();
SET_STATE(CORNER_PASSTHROUGH); SET_STATE(CORNER_PASSTHROUGH);
return; return;
} }
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#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 "chromecast/browser/accessibility/accessibility_sound_delegate.h"
#include "ui/accessibility/ax_enums.mojom.h" #include "ui/accessibility/ax_enums.mojom.h"
#include "ui/events/event.h" #include "ui/events/event.h"
#include "ui/events/event_rewriter.h" #include "ui/events/event_rewriter.h"
...@@ -39,22 +40,6 @@ class TouchExplorationControllerDelegate { ...@@ -39,22 +40,6 @@ class TouchExplorationControllerDelegate {
public: public:
virtual ~TouchExplorationControllerDelegate() {} virtual ~TouchExplorationControllerDelegate() {}
// This function should be called when the passthrough earcon should be
// played.
virtual void PlayPassthroughEarcon() = 0;
// This function should be called when the exit screen earcon should be
// played.
virtual void PlayExitScreenEarcon() = 0;
// This function should be called when the enter screen earcon should be
// played.
virtual void PlayEnterScreenEarcon() = 0;
// This function should be called when the touch type earcon should
// be played.
virtual void PlayTouchTypeEarcon() = 0;
// Called when the user performed an accessibility gesture while in touch // Called when the user performed an accessibility gesture while in touch
// accessibility mode, that should be forwarded to ChromeVox. // accessibility mode, that should be forwarded to ChromeVox.
virtual void HandleAccessibilityGesture(ax::mojom::Gesture gesture) = 0; virtual void HandleAccessibilityGesture(ax::mojom::Gesture gesture) = 0;
...@@ -178,7 +163,8 @@ class TouchExplorationController : public ui::EventRewriter, ...@@ -178,7 +163,8 @@ class TouchExplorationController : public ui::EventRewriter,
public: public:
TouchExplorationController( TouchExplorationController(
aura::Window* root_window, aura::Window* root_window,
TouchExplorationControllerDelegate* delegate); TouchExplorationControllerDelegate* delegate,
AccessibilitySoundDelegate* accessibility_sound_delegate);
~TouchExplorationController() override; ~TouchExplorationController() override;
// Make synthesized touch events are anchored at this point. This is // Make synthesized touch events are anchored at this point. This is
...@@ -448,9 +434,12 @@ class TouchExplorationController : public ui::EventRewriter, ...@@ -448,9 +434,12 @@ class TouchExplorationController : public ui::EventRewriter,
aura::Window* root_window_; aura::Window* root_window_;
// Handles volume control. Not owned. // Handles accessibility gestures. Not owned.
TouchExplorationControllerDelegate* delegate_; TouchExplorationControllerDelegate* delegate_;
// Handles earcons. Not owned.
AccessibilitySoundDelegate* accessibility_sound_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_;
......
...@@ -78,27 +78,37 @@ int Factorial(int n) { ...@@ -78,27 +78,37 @@ int Factorial(int n) {
class MockTouchExplorationControllerDelegate class MockTouchExplorationControllerDelegate
: public TouchExplorationControllerDelegate { : public TouchExplorationControllerDelegate {
public: public:
void PlayPassthroughEarcon() override { ++num_times_passthrough_played_; }
void PlayExitScreenEarcon() override { ++num_times_exit_screen_played_; }
void PlayEnterScreenEarcon() override { ++num_times_enter_screen_played_; }
void PlayTouchTypeEarcon() override { ++num_times_touch_type_sound_played_; }
void HandleAccessibilityGesture(ax::mojom::Gesture gesture) override { void HandleAccessibilityGesture(ax::mojom::Gesture gesture) override {
last_gesture_ = gesture; last_gesture_ = gesture;
} }
const std::vector<float> VolumeChanges() const { return volume_changes_; } const std::vector<float> VolumeChanges() const { return volume_changes_; }
size_t NumAdjustSounds() const { return num_times_adjust_sound_played_; } ax::mojom::Gesture GetLastGesture() const { return last_gesture_; }
void ResetLastGesture() { last_gesture_ = ax::mojom::Gesture::kNone; }
private:
std::vector<float> volume_changes_;
ax::mojom::Gesture last_gesture_ = ax::mojom::Gesture::kNone;
};
class MockAccessibilitySoundDelegate : public AccessibilitySoundDelegate {
public:
MockAccessibilitySoundDelegate() {}
~MockAccessibilitySoundDelegate() override {}
void PlayPassthroughEarcon() override { ++num_times_passthrough_played_; }
void PlayExitScreenEarcon() override { ++num_times_exit_screen_played_; }
void PlayEnterScreenEarcon() override { ++num_times_enter_screen_played_; }
void PlayTouchTypeEarcon() override { ++num_times_touch_type_sound_played_; }
size_t NumPassthroughSounds() const { return num_times_passthrough_played_; } size_t NumPassthroughSounds() const { return num_times_passthrough_played_; }
size_t NumExitScreenSounds() const { return num_times_exit_screen_played_; } size_t NumExitScreenSounds() const { return num_times_exit_screen_played_; }
size_t NumEnterScreenSounds() const { return num_times_enter_screen_played_; } size_t NumEnterScreenSounds() const { return num_times_enter_screen_played_; }
size_t NumTouchTypeSounds() const { size_t NumTouchTypeSounds() const {
return num_times_touch_type_sound_played_; return num_times_touch_type_sound_played_;
} }
ax::mojom::Gesture GetLastGesture() const { return last_gesture_; }
void ResetLastGesture() { last_gesture_ = ax::mojom::Gesture::kNone; }
void ResetCountersToZero() { void ResetCountersToZero() {
num_times_adjust_sound_played_ = 0;
num_times_passthrough_played_ = 0; num_times_passthrough_played_ = 0;
num_times_exit_screen_played_ = 0; num_times_exit_screen_played_ = 0;
num_times_enter_screen_played_ = 0; num_times_enter_screen_played_ = 0;
...@@ -106,13 +116,10 @@ class MockTouchExplorationControllerDelegate ...@@ -106,13 +116,10 @@ class MockTouchExplorationControllerDelegate
} }
private: private:
std::vector<float> volume_changes_;
size_t num_times_adjust_sound_played_ = 0;
size_t num_times_passthrough_played_ = 0; size_t num_times_passthrough_played_ = 0;
size_t num_times_exit_screen_played_ = 0; size_t num_times_exit_screen_played_ = 0;
size_t num_times_enter_screen_played_ = 0; size_t num_times_enter_screen_played_ = 0;
size_t num_times_touch_type_sound_played_ = 0; size_t num_times_touch_type_sound_played_ = 0;
ax::mojom::Gesture last_gesture_ = ax::mojom::Gesture::kNone;
}; };
} // namespace } // namespace
...@@ -298,8 +305,9 @@ class TouchExplorationTest : public aura::test::AuraTestBase { ...@@ -298,8 +305,9 @@ 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(new TouchExplorationControllerTestApi( touch_exploration_controller_.reset(
new TouchExplorationController(root_window(), &delegate_))); new TouchExplorationControllerTestApi(new TouchExplorationController(
root_window(), &delegate_, &accessibility_sound_delegate_)));
cursor_client()->ShowCursor(); cursor_client()->ShowCursor();
cursor_client()->DisableMouseEvents(); cursor_client()->DisableMouseEvents();
} }
...@@ -317,7 +325,7 @@ class TouchExplorationTest : public aura::test::AuraTestBase { ...@@ -317,7 +325,7 @@ class TouchExplorationTest : public aura::test::AuraTestBase {
// Checks that Corner Passthrough is working. Assumes that corner is the // Checks that Corner Passthrough is working. Assumes that corner is the
// bottom left corner or the bottom right corner. // bottom left corner or the bottom right corner.
void AssertCornerPassthroughWorking(gfx::Point corner) { void AssertCornerPassthroughWorking(gfx::Point corner) {
ASSERT_EQ(0U, delegate_.NumPassthroughSounds()); ASSERT_EQ(0U, accessibility_sound_delegate_.NumPassthroughSounds());
ui::TouchEvent first_press( ui::TouchEvent first_press(
ui::ET_TOUCH_PRESSED, corner, Now(), ui::ET_TOUCH_PRESSED, corner, Now(),
...@@ -335,7 +343,7 @@ class TouchExplorationTest : public aura::test::AuraTestBase { ...@@ -335,7 +343,7 @@ class TouchExplorationTest : public aura::test::AuraTestBase {
ui::TouchEvent passthrough_press( ui::TouchEvent passthrough_press(
ui::ET_TOUCH_PRESSED, passthrough, Now(), ui::ET_TOUCH_PRESSED, passthrough, Now(),
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1)); ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
ASSERT_EQ(1U, delegate_.NumPassthroughSounds()); ASSERT_EQ(1U, accessibility_sound_delegate_.NumPassthroughSounds());
generator_->Dispatch(&passthrough_press); generator_->Dispatch(&passthrough_press);
generator_->ReleaseTouchId(1); generator_->ReleaseTouchId(1);
generator_->PressTouchId(1); generator_->PressTouchId(1);
...@@ -417,6 +425,7 @@ class TouchExplorationTest : public aura::test::AuraTestBase { ...@@ -417,6 +425,7 @@ class TouchExplorationTest : public aura::test::AuraTestBase {
ui::GestureDetector::Config gesture_detector_config_; ui::GestureDetector::Config gesture_detector_config_;
base::SimpleTestTickClock simulated_clock_; base::SimpleTestTickClock simulated_clock_;
MockTouchExplorationControllerDelegate delegate_; MockTouchExplorationControllerDelegate delegate_;
MockAccessibilitySoundDelegate accessibility_sound_delegate_;
private: private:
EventCapturer event_capturer_; EventCapturer event_capturer_;
...@@ -1771,9 +1780,9 @@ TEST_F(TouchExplorationTest, EnterEarconPlays) { ...@@ -1771,9 +1780,9 @@ TEST_F(TouchExplorationTest, EnterEarconPlays) {
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1)); ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
generator_->Dispatch(&touch_event); generator_->Dispatch(&touch_event);
ASSERT_EQ(1U, delegate_.NumEnterScreenSounds()); ASSERT_EQ(1U, accessibility_sound_delegate_.NumEnterScreenSounds());
generator_->ReleaseTouchId(1); generator_->ReleaseTouchId(1);
delegate_.ResetCountersToZero(); accessibility_sound_delegate_.ResetCountersToZero();
} }
} }
...@@ -1813,8 +1822,8 @@ TEST_F(TouchExplorationTest, ExitEarconPlays) { ...@@ -1813,8 +1822,8 @@ TEST_F(TouchExplorationTest, ExitEarconPlays) {
generator_->MoveTouch(initial_press); generator_->MoveTouch(initial_press);
generator_->MoveTouch(*point); generator_->MoveTouch(*point);
generator_->ReleaseTouch(); generator_->ReleaseTouch();
ASSERT_EQ(1U, delegate_.NumExitScreenSounds()); ASSERT_EQ(1U, accessibility_sound_delegate_.NumExitScreenSounds());
delegate_.ResetCountersToZero(); accessibility_sound_delegate_.ResetCountersToZero();
} }
} }
...@@ -1950,7 +1959,7 @@ TEST_F(TouchExplorationTest, TouchExploreLiftInLiftActivationArea) { ...@@ -1950,7 +1959,7 @@ TEST_F(TouchExplorationTest, TouchExploreLiftInLiftActivationArea) {
gfx::Point tap_location = lift_activation.CenterPoint(); gfx::Point tap_location = lift_activation.CenterPoint();
EnterTouchExplorationModeAtLocation(tap_location); EnterTouchExplorationModeAtLocation(tap_location);
ClearCapturedEvents(); ClearCapturedEvents();
ASSERT_EQ(0U, delegate_.NumTouchTypeSounds()); ASSERT_EQ(0U, accessibility_sound_delegate_.NumTouchTypeSounds());
// A touch release should trigger a tap. // A touch release should trigger a tap.
ui::TouchEvent touch_explore_release( ui::TouchEvent touch_explore_release(
...@@ -1964,9 +1973,9 @@ TEST_F(TouchExplorationTest, TouchExploreLiftInLiftActivationArea) { ...@@ -1964,9 +1973,9 @@ TEST_F(TouchExplorationTest, TouchExploreLiftInLiftActivationArea) {
EXPECT_EQ(ui::ET_TOUCH_PRESSED, captured_events[0]->type()); EXPECT_EQ(ui::ET_TOUCH_PRESSED, captured_events[0]->type());
EXPECT_EQ(ui::ET_TOUCH_RELEASED, captured_events[1]->type()); EXPECT_EQ(ui::ET_TOUCH_RELEASED, captured_events[1]->type());
EXPECT_EQ(ui::ET_MOUSE_MOVED, captured_events[2]->type()); EXPECT_EQ(ui::ET_MOUSE_MOVED, captured_events[2]->type());
ASSERT_EQ(1U, delegate_.NumTouchTypeSounds()); ASSERT_EQ(1U, accessibility_sound_delegate_.NumTouchTypeSounds());
ClearCapturedEvents(); ClearCapturedEvents();
delegate_.ResetCountersToZero(); accessibility_sound_delegate_.ResetCountersToZero();
// Touch explore inside the activation bounds, but lift outside. // Touch explore inside the activation bounds, but lift outside.
gfx::Point out_tap_location(tap_location.x(), lift_activation.bottom() + 20); gfx::Point out_tap_location(tap_location.x(), lift_activation.bottom() + 20);
...@@ -1982,7 +1991,7 @@ TEST_F(TouchExplorationTest, TouchExploreLiftInLiftActivationArea) { ...@@ -1982,7 +1991,7 @@ TEST_F(TouchExplorationTest, TouchExploreLiftInLiftActivationArea) {
const EventList& out_captured_events = GetCapturedEvents(); const EventList& out_captured_events = GetCapturedEvents();
ASSERT_EQ(1U, out_captured_events.size()); ASSERT_EQ(1U, out_captured_events.size());
EXPECT_EQ(ui::ET_MOUSE_MOVED, out_captured_events[0]->type()); EXPECT_EQ(ui::ET_MOUSE_MOVED, out_captured_events[0]->type());
ASSERT_EQ(0U, delegate_.NumTouchTypeSounds()); ASSERT_EQ(0U, accessibility_sound_delegate_.NumTouchTypeSounds());
} }
// Ensure that any touch release events received after // Ensure that any touch release events received after
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "chromecast/browser/accessibility/touch_exploration_manager.h" #include "chromecast/browser/accessibility/touch_exploration_manager.h"
#include "chromecast/browser/accessibility/accessibility_sound_delegate_stub.h"
#include "chromecast/browser/cast_browser_context.h" #include "chromecast/browser/cast_browser_context.h"
#include "chromecast/browser/cast_browser_process.h" #include "chromecast/browser/cast_browser_process.h"
#include "chromecast/common/extensions_api/accessibility_private.h" #include "chromecast/common/extensions_api/accessibility_private.h"
...@@ -26,8 +27,9 @@ TouchExplorationManager::TouchExplorationManager( ...@@ -26,8 +27,9 @@ TouchExplorationManager::TouchExplorationManager(
: touch_exploration_enabled_(false), : touch_exploration_enabled_(false),
root_window_(root_window), root_window_(root_window),
activation_client_(activation_client), activation_client_(activation_client),
accessibility_focus_ring_controller_( accessibility_focus_ring_controller_(accessibility_focus_ring_controller),
accessibility_focus_ring_controller) { accessibility_sound_delegate_(
std::make_unique<AccessibilitySoundDelegateStub>()) {
UpdateTouchExplorationState(); UpdateTouchExplorationState();
} }
...@@ -39,22 +41,6 @@ void TouchExplorationManager::Enable(bool enabled) { ...@@ -39,22 +41,6 @@ void TouchExplorationManager::Enable(bool enabled) {
UpdateTouchExplorationState(); UpdateTouchExplorationState();
} }
void TouchExplorationManager::PlayPassthroughEarcon() {
LOG(INFO) << "stub PlayPassthroughEarcon";
}
void TouchExplorationManager::PlayEnterScreenEarcon() {
LOG(INFO) << "stub PlayEnterScreenEarcon";
}
void TouchExplorationManager::PlayExitScreenEarcon() {
LOG(INFO) << "stub PlayExitScreenEarcon";
}
void TouchExplorationManager::PlayTouchTypeEarcon() {
LOG(INFO) << "stub PlayTouchTypeEarcon";
}
void TouchExplorationManager::HandleAccessibilityGesture( void TouchExplorationManager::HandleAccessibilityGesture(
ax::mojom::Gesture gesture) { ax::mojom::Gesture gesture) {
// (Code copied from Chrome's // (Code copied from Chrome's
...@@ -99,7 +85,8 @@ void TouchExplorationManager::UpdateTouchExplorationState() { ...@@ -99,7 +85,8 @@ void TouchExplorationManager::UpdateTouchExplorationState() {
if (touch_exploration_enabled_) { if (touch_exploration_enabled_) {
if (!touch_exploration_controller_.get()) { if (!touch_exploration_controller_.get()) {
touch_exploration_controller_ = touch_exploration_controller_ =
std::make_unique<TouchExplorationController>(root_window_, this); std::make_unique<TouchExplorationController>(root_window_, this,
accessibility_sound_delegate_.get());
} }
if (pass_through_surface) { if (pass_through_surface) {
const display::Display display = const display::Display display =
...@@ -119,5 +106,11 @@ void TouchExplorationManager::UpdateTouchExplorationState() { ...@@ -119,5 +106,11 @@ void TouchExplorationManager::UpdateTouchExplorationState() {
} }
} }
void TouchExplorationManager::SetAccessibilitySoundDelegate(
std::unique_ptr<AccessibilitySoundDelegate> delegate) {
accessibility_sound_delegate_ = std::move(delegate);
}
} // namespace shell } // namespace shell
} // namespace chromecast } // namespace chromecast
...@@ -8,8 +8,9 @@ ...@@ -8,8 +8,9 @@
#ifndef CHROMECAST_BROWSER_ACCESSIBILITY_TOUCH_EXPLORATION_MANAGER_H_ #ifndef CHROMECAST_BROWSER_ACCESSIBILITY_TOUCH_EXPLORATION_MANAGER_H_
#define CHROMECAST_BROWSER_ACCESSIBILITY_TOUCH_EXPLORATION_MANAGER_H_ #define CHROMECAST_BROWSER_ACCESSIBILITY_TOUCH_EXPLORATION_MANAGER_H_
#include "chromecast/graphics/accessibility/accessibility_focus_ring_controller.h" #include "chromecast/browser/accessibility/accessibility_sound_delegate.h"
#include "chromecast/browser/accessibility/touch_exploration_controller.h" #include "chromecast/browser/accessibility/touch_exploration_controller.h"
#include "chromecast/graphics/accessibility/accessibility_focus_ring_controller.h"
#include "ui/wm/public/activation_change_observer.h" #include "ui/wm/public/activation_change_observer.h"
#include "ui/wm/public/activation_client.h" #include "ui/wm/public/activation_client.h"
...@@ -33,10 +34,6 @@ class TouchExplorationManager : public TouchExplorationControllerDelegate, ...@@ -33,10 +34,6 @@ class TouchExplorationManager : public TouchExplorationControllerDelegate,
void Enable(bool enabled); void Enable(bool enabled);
// TouchExplorationControllerDelegate overrides: // TouchExplorationControllerDelegate overrides:
void PlayPassthroughEarcon() override;
void PlayExitScreenEarcon() override;
void PlayEnterScreenEarcon() override;
void PlayTouchTypeEarcon() override;
void HandleAccessibilityGesture(ax::mojom::Gesture gesture) override; void HandleAccessibilityGesture(ax::mojom::Gesture gesture) override;
// wm::ActivationChangeObserver overrides: // wm::ActivationChangeObserver overrides:
...@@ -49,6 +46,10 @@ class TouchExplorationManager : public TouchExplorationControllerDelegate, ...@@ -49,6 +46,10 @@ class TouchExplorationManager : public TouchExplorationControllerDelegate,
// events are anchored at this point. // events are anchored at this point.
void SetTouchAccessibilityAnchorPoint(const gfx::Point& anchor_point); void SetTouchAccessibilityAnchorPoint(const gfx::Point& anchor_point);
// Sets the delegate for earcons.
void SetAccessibilitySoundDelegate(
std::unique_ptr<AccessibilitySoundDelegate> delegate);
private: private:
void UpdateTouchExplorationState(); void UpdateTouchExplorationState();
...@@ -59,6 +60,7 @@ class TouchExplorationManager : public TouchExplorationControllerDelegate, ...@@ -59,6 +60,7 @@ class TouchExplorationManager : public TouchExplorationControllerDelegate,
aura::Window* root_window_; aura::Window* root_window_;
wm::ActivationClient* activation_client_; wm::ActivationClient* activation_client_;
AccessibilityFocusRingController* accessibility_focus_ring_controller_; AccessibilityFocusRingController* accessibility_focus_ring_controller_;
std::unique_ptr<AccessibilitySoundDelegate> accessibility_sound_delegate_;
DISALLOW_COPY_AND_ASSIGN(TouchExplorationManager); DISALLOW_COPY_AND_ASSIGN(TouchExplorationManager);
}; };
......
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