OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 #ifndef UI_BASE_WIN_ACCESSIBILITY_MISC_UTILS_H_ | 4 #ifndef UI_BASE_WIN_ACCESSIBILITY_MISC_UTILS_H_ |
5 #define UI_BASE_WIN_ACCESSIBILITY_MISC_UTILS_H_ | 5 #define UI_BASE_WIN_ACCESSIBILITY_MISC_UTILS_H_ |
6 | 6 |
7 #include <atlbase.h> | 7 #include <atlbase.h> |
8 #include <atlcom.h> | 8 #include <atlcom.h> |
9 #include <UIAutomationCore.h> | 9 #include <UIAutomationCore.h> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/strings/string16.h" |
12 #include "ui/base/ui_base_export.h" | 13 #include "ui/base/ui_base_export.h" |
13 | 14 |
14 namespace base { | 15 namespace base { |
15 namespace win { | 16 namespace win { |
16 | 17 |
17 // UIA Text provider implementation for edit controls. | 18 // UIA Text provider implementation for edit controls. |
18 class UI_BASE_EXPORT UIATextProvider | 19 class UI_BASE_EXPORT UIATextProvider |
19 : public NON_EXPORTED_BASE(CComObjectRootEx<CComMultiThreadModel>), | 20 : public NON_EXPORTED_BASE(CComObjectRootEx<CComMultiThreadModel>), |
20 public IValueProvider, | 21 public IValueProvider, |
21 public ITextProvider { | 22 public ITextProvider { |
22 public: | 23 public: |
23 BEGIN_COM_MAP(UIATextProvider) | 24 BEGIN_COM_MAP(UIATextProvider) |
24 COM_INTERFACE_ENTRY2(IUnknown, ITextProvider) | 25 COM_INTERFACE_ENTRY2(IUnknown, ITextProvider) |
25 COM_INTERFACE_ENTRY(IValueProvider) | 26 COM_INTERFACE_ENTRY(IValueProvider) |
26 COM_INTERFACE_ENTRY(ITextProvider) | 27 COM_INTERFACE_ENTRY(ITextProvider) |
27 END_COM_MAP() | 28 END_COM_MAP() |
28 | 29 |
29 UIATextProvider(); | 30 UIATextProvider(); |
30 | 31 |
31 // Creates an instance of the UIATextProvider class. | 32 // Creates an instance of the UIATextProvider class. |
32 // Returns true on success | 33 // Returns true on success |
33 static bool CreateTextProvider(bool editable, IUnknown** provider); | 34 static bool CreateTextProvider(const string16& value, |
| 35 bool editable, |
| 36 IUnknown** provider); |
34 | 37 |
35 void set_editable(bool editable) { | 38 void set_editable(bool editable) { |
36 editable_ = editable; | 39 editable_ = editable; |
37 } | 40 } |
38 | 41 |
| 42 void set_value(const string16& value) { value_ = value; } |
| 43 |
39 // | 44 // |
40 // IValueProvider methods. | 45 // IValueProvider methods. |
41 // | 46 // |
42 STDMETHOD(get_IsReadOnly)(BOOL* read_only); | 47 STDMETHOD(get_IsReadOnly)(BOOL* read_only); |
43 | 48 |
44 // | 49 // |
45 // IValueProvider methods not implemented. | 50 // IValueProvider methods not implemented. |
46 // | 51 // |
47 STDMETHOD(SetValue)(const wchar_t* val) { | 52 STDMETHOD(SetValue)(const wchar_t* val) { |
48 return E_NOTIMPL; | 53 return E_NOTIMPL; |
49 } | 54 } |
50 | 55 |
51 STDMETHOD(get_Value)(BSTR* value) { | 56 STDMETHOD(get_Value)(BSTR* value); |
52 return E_NOTIMPL; | |
53 } | |
54 | 57 |
55 // | 58 // |
56 // ITextProvider methods. | 59 // ITextProvider methods. |
57 // | 60 // |
58 STDMETHOD(GetSelection)(SAFEARRAY** ret) { | 61 STDMETHOD(GetSelection)(SAFEARRAY** ret) { |
59 return E_NOTIMPL; | 62 return E_NOTIMPL; |
60 } | 63 } |
61 | 64 |
62 STDMETHOD(GetVisibleRanges)(SAFEARRAY** ret) { | 65 STDMETHOD(GetVisibleRanges)(SAFEARRAY** ret) { |
63 return E_NOTIMPL; | 66 return E_NOTIMPL; |
(...skipping 12 matching lines...) Expand all Loading... |
76 STDMETHOD(get_DocumentRange)(ITextRangeProvider** ret) { | 79 STDMETHOD(get_DocumentRange)(ITextRangeProvider** ret) { |
77 return E_NOTIMPL; | 80 return E_NOTIMPL; |
78 } | 81 } |
79 | 82 |
80 STDMETHOD(get_SupportedTextSelection)(enum SupportedTextSelection* ret) { | 83 STDMETHOD(get_SupportedTextSelection)(enum SupportedTextSelection* ret) { |
81 return E_NOTIMPL; | 84 return E_NOTIMPL; |
82 } | 85 } |
83 | 86 |
84 private: | 87 private: |
85 bool editable_; | 88 bool editable_; |
| 89 string16 value_; |
86 }; | 90 }; |
87 | 91 |
88 } // win | 92 } // win |
89 } // base | 93 } // base |
90 | 94 |
91 #endif // UI_BASE_WIN_ACCESSIBILITY_MISC_UTILS_H_ | 95 #endif // UI_BASE_WIN_ACCESSIBILITY_MISC_UTILS_H_ |
OLD | NEW |