1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/accessibility/browser_accessibility_manager_gtk.h"
#include "content/browser/accessibility/browser_accessibility_gtk.h"
#include "content/common/accessibility_messages.h"
namespace content {
// static
BrowserAccessibilityManager* BrowserAccessibilityManager::Create(
const AccessibilityNodeData& src,
BrowserAccessibilityDelegate* delegate,
BrowserAccessibilityFactory* factory) {
return new BrowserAccessibilityManagerGtk(
NULL,
src,
delegate,
factory);
}
BrowserAccessibilityManagerGtk::BrowserAccessibilityManagerGtk(
GtkWidget* parent_widget,
const AccessibilityNodeData& src,
BrowserAccessibilityDelegate* delegate,
BrowserAccessibilityFactory* factory)
: BrowserAccessibilityManager(src, delegate, factory),
parent_widget_(parent_widget) {
}
BrowserAccessibilityManagerGtk::~BrowserAccessibilityManagerGtk() {
}
// static
AccessibilityNodeData BrowserAccessibilityManagerGtk::GetEmptyDocument() {
AccessibilityNodeData empty_document;
empty_document.id = 0;
empty_document.role = AccessibilityNodeData::ROLE_ROOT_WEB_AREA;
empty_document.state =
1 << AccessibilityNodeData::STATE_READONLY;
return empty_document;
}
void BrowserAccessibilityManagerGtk::NotifyAccessibilityEvent(
int type,
BrowserAccessibility* node) {
if (!node->IsNative())
return;
AtkObject* atk_object = node->ToBrowserAccessibilityGtk()->GetAtkObject();
switch (type) {
case AccessibilityNotificationChildrenChanged:
RecursivelySendChildrenChanged(GetRoot()->ToBrowserAccessibilityGtk());
break;
case AccessibilityNotificationFocusChanged:
// Note: atk_focus_tracker_notify may be deprecated in the future;
// follow this bug for the replacement:
// https://bugzilla.gnome.org/show_bug.cgi?id=649575#c4
g_signal_emit_by_name(atk_object, "focus-event", true);
atk_focus_tracker_notify(atk_object);
break;
default:
break;
}
}
void BrowserAccessibilityManagerGtk::RecursivelySendChildrenChanged(
BrowserAccessibilityGtk* node) {
AtkObject* atkObject = node->ToBrowserAccessibilityGtk()->GetAtkObject();
for (unsigned int i = 0; i < node->children().size(); ++i) {
BrowserAccessibilityGtk* child =
node->children()[i]->ToBrowserAccessibilityGtk();
g_signal_emit_by_name(atkObject,
"children-changed::add",
i,
child->GetAtkObject());
RecursivelySendChildrenChanged(child);
}
}
} // namespace content
|