| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/browser/accessibility/browser_accessibility_manager_gtk.h" | |
| 6 | |
| 7 #include "content/browser/accessibility/browser_accessibility_gtk.h" | |
| 8 #include "content/common/accessibility_messages.h" | |
| 9 | |
| 10 using webkit_glue::WebAccessibility; | |
| 11 | |
| 12 // static | |
| 13 BrowserAccessibilityManager* BrowserAccessibilityManager::Create( | |
| 14 gfx::NativeView parent_view, | |
| 15 const WebAccessibility& src, | |
| 16 BrowserAccessibilityDelegate* delegate, | |
| 17 BrowserAccessibilityFactory* factory) { | |
| 18 return new BrowserAccessibilityManagerGtk( | |
| 19 parent_view, | |
| 20 src, | |
| 21 delegate, | |
| 22 factory); | |
| 23 } | |
| 24 | |
| 25 BrowserAccessibilityManagerGtk::BrowserAccessibilityManagerGtk( | |
| 26 GtkWidget* parent_view, | |
| 27 const WebAccessibility& src, | |
| 28 BrowserAccessibilityDelegate* delegate, | |
| 29 BrowserAccessibilityFactory* factory) | |
| 30 : BrowserAccessibilityManager(parent_view, src, delegate, factory) { | |
| 31 } | |
| 32 | |
| 33 BrowserAccessibilityManagerGtk::~BrowserAccessibilityManagerGtk() { | |
| 34 } | |
| 35 | |
| 36 void BrowserAccessibilityManagerGtk::NotifyAccessibilityEvent( | |
| 37 int type, | |
| 38 BrowserAccessibility* node) { | |
| 39 AtkObject* atk_object = node->ToBrowserAccessibilityGtk()->GetAtkObject(); | |
| 40 | |
| 41 switch (type) { | |
| 42 case AccessibilityNotificationChildrenChanged: | |
| 43 RecursivelySendChildrenChanged(GetRoot()->ToBrowserAccessibilityGtk()); | |
| 44 break; | |
| 45 case AccessibilityNotificationFocusChanged: | |
| 46 // Note: atk_focus_tracker_notify may be deprecated in the future; | |
| 47 // follow this bug for the replacement: | |
| 48 // https://bugzilla.gnome.org/show_bug.cgi?id=649575#c4 | |
| 49 g_signal_emit_by_name(atk_object, "focus-event", true); | |
| 50 atk_focus_tracker_notify(atk_object); | |
| 51 break; | |
| 52 default: | |
| 53 break; | |
| 54 } | |
| 55 } | |
| 56 | |
| 57 void BrowserAccessibilityManagerGtk::RecursivelySendChildrenChanged( | |
| 58 BrowserAccessibilityGtk* node) { | |
| 59 AtkObject* atkObject = node->ToBrowserAccessibilityGtk()->GetAtkObject(); | |
| 60 for (unsigned int i = 0; i < node->children().size(); ++i) { | |
| 61 BrowserAccessibilityGtk* child = | |
| 62 node->children()[i]->ToBrowserAccessibilityGtk(); | |
| 63 g_signal_emit_by_name(atkObject, | |
| 64 "children-changed::add", | |
| 65 i, | |
| 66 child->GetAtkObject()); | |
| 67 RecursivelySendChildrenChanged(child); | |
| 68 } | |
| 69 } | |
| OLD | NEW |