Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3214)

Unified Diff: ash/ash_touch_exploration_manager_chromeos.cc

Issue 2378773011: Only exclude workarea from touch-exploration with active shell-surface (Closed)
Patch Set: resolved merge issues in unittest Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/ash_touch_exploration_manager_chromeos.h ('k') | components/exo/pointer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/ash_touch_exploration_manager_chromeos.cc
diff --git a/ash/ash_touch_exploration_manager_chromeos.cc b/ash/ash_touch_exploration_manager_chromeos.cc
index 68aba77b51297ebdc0e0d4ba7b74b408e8c05046..8eda21eebdac5d43bafa95e6e7d0744f40322b6b 100644
--- a/ash/ash_touch_exploration_manager_chromeos.cc
+++ b/ash/ash_touch_exploration_manager_chromeos.cc
@@ -4,9 +4,11 @@
#include "ash/ash_touch_exploration_manager_chromeos.h"
+#include "ash/aura/wm_root_window_controller_aura.h"
#include "ash/common/accessibility_delegate.h"
#include "ash/common/system/tray/system_tray_notifier.h"
#include "ash/common/wm_shell.h"
+#include "ash/common/wm_window.h"
#include "ash/root_window_controller.h"
#include "ash/shell.h"
#include "ash/wm/window_util.h"
@@ -25,6 +27,7 @@ AshTouchExplorationManager::AshTouchExplorationManager(
audio_handler_(chromeos::CrasAudioHandler::Get()) {
WmShell::Get()->system_tray_notifier()->AddAccessibilityObserver(this);
Shell::GetInstance()->activation_client()->AddObserver(this);
+ display::Screen::GetScreen()->AddObserver(this);
UpdateTouchExplorationState();
}
@@ -34,6 +37,7 @@ AshTouchExplorationManager::~AshTouchExplorationManager() {
if (system_tray_notifier)
system_tray_notifier->RemoveAccessibilityObserver(this);
Shell::GetInstance()->activation_client()->RemoveObserver(this);
+ display::Screen::GetScreen()->RemoveObserver(this);
}
void AshTouchExplorationManager::OnAccessibilityModeChanged(
@@ -88,6 +92,16 @@ void AshTouchExplorationManager::HandleAccessibilityGesture(
WmShell::Get()->accessibility_delegate()->HandleAccessibilityGesture(gesture);
}
+void AshTouchExplorationManager::OnDisplayMetricsChanged(
+ const display::Display& display,
+ uint32_t changed_metrics) {
+ if (root_window_controller_->wm_root_window_controller()
+ ->GetWindow()
+ ->GetDisplayNearestWindow()
+ .id() == display.id())
+ UpdateTouchExplorationState();
+}
+
void AshTouchExplorationManager::OnWindowActivated(
aura::client::ActivationChangeObserver::ActivationReason reason,
aura::Window* gained_active,
@@ -115,16 +129,26 @@ void AshTouchExplorationManager::UpdateTouchExplorationState() {
const bool spoken_feedback_enabled =
WmShell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled();
- if (!pass_through_surface && spoken_feedback_enabled &&
- !touch_exploration_controller_.get()) {
- touch_exploration_controller_.reset(new ui::TouchExplorationController(
- root_window_controller_->GetRootWindow(), this));
- } else if (!spoken_feedback_enabled || pass_through_surface) {
- touch_exploration_controller_.reset();
- if (spoken_feedback_enabled) {
+ if (spoken_feedback_enabled) {
+ if (!touch_exploration_controller_.get()) {
+ touch_exploration_controller_ =
+ base::MakeUnique<ui::TouchExplorationController>(
+ root_window_controller_->GetRootWindow(), this);
+ }
+ if (pass_through_surface) {
+ const gfx::Rect& work_area =
+ root_window_controller_->wm_root_window_controller()
+ ->GetWindow()
+ ->GetDisplayNearestWindow()
+ .work_area();
+ touch_exploration_controller_->SetExcludeBounds(work_area);
SilenceSpokenFeedback();
WmShell::Get()->accessibility_delegate()->ClearFocusHighlight();
+ } else {
+ touch_exploration_controller_->SetExcludeBounds(gfx::Rect());
}
+ } else {
+ touch_exploration_controller_.reset();
}
}
« no previous file with comments | « ash/ash_touch_exploration_manager_chromeos.h ('k') | components/exo/pointer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698