OLD | NEW |
| (Empty) |
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 "base/win/accessibility_misc_utils.h" | |
5 | |
6 #include "base/logging.h" | |
7 | |
8 namespace base { | |
9 namespace win { | |
10 | |
11 // UIA TextProvider implementation. | |
12 UIATextProvider::UIATextProvider() | |
13 : editable_(false) {} | |
14 | |
15 // static | |
16 bool UIATextProvider::CreateTextProvider(bool editable, IUnknown** provider) { | |
17 CComObject<UIATextProvider>* text_provider = NULL; | |
18 HRESULT hr = CComObject<UIATextProvider>::CreateInstance(&text_provider); | |
19 if (SUCCEEDED(hr)) { | |
20 DCHECK(text_provider); | |
21 text_provider->set_editable(editable); | |
22 text_provider->AddRef(); | |
23 *provider = static_cast<ITextProvider*>(text_provider); | |
24 return true; | |
25 } | |
26 return false; | |
27 } | |
28 | |
29 STDMETHODIMP UIATextProvider::get_IsReadOnly(BOOL* read_only) { | |
30 *read_only = !editable_; | |
31 return S_OK; | |
32 } | |
33 | |
34 } // namespace win | |
35 } // namespace base | |
OLD | NEW |