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

Unified Diff: components/exo/ax_tree_source_surface.h

Issue 2640123004: Initial support for native accessibility in ARC (Closed)
Patch Set: address feedback Created 3 years, 11 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: components/exo/ax_tree_source_surface.h
diff --git a/components/exo/ax_tree_source_surface.h b/components/exo/ax_tree_source_surface.h
new file mode 100644
index 0000000000000000000000000000000000000000..8a52a10f5f2fc9ed4bc15140f6bd7a87220c287c
--- /dev/null
+++ b/components/exo/ax_tree_source_surface.h
@@ -0,0 +1,51 @@
+// Copyright 2017 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 COMPONENTS_EXO_AX_TREE_SOURCE_SURFACE_H_
+#define COMPONENTS_EXO_AX_TREE_SOURCE_SURFACE_H_
+
+#include "base/observer_list.h"
+#include "ui/accessibility/ax_enums.h"
+#include "ui/accessibility/ax_node.h"
+#include "ui/accessibility/ax_node_data.h"
+#include "ui/accessibility/ax_tree_data.h"
+#include "ui/accessibility/ax_tree_source.h"
+
+namespace exo {
+
+// An AXTreeSource that contains nodes without backing objects.
+// As a result, events are fired directly on the tree's nodes. Implementers are
+// responsible for updating the tree's contents before event dispatch to
+// observers.
+class AXTreeSourceSurface
+ : public ui::AXTreeSource<ui::AXNode*, ui::AXNodeData, ui::AXTreeData> {
+ public:
+ AXTreeSourceSurface();
+ ~AXTreeSourceSurface() override;
+
+ class Observer {
+ public:
+ virtual void OnAccessibilityEvent(uint32_t node_id, ui::AXEvent event) = 0;
+ };
+
+ // Called by servers to dispatch events.
+ virtual void NotifyAccessibilityEvent(uint32_t node_id, ui::AXEvent event);
+
+ // Called by containing tree sources to observe events from a serving tree.
+ void AddObserver(Observer* observer);
+ void RemoveObserver(Observer* observer);
+
+ protected:
+ // Subclasses should initialize the source tree and begin serving events.
+ virtual void Reset() = 0;
+
+ private:
+ base::ObserverList<Observer> observers_;
+
+ DISALLOW_COPY_AND_ASSIGN(AXTreeSourceSurface);
+};
+
+} // namespace exo
+
+#endif // COMPONENTS_EXO_AX_TREE_SOURCE_SURFACE_H_

Powered by Google App Engine
This is Rietveld 408576698