cros: Move AshTouchExplorationManager into //ash/accessibility
Rename the class to TouchExplorationManager, since it's already
ash-only and there are no other such managers.
Remove the _chromeos suffix from the file, since ash is chromeos only
these days.
This code probably dates back to when ash ran on Windows. Some of this
class could be collapsed with TouchExplorationController.
Bug: none
Test: ash_unittests
Change-Id: Id6e81d60e32ff27bccaf4f3d231e463c4c4eb747
Reviewed-on: https://chromium-review.googlesource.com/956536
Commit-Queue: James Cook <[email protected]>
Reviewed-by: David Tseng <[email protected]>
Cr-Commit-Position: refs/heads/master@{#542124}
diff --git a/ash/BUILD.gn b/ash/BUILD.gn
index 77732ff3..50a014d 100644
--- a/ash/BUILD.gn
+++ b/ash/BUILD.gn
@@ -75,6 +75,8 @@
"accessibility/touch_accessibility_enabler.h",
"accessibility/touch_exploration_controller.cc",
"accessibility/touch_exploration_controller.h",
+ "accessibility/touch_exploration_manager.cc",
+ "accessibility/touch_exploration_manager.h",
"animation/animation_change_type.h",
"app_list/app_list_controller_impl.cc",
"app_list/app_list_controller_impl.h",
@@ -91,8 +93,6 @@
"ash_export.h",
"ash_layout_constants.cc",
"ash_layout_constants.h",
- "ash_touch_exploration_manager_chromeos.cc",
- "ash_touch_exploration_manager_chromeos.h",
"ash_view_ids.h",
"autoclick/autoclick_controller.cc",
"autoclick/autoclick_controller.h",
@@ -1406,10 +1406,10 @@
"accessibility/accessibility_panel_layout_manager_unittest.cc",
"accessibility/touch_accessibility_enabler_unittest.cc",
"accessibility/touch_exploration_controller_unittest.cc",
+ "accessibility/touch_exploration_manager_unittest.cc",
"app_list/app_list_presenter_delegate_unittest.cc",
"app_list/model/app_list_item_list_unittest.cc",
"app_list/model/app_list_model_unittest.cc",
- "ash_touch_exploration_manager_chromeos_unittest.cc",
"autoclick/autoclick_unittest.cc",
"detachable_base/detachable_base_handler_unittest.cc",
"detachable_base/detachable_base_notification_controller_unittest.cc",
diff --git a/ash/ash_touch_exploration_manager_chromeos.cc b/ash/accessibility/touch_exploration_manager.cc
similarity index 81%
rename from ash/ash_touch_exploration_manager_chromeos.cc
rename to ash/accessibility/touch_exploration_manager.cc
index 9306f6308..d2efb99 100644
--- a/ash/ash_touch_exploration_manager_chromeos.cc
+++ b/ash/accessibility/touch_exploration_manager.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ash/ash_touch_exploration_manager_chromeos.h"
+#include "ash/accessibility/touch_exploration_manager.h"
#include <memory>
#include <vector>
@@ -34,7 +34,7 @@
} // namespace
-AshTouchExplorationManager::AshTouchExplorationManager(
+TouchExplorationManager::TouchExplorationManager(
RootWindowController* root_window_controller)
: root_window_controller_(root_window_controller),
audio_handler_(chromeos::CrasAudioHandler::Get()),
@@ -46,7 +46,7 @@
UpdateTouchExplorationState();
}
-AshTouchExplorationManager::~AshTouchExplorationManager() {
+TouchExplorationManager::~TouchExplorationManager() {
// TODO(jamescook): Clean up shutdown order so this check isn't needed.
if (Shell::Get()->accessibility_controller())
Shell::Get()->accessibility_controller()->RemoveObserver(this);
@@ -55,12 +55,12 @@
Shell::Get()->RemoveShellObserver(this);
}
-void AshTouchExplorationManager::OnAccessibilityStatusChanged(
+void TouchExplorationManager::OnAccessibilityStatusChanged(
AccessibilityNotificationVisibility notify) {
UpdateTouchExplorationState();
}
-void AshTouchExplorationManager::SetOutputLevel(int volume) {
+void TouchExplorationManager::SetOutputLevel(int volume) {
if (volume > 0) {
if (audio_handler_->IsOutputMuted()) {
audio_handler_->SetOutputMute(false);
@@ -72,12 +72,12 @@
audio_handler_->SetOutputMute(true);
}
-void AshTouchExplorationManager::SilenceSpokenFeedback() {
+void TouchExplorationManager::SilenceSpokenFeedback() {
if (GetA11yController()->IsSpokenFeedbackEnabled())
GetA11yController()->SilenceSpokenFeedback();
}
-void AshTouchExplorationManager::PlayVolumeAdjustEarcon() {
+void TouchExplorationManager::PlayVolumeAdjustEarcon() {
if (!VolumeAdjustSoundEnabled())
return;
if (!audio_handler_->IsOutputMuted() &&
@@ -86,24 +86,24 @@
}
}
-void AshTouchExplorationManager::PlayPassthroughEarcon() {
+void TouchExplorationManager::PlayPassthroughEarcon() {
GetA11yController()->PlayEarcon(chromeos::SOUND_PASSTHROUGH);
}
-void AshTouchExplorationManager::PlayExitScreenEarcon() {
+void TouchExplorationManager::PlayExitScreenEarcon() {
GetA11yController()->PlayEarcon(chromeos::SOUND_EXIT_SCREEN);
}
-void AshTouchExplorationManager::PlayEnterScreenEarcon() {
+void TouchExplorationManager::PlayEnterScreenEarcon() {
GetA11yController()->PlayEarcon(chromeos::SOUND_ENTER_SCREEN);
}
-void AshTouchExplorationManager::HandleAccessibilityGesture(
+void TouchExplorationManager::HandleAccessibilityGesture(
ax::mojom::Gesture gesture) {
GetA11yController()->HandleAccessibilityGesture(gesture);
}
-void AshTouchExplorationManager::OnDisplayMetricsChanged(
+void TouchExplorationManager::OnDisplayMetricsChanged(
const display::Display& display,
uint32_t changed_metrics) {
const display::Display this_display =
@@ -113,15 +113,15 @@
UpdateTouchExplorationState();
}
-void AshTouchExplorationManager::OnTwoFingerTouchStart() {
+void TouchExplorationManager::OnTwoFingerTouchStart() {
GetA11yController()->OnTwoFingerTouchStart();
}
-void AshTouchExplorationManager::OnTwoFingerTouchStop() {
+void TouchExplorationManager::OnTwoFingerTouchStop() {
GetA11yController()->OnTwoFingerTouchStop();
}
-void AshTouchExplorationManager::PlaySpokenFeedbackToggleCountdown(
+void TouchExplorationManager::PlaySpokenFeedbackToggleCountdown(
int tick_count) {
GetA11yController()->ShouldToggleSpokenFeedbackViaTouch(base::BindOnce(
[](int tick_count, bool should_toggle) {
@@ -132,11 +132,11 @@
tick_count));
}
-void AshTouchExplorationManager::PlayTouchTypeEarcon() {
+void TouchExplorationManager::PlayTouchTypeEarcon() {
GetA11yController()->PlayEarcon(chromeos::SOUND_TOUCH_TYPE);
}
-void AshTouchExplorationManager::ToggleSpokenFeedback() {
+void TouchExplorationManager::ToggleSpokenFeedback() {
GetA11yController()->ShouldToggleSpokenFeedbackViaTouch(
base::BindOnce([](bool should_toggle) {
if (!should_toggle)
@@ -147,14 +147,14 @@
}));
}
-void AshTouchExplorationManager::OnWindowActivated(
+void TouchExplorationManager::OnWindowActivated(
::wm::ActivationChangeObserver::ActivationReason reason,
aura::Window* gained_active,
aura::Window* lost_active) {
UpdateTouchExplorationState();
}
-void AshTouchExplorationManager::SetTouchAccessibilityAnchorPoint(
+void TouchExplorationManager::SetTouchAccessibilityAnchorPoint(
const gfx::Point& anchor_point) {
if (touch_exploration_controller_) {
touch_exploration_controller_->SetTouchAccessibilityAnchorPoint(
@@ -162,17 +162,17 @@
}
}
-void AshTouchExplorationManager::OnKeyboardVisibleBoundsChanged(
+void TouchExplorationManager::OnKeyboardVisibleBoundsChanged(
const gfx::Rect& new_bounds) {
UpdateTouchExplorationState();
}
-void AshTouchExplorationManager::OnKeyboardClosed() {
+void TouchExplorationManager::OnKeyboardClosed() {
keyboard_observer_.RemoveAll();
UpdateTouchExplorationState();
}
-void AshTouchExplorationManager::OnVirtualKeyboardStateChanged(
+void TouchExplorationManager::OnVirtualKeyboardStateChanged(
bool activated,
aura::Window* root_window) {
UpdateKeyboardObserverFromStateChanged(
@@ -180,7 +180,7 @@
&keyboard_observer_);
}
-void AshTouchExplorationManager::UpdateTouchExplorationState() {
+void TouchExplorationManager::UpdateTouchExplorationState() {
// See crbug.com/603745 for more details.
const bool pass_through_surface =
wm::GetActiveWindow() &&
@@ -230,7 +230,7 @@
}
}
-bool AshTouchExplorationManager::VolumeAdjustSoundEnabled() {
+bool TouchExplorationManager::VolumeAdjustSoundEnabled() {
return !base::CommandLine::ForCurrentProcess()->HasSwitch(
chromeos::switches::kDisableVolumeAdjustSound);
}
diff --git a/ash/ash_touch_exploration_manager_chromeos.h b/ash/accessibility/touch_exploration_manager.h
similarity index 84%
rename from ash/ash_touch_exploration_manager_chromeos.h
rename to ash/accessibility/touch_exploration_manager.h
index fd39c1e..fbc947c 100644
--- a/ash/ash_touch_exploration_manager_chromeos.h
+++ b/ash/accessibility/touch_exploration_manager.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef ASH_TOUCH_EXPLORATION_MANAGER_CHROMEOS_H_
-#define ASH_TOUCH_EXPLORATION_MANAGER_CHROMEOS_H_
+#ifndef ASH_ACCESSIBILITY_TOUCH_EXPLORATION_MANAGER_H_
+#define ASH_ACCESSIBILITY_TOUCH_EXPLORATION_MANAGER_H_
#include <memory>
@@ -29,11 +29,14 @@
namespace ash {
class RootWindowController;
-// Responsible for initializing TouchExplorationController when spoken
-// feedback is on for ChromeOS only. This class implements
-// TouchExplorationControllerDelegate which allows touch gestures to manipulate
-// the system.
-class ASH_EXPORT AshTouchExplorationManager
+// Responsible for initializing TouchExplorationController when spoken feedback
+// is on. Implements TouchExplorationControllerDelegate which allows touch
+// gestures to manipulate the system.
+//
+// TODO(jamescook): Move the TouchExplorationControllerDelegate methods into
+// TouchExplorationController. I suspect the delegate was added to support ash
+// on Windows, which we don't ship anymore.
+class ASH_EXPORT TouchExplorationManager
: public AccessibilityObserver,
public TouchExplorationControllerDelegate,
public TouchAccessibilityEnablerDelegate,
@@ -42,9 +45,9 @@
public keyboard::KeyboardControllerObserver,
public ShellObserver {
public:
- explicit AshTouchExplorationManager(
+ explicit TouchExplorationManager(
RootWindowController* root_window_controller);
- ~AshTouchExplorationManager() override;
+ ~TouchExplorationManager() override;
// AccessibilityObserver overrides:
void OnAccessibilityStatusChanged(
@@ -100,7 +103,7 @@
keyboard::KeyboardControllerObserver>
keyboard_observer_;
- DISALLOW_COPY_AND_ASSIGN(AshTouchExplorationManager);
+ DISALLOW_COPY_AND_ASSIGN(TouchExplorationManager);
};
} // namespace ash
diff --git a/ash/ash_touch_exploration_manager_chromeos_unittest.cc b/ash/accessibility/touch_exploration_manager_unittest.cc
similarity index 83%
rename from ash/ash_touch_exploration_manager_chromeos_unittest.cc
rename to ash/accessibility/touch_exploration_manager_unittest.cc
index 8348411..3263aa73 100644
--- a/ash/ash_touch_exploration_manager_chromeos_unittest.cc
+++ b/ash/accessibility/touch_exploration_manager_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ash/ash_touch_exploration_manager_chromeos.h"
+#include "ash/accessibility/touch_exploration_manager.h"
#include "ash/accessibility/accessibility_controller.h"
#include "ash/accessibility/test_accessibility_controller_client.h"
@@ -14,11 +14,11 @@
namespace ash {
-using AshTouchExplorationManagerTest = AshTestBase;
+using TouchExplorationManagerTest = AshTestBase;
-TEST_F(AshTouchExplorationManagerTest, AdjustSound) {
+TEST_F(TouchExplorationManagerTest, AdjustSound) {
RootWindowController* controller = Shell::GetPrimaryRootWindowController();
- AshTouchExplorationManager touch_exploration_manager(controller);
+ TouchExplorationManager touch_exploration_manager(controller);
chromeos::CrasAudioHandler* audio_handler = chromeos::CrasAudioHandler::Get();
touch_exploration_manager.SetOutputLevel(10);
@@ -38,9 +38,9 @@
EXPECT_TRUE(audio_handler->IsOutputMuted());
}
-TEST_F(AshTouchExplorationManagerTest, HandleAccessibilityGesture) {
+TEST_F(TouchExplorationManagerTest, HandleAccessibilityGesture) {
RootWindowController* controller = Shell::GetPrimaryRootWindowController();
- AshTouchExplorationManager touch_exploration_manager(controller);
+ TouchExplorationManager touch_exploration_manager(controller);
AccessibilityController* a11y_controller =
Shell::Get()->accessibility_controller();
TestAccessibilityControllerClient client;
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc
index 6399637..55957154 100644
--- a/ash/root_window_controller.cc
+++ b/ash/root_window_controller.cc
@@ -11,8 +11,8 @@
#include "ash/accessibility/accessibility_panel_layout_manager.h"
#include "ash/accessibility/touch_exploration_controller.h"
+#include "ash/accessibility/touch_exploration_manager.h"
#include "ash/ash_constants.h"
-#include "ash/ash_touch_exploration_manager_chromeos.h"
#include "ash/focus_cycler.h"
#include "ash/high_contrast/high_contrast_controller.h"
#include "ash/host/ash_window_tree_host.h"
@@ -704,12 +704,13 @@
shell->OnRootWindowAdded(root_window);
}
- // TODO: AshTouchExplorationManager doesn't work with mus.
+ // TODO: TouchExplorationManager doesn't work with mash.
// http://crbug.com/679782
if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kAshDisableTouchExplorationMode) &&
Shell::GetAshConfig() != Config::MASH) {
- touch_exploration_manager_.reset(new AshTouchExplorationManager(this));
+ touch_exploration_manager_ =
+ std::make_unique<TouchExplorationManager>(this);
}
}
diff --git a/ash/root_window_controller.h b/ash/root_window_controller.h
index ca51a83..76452d61 100644
--- a/ash/root_window_controller.h
+++ b/ash/root_window_controller.h
@@ -45,7 +45,6 @@
namespace ash {
class AlwaysOnTopController;
-class AshTouchExplorationManager;
class AshWindowTreeHost;
class LockScreenActionBackgroundController;
enum class LoginStatus;
@@ -58,6 +57,7 @@
class SystemModalContainerLayoutManager;
class SystemTray;
class SystemWallpaperController;
+class TouchExplorationManager;
class TouchHudDebug;
class TouchHudProjection;
class WallpaperWidgetController;
@@ -312,7 +312,7 @@
// Responsible for initializing TouchExplorationController when spoken
// feedback is on.
- std::unique_ptr<AshTouchExplorationManager> touch_exploration_manager_;
+ std::unique_ptr<TouchExplorationManager> touch_exploration_manager_;
// Heads-up displays for touch events. These HUDs are not owned by the root
// window controller and manage their own lifetimes.