Index: chrome/browser/accessibility/accessibility_extension_api.cc |
diff --git a/chrome/browser/accessibility/accessibility_extension_api.cc b/chrome/browser/accessibility/accessibility_extension_api.cc |
index cac4f2c50887c01ace6db72238ab3b5640094ed7..b5141df7252edb13a7e72dae56bb2db0ffbb0124 100644 |
--- a/chrome/browser/accessibility/accessibility_extension_api.cc |
+++ b/chrome/browser/accessibility/accessibility_extension_api.cc |
@@ -25,6 +25,10 @@ |
#include "extensions/common/error_utils.h" |
#include "extensions/common/manifest_handlers/background_info.h" |
+#if defined(OS_CHROMEOS) |
David Tseng
2014/09/10 22:50:28
Are we going to be able to support all platforms?
dmazzoni
2014/09/11 22:04:36
Implementing this on other platforms is possible b
|
+#include "chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h" |
+#endif |
+ |
namespace keys = extension_accessibility_api_constants; |
namespace accessibility_private = extensions::api::accessibility_private; |
@@ -308,3 +312,27 @@ bool AccessibilityPrivateGetAlertsForTabFunction::RunSync() { |
SetResult(alerts_value); |
return true; |
} |
+ |
+bool AccessibilityPrivateSetFocusRingFunction::RunSync() { |
+#if defined(OS_CHROMEOS) |
+ base::ListValue* rect_values = NULL; |
+ EXTENSION_FUNCTION_VALIDATE(args_->GetList(0, &rect_values)); |
+ |
+ std::vector<gfx::Rect> rects; |
+ for (size_t i = 0; i < rect_values->GetSize(); ++i) { |
+ base::DictionaryValue* rect_value = NULL; |
+ EXTENSION_FUNCTION_VALIDATE(rect_values->GetDictionary(i, &rect_value)); |
+ int left, top, width, height; |
+ EXTENSION_FUNCTION_VALIDATE(rect_value->GetInteger("left", &left)); |
+ EXTENSION_FUNCTION_VALIDATE(rect_value->GetInteger("top", &top)); |
+ EXTENSION_FUNCTION_VALIDATE(rect_value->GetInteger("width", &width)); |
+ EXTENSION_FUNCTION_VALIDATE(rect_value->GetInteger("height", &height)); |
+ rects.push_back(gfx::Rect(left, top, width, height)); |
+ } |
David Tseng
2014/09/10 22:50:28
I'd check to make sure the auto-generated api bind
dmazzoni
2014/09/11 22:04:36
Sure. I filed http://crbug.com/413421 and I'm happ
|
+ |
+ chromeos::AccessibilityFocusRingController::GetInstance()->SetFocusRing( |
+ rects); |
+#endif // defined(OS_CHROMEOS) |
David Tseng
2014/09/10 22:50:28
Should fail on other platforms.
dmazzoni
2014/09/11 22:04:36
Done.
|
+ |
+ return true; |
+} |