Chromium Code Reviews| 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/gfx/geometry/rect.h" | |
|
Luis Héctor Chávez
2017/01/19 17:17:56
nit: Remove
yawano
2017/01/20 06:52:30
Done.
| |
| 12 #include "ui/wm/core/coordinate_conversion.h" | 13 #include "ui/wm/core/coordinate_conversion.h" |
| 13 #include "ui/wm/core/cursor_manager.h" | 14 #include "ui/wm/core/cursor_manager.h" |
| 14 | 15 |
| 15 namespace chromeos { | 16 namespace chromeos { |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| 19 ui::InputMethod* GetInputMethod(aura::Window* root_window) { | 20 ui::InputMethod* GetInputMethod(aura::Window* root_window) { |
| 20 if (root_window->GetHost()) | 21 if (root_window->GetHost()) |
| 21 return root_window->GetHost()->GetInputMethod(); | 22 return root_window->GetHost()->GetInputMethod(); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 shell->AddPreTargetHandler(this); | 70 shell->AddPreTargetHandler(this); |
| 70 shell->cursor_manager()->AddObserver(this); | 71 shell->cursor_manager()->AddObserver(this); |
| 71 registrar_.Add(this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, | 72 registrar_.Add(this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, |
| 72 content::NotificationService::AllSources()); | 73 content::NotificationService::AllSources()); |
| 73 aura::Window* root_window = ash::Shell::GetPrimaryRootWindow(); | 74 aura::Window* root_window = ash::Shell::GetPrimaryRootWindow(); |
| 74 ui::InputMethod* input_method = GetInputMethod(root_window); | 75 ui::InputMethod* input_method = GetInputMethod(root_window); |
| 75 input_method->AddObserver(this); | 76 input_method->AddObserver(this); |
| 76 registered_observers_ = true; | 77 registered_observers_ = true; |
| 77 } | 78 } |
| 78 | 79 |
| 80 void AccessibilityHighlightManager::OnViewFocusedInArc( | |
| 81 const gfx::Rect& bounds) { | |
| 82 focus_rect_ = bounds; | |
| 83 UpdateFocusAndCaretHighlights(); | |
| 84 } | |
| 85 | |
| 79 void AccessibilityHighlightManager::OnMouseEvent(ui::MouseEvent* event) { | 86 void AccessibilityHighlightManager::OnMouseEvent(ui::MouseEvent* event) { |
| 80 if (event->type() == ui::ET_MOUSE_MOVED) { | 87 if (event->type() == ui::ET_MOUSE_MOVED) { |
| 81 cursor_point_ = event->location(); | 88 cursor_point_ = event->location(); |
| 82 if (event->target()) { | 89 if (event->target()) { |
| 83 ::wm::ConvertPointToScreen(static_cast<aura::Window*>(event->target()), | 90 ::wm::ConvertPointToScreen(static_cast<aura::Window*>(event->target()), |
| 84 &cursor_point_); | 91 &cursor_point_); |
| 85 } | 92 } |
| 86 UpdateCursorHighlight(); | 93 UpdateCursorHighlight(); |
| 87 } | 94 } |
| 88 } | 95 } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 156 void AccessibilityHighlightManager::UpdateCursorHighlight() { | 163 void AccessibilityHighlightManager::UpdateCursorHighlight() { |
| 157 if (cursor_ && IsCursorVisible()) { | 164 if (cursor_ && IsCursorVisible()) { |
| 158 AccessibilityFocusRingController::GetInstance()->SetCursorRing( | 165 AccessibilityFocusRingController::GetInstance()->SetCursorRing( |
| 159 cursor_point_); | 166 cursor_point_); |
| 160 } else { | 167 } else { |
| 161 AccessibilityFocusRingController::GetInstance()->HideCursorRing(); | 168 AccessibilityFocusRingController::GetInstance()->HideCursorRing(); |
| 162 } | 169 } |
| 163 } | 170 } |
| 164 | 171 |
| 165 } // namespace chromeos | 172 } // namespace chromeos |
| OLD | NEW |