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

Side by Side Diff: content/browser/accessibility/browser_accessibility_com_win.cc

Issue 2976913002: Better handle null delegates by returning instead of CHECK() (Closed)
Patch Set: Fixes Created 3 years, 5 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 | ui/accessibility/platform/ax_platform_node_base.cc » ('j') | 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) 2017 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2017 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 "content/browser/accessibility/browser_accessibility_com_win.h" 5 #include "content/browser/accessibility/browser_accessibility_com_win.h"
6 6
7 #include <UIAutomationClient.h> 7 #include <UIAutomationClient.h>
8 #include <UIAutomationCoreApi.h> 8 #include <UIAutomationCoreApi.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 3032 matching lines...) Expand 10 before | Expand all | Expand 10 after
3043 // 3043 //
3044 3044
3045 // static 3045 // static
3046 HRESULT WINAPI BrowserAccessibilityComWin::InternalQueryInterface( 3046 HRESULT WINAPI BrowserAccessibilityComWin::InternalQueryInterface(
3047 void* this_ptr, 3047 void* this_ptr,
3048 const _ATL_INTMAP_ENTRY* entries, 3048 const _ATL_INTMAP_ENTRY* entries,
3049 REFIID iid, 3049 REFIID iid,
3050 void** object) { 3050 void** object) {
3051 BrowserAccessibilityComWin* accessibility = 3051 BrowserAccessibilityComWin* accessibility =
3052 reinterpret_cast<BrowserAccessibilityComWin*>(this_ptr); 3052 reinterpret_cast<BrowserAccessibilityComWin*>(this_ptr);
3053
3054 if (!accessibility->owner()) {
3055 *object = nullptr;
3056 return E_NOINTERFACE;
3057 }
3058
3053 int32_t ia_role = accessibility->MSAARole(); 3059 int32_t ia_role = accessibility->MSAARole();
3054 if (iid == IID_IAccessibleImage) { 3060 if (iid == IID_IAccessibleImage) {
3055 if (ia_role != ROLE_SYSTEM_GRAPHIC) { 3061 if (ia_role != ROLE_SYSTEM_GRAPHIC) {
3056 *object = NULL; 3062 *object = nullptr;
3057 return E_NOINTERFACE; 3063 return E_NOINTERFACE;
3058 } 3064 }
3059 } else if (iid == IID_IAccessibleTable || iid == IID_IAccessibleTable2) { 3065 } else if (iid == IID_IAccessibleTable || iid == IID_IAccessibleTable2) {
3060 if (ia_role != ROLE_SYSTEM_TABLE) { 3066 if (ia_role != ROLE_SYSTEM_TABLE) {
3061 *object = NULL; 3067 *object = nullptr;
3062 return E_NOINTERFACE; 3068 return E_NOINTERFACE;
3063 } 3069 }
3064 } else if (iid == IID_IAccessibleTableCell) { 3070 } else if (iid == IID_IAccessibleTableCell) {
3065 if (!ui::IsCellOrTableHeaderRole(accessibility->owner()->GetRole())) { 3071 if (!ui::IsCellOrTableHeaderRole(accessibility->owner()->GetRole())) {
3066 *object = NULL; 3072 *object = nullptr;
3067 return E_NOINTERFACE; 3073 return E_NOINTERFACE;
3068 } 3074 }
3069 } else if (iid == IID_IAccessibleValue) { 3075 } else if (iid == IID_IAccessibleValue) {
3070 if (!accessibility->IsRangeValueSupported()) { 3076 if (!accessibility->IsRangeValueSupported()) {
3071 *object = NULL; 3077 *object = nullptr;
3072 return E_NOINTERFACE; 3078 return E_NOINTERFACE;
3073 } 3079 }
3074 } else if (iid == IID_ISimpleDOMDocument) { 3080 } else if (iid == IID_ISimpleDOMDocument) {
3075 if (ia_role != ROLE_SYSTEM_DOCUMENT) { 3081 if (ia_role != ROLE_SYSTEM_DOCUMENT) {
3076 *object = NULL; 3082 *object = nullptr;
3077 return E_NOINTERFACE; 3083 return E_NOINTERFACE;
3078 } 3084 }
3079 } else if (iid == IID_IAccessibleHyperlink) { 3085 } else if (iid == IID_IAccessibleHyperlink) {
3080 auto* ax_object = 3086 auto* ax_object =
3081 reinterpret_cast<const BrowserAccessibilityComWin*>(this_ptr); 3087 reinterpret_cast<const BrowserAccessibilityComWin*>(this_ptr);
3082 if (!ax_object || !ax_object->IsHyperlink()) { 3088 if (!ax_object || !ax_object->IsHyperlink()) {
3083 *object = nullptr; 3089 *object = nullptr;
3084 return E_NOINTERFACE; 3090 return E_NOINTERFACE;
3085 } 3091 }
3086 } 3092 }
(...skipping 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after
4577 4583
4578 BrowserAccessibilityComWin* ToBrowserAccessibilityComWin( 4584 BrowserAccessibilityComWin* ToBrowserAccessibilityComWin(
4579 BrowserAccessibility* obj) { 4585 BrowserAccessibility* obj) {
4580 if (!obj || !obj->IsNative()) 4586 if (!obj || !obj->IsNative())
4581 return nullptr; 4587 return nullptr;
4582 auto* result = static_cast<BrowserAccessibilityWin*>(obj)->GetCOM(); 4588 auto* result = static_cast<BrowserAccessibilityWin*>(obj)->GetCOM();
4583 return result; 4589 return result;
4584 } 4590 }
4585 4591
4586 } // namespace content 4592 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ui/accessibility/platform/ax_platform_node_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698