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

Unified Diff: chrome/renderer/extensions/automation_internal_custom_bindings.cc

Issue 1457683009: Complete live region support in ChromeVox Next. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/renderer/extensions/automation_internal_custom_bindings.cc
diff --git a/chrome/renderer/extensions/automation_internal_custom_bindings.cc b/chrome/renderer/extensions/automation_internal_custom_bindings.cc
index 0ecab81397b8b05c932a459ba20d7a77358b9463..987d457c2b7f9945261b455fcfff465eb0a7350d 100644
--- a/chrome/renderer/extensions/automation_internal_custom_bindings.cc
+++ b/chrome/renderer/extensions/automation_internal_custom_bindings.cc
@@ -265,7 +265,10 @@ private:
AutomationInternalCustomBindings::AutomationInternalCustomBindings(
ScriptContext* context)
- : ObjectBackedNativeHandler(context), is_active_profile_(true) {
+ : ObjectBackedNativeHandler(context),
+ is_active_profile_(true),
+ tree_change_observer_mask_(
+ api::automation::TREE_CHANGE_OBSERVER_MASK_NOTREECHANGES) {
// It's safe to use base::Unretained(this) here because these bindings
// will only be called on a valid AutomationInternalCustomBindings instance
// and none of the functions have any side effects.
@@ -278,6 +281,7 @@ AutomationInternalCustomBindings::AutomationInternalCustomBindings(
ROUTE_FUNCTION(GetRoutingID);
ROUTE_FUNCTION(StartCachingAccessibilityTrees);
ROUTE_FUNCTION(DestroyAccessibilityTree);
+ ROUTE_FUNCTION(SetTreeChangeObserverMask);
ROUTE_FUNCTION(GetChildIDAtIndex);
#undef ROUTE_FUNCTION
@@ -570,6 +574,18 @@ void AutomationInternalCustomBindings::DestroyAccessibilityTree(
delete cache;
}
+void AutomationInternalCustomBindings::SetTreeChangeObserverMask(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
+ if (args.Length() != 1 || !args[0]->IsString()) {
+ ThrowInvalidArgumentsException(this);
+ return;
+ }
+
+ std::string mask_str = *v8::String::Utf8Value(args[0]);
+ tree_change_observer_mask_ =
Peter Lundblad 2015/11/20 13:42:59 What catches invalid values?
dmazzoni 2015/11/23 20:16:50 ParseTreeChangeObserverMask is autogenerated, it t
+ api::automation::ParseTreeChangeObserverMask(mask_str);
+}
+
void AutomationInternalCustomBindings::RouteTreeIDFunction(
const std::string& name,
TreeIDFunction callback) {
@@ -739,6 +755,24 @@ void AutomationInternalCustomBindings::SendTreeChangeEvent(
if (!is_active_profile_)
return;
+ if (node->data().role != ui::AX_ROLE_EMBEDDED_OBJECT &&
+ node->data().role != ui::AX_ROLE_WEB_VIEW) {
+ switch (tree_change_observer_mask_) {
+ case api::automation::TREE_CHANGE_OBSERVER_MASK_NOTREECHANGES:
+ default:
+ return;
+ case api::automation::TREE_CHANGE_OBSERVER_MASK_LIVEREGIONTREECHANGES:
+ if (!node->data().HasStringAttribute(
+ ui::AX_ATTR_CONTAINER_LIVE_STATUS) &&
+ node->data().role != ui::AX_ROLE_ALERT) {
+ return;
+ }
+ break;
+ case api::automation::TREE_CHANGE_OBSERVER_MASK_ALLTREECHANGES:
+ break;
+ }
+ }
+
auto iter = axtree_to_tree_cache_map_.find(tree);
if (iter == axtree_to_tree_cache_map_.end())
return;

Powered by Google App Engine
This is Rietveld 408576698