Commit f0e98036 authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

splitview: Disable window dragging and splitview with Chromevox on.

Also leave splitview when Chromevox is turned on. It seems strange
to quit especially if user accidentally press Chromevox but also
strange if user can get into a unsupported state.

Test: manual
Bug: 853588
Change-Id: Iff9577462ec20d379ffce96d4998fcd64dffd321
Reviewed-on: https://chromium-review.googlesource.com/1111082Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569795}
parent 498d336c
......@@ -7,6 +7,7 @@
#include <cmath>
#include <memory>
#include "ash/accessibility/accessibility_controller.h"
#include "ash/display/screen_orientation_controller.h"
#include "ash/public/cpp/ash_switches.h"
#include "ash/public/cpp/shell_window_ids.h"
......@@ -283,11 +284,13 @@ class SplitViewController::TabDraggedWindowObserver
};
SplitViewController::SplitViewController() {
Shell::Get()->accessibility_controller()->AddObserver(this);
display::Screen::GetScreen()->AddObserver(this);
}
SplitViewController::~SplitViewController() {
display::Screen::GetScreen()->RemoveObserver(this);
Shell::Get()->accessibility_controller()->RemoveObserver(this);
EndSplitView();
}
......@@ -297,11 +300,18 @@ bool SplitViewController::ShouldAllowSplitView() {
switches::kAshDisableTabletSplitView)) {
return false;
}
if (!Shell::Get()
->tablet_mode_controller()
->IsTabletModeWindowManagerEnabled()) {
return false;
}
// TODO(crubg.com/853588): Disallow window dragging and split screen while
// ChromeVox is on until they are in a usable state.
if (Shell::Get()->accessibility_controller()->IsSpokenFeedbackEnabled())
return false;
return true;
}
......@@ -885,6 +895,13 @@ void SplitViewController::OnTabletModeEnding() {
EndSplitView();
}
void SplitViewController::OnAccessibilityStatusChanged() {
// TODO(crubg.com/853588): Exit split screen if ChromeVox is turned on until
// they are compatible.
if (Shell::Get()->accessibility_controller()->IsSpokenFeedbackEnabled())
EndSplitView();
}
void SplitViewController::StartObserving(aura::Window* window) {
if (window && !window->HasObserver(this)) {
Shell::Get()->shadow_controller()->UpdateShadowForWindow(window);
......
......@@ -5,6 +5,7 @@
#ifndef ASH_WM_SPLITSVIEW_SPLIT_VIEW_CONTROLLER_H_
#define ASH_WM_SPLITSVIEW_SPLIT_VIEW_CONTROLLER_H_
#include "ash/accessibility/accessibility_observer.h"
#include "ash/ash_export.h"
#include "ash/display/screen_orientation_controller.h"
#include "ash/public/interfaces/split_view.mojom.h"
......@@ -44,7 +45,8 @@ class ASH_EXPORT SplitViewController : public mojom::SplitViewController,
public ::wm::ActivationChangeObserver,
public ShellObserver,
public display::DisplayObserver,
public TabletModeObserver {
public TabletModeObserver,
public AccessibilityObserver {
public:
enum State { NO_SNAP, LEFT_SNAPPED, RIGHT_SNAPPED, BOTH_SNAPPED };
......@@ -178,6 +180,9 @@ class ASH_EXPORT SplitViewController : public mojom::SplitViewController,
// TabletModeObserver:
void OnTabletModeEnding() override;
// AccessibilityObserver:
void OnAccessibilityStatusChanged() override;
aura::Window* left_window() { return left_window_; }
aura::Window* right_window() { return right_window_; }
int divider_position() const { return divider_position_; }
......
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