Fix breakages in https://codereview.chromium.org/1155713003/
[chromium-blink-merge.git] / ui / base / win / accessibility_misc_utils.cc
blob0f0b39906a3f5b6f1706cd53cc4e8bf16e37a2ca
1 // Copyright (c) 2012 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 #include "ui/base/win/accessibility_misc_utils.h"
6 #include "base/logging.h"
7 #include "ui/base/win/atl_module.h"
9 namespace base {
10 namespace win {
12 // UIA TextProvider implementation.
13 UIATextProvider::UIATextProvider()
14 : editable_(false) {}
16 UIATextProvider::~UIATextProvider() {
19 // static
20 bool UIATextProvider::CreateTextProvider(const string16& value,
21 bool editable,
22 IUnknown** provider) {
23 // Make sure ATL is initialized in this module.
24 ui::win::CreateATLModuleIfNeeded();
26 CComObject<UIATextProvider>* text_provider = NULL;
27 HRESULT hr = CComObject<UIATextProvider>::CreateInstance(&text_provider);
28 if (SUCCEEDED(hr)) {
29 DCHECK(text_provider);
30 text_provider->set_editable(editable);
31 text_provider->set_value(value);
32 text_provider->AddRef();
33 *provider = static_cast<ITextProvider*>(text_provider);
34 return true;
36 return false;
39 STDMETHODIMP UIATextProvider::get_IsReadOnly(BOOL* read_only) {
40 *read_only = !editable_;
41 return S_OK;
45 // IValueProvider methods.
48 STDMETHODIMP UIATextProvider::SetValue(const wchar_t* val) {
49 return E_NOTIMPL;
52 STDMETHODIMP UIATextProvider::get_Value(BSTR* value) {
53 *value = SysAllocString(value_.c_str());
54 return S_OK;
58 // ITextProvider methods.
61 STDMETHODIMP UIATextProvider::GetSelection(SAFEARRAY** ret) {
62 return E_NOTIMPL;
65 STDMETHODIMP UIATextProvider::GetVisibleRanges(SAFEARRAY** ret) {
66 return E_NOTIMPL;
69 STDMETHODIMP UIATextProvider::RangeFromChild(IRawElementProviderSimple* child,
70 ITextRangeProvider** ret) {
71 return E_NOTIMPL;
74 STDMETHODIMP UIATextProvider::RangeFromPoint(struct UiaPoint point,
75 ITextRangeProvider** ret) {
76 return E_NOTIMPL;
79 STDMETHODIMP UIATextProvider::get_DocumentRange(ITextRangeProvider** ret) {
80 return E_NOTIMPL;
83 STDMETHODIMP UIATextProvider::get_SupportedTextSelection(
84 enum SupportedTextSelection* ret) {
85 return E_NOTIMPL;
88 } // namespace win
89 } // namespace base