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

Side by Side Diff: ui/accessibility/platform/ax_fake_caret_win.h

Issue 2781613003: Added a class acting as a fake caret for accessibility. (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 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_FAKE_CARET_WIN_H_
6 #define UI_ACCESSIBILITY_PLATFORM_AX_FAKE_CARET_WIN_H_
7
8 #include <atlbase.h>
9 #include <atlcom.h>
10 #include <oleacc.h>
11 #include <windows.h>
12
13 #include "base/compiler_specific.h"
14 #include "base/macros.h"
15 #include "ui/accessibility/ax_export.h"
16 #include "ui/gfx/geometry/rect.h"
17
18 namespace ui {
19
20 // A class representing the position of the caret to assistive software on
21 // Windows. This is required because Chrome doesn't use the standard system
22 // caret and because some assistive software still relies on specific
23 // accessibility APIs to retrieve the caret position.
24 class __declspec(uuid("170646b5-cb01-43e7-93f0-3ca455828d03")) AXFakeCaretWin
25 : NON_EXPORTED_BASE(public CComObjectRootEx<CComSingleThreadModel>),
26 public IDispatchImpl<IAccessible,
27 &IID_IAccessible,
28 &LIBID_Accessibility> {
29 public:
30 BEGIN_COM_MAP(AXFakeCaretWin)
31 COM_INTERFACE_ENTRY2(IDispatch, IAccessible)
32 COM_INTERFACE_ENTRY(IAccessible)
33 END_COM_MAP()
34
35 AXFakeCaretWin();
36 virtual ~AXFakeCaretWin() = default;
37
38 gfx::Rect bounds() { return bounds_; }
39 AX_EXPORT static void SetBounds(gfx::Rect bounds);
40
41 // IAccessible methods.
42
43 // Performs the default action on a given object.
44 STDMETHODIMP accDoDefaultAction(VARIANT var_id) override { return E_NOTIMPL; }
45
46 // Retrieves the child element or child object at a given point on the screen.
47 STDMETHODIMP accHitTest(LONG x_left, LONG y_top, VARIANT* child) override {
48 return E_NOTIMPL;
49 }
50
51 // Retrieves the specified object's current screen location.
52 STDMETHODIMP accLocation(LONG* x_left,
53 LONG* y_top,
54 LONG* width,
55 LONG* height,
56 VARIANT var_id) override;
57
58 // Traverses to another UI element and retrieves the object.
59 STDMETHODIMP accNavigate(LONG nav_dir, VARIANT start, VARIANT* end) override {
60 return E_NOTIMPL;
61 }
62
63 // Retrieves an IDispatch interface pointer for the specified child.
64 STDMETHODIMP get_accChild(VARIANT var_child,
65 IDispatch** disp_child) override {
66 return E_NOTIMPL;
67 }
68
69 // Retrieves the number of accessible children.
70 STDMETHODIMP get_accChildCount(LONG* child_count) override {
71 return E_NOTIMPL;
72 }
73
74 // Retrieves a string that describes the object's default action.
75 STDMETHODIMP get_accDefaultAction(VARIANT var_id,
76 BSTR* default_action) override {
77 return E_NOTIMPL;
78 }
79
80 // Retrieves the object's description.
81 STDMETHODIMP get_accDescription(VARIANT var_id, BSTR* desc) override {
82 return E_NOTIMPL;
83 }
84
85 // Retrieves the object that has the keyboard focus.
86 STDMETHODIMP get_accFocus(VARIANT* focus_child) override { return E_NOTIMPL; }
87
88 // Retrieves the help information associated with the object.
89 STDMETHODIMP get_accHelp(VARIANT var_id, BSTR* heflp) override {
90 return E_NOTIMPL;
91 }
92
93 // Retrieves the specified object's shortcut.
94 STDMETHODIMP get_accKeyboardShortcut(VARIANT var_id,
95 BSTR* access_key) override {
96 return E_NOTIMPL;
97 }
98
99 // Retrieves the name of the specified object.
100 STDMETHODIMP get_accName(VARIANT var_id, BSTR* name) override;
101
102 // Retrieves the IDispatch interface of the object's parent.
103 STDMETHODIMP get_accParent(IDispatch** disp_parent) override {
104 return E_NOTIMPL;
105 }
106
107 // Retrieves information describing the role of the specified object.
108 STDMETHODIMP get_accRole(VARIANT var_id, VARIANT* role) override;
109
110 // Retrieves the current state of the specified object.
111 STDMETHODIMP get_accState(VARIANT var_id, VARIANT* state) override {
112 return E_NOTIMPL;
113 }
114
115 // Returns the value associated with the object.
116 STDMETHODIMP get_accValue(VARIANT var_id, BSTR* value) override {
117 return E_NOTIMPL;
118 }
119
120 // Make an object take focus or extend the selection.
121 STDMETHODIMP accSelect(LONG flags_sel, VARIANT var_id) override {
122 return E_NOTIMPL;
123 }
124
125 STDMETHODIMP get_accHelpTopic(BSTR* help_file,
126 VARIANT var_id,
127 LONG* topic_id) override {
128 return E_NOTIMPL;
129 }
130
131 STDMETHODIMP get_accSelection(VARIANT* selected) override {
132 return E_NOTIMPL;
133 }
134
135 // Deprecated methods.
136 STDMETHODIMP put_accName(VARIANT var_id, BSTR put_name) override {
137 return E_NOTIMPL;
138 }
139
140 STDMETHODIMP put_accValue(VARIANT var_id, BSTR put_val) override {
141 return E_NOTIMPL;
142 }
143
144 private:
145 const LPCTSTR OBJECT_NAME = L"Caret";
146 // There is only one caret present at any one time.
147 static gfx::Rect bounds_;
148 DISALLOW_COPY_AND_ASSIGN(AXFakeCaretWin);
149 };
150
151 } // namespace ui
152
153 #endif // UI_ACCESSIBILITY_PLATFORM_AX_FAKE_CARET_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698