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

Unified Diff: content/browser/accessibility/browser_accessibility_event.h

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.h
diff --git a/content/browser/accessibility/browser_accessibility_event.h b/content/browser/accessibility/browser_accessibility_event.h
new file mode 100644
index 0000000000000000000000000000000000000000..470d8b2fddf657ba2560137a86e1ca763b3446f2
--- /dev/null
+++ b/content/browser/accessibility/browser_accessibility_event.h
@@ -0,0 +1,84 @@
+// 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.
+
+#ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_EVENT_H_
+#define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_EVENT_H_
+
+#include <string>
+
+#include "content/browser/accessibility/browser_accessibility.h"
+#include "content/common/content_export.h"
+#include "ui/accessibility/ax_enums.h"
+
+namespace content {
+
+class BrowserAccessibility;
+
+class CONTENT_EXPORT BrowserAccessibilityEvent {
+ public:
+ enum Source {
+ FromBlink,
+ FromChildFrameLoading,
+ FromFindInPageResult,
+ FromRenderFrameHost,
+ FromScroll,
+ FromTreeChange,
+ FromWindowFocusChange,
+ };
+
+ enum Result {
+ Sent,
+ NotNeededOnThisPlatform,
+ DiscardedBecauseUserNavigatingAway,
+ DiscardedBecauseLiveRegionBusy,
+ FailedBecauseNoWindow,
+ FailedBecauseNoFocus,
+ FailedBecauseFrameIsDetached,
+ };
+
+ // Returns true if the given result indicates that sending the event failed.
+ // Returns false if the event was sent, or if it was not needed (which is
+ // not considered failure).
+ static bool FailedToSend(Result result);
+
+ static BrowserAccessibilityEvent* Create(Source source,
+ ui::AXEvent event_type,
+ const BrowserAccessibility* target);
+
+ // Construct a new accessibility event that should be sent via a
+ // platform-specific notification.
+ BrowserAccessibilityEvent(Source source,
+ ui::AXEvent event_type,
+ const BrowserAccessibility* target);
+ virtual ~BrowserAccessibilityEvent();
+
+ // Synchronously try to send the native accessibility event notification
+ // and return a result indicating the outcome. This deletes the event.
+ virtual Result Fire();
+
+ Source source() { return source_; }
+ ui::AXEvent event_type() { return event_type_; }
+ const BrowserAccessibility* target() { return target_; }
+ void set_target(const BrowserAccessibility* target) { target_ = target; }
+ void set_original_target(BrowserAccessibility* target) {
+ original_target_ = target;
+ }
+
+ protected:
+ virtual std::string GetEventNameStr();
+ void VerboseLog(Result result);
+
+ private:
+ Source source_;
+ ui::AXEvent event_type_;
+ const BrowserAccessibility* target_;
+ const BrowserAccessibility* original_target_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityEvent);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_EVENT_H_

Powered by Google App Engine
This is Rietveld 408576698