|
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) { | |
David Tseng
2012/05/02 18:02:58
Might have to switch on all enum values (somewhat
dmazzoni
2012/05/02 19:33:05
It's okay as long as there's a default in the swit
| |
42 case AccessibilityNotificationChildrenChanged: | |
43 RecursivelySendChildrenChanged(GetRoot()->ToBrowserAccessibilityGtk()); | |
44 break; | |
45 case AccessibilityNotificationFocusChanged: | |
46 g_signal_emit_by_name(atk_object, "focus-event", true); | |
David Tseng
2012/05/02 18:02:58
Add a note here to pick the authoritative way of s
dmazzoni
2012/05/02 19:33:05
Done.
| |
47 atk_focus_tracker_notify(atk_object); | |
48 break; | |
49 default: | |
50 break; | |
51 } | |
52 } | |
53 | |
54 void BrowserAccessibilityManagerGtk::RecursivelySendChildrenChanged( | |
55 BrowserAccessibilityGtk* node) { | |
56 AtkObject* atkObject = node->ToBrowserAccessibilityGtk()->GetAtkObject(); | |
57 for (unsigned int i = 0; i < node->children().size(); ++i) { | |
58 BrowserAccessibilityGtk* child = | |
59 node->children()[i]->ToBrowserAccessibilityGtk(); | |
60 g_signal_emit_by_name(atkObject, | |
61 "children-changed::add", | |
62 i, | |
63 child->GetAtkObject()); | |
64 RecursivelySendChildrenChanged(child); | |
65 } | |
66 } | |
OLD | NEW |