Flutter Engine
The Flutter Engine
ax_platform_relation_win.h
Go to the documentation of this file.
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 UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_RELATION_WIN_H_
6#define UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_RELATION_WIN_H_
7
8#include <oleacc.h>
9#include <wrl/client.h>
10#include <set>
11#include <vector>
12
14#include "base/metrics/histogram_macros.h"
15#include "base/observer_list.h"
16#include "base/win/atl.h"
17#include "third_party/iaccessible2/ia2_api_all.h"
18#include "ui/accessibility/ax_export.h"
19#include "ui/accessibility/ax_text_utils.h"
20#include "ui/accessibility/platform/ax_platform_node_win.h"
21
22namespace ui {
23
24//
25// AXPlatformRelationWin
26//
27// A simple implementation of IAccessibleRelation, used to represent a
28// relationship between one accessible node in the tree and
29// potentially multiple target nodes. Also contains a utility function
30// to compute all of the possible IAccessible2 relations and reverse
31// relations given the internal relation id attributes.
32class AXPlatformRelationWin : public CComObjectRootEx<CComMultiThreadModel>,
33 public IAccessibleRelation {
34 public:
35 BEGIN_COM_MAP(AXPlatformRelationWin)
36 COM_INTERFACE_ENTRY(IAccessibleRelation)
37 END_COM_MAP()
38
40 virtual ~AXPlatformRelationWin();
41
42 // This is the main utility function that enumerates all of the possible
43 // IAccessible2 relations between one node and any other node in the tree.
44 // Forward relations come from the int_attributes and intlist_attributes
45 // in node_data. Reverse relations come from querying |delegate| for the
46 // reverse relations given |node_data.id|.
47 //
48 // If you pass -1 for |desired_index| and "" for |desired_ia2_relation|,
49 // it will return a count of all relations.
50 //
51 // If you pass either an index in |desired_index| or a specific relation
52 // in |desired_ia2_relation|, the first matching relation will be returned in
53 // |out_ia2_relation| and |out_targets| (both of which must not be null),
54 // and it will return 1 on success, and 0 if none were found matching that
55 // criteria.
57 int desired_index,
58 const base::string16& desired_ia2_relation,
59 base::string16* out_ia2_relation,
60 std::set<AXPlatformNode*>* out_targets);
61
62 void Initialize(const base::string16& type);
63 void Invalidate();
64 void AddTarget(AXPlatformNodeWin* target);
65
66 // IAccessibleRelation methods.
67 IFACEMETHODIMP get_relationType(BSTR* relation_type) override;
68 IFACEMETHODIMP get_nTargets(LONG* n_targets) override;
69 IFACEMETHODIMP get_target(LONG target_index, IUnknown** target) override;
70 IFACEMETHODIMP get_targets(LONG max_targets,
71 IUnknown** targets,
72 LONG* n_targets) override;
73 IFACEMETHODIMP get_localizedRelationType(BSTR* relation_type) override;
74
75 private:
76 base::string16 type_;
77 std::vector<Microsoft::WRL::ComPtr<AXPlatformNodeWin>> targets_;
78};
79
80} // namespace ui
81
82#endif // UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_RELATION_WIN_H_
GLenum type
IFACEMETHODIMP get_relationType(BSTR *relation_type) override
IFACEMETHODIMP get_localizedRelationType(BSTR *relation_type) override
IFACEMETHODIMP get_target(LONG target_index, IUnknown **target) override
void Initialize(const base::string16 &type)
IFACEMETHODIMP get_nTargets(LONG *n_targets) override
static int EnumerateRelationships(AXPlatformNodeBase *node, int desired_index, const base::string16 &desired_ia2_relation, base::string16 *out_ia2_relation, std::set< AXPlatformNode * > *out_targets)
void AddTarget(AXPlatformNodeWin *target)
IFACEMETHODIMP get_targets(LONG max_targets, IUnknown **targets, LONG *n_targets) override
uint32_t * target
long LONG
Definition: windows_types.h:23