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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: ui/accessibility/platform/ax_fake_caret_win.h
diff --git a/ui/accessibility/platform/ax_fake_caret_win.h b/ui/accessibility/platform/ax_fake_caret_win.h
new file mode 100644
index 0000000000000000000000000000000000000000..f1fdf77f764da1b7838f4a988487f4680337323c
--- /dev/null
+++ b/ui/accessibility/platform/ax_fake_caret_win.h
@@ -0,0 +1,153 @@
+// Copyright (c) 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 UI_ACCESSIBILITY_PLATFORM_AX_FAKE_CARET_WIN_H_
+#define UI_ACCESSIBILITY_PLATFORM_AX_FAKE_CARET_WIN_H_
+
+#include <atlbase.h>
+#include <atlcom.h>
+#include <oleacc.h>
+#include <windows.h>
+
+#include "base/compiler_specific.h"
+#include "base/macros.h"
+#include "ui/accessibility/ax_export.h"
+#include "ui/gfx/geometry/rect.h"
+
+namespace ui {
+
+// A class representing the position of the caret to assistive software on
+// Windows. This is required because Chrome doesn't use the standard system
+// caret and because some assistive software still relies on specific
+// accessibility APIs to retrieve the caret position.
+class __declspec(uuid("170646b5-cb01-43e7-93f0-3ca455828d03")) AXFakeCaretWin
+ : NON_EXPORTED_BASE(public CComObjectRootEx<CComSingleThreadModel>),
+ public IDispatchImpl<IAccessible,
+ &IID_IAccessible,
+ &LIBID_Accessibility> {
+ public:
+ BEGIN_COM_MAP(AXFakeCaretWin)
+ COM_INTERFACE_ENTRY2(IDispatch, IAccessible)
+ COM_INTERFACE_ENTRY(IAccessible)
+ END_COM_MAP()
+
+ AXFakeCaretWin();
+ virtual ~AXFakeCaretWin() = default;
+
+ gfx::Rect bounds() { return bounds_; }
+ AX_EXPORT static void SetBounds(gfx::Rect bounds);
+
+ // IAccessible methods.
+
+ // Performs the default action on a given object.
+ STDMETHODIMP accDoDefaultAction(VARIANT var_id) override { return E_NOTIMPL; }
+
+ // Retrieves the child element or child object at a given point on the screen.
+ STDMETHODIMP accHitTest(LONG x_left, LONG y_top, VARIANT* child) override {
+ return E_NOTIMPL;
+ }
+
+ // Retrieves the specified object's current screen location.
+ STDMETHODIMP accLocation(LONG* x_left,
+ LONG* y_top,
+ LONG* width,
+ LONG* height,
+ VARIANT var_id) override;
+
+ // Traverses to another UI element and retrieves the object.
+ STDMETHODIMP accNavigate(LONG nav_dir, VARIANT start, VARIANT* end) override {
+ return E_NOTIMPL;
+ }
+
+ // Retrieves an IDispatch interface pointer for the specified child.
+ STDMETHODIMP get_accChild(VARIANT var_child,
+ IDispatch** disp_child) override {
+ return E_NOTIMPL;
+ }
+
+ // Retrieves the number of accessible children.
+ STDMETHODIMP get_accChildCount(LONG* child_count) override {
+ return E_NOTIMPL;
+ }
+
+ // Retrieves a string that describes the object's default action.
+ STDMETHODIMP get_accDefaultAction(VARIANT var_id,
+ BSTR* default_action) override {
+ return E_NOTIMPL;
+ }
+
+ // Retrieves the object's description.
+ STDMETHODIMP get_accDescription(VARIANT var_id, BSTR* desc) override {
+ return E_NOTIMPL;
+ }
+
+ // Retrieves the object that has the keyboard focus.
+ STDMETHODIMP get_accFocus(VARIANT* focus_child) override { return E_NOTIMPL; }
+
+ // Retrieves the help information associated with the object.
+ STDMETHODIMP get_accHelp(VARIANT var_id, BSTR* heflp) override {
+ return E_NOTIMPL;
+ }
+
+ // Retrieves the specified object's shortcut.
+ STDMETHODIMP get_accKeyboardShortcut(VARIANT var_id,
+ BSTR* access_key) override {
+ return E_NOTIMPL;
+ }
+
+ // Retrieves the name of the specified object.
+ STDMETHODIMP get_accName(VARIANT var_id, BSTR* name) override;
+
+ // Retrieves the IDispatch interface of the object's parent.
+ STDMETHODIMP get_accParent(IDispatch** disp_parent) override {
+ return E_NOTIMPL;
+ }
+
+ // Retrieves information describing the role of the specified object.
+ STDMETHODIMP get_accRole(VARIANT var_id, VARIANT* role) override;
+
+ // Retrieves the current state of the specified object.
+ STDMETHODIMP get_accState(VARIANT var_id, VARIANT* state) override {
+ return E_NOTIMPL;
+ }
+
+ // Returns the value associated with the object.
+ STDMETHODIMP get_accValue(VARIANT var_id, BSTR* value) override {
+ return E_NOTIMPL;
+ }
+
+ // Make an object take focus or extend the selection.
+ STDMETHODIMP accSelect(LONG flags_sel, VARIANT var_id) override {
+ return E_NOTIMPL;
+ }
+
+ STDMETHODIMP get_accHelpTopic(BSTR* help_file,
+ VARIANT var_id,
+ LONG* topic_id) override {
+ return E_NOTIMPL;
+ }
+
+ STDMETHODIMP get_accSelection(VARIANT* selected) override {
+ return E_NOTIMPL;
+ }
+
+ // Deprecated methods.
+ STDMETHODIMP put_accName(VARIANT var_id, BSTR put_name) override {
+ return E_NOTIMPL;
+ }
+
+ STDMETHODIMP put_accValue(VARIANT var_id, BSTR put_val) override {
+ return E_NOTIMPL;
+ }
+
+ private:
+ const LPCTSTR OBJECT_NAME = L"Caret";
+ // There is only one caret present at any one time.
+ static gfx::Rect bounds_;
+ DISALLOW_COPY_AND_ASSIGN(AXFakeCaretWin);
+};
+
+} // namespace ui
+
+#endif // UI_ACCESSIBILITY_PLATFORM_AX_FAKE_CARET_WIN_H_

Powered by Google App Engine
This is Rietveld 408576698