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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 } | 46 } |
47 | 47 |
48 void AXViewObjWrapper::Serialize(ui::AXNodeData* out_node_data) { | 48 void AXViewObjWrapper::Serialize(ui::AXNodeData* out_node_data) { |
49 ui::AXViewState view_data; | 49 ui::AXViewState view_data; |
50 view_->GetAccessibleState(&view_data); | 50 view_->GetAccessibleState(&view_data); |
51 | 51 |
52 out_node_data->id = GetID(); | 52 out_node_data->id = GetID(); |
53 out_node_data->role = view_data.role; | 53 out_node_data->role = view_data.role; |
54 | 54 |
55 out_node_data->state = view_data.state(); | 55 out_node_data->state = view_data.state(); |
56 if (view_->HasFocus()) | |
57 out_node_data->state |= 1 << ui::AX_STATE_FOCUSED; | |
58 if (view_->IsFocusable()) | 56 if (view_->IsFocusable()) |
59 out_node_data->state |= 1 << ui::AX_STATE_FOCUSABLE; | 57 out_node_data->state |= 1 << ui::AX_STATE_FOCUSABLE; |
60 if (!view_->visible()) | 58 if (!view_->visible()) |
61 out_node_data->state |= 1 << ui::AX_STATE_INVISIBLE; | 59 out_node_data->state |= 1 << ui::AX_STATE_INVISIBLE; |
62 | 60 |
63 out_node_data->location = view_->GetBoundsInScreen(); | 61 out_node_data->location = view_->GetBoundsInScreen(); |
64 | 62 |
65 out_node_data->AddStringAttribute( | 63 out_node_data->AddStringAttribute( |
66 ui::AX_ATTR_NAME, base::UTF16ToUTF8(view_data.name)); | 64 ui::AX_ATTR_NAME, base::UTF16ToUTF8(view_data.name)); |
67 out_node_data->AddStringAttribute( | 65 out_node_data->AddStringAttribute( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 void AXViewObjWrapper::SetSelection(int32_t start, int32_t end) { | 100 void AXViewObjWrapper::SetSelection(int32_t start, int32_t end) { |
103 // TODO(dtseng): Implement. | 101 // TODO(dtseng): Implement. |
104 } | 102 } |
105 | 103 |
106 void AXViewObjWrapper::ShowContextMenu() { | 104 void AXViewObjWrapper::ShowContextMenu() { |
107 view_->ShowContextMenu(view_->bounds().CenterPoint(), | 105 view_->ShowContextMenu(view_->bounds().CenterPoint(), |
108 ui::MENU_SOURCE_KEYBOARD); | 106 ui::MENU_SOURCE_KEYBOARD); |
109 } | 107 } |
110 | 108 |
111 } // namespace views | 109 } // namespace views |
OLD | NEW |