Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: ui/views/accessibility/native_view_accessibility_win.cc

Issue 872683005: Add missing NULL checks to NativeViewAccessibilityWin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 4
5 #include "ui/views/accessibility/native_view_accessibility_win.h" 5 #include "ui/views/accessibility/native_view_accessibility_win.h"
6 6
7 #include <oleacc.h> 7 #include <oleacc.h>
8 #include <UIAutomationClient.h> 8 #include <UIAutomationClient.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 return E_NOTIMPL; 783 return E_NOTIMPL;
784 } 784 }
785 785
786 STDMETHODIMP NativeViewAccessibilityWin::accSelect( 786 STDMETHODIMP NativeViewAccessibilityWin::accSelect(
787 LONG flagsSelect, VARIANT var_id) { 787 LONG flagsSelect, VARIANT var_id) {
788 return E_NOTIMPL; 788 return E_NOTIMPL;
789 } 789 }
790 790
791 STDMETHODIMP NativeViewAccessibilityWin::get_accHelp( 791 STDMETHODIMP NativeViewAccessibilityWin::get_accHelp(
792 VARIANT var_id, BSTR* help) { 792 VARIANT var_id, BSTR* help) {
793 if (!IsValidId(var_id) || !help)
794 return E_INVALIDARG;
795
796 if (!view_)
797 return E_FAIL;
798
793 base::string16 temp = base::UTF8ToUTF16(view_->GetClassName()); 799 base::string16 temp = base::UTF8ToUTF16(view_->GetClassName());
794 *help = SysAllocString(temp.c_str()); 800 *help = SysAllocString(temp.c_str());
795 return S_OK; 801 return S_OK;
796 } 802 }
797 803
798 STDMETHODIMP NativeViewAccessibilityWin::get_accHelpTopic( 804 STDMETHODIMP NativeViewAccessibilityWin::get_accHelpTopic(
799 BSTR* help_file, VARIANT var_id, LONG* topic_id) { 805 BSTR* help_file, VARIANT var_id, LONG* topic_id) {
800 if (help_file) { 806 if (help_file) {
801 *help_file = NULL; 807 *help_file = NULL;
802 } 808 }
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 base::win::GetVersion() >= base::win::VERSION_WIN8) { 1182 base::win::GetVersion() >= base::win::VERSION_WIN8) {
1177 return QueryInterface(riid, object); 1183 return QueryInterface(riid, object);
1178 } 1184 }
1179 1185
1180 *object = NULL; 1186 *object = NULL;
1181 return E_FAIL; 1187 return E_FAIL;
1182 } 1188 }
1183 1189
1184 STDMETHODIMP NativeViewAccessibilityWin::GetPatternProvider( 1190 STDMETHODIMP NativeViewAccessibilityWin::GetPatternProvider(
1185 PATTERNID id, IUnknown** provider) { 1191 PATTERNID id, IUnknown** provider) {
1192 if (!view_)
1193 return E_FAIL;
1194
1195 if (!provider)
1196 return E_INVALIDARG;
1197
1186 DVLOG(1) << "In Function: " 1198 DVLOG(1) << "In Function: "
1187 << __FUNCTION__ 1199 << __FUNCTION__
1188 << " for pattern id: " 1200 << " for pattern id: "
1189 << id; 1201 << id;
1190 if (id == UIA_ValuePatternId || id == UIA_TextPatternId) { 1202 if (id == UIA_ValuePatternId || id == UIA_TextPatternId) {
1191 ui::AXViewState state; 1203 ui::AXViewState state;
1192 view_->GetAccessibleState(&state); 1204 view_->GetAccessibleState(&state);
1193 long role = MSAARole(state.role); 1205 long role = MSAARole(state.role);
1194 1206
1195 if (role == ROLE_SYSTEM_TEXT) { 1207 if (role == ROLE_SYSTEM_TEXT) {
1196 DVLOG(1) << "Returning UIA text provider"; 1208 DVLOG(1) << "Returning UIA text provider";
1197 base::win::UIATextProvider::CreateTextProvider( 1209 base::win::UIATextProvider::CreateTextProvider(
1198 state.value, true, provider); 1210 state.value, true, provider);
1199 return S_OK; 1211 return S_OK;
1200 } 1212 }
1201 } 1213 }
1202 return E_NOTIMPL; 1214 return E_NOTIMPL;
1203 } 1215 }
1204 1216
1205 STDMETHODIMP NativeViewAccessibilityWin::GetPropertyValue(PROPERTYID id, 1217 STDMETHODIMP NativeViewAccessibilityWin::GetPropertyValue(PROPERTYID id,
1206 VARIANT* ret) { 1218 VARIANT* ret) {
1219 if (!view_)
1220 return E_FAIL;
1221
1222 if (!ret)
1223 return E_INVALIDARG;
1224
1207 DVLOG(1) << "In Function: " 1225 DVLOG(1) << "In Function: "
1208 << __FUNCTION__ 1226 << __FUNCTION__
1209 << " for property id: " 1227 << " for property id: "
1210 << id; 1228 << id;
1211 if (id == UIA_ControlTypePropertyId) { 1229 if (id == UIA_ControlTypePropertyId) {
1212 ui::AXViewState state; 1230 ui::AXViewState state;
1213 view_->GetAccessibleState(&state); 1231 view_->GetAccessibleState(&state);
1214 long role = MSAARole(state.role); 1232 long role = MSAARole(state.role);
1215 if (role == ROLE_SYSTEM_TEXT) { 1233 if (role == ROLE_SYSTEM_TEXT) {
1216 V_VT(ret) = VT_I4; 1234 V_VT(ret) = VT_I4;
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1531 if (view == NULL || view == view_) { 1549 if (view == NULL || view == view_) {
1532 alert_target_view_storage_ids_.erase( 1550 alert_target_view_storage_ids_.erase(
1533 alert_target_view_storage_ids_.begin() + i); 1551 alert_target_view_storage_ids_.begin() + i);
1534 } else { 1552 } else {
1535 ++i; 1553 ++i;
1536 } 1554 }
1537 } 1555 }
1538 } 1556 }
1539 1557
1540 } // namespace views 1558 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698