| Index: ui/accessibility/platform/ax_fake_caret_win.cc
|
| diff --git a/ui/accessibility/platform/ax_fake_caret_win.cc b/ui/accessibility/platform/ax_fake_caret_win.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a7a6d2aece601f6d0cbb449ce04f7845662f61db
|
| --- /dev/null
|
| +++ b/ui/accessibility/platform/ax_fake_caret_win.cc
|
| @@ -0,0 +1,57 @@
|
| +// 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.
|
| +
|
| +#include "ui/accessibility/platform/ax_fake_caret_win.h"
|
| +
|
| +#include "base/logging.h"
|
| +#include "ui/base/win/atl_module.h"
|
| +
|
| +namespace ui {
|
| +
|
| +AXFakeCaretWin::AXFakeCaretWin() {
|
| + ui::win::CreateATLModuleIfNeeded();
|
| +}
|
| +
|
| +// static
|
| +void AXFakeCaretWin::SetBounds(gfx::Rect bounds) {
|
| + bounds_ = bounds;
|
| +}
|
| +
|
| +STDMETHODIMP AXFakeCaretWin::accLocation(LONG* x_left,
|
| + LONG* y_top,
|
| + LONG* width,
|
| + LONG* height,
|
| + VARIANT var_id) {
|
| + if (!x_left || !y_top || !width || !height)
|
| + return E_INVALIDARG;
|
| + if (var_id.vt != VT_I4 || var_id.lVal != CHILDID_SELF)
|
| + return E_INVALIDARG;
|
| +
|
| + *x_left = static_cast<LONG>(bounds().x());
|
| + *y_top = static_cast<LONG>(bounds().y());
|
| + *width = static_cast<LONG>(bounds().width());
|
| + *height = static_cast<LONG>(bounds().height());
|
| + return S_OK;
|
| +}
|
| +
|
| +STDMETHODIMP AXFakeCaretWin::get_accName(VARIANT var_id, BSTR* name) {
|
| + if (var_id.vt != VT_I4 || var_id.lVal != CHILDID_SELF)
|
| + return E_INVALIDARG;
|
| + if (!name)
|
| + return E_INVALIDARG;
|
| + *name = SysAllocString(OBJECT_NAME);
|
| + return S_OK;
|
| +}
|
| +
|
| +STDMETHODIMP AXFakeCaretWin::get_accRole(VARIANT var_id, VARIANT* role) {
|
| + if (var_id.vt != VT_I4 || var_id.lVal != CHILDID_SELF)
|
| + return E_INVALIDARG;
|
| + if (!role)
|
| + return E_INVALIDARG;
|
| + role->vt = VT_I4;
|
| + role->lVal = ROLE_SYSTEM_CARET;
|
| + return S_OK;
|
| +}
|
| +
|
| +} // namespace ui
|
|
|