| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/accessibility/browser_accessibility_manager_gtk.h" | 5 #include "content/browser/accessibility/browser_accessibility_manager_gtk.h" |
| 6 | 6 |
| 7 #include "content/browser/accessibility/browser_accessibility_gtk.h" | 7 #include "content/browser/accessibility/browser_accessibility_gtk.h" |
| 8 #include "content/common/accessibility_messages.h" | 8 #include "content/common/accessibility_messages.h" |
| 9 | 9 |
| 10 namespace content { | 10 namespace content { |
| 11 | 11 |
| 12 // static | 12 // static |
| 13 BrowserAccessibilityManager* BrowserAccessibilityManager::Create( | 13 BrowserAccessibilityManager* BrowserAccessibilityManager::Create( |
| 14 const AccessibilityNodeData& src, | 14 const ui::AXNodeData& src, |
| 15 BrowserAccessibilityDelegate* delegate, | 15 BrowserAccessibilityDelegate* delegate, |
| 16 BrowserAccessibilityFactory* factory) { | 16 BrowserAccessibilityFactory* factory) { |
| 17 return new BrowserAccessibilityManagerGtk( | 17 return new BrowserAccessibilityManagerGtk( |
| 18 NULL, | 18 NULL, |
| 19 src, | 19 src, |
| 20 delegate, | 20 delegate, |
| 21 factory); | 21 factory); |
| 22 } | 22 } |
| 23 | 23 |
| 24 BrowserAccessibilityManagerGtk::BrowserAccessibilityManagerGtk( | 24 BrowserAccessibilityManagerGtk::BrowserAccessibilityManagerGtk( |
| 25 GtkWidget* parent_widget, | 25 GtkWidget* parent_widget, |
| 26 const AccessibilityNodeData& src, | 26 const ui::AXNodeData& src, |
| 27 BrowserAccessibilityDelegate* delegate, | 27 BrowserAccessibilityDelegate* delegate, |
| 28 BrowserAccessibilityFactory* factory) | 28 BrowserAccessibilityFactory* factory) |
| 29 : BrowserAccessibilityManager(delegate, factory), | 29 : BrowserAccessibilityManager(delegate, factory), |
| 30 parent_widget_(parent_widget) { | 30 parent_widget_(parent_widget) { |
| 31 Initialize(src); | 31 Initialize(src); |
| 32 } | 32 } |
| 33 | 33 |
| 34 BrowserAccessibilityManagerGtk::~BrowserAccessibilityManagerGtk() { | 34 BrowserAccessibilityManagerGtk::~BrowserAccessibilityManagerGtk() { |
| 35 } | 35 } |
| 36 | 36 |
| 37 // static | 37 // static |
| 38 AccessibilityNodeData BrowserAccessibilityManagerGtk::GetEmptyDocument() { | 38 ui::AXNodeData BrowserAccessibilityManagerGtk::GetEmptyDocument() { |
| 39 AccessibilityNodeData empty_document; | 39 ui::AXNodeData empty_document; |
| 40 empty_document.id = 0; | 40 empty_document.id = 0; |
| 41 empty_document.role = blink::WebAXRoleRootWebArea; | 41 empty_document.role = ui::AX_ROLE_ROOT_WEB_AREA; |
| 42 empty_document.state = | 42 empty_document.state = |
| 43 1 << blink::WebAXStateReadonly; | 43 1 << ui::AX_STATE_READONLY; |
| 44 return empty_document; | 44 return empty_document; |
| 45 } | 45 } |
| 46 | 46 |
| 47 void BrowserAccessibilityManagerGtk::NotifyAccessibilityEvent( | 47 void BrowserAccessibilityManagerGtk::NotifyAccessibilityEvent( |
| 48 blink::WebAXEvent event_type, | 48 ui::AXEvent event_type, |
| 49 BrowserAccessibility* node) { | 49 BrowserAccessibility* node) { |
| 50 if (!node->IsNative()) | 50 if (!node->IsNative()) |
| 51 return; | 51 return; |
| 52 AtkObject* atk_object = node->ToBrowserAccessibilityGtk()->GetAtkObject(); | 52 AtkObject* atk_object = node->ToBrowserAccessibilityGtk()->GetAtkObject(); |
| 53 | 53 |
| 54 switch (event_type) { | 54 switch (event_type) { |
| 55 case blink::WebAXEventChildrenChanged: | 55 case ui::AX_EVENT_CHILDREN_CHANGED: |
| 56 RecursivelySendChildrenChanged(GetRoot()->ToBrowserAccessibilityGtk()); | 56 RecursivelySendChildrenChanged(GetRoot()->ToBrowserAccessibilityGtk()); |
| 57 break; | 57 break; |
| 58 case blink::WebAXEventFocus: | 58 case ui::AX_EVENT_FOCUS: |
| 59 // Note: the focus-event was deprecated in ATK 2.9.4 | 59 // Note: the focus-event was deprecated in ATK 2.9.4 |
| 60 // See https://bugzilla.gnome.org/show_bug.cgi?id=649575#c8 | 60 // See https://bugzilla.gnome.org/show_bug.cgi?id=649575#c8 |
| 61 g_signal_emit_by_name(atk_object, "focus-event", true); | 61 g_signal_emit_by_name(atk_object, "focus-event", true); |
| 62 break; | 62 break; |
| 63 default: | 63 default: |
| 64 break; | 64 break; |
| 65 } | 65 } |
| 66 } | 66 } |
| 67 | 67 |
| 68 void BrowserAccessibilityManagerGtk::RecursivelySendChildrenChanged( | 68 void BrowserAccessibilityManagerGtk::RecursivelySendChildrenChanged( |
| 69 BrowserAccessibilityGtk* node) { | 69 BrowserAccessibilityGtk* node) { |
| 70 AtkObject* atkObject = node->ToBrowserAccessibilityGtk()->GetAtkObject(); | 70 AtkObject* atkObject = node->ToBrowserAccessibilityGtk()->GetAtkObject(); |
| 71 for (unsigned int i = 0; i < node->children().size(); ++i) { | 71 for (unsigned int i = 0; i < node->children().size(); ++i) { |
| 72 BrowserAccessibilityGtk* child = | 72 BrowserAccessibilityGtk* child = |
| 73 node->children()[i]->ToBrowserAccessibilityGtk(); | 73 node->children()[i]->ToBrowserAccessibilityGtk(); |
| 74 g_signal_emit_by_name(atkObject, | 74 g_signal_emit_by_name(atkObject, |
| 75 "children-changed::add", | 75 "children-changed::add", |
| 76 i, | 76 i, |
| 77 child->GetAtkObject()); | 77 child->GetAtkObject()); |
| 78 RecursivelySendChildrenChanged(child); | 78 RecursivelySendChildrenChanged(child); |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 | 81 |
| 82 } // namespace content | 82 } // namespace content |
| OLD | NEW |