| 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 { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 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 AccessibilityNodeData BrowserAccessibilityManagerGtk::GetEmptyDocument() { |
| 39 AccessibilityNodeData empty_document; | 39 AccessibilityNodeData empty_document; |
| 40 empty_document.id = 0; | 40 empty_document.id = 0; |
| 41 empty_document.role = AccessibilityNodeData::ROLE_ROOT_WEB_AREA; | 41 empty_document.role = WebKit::WebAXRoleRootWebArea; |
| 42 empty_document.state = | 42 empty_document.state = |
| 43 1 << AccessibilityNodeData::STATE_READONLY; | 43 1 << WebKit::WebAXStateReadonly; |
| 44 return empty_document; | 44 return empty_document; |
| 45 } | 45 } |
| 46 | 46 |
| 47 void BrowserAccessibilityManagerGtk::NotifyAccessibilityEvent( | 47 void BrowserAccessibilityManagerGtk::NotifyAccessibilityEvent( |
| 48 int type, | 48 WebKit::WebAXEvent 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 (type) { | 54 switch (event_type) { |
| 55 case AccessibilityNotificationChildrenChanged: | 55 case WebKit::WebAXEventChildrenChanged: |
| 56 RecursivelySendChildrenChanged(GetRoot()->ToBrowserAccessibilityGtk()); | 56 RecursivelySendChildrenChanged(GetRoot()->ToBrowserAccessibilityGtk()); |
| 57 break; | 57 break; |
| 58 case AccessibilityNotificationFocusChanged: | 58 case WebKit::WebAXEventFocus: |
| 59 // Note: atk_focus_tracker_notify may be deprecated in the future; | 59 // Note: atk_focus_tracker_notify may be deprecated in the future; |
| 60 // follow this bug for the replacement: | 60 // follow this bug for the replacement: |
| 61 // https://bugzilla.gnome.org/show_bug.cgi?id=649575#c4 | 61 // https://bugzilla.gnome.org/show_bug.cgi?id=649575#c4 |
| 62 g_signal_emit_by_name(atk_object, "focus-event", true); | 62 g_signal_emit_by_name(atk_object, "focus-event", true); |
| 63 atk_focus_tracker_notify(atk_object); | 63 atk_focus_tracker_notify(atk_object); |
| 64 break; | 64 break; |
| 65 default: | 65 default: |
| 66 break; | 66 break; |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 | 69 |
| 70 void BrowserAccessibilityManagerGtk::RecursivelySendChildrenChanged( | 70 void BrowserAccessibilityManagerGtk::RecursivelySendChildrenChanged( |
| 71 BrowserAccessibilityGtk* node) { | 71 BrowserAccessibilityGtk* node) { |
| 72 AtkObject* atkObject = node->ToBrowserAccessibilityGtk()->GetAtkObject(); | 72 AtkObject* atkObject = node->ToBrowserAccessibilityGtk()->GetAtkObject(); |
| 73 for (unsigned int i = 0; i < node->children().size(); ++i) { | 73 for (unsigned int i = 0; i < node->children().size(); ++i) { |
| 74 BrowserAccessibilityGtk* child = | 74 BrowserAccessibilityGtk* child = |
| 75 node->children()[i]->ToBrowserAccessibilityGtk(); | 75 node->children()[i]->ToBrowserAccessibilityGtk(); |
| 76 g_signal_emit_by_name(atkObject, | 76 g_signal_emit_by_name(atkObject, |
| 77 "children-changed::add", | 77 "children-changed::add", |
| 78 i, | 78 i, |
| 79 child->GetAtkObject()); | 79 child->GetAtkObject()); |
| 80 RecursivelySendChildrenChanged(child); | 80 RecursivelySendChildrenChanged(child); |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 | 83 |
| 84 } // namespace content | 84 } // namespace content |
| OLD | NEW |