Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Side by Side Diff: content/browser/accessibility/browser_accessibility_event_win.cc

Issue 1925473002: Add verbose logging for native accessibility events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@load_complete
Patch Set: address all feedback Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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_event_win.h"
6
7 #include "base/strings/utf_string_conversions.h"
8 #include "content/browser/accessibility/accessibility_tree_formatter_utils_win.h "
9 #include "content/browser/accessibility/browser_accessibility.h"
10 #include "content/browser/accessibility/browser_accessibility_manager_win.h"
11
12 namespace content {
13
14 // static
15 BrowserAccessibilityEvent* BrowserAccessibilityEvent::Create(
16 Source source,
17 ui::AXEvent event_type,
18 const BrowserAccessibility* target) {
19 LONG win_event_type = EVENT_MIN;
20 switch (event_type) {
21 case ui::AX_EVENT_ACTIVEDESCENDANTCHANGED:
22 win_event_type = IA2_EVENT_ACTIVE_DESCENDANT_CHANGED;
23 break;
24 case ui::AX_EVENT_ALERT:
25 win_event_type = EVENT_SYSTEM_ALERT;
26 break;
27 case ui::AX_EVENT_AUTOCORRECTION_OCCURED:
28 win_event_type = IA2_EVENT_OBJECT_ATTRIBUTE_CHANGED;
29 break;
30 case ui::AX_EVENT_CHILDREN_CHANGED:
31 win_event_type = EVENT_OBJECT_REORDER;
32 break;
33 case ui::AX_EVENT_FOCUS:
34 win_event_type = EVENT_OBJECT_FOCUS;
35 break;
36 case ui::AX_EVENT_LIVE_REGION_CHANGED:
37 win_event_type = EVENT_OBJECT_LIVEREGIONCHANGED;
38 break;
39 case ui::AX_EVENT_LOAD_COMPLETE:
40 win_event_type = IA2_EVENT_DOCUMENT_LOAD_COMPLETE;
41 break;
42 case ui::AX_EVENT_SCROLL_POSITION_CHANGED:
43 win_event_type = EVENT_SYSTEM_SCROLLINGEND;
44 break;
45 case ui::AX_EVENT_SCROLLED_TO_ANCHOR:
46 win_event_type = EVENT_SYSTEM_SCROLLINGSTART;
47 break;
48 case ui::AX_EVENT_SELECTED_CHILDREN_CHANGED:
49 win_event_type = EVENT_OBJECT_SELECTIONWITHIN;
50 break;
51 default:
52 break;
53 }
54
55 return new BrowserAccessibilityEventWin(
56 source,
57 event_type,
58 win_event_type,
59 target);
60 }
61
62 BrowserAccessibilityEventWin::BrowserAccessibilityEventWin(
63 Source source,
64 ui::AXEvent event_type,
65 LONG win_event_type,
66 const BrowserAccessibility* target)
67 : BrowserAccessibilityEvent(source, event_type, target),
68 win_event_type_(win_event_type) {
69 }
70
71 BrowserAccessibilityEventWin::~BrowserAccessibilityEventWin() {
72 }
73
74 BrowserAccessibilityEvent::Result BrowserAccessibilityEventWin::Fire() {
75 DCHECK(target()->manager());
76
77 if (win_event_type_ == EVENT_MIN) {
78 delete this;
79 return NotNeededOnThisPlatform;
80 }
81
82 Result result = target()->manager()->ToBrowserAccessibilityManagerWin()
83 ->FireWinAccessibilityEvent(this);
84
85 if (VLOG_IS_ON(1))
86 VerboseLog(result);
87
88 delete this;
89 return result;
90 }
91
92 std::string BrowserAccessibilityEventWin::GetEventNameStr() {
93 std::string result = base::UTF16ToUTF8(AccessibilityEventToString(
94 win_event_type_));
95 if (event_type() != ui::AX_EVENT_NONE)
96 result += "/" + ui::ToString(event_type());
97 return result;
98 }
99
100 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698