Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3054)

Unified Diff: chrome/browser/accessibility/accessibility_extension_api.cc

Issue 560983002: Add private extension API to move the accessibility focus ring. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@focus_ring_2_accessibility_ring
Patch Set: Rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..63957ae5049cd631c65a57a630c6e295f667431e 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)
+#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,29 @@ 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));
+ }
+
+ chromeos::AccessibilityFocusRingController::GetInstance()->SetFocusRing(
+ rects);
+ return true;
+#endif // defined(OS_CHROMEOS)
+
+ error_ = keys:: kErrorNotSupported;
+ return false;
+}

Powered by Google App Engine
This is Rietveld 408576698