| OLD | NEW |
| 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/accessibility_delegate.h" | 7 #include "ash/accessibility_delegate.h" |
| 8 #include "ash/audio/sounds.h" | 8 #include "ash/audio/sounds.h" |
| 9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 gesture); | 90 gesture); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void AshTouchExplorationManager::OnWindowActivated( | 93 void AshTouchExplorationManager::OnWindowActivated( |
| 94 aura::client::ActivationChangeObserver::ActivationReason reason, | 94 aura::client::ActivationChangeObserver::ActivationReason reason, |
| 95 aura::Window* gained_active, | 95 aura::Window* gained_active, |
| 96 aura::Window* lost_active) { | 96 aura::Window* lost_active) { |
| 97 UpdateTouchExplorationState(); | 97 UpdateTouchExplorationState(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void AshTouchExplorationManager::SetTouchAccessibilityAnchorPoint( |
| 101 const gfx::Point& anchor_point) { |
| 102 if (touch_exploration_controller_) { |
| 103 touch_exploration_controller_->SetTouchAccessibilityAnchorPoint( |
| 104 anchor_point); |
| 105 } |
| 106 } |
| 107 |
| 100 void AshTouchExplorationManager::UpdateTouchExplorationState() { | 108 void AshTouchExplorationManager::UpdateTouchExplorationState() { |
| 101 // Comes from components/exo/shell_surface.cc. | 109 // Comes from components/exo/shell_surface.cc. |
| 102 const char kExoShellSurfaceWindowName[] = "ExoShellSurface"; | 110 const char kExoShellSurfaceWindowName[] = "ExoShellSurface"; |
| 103 | 111 |
| 104 // See crbug.com/603745 for more details. | 112 // See crbug.com/603745 for more details. |
| 105 bool pass_through_surface = | 113 bool pass_through_surface = |
| 106 wm::GetActiveWindow() && | 114 wm::GetActiveWindow() && |
| 107 wm::GetActiveWindow()->name() == kExoShellSurfaceWindowName; | 115 wm::GetActiveWindow()->name() == kExoShellSurfaceWindowName; |
| 108 | 116 |
| 109 AccessibilityDelegate* delegate = | 117 AccessibilityDelegate* delegate = |
| 110 Shell::GetInstance()->accessibility_delegate(); | 118 Shell::GetInstance()->accessibility_delegate(); |
| 111 bool enabled = delegate->IsSpokenFeedbackEnabled(); | 119 bool enabled = delegate->IsSpokenFeedbackEnabled(); |
| 112 | 120 |
| 113 if (!pass_through_surface && enabled && | 121 if (!pass_through_surface && enabled && |
| 114 !touch_exploration_controller_.get()) { | 122 !touch_exploration_controller_.get()) { |
| 115 touch_exploration_controller_.reset(new ui::TouchExplorationController( | 123 touch_exploration_controller_.reset(new ui::TouchExplorationController( |
| 116 root_window_controller_->GetRootWindow(), this)); | 124 root_window_controller_->GetRootWindow(), this)); |
| 117 } else if (!enabled || pass_through_surface) { | 125 } else if (!enabled || pass_through_surface) { |
| 118 touch_exploration_controller_.reset(); | 126 touch_exploration_controller_.reset(); |
| 119 } | 127 } |
| 120 } | 128 } |
| 121 | 129 |
| 122 bool AshTouchExplorationManager::VolumeAdjustSoundEnabled() { | 130 bool AshTouchExplorationManager::VolumeAdjustSoundEnabled() { |
| 123 return !base::CommandLine::ForCurrentProcess()->HasSwitch( | 131 return !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 124 chromeos::switches::kDisableVolumeAdjustSound); | 132 chromeos::switches::kDisableVolumeAdjustSound); |
| 125 } | 133 } |
| 126 | 134 |
| 127 } // namespace ash | 135 } // namespace ash |
| OLD | NEW |