Replace ui::AXViewState with AXNodeData and AXActionData
This is a refactoring change.
Originally AXViewState was created when Views accessibility
didn't share any code with the rest of Chrome. Now there's
a lot more overlap, and every place where AXViewState is
consumed, it's just converted into AXNodeData. This change
eliminates AXViewState and uses AXNodeData in Views directly,
allowing us to delete some conversion code.
To replace AXViewState::set_value_callback, which was rather
awkward, this change adds a virtual function to View that
takes an AXActionData, a general-purpose struct that encodes an
accessible action to take on an object. That provides a
cleaner solution for set_value_callback and allows for
more streamlining of code later.
I suggest reviewing Patch Set 4 first, as that includes
only the non-mechanical changes.
BUG=662064
Review-Url: https://codereview.chromium.org/2477463003
Cr-Commit-Position: refs/heads/master@{#429823}
diff --git a/ui/accessibility/ax_node_data.h b/ui/accessibility/ax_node_data.h
index 3fbaaa5..acd5ec5 100644
--- a/ui/accessibility/ax_node_data.h
+++ b/ui/accessibility/ax_node_data.h
@@ -93,8 +93,17 @@
// Convenience functions, mainly for writing unit tests.
// Equivalent to AddStringAttribute(ATTR_NAME, name).
void SetName(const std::string& name);
+ void SetName(const base::string16& name);
// Equivalent to AddStringAttribute(ATTR_VALUE, value).
void SetValue(const std::string& value);
+ void SetValue(const base::string16& value);
+
+ // Helper to check whether |state_flag| is set in the given |state|.
+ static bool IsFlagSet(uint32_t state, ui::AXState state_flag);
+
+ // Set or check bits in |state_|.
+ void AddStateFlag(ui::AXState state_flag);
+ bool HasStateFlag(ui::AXState state_flag) const;
// Return a string representation of this data, for debugging.
virtual std::string ToString() const;