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" |
11 #include "ui/aura/window_tree_host.h" | 11 #include "ui/aura/window_tree_host.h" |
| 12 #include "ui/wm/core/coordinate_conversion.h" |
12 #include "ui/wm/core/cursor_manager.h" | 13 #include "ui/wm/core/cursor_manager.h" |
13 | 14 |
14 namespace chromeos { | 15 namespace chromeos { |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
18 ui::InputMethod* GetInputMethod(aura::Window* root_window) { | 19 ui::InputMethod* GetInputMethod(aura::Window* root_window) { |
19 if (root_window->GetHost()) | 20 if (root_window->GetHost()) |
20 return root_window->GetHost()->GetInputMethod(); | 21 return root_window->GetHost()->GetInputMethod(); |
21 return nullptr; | 22 return nullptr; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 registrar_.Add(this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, | 71 registrar_.Add(this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, |
71 content::NotificationService::AllSources()); | 72 content::NotificationService::AllSources()); |
72 aura::Window* root_window = ash::Shell::GetPrimaryRootWindow(); | 73 aura::Window* root_window = ash::Shell::GetPrimaryRootWindow(); |
73 ui::InputMethod* input_method = GetInputMethod(root_window); | 74 ui::InputMethod* input_method = GetInputMethod(root_window); |
74 input_method->AddObserver(this); | 75 input_method->AddObserver(this); |
75 registered_observers_ = true; | 76 registered_observers_ = true; |
76 } | 77 } |
77 | 78 |
78 void AccessibilityHighlightManager::OnMouseEvent(ui::MouseEvent* event) { | 79 void AccessibilityHighlightManager::OnMouseEvent(ui::MouseEvent* event) { |
79 if (event->type() == ui::ET_MOUSE_MOVED) { | 80 if (event->type() == ui::ET_MOUSE_MOVED) { |
80 cursor_point_ = event->root_location(); | 81 cursor_point_ = event->location(); |
| 82 if (event->target()) { |
| 83 ::wm::ConvertPointToScreen(static_cast<aura::Window*>(event->target()), |
| 84 &cursor_point_); |
| 85 } |
81 UpdateCursorHighlight(); | 86 UpdateCursorHighlight(); |
82 } | 87 } |
83 } | 88 } |
84 | 89 |
85 void AccessibilityHighlightManager::OnKeyEvent(ui::KeyEvent* event) { | 90 void AccessibilityHighlightManager::OnKeyEvent(ui::KeyEvent* event) { |
86 if (event->type() == ui::ET_KEY_PRESSED) | 91 if (event->type() == ui::ET_KEY_PRESSED) |
87 UpdateFocusAndCaretHighlights(); | 92 UpdateFocusAndCaretHighlights(); |
88 } | 93 } |
89 | 94 |
90 void AccessibilityHighlightManager::Observe( | 95 void AccessibilityHighlightManager::Observe( |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 void AccessibilityHighlightManager::UpdateCursorHighlight() { | 156 void AccessibilityHighlightManager::UpdateCursorHighlight() { |
152 if (cursor_ && IsCursorVisible()) { | 157 if (cursor_ && IsCursorVisible()) { |
153 AccessibilityFocusRingController::GetInstance()->SetCursorRing( | 158 AccessibilityFocusRingController::GetInstance()->SetCursorRing( |
154 cursor_point_); | 159 cursor_point_); |
155 } else { | 160 } else { |
156 AccessibilityFocusRingController::GetInstance()->HideCursorRing(); | 161 AccessibilityFocusRingController::GetInstance()->HideCursorRing(); |
157 } | 162 } |
158 } | 163 } |
159 | 164 |
160 } // namespace chromeos | 165 } // namespace chromeos |
OLD | NEW |