| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/accessibility/ax_view_obj_wrapper.h" | 5 #include "ui/views/accessibility/ax_view_obj_wrapper.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "ui/accessibility/ax_node_data.h" | 8 #include "ui/accessibility/ax_node_data.h" |
| 9 #include "ui/accessibility/ax_view_state.h" | 9 #include "ui/accessibility/ax_view_state.h" |
| 10 #include "ui/events/event_utils.h" | 10 #include "ui/events/event_utils.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 } | 43 } |
| 44 | 44 |
| 45 void AXViewObjWrapper::Serialize(ui::AXNodeData* out_node_data) { | 45 void AXViewObjWrapper::Serialize(ui::AXNodeData* out_node_data) { |
| 46 ui::AXViewState view_data; | 46 ui::AXViewState view_data; |
| 47 view_->GetAccessibleState(&view_data); | 47 view_->GetAccessibleState(&view_data); |
| 48 | 48 |
| 49 out_node_data->id = GetID(); | 49 out_node_data->id = GetID(); |
| 50 out_node_data->role = view_data.role; | 50 out_node_data->role = view_data.role; |
| 51 | 51 |
| 52 out_node_data->state = view_data.state(); | 52 out_node_data->state = view_data.state(); |
| 53 if (view_->HasFocus()) | |
| 54 out_node_data->state |= 1 << ui::AX_STATE_FOCUSED; | |
| 55 if (view_->IsFocusable()) | 53 if (view_->IsFocusable()) |
| 56 out_node_data->state |= 1 << ui::AX_STATE_FOCUSABLE; | 54 out_node_data->state |= 1 << ui::AX_STATE_FOCUSABLE; |
| 57 if (!view_->visible()) | 55 if (!view_->visible()) |
| 58 out_node_data->state |= 1 << ui::AX_STATE_INVISIBLE; | 56 out_node_data->state |= 1 << ui::AX_STATE_INVISIBLE; |
| 59 | 57 |
| 60 out_node_data->location = view_->GetBoundsInScreen(); | 58 out_node_data->location = view_->GetBoundsInScreen(); |
| 61 | 59 |
| 62 out_node_data->AddStringAttribute( | 60 out_node_data->AddStringAttribute( |
| 63 ui::AX_ATTR_NAME, base::UTF16ToUTF8(view_data.name)); | 61 ui::AX_ATTR_NAME, base::UTF16ToUTF8(view_data.name)); |
| 64 out_node_data->AddStringAttribute( | 62 out_node_data->AddStringAttribute( |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 void AXViewObjWrapper::SetSelection(int32_t start, int32_t end) { | 97 void AXViewObjWrapper::SetSelection(int32_t start, int32_t end) { |
| 100 // TODO(dtseng): Implement. | 98 // TODO(dtseng): Implement. |
| 101 } | 99 } |
| 102 | 100 |
| 103 void AXViewObjWrapper::ShowContextMenu() { | 101 void AXViewObjWrapper::ShowContextMenu() { |
| 104 view_->ShowContextMenu(view_->bounds().CenterPoint(), | 102 view_->ShowContextMenu(view_->bounds().CenterPoint(), |
| 105 ui::MENU_SOURCE_KEYBOARD); | 103 ui::MENU_SOURCE_KEYBOARD); |
| 106 } | 104 } |
| 107 | 105 |
| 108 } // namespace views | 106 } // namespace views |
| OLD | NEW |