| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 | 4 |
| 5 #include "chrome/browser/autocomplete/autocomplete_accessibility.h" | 5 #include "chrome/browser/autocomplete/autocomplete_accessibility.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 8 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
| 9 #include "chrome/browser/autocomplete/autocomplete_edit_view_win.h" | 9 #include "chrome/browser/autocomplete/autocomplete_edit_view_win.h" |
| 10 #include "grit/generated_resources.h" | 10 #include "grit/generated_resources.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 STDMETHODIMP AutocompleteAccessibility::get_accName(VARIANT var_id, | 92 STDMETHODIMP AutocompleteAccessibility::get_accName(VARIANT var_id, |
| 93 BSTR* name) { | 93 BSTR* name) { |
| 94 if (var_id.vt != VT_I4 || !name) { | 94 if (var_id.vt != VT_I4 || !name) { |
| 95 return E_INVALIDARG; | 95 return E_INVALIDARG; |
| 96 } | 96 } |
| 97 | 97 |
| 98 std::wstring temp_name = l10n_util::GetString(IDS_ACCNAME_LOCATION); | 98 std::wstring temp_name = l10n_util::GetString(IDS_ACCNAME_LOCATION); |
| 99 | 99 |
| 100 if (!temp_name.empty()) { | 100 if (!temp_name.empty()) { |
| 101 // Return name retrieved. | 101 // Return name retrieved. |
| 102 *name = CComBSTR(temp_name.c_str()).Detach(); | 102 *name = SysAllocString(temp_name.c_str()); |
| 103 } else { | 103 } else { |
| 104 // If no name is found, return S_FALSE. | 104 // If no name is found, return S_FALSE. |
| 105 return S_FALSE; | 105 return S_FALSE; |
| 106 } | 106 } |
| 107 DCHECK(*name); | 107 DCHECK(*name); |
| 108 | 108 |
| 109 return S_OK; | 109 return S_OK; |
| 110 } | 110 } |
| 111 | 111 |
| 112 STDMETHODIMP AutocompleteAccessibility::get_accDescription(VARIANT var_id, | 112 STDMETHODIMP AutocompleteAccessibility::get_accDescription(VARIANT var_id, |
| 113 BSTR* desc) { | 113 BSTR* desc) { |
| 114 if (var_id.vt != VT_I4 || !desc) { | 114 if (var_id.vt != VT_I4 || !desc) { |
| 115 return E_INVALIDARG; | 115 return E_INVALIDARG; |
| 116 } | 116 } |
| 117 | 117 |
| 118 return S_FALSE; | 118 return S_FALSE; |
| 119 } | 119 } |
| 120 | 120 |
| 121 STDMETHODIMP AutocompleteAccessibility::get_accValue(VARIANT var_id, | 121 STDMETHODIMP AutocompleteAccessibility::get_accValue(VARIANT var_id, |
| 122 BSTR* value) { | 122 BSTR* value) { |
| 123 if (var_id.vt != VT_I4 || !value) { | 123 if (var_id.vt != VT_I4 || !value) { |
| 124 return E_INVALIDARG; | 124 return E_INVALIDARG; |
| 125 } | 125 } |
| 126 | 126 |
| 127 std::wstring temp_value; | 127 std::wstring temp_value; |
| 128 | 128 |
| 129 if (var_id.lVal != CHILDID_SELF) | 129 if (var_id.lVal != CHILDID_SELF) |
| 130 return E_INVALIDARG; | 130 return E_INVALIDARG; |
| 131 | 131 |
| 132 // Edit box has no children, only handle self. | 132 // Edit box has no children, only handle self. |
| 133 temp_value = edit_box_->GetText(); | 133 temp_value = edit_box_->GetText(); |
| 134 if (temp_value.empty()) | 134 if (temp_value.empty()) |
| 135 return S_FALSE; | 135 return S_FALSE; |
| 136 | 136 |
| 137 // Return value retrieved. | 137 // Return value retrieved. |
| 138 *value = CComBSTR(temp_value.c_str()).Detach(); | 138 *value = SysAllocString(temp_value.c_str()); |
| 139 | 139 |
| 140 DCHECK(*value); | 140 DCHECK(*value); |
| 141 | 141 |
| 142 return S_OK; | 142 return S_OK; |
| 143 | |
| 144 } | 143 } |
| 145 | 144 |
| 146 STDMETHODIMP AutocompleteAccessibility::get_accState(VARIANT var_id, | 145 STDMETHODIMP AutocompleteAccessibility::get_accState(VARIANT var_id, |
| 147 VARIANT* state) { | 146 VARIANT* state) { |
| 148 if (var_id.vt != VT_I4 || !state) { | 147 if (var_id.vt != VT_I4 || !state) { |
| 149 return E_INVALIDARG; | 148 return E_INVALIDARG; |
| 150 } | 149 } |
| 151 | 150 |
| 152 DCHECK(default_accessibility_server_); | 151 DCHECK(default_accessibility_server_); |
| 153 HRESULT hr = default_accessibility_server_->get_accState(var_id, state); | 152 HRESULT hr = default_accessibility_server_->get_accState(var_id, state); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 BSTR put_name) { | 257 BSTR put_name) { |
| 259 // Deprecated. | 258 // Deprecated. |
| 260 return DISP_E_MEMBERNOTFOUND; | 259 return DISP_E_MEMBERNOTFOUND; |
| 261 } | 260 } |
| 262 | 261 |
| 263 STDMETHODIMP AutocompleteAccessibility::put_accValue(VARIANT var_id, | 262 STDMETHODIMP AutocompleteAccessibility::put_accValue(VARIANT var_id, |
| 264 BSTR put_val) { | 263 BSTR put_val) { |
| 265 // Deprecated. | 264 // Deprecated. |
| 266 return DISP_E_MEMBERNOTFOUND; | 265 return DISP_E_MEMBERNOTFOUND; |
| 267 } | 266 } |
| OLD | NEW |