Commit 562a9c11 authored by David Tseng's avatar David Tseng Committed by Commit Bot

Dynamically change ChromeVox toggle help string

Bug: 863093
Change-Id: I3307df10ca8c438c3683418f3e50c9e4859918bd
Reviewed-on: https://chromium-review.googlesource.com/1136530Reviewed-by: default avatarDan Erat <derat@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: David Tseng <dtseng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#575927}
parent 379bb89d
......@@ -232,9 +232,12 @@ AccessibilityController::AccessibilityController(
: connector_(connector),
autoclick_delay_(AutoclickController::GetDefaultAutoclickDelay()) {
Shell::Get()->session_controller()->AddObserver(this);
Shell::Get()->tablet_mode_controller()->AddObserver(this);
}
AccessibilityController::~AccessibilityController() {
if (Shell::Get()->tablet_mode_controller())
Shell::Get()->tablet_mode_controller()->RemoveObserver(this);
Shell::Get()->session_controller()->RemoveObserver(this);
}
......@@ -731,6 +734,16 @@ void AccessibilityController::FlushMojoForTest() {
client_.FlushForTesting();
}
void AccessibilityController::OnTabletModeStarted() {
if (IsSpokenFeedbackEnabled())
ShowAccessibilityNotification(A11yNotificationType::kSpokenFeedbackEnabled);
}
void AccessibilityController::OnTabletModeEnded() {
if (IsSpokenFeedbackEnabled())
ShowAccessibilityNotification(A11yNotificationType::kSpokenFeedbackEnabled);
}
void AccessibilityController::ObservePrefs(PrefService* prefs) {
DCHECK(prefs);
......
......@@ -11,6 +11,7 @@
#include "ash/public/cpp/ash_constants.h"
#include "ash/public/interfaces/accessibility_controller.mojom.h"
#include "ash/session/session_observer.h"
#include "ash/wm/tablet_mode/tablet_mode_observer.h"
#include "base/macros.h"
#include "base/observer_list.h"
#include "base/time/time.h"
......@@ -41,7 +42,8 @@ enum AccessibilityNotificationVisibility {
// Uses preferences to communicate with chrome to support mash.
class ASH_EXPORT AccessibilityController
: public mojom::AccessibilityController,
public SessionObserver {
public SessionObserver,
public TabletModeObserver {
public:
explicit AccessibilityController(service_manager::Connector* connector);
~AccessibilityController() override;
......@@ -171,6 +173,10 @@ class ASH_EXPORT AccessibilityController
void FlushMojoForTest();
private:
// TabletModeObserver:
void OnTabletModeStarted() override;
void OnTabletModeEnded() override;
// Observes either the signin screen prefs or active user prefs and loads
// initial settings.
void ObservePrefs(PrefService* prefs);
......
......@@ -1012,6 +1012,8 @@ void Shell::Init(
prefs::mojom::kLocalStateServiceName);
}
tablet_mode_controller_ = std::make_unique<TabletModeController>();
// Some delegates access ShellPort during their construction. Create them here
// instead of the ShellPort constructor.
accessibility_focus_ring_controller_ =
......@@ -1108,7 +1110,6 @@ void Shell::Init(
}
accelerator_controller_ = shell_port_->CreateAcceleratorController();
tablet_mode_controller_ = std::make_unique<TabletModeController>();
// |app_list_controller_| is put after |tablet_mode_controller_| as the former
// uses the latter in constructor.
......
......@@ -218,7 +218,7 @@ void MessagePopupCollection::UpdateWidgets() {
else
base -= view_height + kToastMarginY;
if (views::ViewsDelegate::GetInstance()) {
if (views::ViewsDelegate::GetInstance() && a11y_feedback_for_updates) {
views::ViewsDelegate::GetInstance()->NotifyAccessibilityEvent(
toast, ax::mojom::Event::kAlert);
}
......
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