| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 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 #ifndef COMPONENTS_EXO_AX_TREE_SOURCE_SURFACE_H_ |
| 6 #define COMPONENTS_EXO_AX_TREE_SOURCE_SURFACE_H_ |
| 7 |
| 8 #include "base/observer_list.h" |
| 9 #include "ui/accessibility/ax_enums.h" |
| 10 #include "ui/accessibility/ax_node.h" |
| 11 #include "ui/accessibility/ax_node_data.h" |
| 12 #include "ui/accessibility/ax_tree_data.h" |
| 13 #include "ui/accessibility/ax_tree_source.h" |
| 14 |
| 15 namespace exo { |
| 16 |
| 17 // An AXTreeSource that contains nodes without backing objects. |
| 18 // As a result, events are fired directly on the tree's nodes. Implementers are |
| 19 // responsible for updating the tree's contents before event dispatch to |
| 20 // observers. |
| 21 class AXTreeSourceSurface |
| 22 : public ui::AXTreeSource<ui::AXNode*, ui::AXNodeData, ui::AXTreeData> { |
| 23 public: |
| 24 AXTreeSourceSurface(); |
| 25 ~AXTreeSourceSurface() override; |
| 26 |
| 27 class Observer { |
| 28 public: |
| 29 virtual void OnAccessibilityEvent(uint32_t node_id, ui::AXEvent event) = 0; |
| 30 }; |
| 31 |
| 32 // Called by servers to dispatch events. |
| 33 virtual void NotifyAccessibilityEvent(uint32_t node_id, ui::AXEvent event); |
| 34 |
| 35 // Called by containing tree sources to observe events from a serving tree. |
| 36 void AddObserver(Observer* observer); |
| 37 void RemoveObserver(Observer* observer); |
| 38 |
| 39 protected: |
| 40 // Subclasses should initialize the source tree and begin serving events. |
| 41 virtual void Reset() = 0; |
| 42 |
| 43 private: |
| 44 base::ObserverList<Observer> observers_; |
| 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(AXTreeSourceSurface); |
| 47 }; |
| 48 |
| 49 } // namespace exo |
| 50 |
| 51 #endif // COMPONENTS_EXO_AX_TREE_SOURCE_SURFACE_H_ |
| OLD | NEW |