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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
// Copyright (c) 2010 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 "chrome/browser/accessibility_events.h"
#include "chrome/browser/extensions/extension_accessibility_api_constants.h"
#include "chrome/browser/profile.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/notification_type.h"
namespace keys = extension_accessibility_api_constants;
void SendAccessibilityNotification(
NotificationType type, AccessibilityControlInfo* info) {
Profile *profile = info->profile();
if (profile->ShouldSendAccessibilityEvents()) {
NotificationService::current()->Notify(
type,
Source<Profile>(profile),
Details<AccessibilityControlInfo>(info));
}
}
void AccessibilityControlInfo::SerializeToDict(DictionaryValue *dict) const {
dict->SetString(keys::kNameKey, name_);
}
void AccessibilityWindowInfo::SerializeToDict(DictionaryValue *dict) const {
AccessibilityControlInfo::SerializeToDict(dict);
dict->SetString(keys::kTypeKey, keys::kTypeWindow);
}
void AccessibilityButtonInfo::SerializeToDict(DictionaryValue *dict) const {
AccessibilityControlInfo::SerializeToDict(dict);
dict->SetString(keys::kTypeKey, keys::kTypeButton);
}
void AccessibilityLinkInfo::SerializeToDict(DictionaryValue *dict) const {
AccessibilityControlInfo::SerializeToDict(dict);
dict->SetString(keys::kTypeKey, keys::kTypeLink);
}
void AccessibilityRadioButtonInfo::SerializeToDict(
DictionaryValue *dict) const {
AccessibilityControlInfo::SerializeToDict(dict);
dict->SetString(keys::kTypeKey, keys::kTypeRadioButton);
dict->SetBoolean(keys::kCheckedKey, checked_);
dict->SetInteger(keys::kItemIndexKey, item_index_);
dict->SetInteger(keys::kItemCountKey, item_count_);
}
void AccessibilityCheckboxInfo::SerializeToDict(DictionaryValue *dict) const {
AccessibilityControlInfo::SerializeToDict(dict);
dict->SetString(keys::kTypeKey, keys::kTypeCheckbox);
dict->SetBoolean(keys::kCheckedKey, checked_);
}
void AccessibilityTabInfo::SerializeToDict(DictionaryValue *dict) const {
AccessibilityControlInfo::SerializeToDict(dict);
dict->SetString(keys::kTypeKey, keys::kTypeTab);
dict->SetInteger(keys::kItemIndexKey, tab_index_);
dict->SetInteger(keys::kItemCountKey, tab_count_);
}
void AccessibilityComboBoxInfo::SerializeToDict(DictionaryValue *dict) const {
AccessibilityControlInfo::SerializeToDict(dict);
dict->SetString(keys::kTypeKey, keys::kTypeComboBox);
dict->SetString(keys::kValueKey, value_);
dict->SetInteger(keys::kItemIndexKey, item_index_);
dict->SetInteger(keys::kItemCountKey, item_count_);
}
void AccessibilityTextBoxInfo::SerializeToDict(DictionaryValue *dict) const {
AccessibilityControlInfo::SerializeToDict(dict);
dict->SetString(keys::kTypeKey, keys::kTypeTextBox);
dict->SetString(keys::kValueKey, value_);
dict->SetBoolean(keys::kPasswordKey, password_);
dict->SetInteger(keys::kSelectionStartKey, selection_start_);
dict->SetInteger(keys::kSelectionEndKey, selection_end_);
}
void AccessibilityListBoxInfo::SerializeToDict(DictionaryValue *dict) const {
AccessibilityControlInfo::SerializeToDict(dict);
dict->SetString(keys::kTypeKey, keys::kTypeListBox);
dict->SetString(keys::kValueKey, value_);
dict->SetInteger(keys::kItemIndexKey, item_index_);
dict->SetInteger(keys::kItemCountKey, item_count_);
}
void AccessibilityMenuInfo::SerializeToDict(DictionaryValue *dict) const {
AccessibilityControlInfo::SerializeToDict(dict);
dict->SetString(keys::kTypeKey, keys::kTypeMenu);
}
void AccessibilityMenuItemInfo::SerializeToDict(DictionaryValue *dict) const {
AccessibilityControlInfo::SerializeToDict(dict);
dict->SetString(keys::kTypeKey, keys::kTypeMenuItem);
dict->SetBoolean(keys::kHasSubmenuKey, has_submenu_);
dict->SetInteger(keys::kItemIndexKey, item_index_);
dict->SetInteger(keys::kItemCountKey, item_count_);
}
|