forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Creates an observer interface that can be used to observe node additi…
…ons, removals and updates on a tree source During offline discussions it was decided that modifying the AXTreeSource interface in order to add methods that are specific only to an AXTreeSourceAnnotator component, such as AXImageAnnotator, would be undesirable because it would polude the interface with methods that would only be implemented by a handful of tree sources. This patch takes another approach: It adds an AXTreeSourceObserver which can be used by the annotator to get notified when nodes are added, removed, or updated in the tree source. R=dtseng@chromium.org, mschillaci@google.com AX-Relnotes: n/a. Bug: 1248380 Change-Id: I0bab9c3eb054bca718cbba5c795d512157948d18 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3164937 Commit-Queue: Nektarios Paisios <nektar@chromium.org> Reviewed-by: Mark Schillaci <mschillaci@google.com> Cr-Commit-Position: refs/heads/main@{#923428}
- Loading branch information
Nektarios Paisios
authored and
Chromium LUCI CQ
committed
Sep 21, 2021
1 parent
1962045
commit 700dd6f
Showing
4 changed files
with
56 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright 2021 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 UI_ACCESSIBILITY_AX_TREE_SOURCE_OBSERVER_H_ | ||
#define UI_ACCESSIBILITY_AX_TREE_SOURCE_OBSERVER_H_ | ||
|
||
#include "base/observer_list_types.h" | ||
#include "ui/accessibility/ax_export.h" | ||
|
||
namespace ui { | ||
|
||
template <typename AXNodeSource> | ||
class AXTreeSource; | ||
|
||
// This is an interface for a class that observes changes to an `AXTreeSource`. | ||
template <typename AXNodeSource> | ||
class AX_EXPORT AXTreeSourceObserver : public base::CheckedObserver { | ||
public: | ||
~AXTreeSourceObserver() override = default; | ||
|
||
virtual void OnNodeAdded(const AXTreeSource<AXNodeSource>& tree_source, | ||
const AXNodeSource& node_source) = 0; | ||
virtual void OnNodeUpdated(const AXTreeSource<AXNodeSource>& tree_source, | ||
const AXNodeSource& node_source) = 0; | ||
virtual void OnNodeRemoved(const AXTreeSource<AXNodeSource>& tree_source, | ||
const AXNodeSource& node_source) = 0; | ||
}; | ||
|
||
} // namespace ui | ||
|
||
#endif // UI_ACCESSIBILITY_AX_TREE_SOURCE_OBSERVER_H_ |