Chromium Code Reviews| Index: ui/views/accessibility/native_view_accessibility.cc |
| diff --git a/ui/views/accessibility/native_view_accessibility.cc b/ui/views/accessibility/native_view_accessibility.cc |
| index 04a0fa5afb95126235feb7432fb72ff02c50bf93..8e1ddb8bac14118dd29903e52e2e3f86b47f65fd 100644 |
| --- a/ui/views/accessibility/native_view_accessibility.cc |
| +++ b/ui/views/accessibility/native_view_accessibility.cc |
| @@ -184,6 +184,49 @@ NativeViewAccessibility::GetTargetForNativeAccessibilityEvent() { |
| return gfx::kNullAcceleratedWidget; |
| } |
| +bool NativeViewAccessibility::AccessibilityPerformAction( |
| + const ui::AXActionData& data) { |
| + switch (data.action) { |
| + // Handle accessible actions that apply to all Views here. |
| + case ui::AX_ACTION_DO_DEFAULT: |
| + DoDefaultAction(); |
| + break; |
|
tapted
2016/11/21 02:15:43
return true?
Patti Lor
2016/11/21 23:24:38
Done.
|
| + case ui::AX_ACTION_SET_FOCUS: |
| + SetFocused(true); |
|
tapted
2016/11/21 02:15:43
return SetFocused? (if yes, break not required aft
Patti Lor
2016/11/21 23:24:38
Done.
|
| + break; |
| + case ui::AX_ACTION_BLUR: |
| + SetFocused(false); |
| + break; |
| + |
| + // Actions that only apply to specific Views should be dealt with by |
| + // HandleAccessibleAction(). |
| + case ui::AX_ACTION_REPLACE_SELECTED_TEXT: |
| + case ui::AX_ACTION_SET_VALUE: |
| + return view_->HandleAccessibleAction(data); |
| + break; |
| + |
| + // Not yet implemented accessibility actions. |
| + case ui::AX_ACTION_DECREMENT: |
| + case ui::AX_ACTION_HIT_TEST: |
| + case ui::AX_ACTION_INCREMENT: |
| + case ui::AX_ACTION_SCROLL_TO_MAKE_VISIBLE: |
| + case ui::AX_ACTION_SCROLL_TO_POINT: |
| + case ui::AX_ACTION_SET_ACCESSIBILITY_FOCUS: |
| + case ui::AX_ACTION_SET_SCROLL_OFFSET: |
| + case ui::AX_ACTION_SET_SELECTION: |
| + case ui::AX_ACTION_SHOW_CONTEXT_MENU: |
| + NOTIMPLEMENTED(); |
| + break; |
| + |
| + // Actions that are only used for the web or not used for Views. |
| + case ui::AX_ACTION_SET_SEQUENTIAL_FOCUS_NAVIGATION_STARTING_POINT: |
| + case ui::AX_ACTION_NONE: |
| + NOTREACHED(); |
| + break; |
| + } |
| + return false; |
| +} |
| + |
| void NativeViewAccessibility::DoDefaultAction() { |
| gfx::Point center = view_->GetLocalBounds().CenterPoint(); |
| view_->OnMousePressed(ui::MouseEvent(ui::ET_MOUSE_PRESSED, |
| @@ -200,23 +243,6 @@ void NativeViewAccessibility::DoDefaultAction() { |
| ui::EF_LEFT_MOUSE_BUTTON)); |
| } |
| -bool NativeViewAccessibility::SetStringValue(const base::string16& new_value, |
| - bool clear_first) { |
| - // Return an error if the view can't set the value. |
| - if (!CanSetStringValue()) |
| - return false; |
| - |
| - ui::AXActionData action_data; |
| - action_data.value = new_value; |
| - action_data.action = clear_first ? ui::AX_ACTION_SET_VALUE |
| - : ui::AX_ACTION_REPLACE_SELECTED_TEXT; |
| - return view_->HandleAccessibleAction(action_data); |
| -} |
| - |
| -bool NativeViewAccessibility::CanSetStringValue() { |
| - return !ui::AXNodeData::IsFlagSet(GetData().state, ui::AX_STATE_READ_ONLY); |
| -} |
| - |
| bool NativeViewAccessibility::SetFocused(bool focused) { |
|
tapted
2016/11/21 02:15:43
nit: move this to match the declaration order
Patti Lor
2016/11/21 23:24:38
Done, thanks!
|
| if (!ui::AXNodeData::IsFlagSet(GetData().state, ui::AX_STATE_FOCUSABLE)) |
| return false; |