| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/accessibility/accessibility_extension_api.h" | 5 #include "chrome/browser/accessibility/accessibility_extension_api.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "content/public/browser/browser_accessibility_state.h" | 24 #include "content/public/browser/browser_accessibility_state.h" |
| 25 #include "extensions/browser/event_router.h" | 25 #include "extensions/browser/event_router.h" |
| 26 #include "extensions/browser/extension_system.h" | 26 #include "extensions/browser/extension_system.h" |
| 27 #include "extensions/browser/lazy_background_task_queue.h" | 27 #include "extensions/browser/lazy_background_task_queue.h" |
| 28 #include "extensions/common/error_utils.h" | 28 #include "extensions/common/error_utils.h" |
| 29 #include "extensions/common/manifest_handlers/background_info.h" | 29 #include "extensions/common/manifest_handlers/background_info.h" |
| 30 | 30 |
| 31 #if defined(OS_CHROMEOS) | 31 #if defined(OS_CHROMEOS) |
| 32 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 32 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 33 #include "chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h" | 33 #include "chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h" |
| 34 using chromeos::AccessibilityFocusRingController; |
| 34 #endif | 35 #endif |
| 35 | 36 |
| 36 namespace accessibility_private = extensions::api::accessibility_private; | 37 namespace accessibility_private = extensions::api::accessibility_private; |
| 37 | 38 |
| 38 namespace { | 39 namespace { |
| 39 #if defined(OS_CHROMEOS) | 40 #if defined(OS_CHROMEOS) |
| 40 // ScreenRect fields. | 41 // ScreenRect fields. |
| 41 const char kLeft[] = "left"; | 42 const char kLeft[] = "left"; |
| 42 const char kTop[] = "top"; | 43 const char kTop[] = "top"; |
| 43 const char kWidth[] = "width"; | 44 const char kWidth[] = "width"; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 71 EXTENSION_FUNCTION_VALIDATE(rect_values->GetDictionary(i, &rect_value)); | 72 EXTENSION_FUNCTION_VALIDATE(rect_values->GetDictionary(i, &rect_value)); |
| 72 int left, top, width, height; | 73 int left, top, width, height; |
| 73 EXTENSION_FUNCTION_VALIDATE(rect_value->GetInteger(kLeft, &left)); | 74 EXTENSION_FUNCTION_VALIDATE(rect_value->GetInteger(kLeft, &left)); |
| 74 EXTENSION_FUNCTION_VALIDATE(rect_value->GetInteger(kTop, &top)); | 75 EXTENSION_FUNCTION_VALIDATE(rect_value->GetInteger(kTop, &top)); |
| 75 EXTENSION_FUNCTION_VALIDATE(rect_value->GetInteger(kWidth, &width)); | 76 EXTENSION_FUNCTION_VALIDATE(rect_value->GetInteger(kWidth, &width)); |
| 76 EXTENSION_FUNCTION_VALIDATE(rect_value->GetInteger(kHeight, &height)); | 77 EXTENSION_FUNCTION_VALIDATE(rect_value->GetInteger(kHeight, &height)); |
| 77 rects.push_back(gfx::Rect(left, top, width, height)); | 78 rects.push_back(gfx::Rect(left, top, width, height)); |
| 78 } | 79 } |
| 79 | 80 |
| 80 // Move the visible focus ring to cover all of these rects. | 81 // Move the visible focus ring to cover all of these rects. |
| 81 chromeos::AccessibilityFocusRingController::GetInstance()->SetFocusRing( | 82 AccessibilityFocusRingController::GetInstance()->SetFocusRing( |
| 82 rects); | 83 rects, AccessibilityFocusRingController::PERSIST_FOCUS_RING); |
| 83 | 84 |
| 84 // Also update the touch exploration controller so that synthesized | 85 // Also update the touch exploration controller so that synthesized |
| 85 // touch events are anchored within the focused object. | 86 // touch events are anchored within the focused object. |
| 86 if (!rects.empty()) { | 87 if (!rects.empty()) { |
| 87 chromeos::AccessibilityManager* manager = | 88 chromeos::AccessibilityManager* manager = |
| 88 chromeos::AccessibilityManager::Get(); | 89 chromeos::AccessibilityManager::Get(); |
| 89 manager->SetTouchAccessibilityAnchorPoint(rects[0].CenterPoint()); | 90 manager->SetTouchAccessibilityAnchorPoint(rects[0].CenterPoint()); |
| 90 } | 91 } |
| 91 | 92 |
| 92 return true; | 93 return true; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 121 } else { | 122 } else { |
| 122 manager->SetKeyboardListenerExtensionId(std::string(), | 123 manager->SetKeyboardListenerExtensionId(std::string(), |
| 123 details.GetProfile()); | 124 details.GetProfile()); |
| 124 manager->set_keyboard_listener_capture(false); | 125 manager->set_keyboard_listener_capture(false); |
| 125 } | 126 } |
| 126 return RespondNow(NoArguments()); | 127 return RespondNow(NoArguments()); |
| 127 #endif // defined OS_CHROMEOS | 128 #endif // defined OS_CHROMEOS |
| 128 | 129 |
| 129 return RespondNow(Error(kErrorNotSupported)); | 130 return RespondNow(Error(kErrorNotSupported)); |
| 130 } | 131 } |
| OLD | NEW |