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

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

Issue 2781613003: Added a class acting as a fake caret for accessibility. (Closed)
Patch Set: Created 3 years, 8 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 #include "ui/accessibility/platform/ax_fake_caret_win.h"
6
7 #include "base/logging.h"
8 #include "ui/base/win/atl_module.h"
9
10 namespace ui {
11
12 AXFakeCaretWin::AXFakeCaretWin() {
13 ui::win::CreateATLModuleIfNeeded();
14 }
15
16 // static
17 void AXFakeCaretWin::SetBounds(gfx::Rect bounds) {
18 bounds_ = bounds;
19 }
20
21 STDMETHODIMP AXFakeCaretWin::accLocation(LONG* x_left,
22 LONG* y_top,
23 LONG* width,
24 LONG* height,
25 VARIANT var_id) {
26 if (!x_left || !y_top || !width || !height)
27 return E_INVALIDARG;
28 if (var_id.vt != VT_I4 || var_id.lVal != CHILDID_SELF)
29 return E_INVALIDARG;
30
31 *x_left = static_cast<LONG>(bounds().x());
32 *y_top = static_cast<LONG>(bounds().y());
33 *width = static_cast<LONG>(bounds().width());
34 *height = static_cast<LONG>(bounds().height());
35 return S_OK;
36 }
37
38 STDMETHODIMP AXFakeCaretWin::get_accName(VARIANT var_id, BSTR* name) {
39 if (var_id.vt != VT_I4 || var_id.lVal != CHILDID_SELF)
40 return E_INVALIDARG;
41 if (!name)
42 return E_INVALIDARG;
43 *name = SysAllocString(OBJECT_NAME);
44 return S_OK;
45 }
46
47 STDMETHODIMP AXFakeCaretWin::get_accRole(VARIANT var_id, VARIANT* role) {
48 if (var_id.vt != VT_I4 || var_id.lVal != CHILDID_SELF)
49 return E_INVALIDARG;
50 if (!role)
51 return E_INVALIDARG;
52 role->vt = VT_I4;
53 role->lVal = ROLE_SYSTEM_CARET;
54 return S_OK;
55 }
56
57 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698