| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <atlbase.h> | 5 #include <atlbase.h> |
| 6 #include <atlcom.h> | 6 #include <atlcom.h> |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <oleacc.h> | 8 #include <oleacc.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 instance->AddRef(); | 176 instance->AddRef(); |
| 177 return instance; | 177 return instance; |
| 178 } | 178 } |
| 179 | 179 |
| 180 // static | 180 // static |
| 181 AXPlatformNode* AXPlatformNode::FromNativeViewAccessible( | 181 AXPlatformNode* AXPlatformNode::FromNativeViewAccessible( |
| 182 gfx::NativeViewAccessible accessible) { | 182 gfx::NativeViewAccessible accessible) { |
| 183 if (!accessible) | 183 if (!accessible) |
| 184 return nullptr; | 184 return nullptr; |
| 185 base::win::ScopedComPtr<AXPlatformNodeWin> ax_platform_node; | 185 base::win::ScopedComPtr<AXPlatformNodeWin> ax_platform_node; |
| 186 accessible->QueryInterface(ax_platform_node.Receive()); | 186 accessible->QueryInterface(ax_platform_node.GetAddressOf()); |
| 187 return ax_platform_node.Get(); | 187 return ax_platform_node.Get(); |
| 188 } | 188 } |
| 189 | 189 |
| 190 // | 190 // |
| 191 // AXPlatformNodeWin | 191 // AXPlatformNodeWin |
| 192 // | 192 // |
| 193 | 193 |
| 194 AXPlatformNodeWin::AXPlatformNodeWin() { | 194 AXPlatformNodeWin::AXPlatformNodeWin() { |
| 195 } | 195 } |
| 196 | 196 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 ::NotifyWinEvent(native_event, hwnd, OBJID_CLIENT, -unique_id_); | 236 ::NotifyWinEvent(native_event, hwnd, OBJID_CLIENT, -unique_id_); |
| 237 | 237 |
| 238 // Keep track of objects that are a target of an alert event. | 238 // Keep track of objects that are a target of an alert event. |
| 239 if (event_type == ui::AX_EVENT_ALERT) | 239 if (event_type == ui::AX_EVENT_ALERT) |
| 240 AddAlertTarget(); | 240 AddAlertTarget(); |
| 241 } | 241 } |
| 242 | 242 |
| 243 int AXPlatformNodeWin::GetIndexInParent() { | 243 int AXPlatformNodeWin::GetIndexInParent() { |
| 244 base::win::ScopedComPtr<IDispatch> parent_dispatch; | 244 base::win::ScopedComPtr<IDispatch> parent_dispatch; |
| 245 base::win::ScopedComPtr<IAccessible> parent_accessible; | 245 base::win::ScopedComPtr<IAccessible> parent_accessible; |
| 246 if (S_OK != get_accParent(parent_dispatch.Receive())) | 246 if (S_OK != get_accParent(parent_dispatch.GetAddressOf())) |
| 247 return -1; | 247 return -1; |
| 248 if (S_OK != parent_dispatch.CopyTo(parent_accessible.Receive())) | 248 if (S_OK != parent_dispatch.CopyTo(parent_accessible.GetAddressOf())) |
| 249 return -1; | 249 return -1; |
| 250 | 250 |
| 251 LONG child_count = 0; | 251 LONG child_count = 0; |
| 252 if (S_OK != parent_accessible->get_accChildCount(&child_count)) | 252 if (S_OK != parent_accessible->get_accChildCount(&child_count)) |
| 253 return -1; | 253 return -1; |
| 254 for (LONG index = 1; index <= child_count; ++index) { | 254 for (LONG index = 1; index <= child_count; ++index) { |
| 255 base::win::ScopedVariant childid_index(index); | 255 base::win::ScopedVariant childid_index(index); |
| 256 base::win::ScopedComPtr<IDispatch> child_dispatch; | 256 base::win::ScopedComPtr<IDispatch> child_dispatch; |
| 257 base::win::ScopedComPtr<IAccessible> child_accessible; | 257 base::win::ScopedComPtr<IAccessible> child_accessible; |
| 258 if (S_OK == parent_accessible->get_accChild(childid_index, | 258 if (S_OK == parent_accessible->get_accChild( |
| 259 child_dispatch.Receive()) && | 259 childid_index, child_dispatch.GetAddressOf()) && |
| 260 S_OK == child_dispatch.CopyTo(child_accessible.Receive())) { | 260 S_OK == child_dispatch.CopyTo(child_accessible.GetAddressOf())) { |
| 261 if (child_accessible.Get() == this) | 261 if (child_accessible.Get() == this) |
| 262 return index - 1; | 262 return index - 1; |
| 263 } | 263 } |
| 264 } | 264 } |
| 265 | 265 |
| 266 return -1; | 266 return -1; |
| 267 } | 267 } |
| 268 | 268 |
| 269 // | 269 // |
| 270 // IAccessible implementation. | 270 // IAccessible implementation. |
| (...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1290 | 1290 |
| 1291 AXPlatformNodeBase* base = | 1291 AXPlatformNodeBase* base = |
| 1292 FromNativeViewAccessible(node->GetNativeViewAccessible()); | 1292 FromNativeViewAccessible(node->GetNativeViewAccessible()); |
| 1293 if (base && !IsDescendant(base)) | 1293 if (base && !IsDescendant(base)) |
| 1294 base = nullptr; | 1294 base = nullptr; |
| 1295 | 1295 |
| 1296 return static_cast<AXPlatformNodeWin*>(base); | 1296 return static_cast<AXPlatformNodeWin*>(base); |
| 1297 } | 1297 } |
| 1298 | 1298 |
| 1299 } // namespace ui | 1299 } // namespace ui |
| OLD | NEW |