| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 base::DictionaryValue* rect_value = NULL; | 70 base::DictionaryValue* rect_value = NULL; |
| 71 EXTENSION_FUNCTION_VALIDATE(rect_values->GetDictionary(i, &rect_value)); | 71 EXTENSION_FUNCTION_VALIDATE(rect_values->GetDictionary(i, &rect_value)); |
| 72 int left, top, width, height; | 72 int left, top, width, height; |
| 73 EXTENSION_FUNCTION_VALIDATE(rect_value->GetInteger(kLeft, &left)); | 73 EXTENSION_FUNCTION_VALIDATE(rect_value->GetInteger(kLeft, &left)); |
| 74 EXTENSION_FUNCTION_VALIDATE(rect_value->GetInteger(kTop, &top)); | 74 EXTENSION_FUNCTION_VALIDATE(rect_value->GetInteger(kTop, &top)); |
| 75 EXTENSION_FUNCTION_VALIDATE(rect_value->GetInteger(kWidth, &width)); | 75 EXTENSION_FUNCTION_VALIDATE(rect_value->GetInteger(kWidth, &width)); |
| 76 EXTENSION_FUNCTION_VALIDATE(rect_value->GetInteger(kHeight, &height)); | 76 EXTENSION_FUNCTION_VALIDATE(rect_value->GetInteger(kHeight, &height)); |
| 77 rects.push_back(gfx::Rect(left, top, width, height)); | 77 rects.push_back(gfx::Rect(left, top, width, height)); |
| 78 } | 78 } |
| 79 | 79 |
| 80 // Move the visible focus ring to cover all of these rects. |
| 80 chromeos::AccessibilityFocusRingController::GetInstance()->SetFocusRing( | 81 chromeos::AccessibilityFocusRingController::GetInstance()->SetFocusRing( |
| 81 rects); | 82 rects); |
| 83 |
| 84 // Also update the touch exploration controller so that synthesized |
| 85 // touch events are anchored within the focused object. |
| 86 if (!rects.empty()) { |
| 87 chromeos::AccessibilityManager* manager = |
| 88 chromeos::AccessibilityManager::Get(); |
| 89 manager->SetTouchAccessibilityAnchorPoint(rects[0].CenterPoint()); |
| 90 } |
| 91 |
| 82 return true; | 92 return true; |
| 83 #endif // defined(OS_CHROMEOS) | 93 #endif // defined(OS_CHROMEOS) |
| 84 | 94 |
| 85 error_ = kErrorNotSupported; | 95 error_ = kErrorNotSupported; |
| 86 return false; | 96 return false; |
| 87 } | 97 } |
| 88 | 98 |
| 89 ExtensionFunction::ResponseAction | 99 ExtensionFunction::ResponseAction |
| 90 AccessibilityPrivateSetKeyboardListenerFunction::Run() { | 100 AccessibilityPrivateSetKeyboardListenerFunction::Run() { |
| 91 ChromeExtensionFunctionDetails details(this); | 101 ChromeExtensionFunctionDetails details(this); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 111 } else { | 121 } else { |
| 112 manager->SetKeyboardListenerExtensionId(std::string(), | 122 manager->SetKeyboardListenerExtensionId(std::string(), |
| 113 details.GetProfile()); | 123 details.GetProfile()); |
| 114 manager->set_keyboard_listener_capture(false); | 124 manager->set_keyboard_listener_capture(false); |
| 115 } | 125 } |
| 116 return RespondNow(NoArguments()); | 126 return RespondNow(NoArguments()); |
| 117 #endif // defined OS_CHROMEOS | 127 #endif // defined OS_CHROMEOS |
| 118 | 128 |
| 119 return RespondNow(Error(kErrorNotSupported)); | 129 return RespondNow(Error(kErrorNotSupported)); |
| 120 } | 130 } |
| OLD | NEW |