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

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

Issue 2694903010: AX checked state changes (Closed)
Patch Set: Fix compiler error Created 3 years, 9 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.cc
diff --git a/chrome/renderer/extensions/automation_internal_custom_bindings.cc b/chrome/renderer/extensions/automation_internal_custom_bindings.cc
index e56944b1f4928389aae3fb68e502e1dc620804e8..d975b88d74422fb7f350cf38a74d47881b7e1f01 100644
--- a/chrome/renderer/extensions/automation_internal_custom_bindings.cc
+++ b/chrome/renderer/extensions/automation_internal_custom_bindings.cc
@@ -711,6 +711,16 @@ AutomationInternalCustomBindings::AutomationInternalCustomBindings(
std::string name_from_str = ui::ToString(name_from);
result.Set(v8::String::NewFromUtf8(isolate, name_from_str.c_str()));
});
+ RouteNodeIDFunction(
+ "GetChecked", [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result,
+ TreeCache* cache, ui::AXNode* node) {
+ const auto checked_state = static_cast<ui::AXCheckedState>(
+ node->data().GetIntAttribute(ui::AX_ATTR_CHECKED_STATE));
+ const char* checked_str = GetCheckedStateName(checked_state);
+ if (checked_state) {
+ result.Set(v8::String::NewFromUtf8(isolate, checked_str));
+ }
+ });
}
AutomationInternalCustomBindings::~AutomationInternalCustomBindings() {}
@@ -1001,6 +1011,21 @@ void AutomationInternalCustomBindings::GetState(
args.GetReturnValue().Set(state);
}
+const char* AutomationInternalCustomBindings::GetCheckedStateName(
David Tseng 2017/03/13 18:10:54 ax_enums.h should generate this for you (ToString(
+ const ui::AXCheckedState checked_state) {
+ switch (checked_state) {
+ case ui::AX_CHECKED_STATE_NONE:
+ return nullptr;
+ case ui::AX_CHECKED_STATE_TRUE:
+ return "true";
+ case ui::AX_CHECKED_STATE_MIXED:
+ return "mixed";
+ default:
+ break;
+ }
+ return "false";
+}
+
void AutomationInternalCustomBindings::UpdateOverallTreeChangeObserverFilter() {
tree_change_observer_overall_filter_ = 0;
for (const auto& observer : tree_change_observers_)

Powered by Google App Engine
This is Rietveld 408576698