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

Unified 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, 8 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/accessibility/browser_accessibility_event_win.cc
diff --git a/content/browser/accessibility/browser_accessibility_event_win.cc b/content/browser/accessibility/browser_accessibility_event_win.cc
new file mode 100644
index 0000000000000000000000000000000000000000..effc4151b3d10a3b2b4b2e70e3fbf283d95c4878
--- /dev/null
+++ b/content/browser/accessibility/browser_accessibility_event_win.cc
@@ -0,0 +1,100 @@
+// Copyright 2016 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_event_win.h"
+
+#include "base/strings/utf_string_conversions.h"
+#include "content/browser/accessibility/accessibility_tree_formatter_utils_win.h"
+#include "content/browser/accessibility/browser_accessibility.h"
+#include "content/browser/accessibility/browser_accessibility_manager_win.h"
+
+namespace content {
+
+// static
+BrowserAccessibilityEvent* BrowserAccessibilityEvent::Create(
+ Source source,
+ ui::AXEvent event_type,
+ const BrowserAccessibility* target) {
+ LONG win_event_type = EVENT_MIN;
+ switch (event_type) {
+ case ui::AX_EVENT_ACTIVEDESCENDANTCHANGED:
+ win_event_type = IA2_EVENT_ACTIVE_DESCENDANT_CHANGED;
+ break;
+ case ui::AX_EVENT_ALERT:
+ win_event_type = EVENT_SYSTEM_ALERT;
+ break;
+ case ui::AX_EVENT_AUTOCORRECTION_OCCURED:
+ win_event_type = IA2_EVENT_OBJECT_ATTRIBUTE_CHANGED;
+ break;
+ case ui::AX_EVENT_CHILDREN_CHANGED:
+ win_event_type = EVENT_OBJECT_REORDER;
+ break;
+ case ui::AX_EVENT_FOCUS:
+ win_event_type = EVENT_OBJECT_FOCUS;
+ break;
+ case ui::AX_EVENT_LIVE_REGION_CHANGED:
+ win_event_type = EVENT_OBJECT_LIVEREGIONCHANGED;
+ break;
+ case ui::AX_EVENT_LOAD_COMPLETE:
+ win_event_type = IA2_EVENT_DOCUMENT_LOAD_COMPLETE;
+ break;
+ case ui::AX_EVENT_SCROLL_POSITION_CHANGED:
+ win_event_type = EVENT_SYSTEM_SCROLLINGEND;
+ break;
+ case ui::AX_EVENT_SCROLLED_TO_ANCHOR:
+ win_event_type = EVENT_SYSTEM_SCROLLINGSTART;
+ break;
+ case ui::AX_EVENT_SELECTED_CHILDREN_CHANGED:
+ win_event_type = EVENT_OBJECT_SELECTIONWITHIN;
+ break;
+ default:
+ break;
+ }
+
+ return new BrowserAccessibilityEventWin(
+ source,
+ event_type,
+ win_event_type,
+ target);
+}
+
+BrowserAccessibilityEventWin::BrowserAccessibilityEventWin(
+ Source source,
+ ui::AXEvent event_type,
+ LONG win_event_type,
+ const BrowserAccessibility* target)
+ : BrowserAccessibilityEvent(source, event_type, target),
+ win_event_type_(win_event_type) {
+}
+
+BrowserAccessibilityEventWin::~BrowserAccessibilityEventWin() {
+}
+
+BrowserAccessibilityEvent::Result BrowserAccessibilityEventWin::Fire() {
+ DCHECK(target()->manager());
+
+ if (win_event_type_ == EVENT_MIN) {
+ delete this;
+ return NotNeededOnThisPlatform;
+ }
+
+ Result result = target()->manager()->ToBrowserAccessibilityManagerWin()
+ ->FireWinAccessibilityEvent(this);
+
+ if (VLOG_IS_ON(1))
+ VerboseLog(result);
+
+ delete this;
+ return result;
+}
+
+std::string BrowserAccessibilityEventWin::GetEventNameStr() {
+ std::string result = base::UTF16ToUTF8(AccessibilityEventToString(
+ win_event_type_));
+ if (event_type() != ui::AX_EVENT_NONE)
+ result += "/" + ui::ToString(event_type());
+ return result;
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698