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

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

Issue 1155183006: Reimplement automation API on top of C++-backed AXTree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@automation_faster_2
Patch Set: Rebase Created 5 years, 6 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/renderer/extensions/automation_internal_custom_bindings.h
diff --git a/chrome/renderer/extensions/automation_internal_custom_bindings.h b/chrome/renderer/extensions/automation_internal_custom_bindings.h
index 1bc8a795daa7a631cf7bf71cffbc3134e78c2fb9..d80d4ef7b1b27ed9dd63ca0222e89be11e47778b 100644
--- a/chrome/renderer/extensions/automation_internal_custom_bindings.h
+++ b/chrome/renderer/extensions/automation_internal_custom_bindings.h
@@ -17,9 +17,21 @@ namespace extensions {
class AutomationMessageFilter;
+struct TreeCache {
+ TreeCache();
+ ~TreeCache();
+
+ int tab_id;
+ int tree_id;
+
+ gfx::Vector2d location_offset;
+ ui::AXTree tree;
+};
+
// The native component of custom bindings for the chrome.automationInternal
// API.
-class AutomationInternalCustomBindings : public ObjectBackedNativeHandler {
+class AutomationInternalCustomBindings : public ObjectBackedNativeHandler,
+ public ui::AXTreeDelegate {
public:
explicit AutomationInternalCustomBindings(ScriptContext* context);
@@ -39,10 +51,76 @@ class AutomationInternalCustomBindings : public ObjectBackedNativeHandler {
// Get the routing ID for the extension.
void GetRoutingID(const v8::FunctionCallbackInfo<v8::Value>& args);
+ //
+ void StartCachingAccessibilityTrees(
+ const v8::FunctionCallbackInfo<v8::Value>& args);
+
+ //
+ void DestroyAccessibilityTree(
+ const v8::FunctionCallbackInfo<v8::Value>& args);
+
+ void GetRootID(
+ const v8::FunctionCallbackInfo<v8::Value>& args);
+
+ bool GetNodeHelper(
+ const v8::FunctionCallbackInfo<v8::Value>& args,
+ TreeCache** out_cache,
+ ui::AXNode** out_node);
+ void SetReturnValueFromBaseValue(
+ const v8::FunctionCallbackInfo<v8::Value>& args,
+ base::Value* value);
+
+ void GetParentID(
+ const v8::FunctionCallbackInfo<v8::Value>& args);
+ void GetChildCount(
+ const v8::FunctionCallbackInfo<v8::Value>& args);
+ void GetChildIDAtIndex(
+ const v8::FunctionCallbackInfo<v8::Value>& args);
+ void GetIndexInParent(
+ const v8::FunctionCallbackInfo<v8::Value>& args);
+
+ void GetState(
+ const v8::FunctionCallbackInfo<v8::Value>& args);
+ void GetRole(
+ const v8::FunctionCallbackInfo<v8::Value>& args);
+ void GetLocation(
+ const v8::FunctionCallbackInfo<v8::Value>& args);
+
+ bool GetAttributeHelper(
+ const v8::FunctionCallbackInfo<v8::Value>& args,
+ ui::AXNode** out_node,
+ std::string* out_attribute_name);
+
+ void GetStringAttribute(
+ const v8::FunctionCallbackInfo<v8::Value>& args);
+ void GetBoolAttribute(
+ const v8::FunctionCallbackInfo<v8::Value>& args);
+ void GetIntAttribute(
+ const v8::FunctionCallbackInfo<v8::Value>& args);
+ void GetFloatAttribute(
+ const v8::FunctionCallbackInfo<v8::Value>& args);
+ void GetIntListAttribute(
+ const v8::FunctionCallbackInfo<v8::Value>& args);
+
// Handle accessibility events from the browser process.
void OnAccessibilityEvent(
const ExtensionMsg_AccessibilityEventParams& params);
+ // AXTreeDelegate implementation.
+ void OnNodeWillBeDeleted(ui::AXTree* tree, ui::AXNode* node) override;
+ void OnSubtreeWillBeDeleted(ui::AXTree* tree, ui::AXNode* node) override;
+ void OnNodeCreated(ui::AXTree* tree, ui::AXNode* node) override;
+ void OnNodeChanged(ui::AXTree* tree, ui::AXNode* node) override;
+ void OnAtomicUpdateFinished(ui::AXTree* tree,
+ bool root_changed,
+ const std::vector<Change>& changes) override;
+
+ void SendTreeChangeEvent(const char *change_type,
+ ui::AXTree* tree,
+ ui::AXNode* node);
+
+ base::hash_map<int, TreeCache*> tree_id_to_tree_cache_map_;
+ base::hash_map<ui::AXTree*, TreeCache*> axtree_to_tree_cache_map_;
scoped_refptr<AutomationMessageFilter> message_filter_;
DISALLOW_COPY_AND_ASSIGN(AutomationInternalCustomBindings);

Powered by Google App Engine
This is Rietveld 408576698