| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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/shell.h" | 5 #include "ash/shell.h" |
| 6 #include "chrome/browser/chromeos/accessibility/accessibility_highlight_manager.
h" | 6 #include "chrome/browser/chromeos/accessibility/accessibility_highlight_manager.
h" |
| 7 #include "chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h" | 7 #include "chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h" |
| 8 #include "content/public/browser/focused_node_details.h" | 8 #include "content/public/browser/focused_node_details.h" |
| 9 #include "content/public/browser/notification_service.h" | 9 #include "content/public/browser/notification_service.h" |
| 10 #include "content/public/browser/notification_types.h" | 10 #include "content/public/browser/notification_types.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 shell->AddPreTargetHandler(this); | 69 shell->AddPreTargetHandler(this); |
| 70 shell->cursor_manager()->AddObserver(this); | 70 shell->cursor_manager()->AddObserver(this); |
| 71 registrar_.Add(this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, | 71 registrar_.Add(this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, |
| 72 content::NotificationService::AllSources()); | 72 content::NotificationService::AllSources()); |
| 73 aura::Window* root_window = ash::Shell::GetPrimaryRootWindow(); | 73 aura::Window* root_window = ash::Shell::GetPrimaryRootWindow(); |
| 74 ui::InputMethod* input_method = GetInputMethod(root_window); | 74 ui::InputMethod* input_method = GetInputMethod(root_window); |
| 75 input_method->AddObserver(this); | 75 input_method->AddObserver(this); |
| 76 registered_observers_ = true; | 76 registered_observers_ = true; |
| 77 } | 77 } |
| 78 | 78 |
| 79 void AccessibilityHighlightManager::OnViewFocusedInArc( |
| 80 const gfx::Rect& bounds_in_screen) { |
| 81 focus_rect_ = bounds_in_screen; |
| 82 UpdateFocusAndCaretHighlights(); |
| 83 } |
| 84 |
| 79 void AccessibilityHighlightManager::OnMouseEvent(ui::MouseEvent* event) { | 85 void AccessibilityHighlightManager::OnMouseEvent(ui::MouseEvent* event) { |
| 80 if (event->type() == ui::ET_MOUSE_MOVED) { | 86 if (event->type() == ui::ET_MOUSE_MOVED) { |
| 81 cursor_point_ = event->location(); | 87 cursor_point_ = event->location(); |
| 82 if (event->target()) { | 88 if (event->target()) { |
| 83 ::wm::ConvertPointToScreen(static_cast<aura::Window*>(event->target()), | 89 ::wm::ConvertPointToScreen(static_cast<aura::Window*>(event->target()), |
| 84 &cursor_point_); | 90 &cursor_point_); |
| 85 } | 91 } |
| 86 UpdateCursorHighlight(); | 92 UpdateCursorHighlight(); |
| 87 } | 93 } |
| 88 } | 94 } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 void AccessibilityHighlightManager::UpdateCursorHighlight() { | 162 void AccessibilityHighlightManager::UpdateCursorHighlight() { |
| 157 if (cursor_ && IsCursorVisible()) { | 163 if (cursor_ && IsCursorVisible()) { |
| 158 AccessibilityFocusRingController::GetInstance()->SetCursorRing( | 164 AccessibilityFocusRingController::GetInstance()->SetCursorRing( |
| 159 cursor_point_); | 165 cursor_point_); |
| 160 } else { | 166 } else { |
| 161 AccessibilityFocusRingController::GetInstance()->HideCursorRing(); | 167 AccessibilityFocusRingController::GetInstance()->HideCursorRing(); |
| 162 } | 168 } |
| 163 } | 169 } |
| 164 | 170 |
| 165 } // namespace chromeos | 171 } // namespace chromeos |
| OLD | NEW |