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

Side by Side Diff: ash/ash_touch_exploration_manager_chromeos.cc

Issue 2154523002: Move AccessibilityDelegate ownership to ash::WmShell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@setmediadelegate
Patch Set: fix mash_unittests Created 4 years, 5 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/accelerators/spoken_feedback_toggler_unittest.cc ('k') | ash/aura/wm_shell_aura.h » ('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/common/accessibility_delegate.h" 7 #include "ash/common/accessibility_delegate.h"
8 #include "ash/common/system/tray/system_tray_notifier.h" 8 #include "ash/common/system/tray/system_tray_notifier.h"
9 #include "ash/common/wm_shell.h" 9 #include "ash/common/wm_shell.h"
10 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 audio_handler_->SetOutputMute(false); 47 audio_handler_->SetOutputMute(false);
48 } 48 }
49 } 49 }
50 audio_handler_->SetOutputVolumePercent(volume); 50 audio_handler_->SetOutputVolumePercent(volume);
51 // Avoid negative volume. 51 // Avoid negative volume.
52 if (audio_handler_->IsOutputVolumeBelowDefaultMuteLevel()) 52 if (audio_handler_->IsOutputVolumeBelowDefaultMuteLevel())
53 audio_handler_->SetOutputMute(true); 53 audio_handler_->SetOutputMute(true);
54 } 54 }
55 55
56 void AshTouchExplorationManager::SilenceSpokenFeedback() { 56 void AshTouchExplorationManager::SilenceSpokenFeedback() {
57 if (WmShell::Get()->GetAccessibilityDelegate()->IsSpokenFeedbackEnabled()) 57 if (WmShell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled())
58 WmShell::Get()->GetAccessibilityDelegate()->SilenceSpokenFeedback(); 58 WmShell::Get()->accessibility_delegate()->SilenceSpokenFeedback();
59 } 59 }
60 60
61 void AshTouchExplorationManager::PlayVolumeAdjustEarcon() { 61 void AshTouchExplorationManager::PlayVolumeAdjustEarcon() {
62 if (!VolumeAdjustSoundEnabled()) 62 if (!VolumeAdjustSoundEnabled())
63 return; 63 return;
64 if (!audio_handler_->IsOutputMuted() && 64 if (!audio_handler_->IsOutputMuted() &&
65 audio_handler_->GetOutputVolumePercent() != 100) { 65 audio_handler_->GetOutputVolumePercent() != 100) {
66 WmShell::Get()->GetAccessibilityDelegate()->PlayEarcon( 66 WmShell::Get()->accessibility_delegate()->PlayEarcon(
67 chromeos::SOUND_VOLUME_ADJUST); 67 chromeos::SOUND_VOLUME_ADJUST);
68 } 68 }
69 } 69 }
70 70
71 void AshTouchExplorationManager::PlayPassthroughEarcon() { 71 void AshTouchExplorationManager::PlayPassthroughEarcon() {
72 WmShell::Get()->GetAccessibilityDelegate()->PlayEarcon( 72 WmShell::Get()->accessibility_delegate()->PlayEarcon(
73 chromeos::SOUND_PASSTHROUGH); 73 chromeos::SOUND_PASSTHROUGH);
74 } 74 }
75 75
76 void AshTouchExplorationManager::PlayExitScreenEarcon() { 76 void AshTouchExplorationManager::PlayExitScreenEarcon() {
77 WmShell::Get()->GetAccessibilityDelegate()->PlayEarcon( 77 WmShell::Get()->accessibility_delegate()->PlayEarcon(
78 chromeos::SOUND_EXIT_SCREEN); 78 chromeos::SOUND_EXIT_SCREEN);
79 } 79 }
80 80
81 void AshTouchExplorationManager::PlayEnterScreenEarcon() { 81 void AshTouchExplorationManager::PlayEnterScreenEarcon() {
82 WmShell::Get()->GetAccessibilityDelegate()->PlayEarcon( 82 WmShell::Get()->accessibility_delegate()->PlayEarcon(
83 chromeos::SOUND_ENTER_SCREEN); 83 chromeos::SOUND_ENTER_SCREEN);
84 } 84 }
85 85
86 void AshTouchExplorationManager::HandleAccessibilityGesture( 86 void AshTouchExplorationManager::HandleAccessibilityGesture(
87 ui::AXGesture gesture) { 87 ui::AXGesture gesture) {
88 WmShell::Get()->GetAccessibilityDelegate()->HandleAccessibilityGesture( 88 WmShell::Get()->accessibility_delegate()->HandleAccessibilityGesture(gesture);
89 gesture);
90 } 89 }
91 90
92 void AshTouchExplorationManager::OnWindowActivated( 91 void AshTouchExplorationManager::OnWindowActivated(
93 aura::client::ActivationChangeObserver::ActivationReason reason, 92 aura::client::ActivationChangeObserver::ActivationReason reason,
94 aura::Window* gained_active, 93 aura::Window* gained_active,
95 aura::Window* lost_active) { 94 aura::Window* lost_active) {
96 UpdateTouchExplorationState(); 95 UpdateTouchExplorationState();
97 } 96 }
98 97
99 void AshTouchExplorationManager::SetTouchAccessibilityAnchorPoint( 98 void AshTouchExplorationManager::SetTouchAccessibilityAnchorPoint(
100 const gfx::Point& anchor_point) { 99 const gfx::Point& anchor_point) {
101 if (touch_exploration_controller_) { 100 if (touch_exploration_controller_) {
102 touch_exploration_controller_->SetTouchAccessibilityAnchorPoint( 101 touch_exploration_controller_->SetTouchAccessibilityAnchorPoint(
103 anchor_point); 102 anchor_point);
104 } 103 }
105 } 104 }
106 105
107 void AshTouchExplorationManager::UpdateTouchExplorationState() { 106 void AshTouchExplorationManager::UpdateTouchExplorationState() {
108 // Comes from components/exo/shell_surface.cc. 107 // Comes from components/exo/shell_surface.cc.
109 const char kExoShellSurfaceWindowName[] = "ExoShellSurface"; 108 const char kExoShellSurfaceWindowName[] = "ExoShellSurface";
110 109
111 // See crbug.com/603745 for more details. 110 // See crbug.com/603745 for more details.
112 const bool pass_through_surface = 111 const bool pass_through_surface =
113 wm::GetActiveWindow() && 112 wm::GetActiveWindow() &&
114 wm::GetActiveWindow()->name() == kExoShellSurfaceWindowName; 113 wm::GetActiveWindow()->name() == kExoShellSurfaceWindowName;
115 114
116 const bool spoken_feedback_enabled = 115 const bool spoken_feedback_enabled =
117 WmShell::Get()->GetAccessibilityDelegate()->IsSpokenFeedbackEnabled(); 116 WmShell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled();
118 117
119 if (!pass_through_surface && spoken_feedback_enabled && 118 if (!pass_through_surface && spoken_feedback_enabled &&
120 !touch_exploration_controller_.get()) { 119 !touch_exploration_controller_.get()) {
121 touch_exploration_controller_.reset(new ui::TouchExplorationController( 120 touch_exploration_controller_.reset(new ui::TouchExplorationController(
122 root_window_controller_->GetRootWindow(), this)); 121 root_window_controller_->GetRootWindow(), this));
123 } else if (!spoken_feedback_enabled || pass_through_surface) { 122 } else if (!spoken_feedback_enabled || pass_through_surface) {
124 touch_exploration_controller_.reset(); 123 touch_exploration_controller_.reset();
125 } 124 }
126 } 125 }
127 126
128 bool AshTouchExplorationManager::VolumeAdjustSoundEnabled() { 127 bool AshTouchExplorationManager::VolumeAdjustSoundEnabled() {
129 return !base::CommandLine::ForCurrentProcess()->HasSwitch( 128 return !base::CommandLine::ForCurrentProcess()->HasSwitch(
130 chromeos::switches::kDisableVolumeAdjustSound); 129 chromeos::switches::kDisableVolumeAdjustSound);
131 } 130 }
132 131
133 } // namespace ash 132 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/spoken_feedback_toggler_unittest.cc ('k') | ash/aura/wm_shell_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698