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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/ash_touch_exploration_manager_chromeos.h" 5 #include "ash/ash_touch_exploration_manager_chromeos.h"
6 6
7 #include "ash/aura/wm_root_window_controller_aura.h"
7 #include "ash/common/accessibility_delegate.h" 8 #include "ash/common/accessibility_delegate.h"
8 #include "ash/common/system/tray/system_tray_notifier.h" 9 #include "ash/common/system/tray/system_tray_notifier.h"
9 #include "ash/common/wm_shell.h" 10 #include "ash/common/wm_shell.h"
11 #include "ash/common/wm_window.h"
10 #include "ash/root_window_controller.h" 12 #include "ash/root_window_controller.h"
11 #include "ash/shell.h" 13 #include "ash/shell.h"
12 #include "ash/wm/window_util.h" 14 #include "ash/wm/window_util.h"
13 #include "base/command_line.h" 15 #include "base/command_line.h"
14 #include "chromeos/audio/chromeos_sounds.h" 16 #include "chromeos/audio/chromeos_sounds.h"
15 #include "chromeos/audio/cras_audio_handler.h" 17 #include "chromeos/audio/cras_audio_handler.h"
16 #include "chromeos/chromeos_switches.h" 18 #include "chromeos/chromeos_switches.h"
17 #include "ui/chromeos/touch_exploration_controller.h" 19 #include "ui/chromeos/touch_exploration_controller.h"
18 #include "ui/wm/public/activation_client.h" 20 #include "ui/wm/public/activation_client.h"
19 21
20 namespace ash { 22 namespace ash {
21 23
22 AshTouchExplorationManager::AshTouchExplorationManager( 24 AshTouchExplorationManager::AshTouchExplorationManager(
23 RootWindowController* root_window_controller) 25 RootWindowController* root_window_controller)
24 : root_window_controller_(root_window_controller), 26 : root_window_controller_(root_window_controller),
25 audio_handler_(chromeos::CrasAudioHandler::Get()) { 27 audio_handler_(chromeos::CrasAudioHandler::Get()) {
26 WmShell::Get()->system_tray_notifier()->AddAccessibilityObserver(this); 28 WmShell::Get()->system_tray_notifier()->AddAccessibilityObserver(this);
27 Shell::GetInstance()->activation_client()->AddObserver(this); 29 Shell::GetInstance()->activation_client()->AddObserver(this);
30 display::Screen::GetScreen()->AddObserver(this);
28 UpdateTouchExplorationState(); 31 UpdateTouchExplorationState();
29 } 32 }
30 33
31 AshTouchExplorationManager::~AshTouchExplorationManager() { 34 AshTouchExplorationManager::~AshTouchExplorationManager() {
32 SystemTrayNotifier* system_tray_notifier = 35 SystemTrayNotifier* system_tray_notifier =
33 WmShell::Get()->system_tray_notifier(); 36 WmShell::Get()->system_tray_notifier();
34 if (system_tray_notifier) 37 if (system_tray_notifier)
35 system_tray_notifier->RemoveAccessibilityObserver(this); 38 system_tray_notifier->RemoveAccessibilityObserver(this);
36 Shell::GetInstance()->activation_client()->RemoveObserver(this); 39 Shell::GetInstance()->activation_client()->RemoveObserver(this);
40 display::Screen::GetScreen()->RemoveObserver(this);
37 } 41 }
38 42
39 void AshTouchExplorationManager::OnAccessibilityModeChanged( 43 void AshTouchExplorationManager::OnAccessibilityModeChanged(
40 AccessibilityNotificationVisibility notify) { 44 AccessibilityNotificationVisibility notify) {
41 UpdateTouchExplorationState(); 45 UpdateTouchExplorationState();
42 } 46 }
43 47
44 void AshTouchExplorationManager::SetOutputLevel(int volume) { 48 void AshTouchExplorationManager::SetOutputLevel(int volume) {
45 if (volume > 0) { 49 if (volume > 0) {
46 if (audio_handler_->IsOutputMuted()) { 50 if (audio_handler_->IsOutputMuted()) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 void AshTouchExplorationManager::PlayEnterScreenEarcon() { 85 void AshTouchExplorationManager::PlayEnterScreenEarcon() {
82 WmShell::Get()->accessibility_delegate()->PlayEarcon( 86 WmShell::Get()->accessibility_delegate()->PlayEarcon(
83 chromeos::SOUND_ENTER_SCREEN); 87 chromeos::SOUND_ENTER_SCREEN);
84 } 88 }
85 89
86 void AshTouchExplorationManager::HandleAccessibilityGesture( 90 void AshTouchExplorationManager::HandleAccessibilityGesture(
87 ui::AXGesture gesture) { 91 ui::AXGesture gesture) {
88 WmShell::Get()->accessibility_delegate()->HandleAccessibilityGesture(gesture); 92 WmShell::Get()->accessibility_delegate()->HandleAccessibilityGesture(gesture);
89 } 93 }
90 94
95 void AshTouchExplorationManager::OnDisplayMetricsChanged(
96 const display::Display& display,
97 uint32_t changed_metrics) {
98 if (root_window_controller_->wm_root_window_controller()
99 ->GetWindow()
100 ->GetDisplayNearestWindow()
101 .id() == display.id())
102 UpdateTouchExplorationState();
103 }
104
91 void AshTouchExplorationManager::OnWindowActivated( 105 void AshTouchExplorationManager::OnWindowActivated(
92 aura::client::ActivationChangeObserver::ActivationReason reason, 106 aura::client::ActivationChangeObserver::ActivationReason reason,
93 aura::Window* gained_active, 107 aura::Window* gained_active,
94 aura::Window* lost_active) { 108 aura::Window* lost_active) {
95 UpdateTouchExplorationState(); 109 UpdateTouchExplorationState();
96 } 110 }
97 111
98 void AshTouchExplorationManager::SetTouchAccessibilityAnchorPoint( 112 void AshTouchExplorationManager::SetTouchAccessibilityAnchorPoint(
99 const gfx::Point& anchor_point) { 113 const gfx::Point& anchor_point) {
100 if (touch_exploration_controller_) { 114 if (touch_exploration_controller_) {
101 touch_exploration_controller_->SetTouchAccessibilityAnchorPoint( 115 touch_exploration_controller_->SetTouchAccessibilityAnchorPoint(
102 anchor_point); 116 anchor_point);
103 } 117 }
104 } 118 }
105 119
106 void AshTouchExplorationManager::UpdateTouchExplorationState() { 120 void AshTouchExplorationManager::UpdateTouchExplorationState() {
107 // Comes from components/exo/shell_surface.cc. 121 // Comes from components/exo/shell_surface.cc.
108 const char kExoShellSurfaceWindowName[] = "ExoShellSurface"; 122 const char kExoShellSurfaceWindowName[] = "ExoShellSurface";
109 123
110 // See crbug.com/603745 for more details. 124 // See crbug.com/603745 for more details.
111 const bool pass_through_surface = 125 const bool pass_through_surface =
112 wm::GetActiveWindow() && 126 wm::GetActiveWindow() &&
113 wm::GetActiveWindow()->name() == kExoShellSurfaceWindowName; 127 wm::GetActiveWindow()->name() == kExoShellSurfaceWindowName;
114 128
115 const bool spoken_feedback_enabled = 129 const bool spoken_feedback_enabled =
116 WmShell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled(); 130 WmShell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled();
117 131
118 if (!pass_through_surface && spoken_feedback_enabled && 132 if (spoken_feedback_enabled) {
119 !touch_exploration_controller_.get()) { 133 if (!touch_exploration_controller_.get()) {
120 touch_exploration_controller_.reset(new ui::TouchExplorationController( 134 touch_exploration_controller_ =
121 root_window_controller_->GetRootWindow(), this)); 135 base::MakeUnique<ui::TouchExplorationController>(
122 } else if (!spoken_feedback_enabled || pass_through_surface) { 136 root_window_controller_->GetRootWindow(), this);
123 touch_exploration_controller_.reset(); 137 }
124 if (spoken_feedback_enabled) { 138 if (pass_through_surface) {
139 const gfx::Rect& work_area =
140 root_window_controller_->wm_root_window_controller()
141 ->GetWindow()
142 ->GetDisplayNearestWindow()
143 .work_area();
144 touch_exploration_controller_->SetExcludeBounds(work_area);
125 SilenceSpokenFeedback(); 145 SilenceSpokenFeedback();
126 WmShell::Get()->accessibility_delegate()->ClearFocusHighlight(); 146 WmShell::Get()->accessibility_delegate()->ClearFocusHighlight();
147 } else {
148 touch_exploration_controller_->SetExcludeBounds(gfx::Rect());
127 } 149 }
150 } else {
151 touch_exploration_controller_.reset();
128 } 152 }
129 } 153 }
130 154
131 bool AshTouchExplorationManager::VolumeAdjustSoundEnabled() { 155 bool AshTouchExplorationManager::VolumeAdjustSoundEnabled() {
132 return !base::CommandLine::ForCurrentProcess()->HasSwitch( 156 return !base::CommandLine::ForCurrentProcess()->HasSwitch(
133 chromeos::switches::kDisableVolumeAdjustSound); 157 chromeos::switches::kDisableVolumeAdjustSound);
134 } 158 }
135 159
136 } // namespace ash 160 } // namespace ash
OLDNEW
« 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