| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/accessibility/platform/ax_platform_node_auralinux.h" | 5 #include "ui/accessibility/platform/ax_platform_node_auralinux.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 9 #include "ui/accessibility/ax_node_data.h" | 9 #include "ui/accessibility/ax_node_data.h" |
| 10 #include "ui/accessibility/platform/atk_util_auralinux.h" | 10 #include "ui/accessibility/platform/atk_util_auralinux.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 ATK_OBJECT_CLASS(ax_platform_node_auralinux_parent_class)-> | 147 ATK_OBJECT_CLASS(ax_platform_node_auralinux_parent_class)-> |
| 148 ref_relation_set(atk_object); | 148 ref_relation_set(atk_object); |
| 149 | 149 |
| 150 if (!obj) | 150 if (!obj) |
| 151 return atk_relation_set; | 151 return atk_relation_set; |
| 152 | 152 |
| 153 obj->GetAtkRelations(atk_relation_set); | 153 obj->GetAtkRelations(atk_relation_set); |
| 154 return atk_relation_set; | 154 return atk_relation_set; |
| 155 } | 155 } |
| 156 | 156 |
| 157 static AtkAttributeSet* ax_platform_node_auralinux_get_attributes( |
| 158 AtkObject* atk_object) { |
| 159 return NULL; |
| 160 } |
| 161 |
| 157 static AtkRole ax_platform_node_auralinux_get_role(AtkObject* atk_object) { | 162 static AtkRole ax_platform_node_auralinux_get_role(AtkObject* atk_object) { |
| 158 ui::AXPlatformNodeAuraLinux* obj = | 163 ui::AXPlatformNodeAuraLinux* obj = |
| 159 AtkObjectToAXPlatformNodeAuraLinux(atk_object); | 164 AtkObjectToAXPlatformNodeAuraLinux(atk_object); |
| 160 if (!obj) | 165 if (!obj) |
| 161 return ATK_ROLE_INVALID; | 166 return ATK_ROLE_INVALID; |
| 162 return obj->GetAtkRole(); | 167 return obj->GetAtkRole(); |
| 163 } | 168 } |
| 164 | 169 |
| 165 static AtkStateSet* ax_platform_node_auralinux_ref_state_set( | 170 static AtkStateSet* ax_platform_node_auralinux_ref_state_set( |
| 166 AtkObject* atk_object) { | 171 AtkObject* atk_object) { |
| 167 ui::AXPlatformNodeAuraLinux* obj = | 172 ui::AXPlatformNodeAuraLinux* obj = |
| 168 AtkObjectToAXPlatformNodeAuraLinux(atk_object); | 173 AtkObjectToAXPlatformNodeAuraLinux(atk_object); |
| 169 AtkStateSet* state_set = | 174 if (!obj) |
| 175 return NULL; |
| 176 |
| 177 AtkStateSet* atk_state_set = |
| 170 ATK_OBJECT_CLASS(ax_platform_node_auralinux_parent_class)-> | 178 ATK_OBJECT_CLASS(ax_platform_node_auralinux_parent_class)-> |
| 171 ref_state_set(atk_object); | 179 ref_state_set(atk_object); |
| 172 | 180 |
| 173 if (!obj) { | 181 obj->GetAtkState(atk_state_set); |
| 174 atk_state_set_add_state(state_set, ATK_STATE_DEFUNCT); | 182 return atk_state_set; |
| 175 return state_set; | |
| 176 } | |
| 177 obj->GetAtkState(state_set); | |
| 178 | |
| 179 return state_set; | |
| 180 } | 183 } |
| 181 | 184 |
| 182 // | 185 // |
| 183 // The rest of the AXPlatformNodeAuraLinux code, not specific to one | 186 // The rest of the AXPlatformNodeAuraLinux code, not specific to one |
| 184 // of the Atk* interfaces. | 187 // of the Atk* interfaces. |
| 185 // | 188 // |
| 186 | 189 |
| 187 static void ax_platform_node_auralinux_init(AtkObject* atk_object, | 190 static void ax_platform_node_auralinux_init(AtkObject* atk_object, |
| 188 gpointer data) { | 191 gpointer data) { |
| 189 if (ATK_OBJECT_CLASS(ax_platform_node_auralinux_parent_class)->initialize) { | 192 if (ATK_OBJECT_CLASS(ax_platform_node_auralinux_parent_class)->initialize) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 207 klass->initialize = ax_platform_node_auralinux_init; | 210 klass->initialize = ax_platform_node_auralinux_init; |
| 208 klass->get_name = ax_platform_node_auralinux_get_name; | 211 klass->get_name = ax_platform_node_auralinux_get_name; |
| 209 klass->get_description = ax_platform_node_auralinux_get_description; | 212 klass->get_description = ax_platform_node_auralinux_get_description; |
| 210 klass->get_parent = ax_platform_node_auralinux_get_parent; | 213 klass->get_parent = ax_platform_node_auralinux_get_parent; |
| 211 klass->get_n_children = ax_platform_node_auralinux_get_n_children; | 214 klass->get_n_children = ax_platform_node_auralinux_get_n_children; |
| 212 klass->ref_child = ax_platform_node_auralinux_ref_child; | 215 klass->ref_child = ax_platform_node_auralinux_ref_child; |
| 213 klass->get_role = ax_platform_node_auralinux_get_role; | 216 klass->get_role = ax_platform_node_auralinux_get_role; |
| 214 klass->ref_state_set = ax_platform_node_auralinux_ref_state_set; | 217 klass->ref_state_set = ax_platform_node_auralinux_ref_state_set; |
| 215 klass->get_index_in_parent = ax_platform_node_auralinux_get_index_in_parent; | 218 klass->get_index_in_parent = ax_platform_node_auralinux_get_index_in_parent; |
| 216 klass->ref_relation_set = ax_platform_node_auralinux_ref_relation_set; | 219 klass->ref_relation_set = ax_platform_node_auralinux_ref_relation_set; |
| 220 klass->get_attributes = ax_platform_node_auralinux_get_attributes; |
| 217 } | 221 } |
| 218 | 222 |
| 219 GType ax_platform_node_auralinux_get_type() { | 223 GType ax_platform_node_auralinux_get_type() { |
| 220 static volatile gsize type_volatile = 0; | 224 static volatile gsize type_volatile = 0; |
| 221 | 225 |
| 222 if (g_once_init_enter(&type_volatile)) { | 226 if (g_once_init_enter(&type_volatile)) { |
| 223 static const GTypeInfo tinfo = { | 227 static const GTypeInfo tinfo = { |
| 224 sizeof(AXPlatformNodeAuraLinuxClass), | 228 sizeof(AXPlatformNodeAuraLinuxClass), |
| 225 (GBaseInitFunc) 0, | 229 (GBaseInitFunc) 0, |
| 226 (GBaseFinalizeFunc) 0, | 230 (GBaseFinalizeFunc) 0, |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 return ATK_ROLE_ENTRY; | 326 return ATK_ROLE_ENTRY; |
| 323 case ui::AX_ROLE_TOOLBAR: | 327 case ui::AX_ROLE_TOOLBAR: |
| 324 return ATK_ROLE_TOOL_BAR; | 328 return ATK_ROLE_TOOL_BAR; |
| 325 case ui::AX_ROLE_WINDOW: | 329 case ui::AX_ROLE_WINDOW: |
| 326 return ATK_ROLE_WINDOW; | 330 return ATK_ROLE_WINDOW; |
| 327 default: | 331 default: |
| 328 return ATK_ROLE_UNKNOWN; | 332 return ATK_ROLE_UNKNOWN; |
| 329 } | 333 } |
| 330 } | 334 } |
| 331 | 335 |
| 332 void AXPlatformNodeAuraLinux::GetAtkState(AtkStateSet* state_set) { | 336 void AXPlatformNodeAuraLinux::GetAtkState(AtkStateSet* atk_state_set) { |
| 333 uint32 state = GetData().state; | 337 uint32 state = GetData().state; |
| 334 | 338 |
| 335 if (state & (1 << ui::AX_STATE_CHECKED)) | 339 if (state & (1 << ui::AX_STATE_CHECKED)) |
| 336 atk_state_set_add_state(state_set, ATK_STATE_CHECKED); | 340 atk_state_set_add_state(atk_state_set, ATK_STATE_CHECKED); |
| 337 if (state & (1 << ui::AX_STATE_DEFAULT)) | 341 if (state & (1 << ui::AX_STATE_DEFAULT)) |
| 338 atk_state_set_add_state(state_set, ATK_STATE_DEFAULT); | 342 atk_state_set_add_state(atk_state_set, ATK_STATE_DEFAULT); |
| 339 if (state & (1 << ui::AX_STATE_EDITABLE)) | 343 if (state & (1 << ui::AX_STATE_EDITABLE)) |
| 340 atk_state_set_add_state(state_set, ATK_STATE_EDITABLE); | 344 atk_state_set_add_state(atk_state_set, ATK_STATE_EDITABLE); |
| 341 if (state & (1 << ui::AX_STATE_ENABLED)) | 345 if (state & (1 << ui::AX_STATE_ENABLED)) |
| 342 atk_state_set_add_state(state_set, ATK_STATE_ENABLED); | 346 atk_state_set_add_state(atk_state_set, ATK_STATE_ENABLED); |
| 343 if (state & (1 << ui::AX_STATE_EXPANDED)) | 347 if (state & (1 << ui::AX_STATE_EXPANDED)) |
| 344 atk_state_set_add_state(state_set, ATK_STATE_EXPANDED); | 348 atk_state_set_add_state(atk_state_set, ATK_STATE_EXPANDED); |
| 345 if (state & (1 << ui::AX_STATE_FOCUSABLE)) | 349 if (state & (1 << ui::AX_STATE_FOCUSABLE)) |
| 346 atk_state_set_add_state(state_set, ATK_STATE_FOCUSABLE); | 350 atk_state_set_add_state(atk_state_set, ATK_STATE_FOCUSABLE); |
| 347 if (state & (1 << ui::AX_STATE_FOCUSED)) | 351 if (state & (1 << ui::AX_STATE_FOCUSED)) |
| 348 atk_state_set_add_state(state_set, ATK_STATE_FOCUSED); | 352 atk_state_set_add_state(atk_state_set, ATK_STATE_FOCUSED); |
| 349 if (state & (1 << ui::AX_STATE_PRESSED)) | 353 if (state & (1 << ui::AX_STATE_PRESSED)) |
| 350 atk_state_set_add_state(state_set, ATK_STATE_PRESSED); | 354 atk_state_set_add_state(atk_state_set, ATK_STATE_PRESSED); |
| 351 if (state & (1 << ui::AX_STATE_SELECTABLE)) | 355 if (state & (1 << ui::AX_STATE_SELECTABLE)) |
| 352 atk_state_set_add_state(state_set, ATK_STATE_SELECTABLE); | 356 atk_state_set_add_state(atk_state_set, ATK_STATE_SELECTABLE); |
| 353 if (state & (1 << ui::AX_STATE_SELECTED)) | 357 if (state & (1 << ui::AX_STATE_SELECTED)) |
| 354 atk_state_set_add_state(state_set, ATK_STATE_SELECTED); | 358 atk_state_set_add_state(atk_state_set, ATK_STATE_SELECTED); |
| 355 } | 359 } |
| 356 | 360 |
| 357 void AXPlatformNodeAuraLinux::GetAtkRelations(AtkRelationSet* atk_relation_set) | 361 void AXPlatformNodeAuraLinux::GetAtkRelations(AtkRelationSet* atk_relation_set) |
| 358 { | 362 { |
| 359 } | 363 } |
| 360 | 364 |
| 361 AXPlatformNodeAuraLinux::AXPlatformNodeAuraLinux() | 365 AXPlatformNodeAuraLinux::AXPlatformNodeAuraLinux() |
| 362 : atk_object_(nullptr) { | 366 : atk_object_(nullptr) { |
| 363 } | 367 } |
| 364 | 368 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 382 } | 386 } |
| 383 | 387 |
| 384 void AXPlatformNodeAuraLinux::NotifyAccessibilityEvent(ui::AXEvent event_type) { | 388 void AXPlatformNodeAuraLinux::NotifyAccessibilityEvent(ui::AXEvent event_type) { |
| 385 } | 389 } |
| 386 | 390 |
| 387 int AXPlatformNodeAuraLinux::GetIndexInParent() { | 391 int AXPlatformNodeAuraLinux::GetIndexInParent() { |
| 388 return 0; | 392 return 0; |
| 389 } | 393 } |
| 390 | 394 |
| 391 } // namespace ui | 395 } // namespace ui |
| OLD | NEW |