| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "modules/accessibility/InspectorAccessibilityAgent.h" | 5 #include "modules/accessibility/InspectorAccessibilityAgent.h" |
| 6 | 6 |
| 7 #include "core/HTMLNames.h" | 7 #include "core/HTMLNames.h" |
| 8 #include "core/dom/AXObjectCache.h" | 8 #include "core/dom/AXObjectCache.h" |
| 9 #include "core/dom/DOMNodeIds.h" | 9 #include "core/dom/DOMNodeIds.h" |
| 10 #include "core/dom/Element.h" | 10 #include "core/dom/Element.h" |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 PassOwnPtr<AXProperty> createRelatedNodeListProperty(const String& key, AXRelate
dObjectVector& nodes) | 249 PassOwnPtr<AXProperty> createRelatedNodeListProperty(const String& key, AXRelate
dObjectVector& nodes) |
| 250 { | 250 { |
| 251 OwnPtr<AXValue> nodeListValue = createRelatedNodeListValue(nodes, AXValueTyp
eEnum::NodeList); | 251 OwnPtr<AXValue> nodeListValue = createRelatedNodeListValue(nodes, AXValueTyp
eEnum::NodeList); |
| 252 return createProperty(key, nodeListValue.release()); | 252 return createProperty(key, nodeListValue.release()); |
| 253 } | 253 } |
| 254 | 254 |
| 255 PassOwnPtr<AXProperty> createRelatedNodeListProperty(const String& key, AXObject
::AXObjectVector& nodes, const QualifiedName& attr, AXObject* axObject) | 255 PassOwnPtr<AXProperty> createRelatedNodeListProperty(const String& key, AXObject
::AXObjectVector& nodes, const QualifiedName& attr, AXObject* axObject) |
| 256 { | 256 { |
| 257 OwnPtr<AXValue> nodeListValue = createRelatedNodeListValue(nodes); | 257 OwnPtr<AXValue> nodeListValue = createRelatedNodeListValue(nodes); |
| 258 const AtomicString& attrValue = axObject->getAttribute(attr); | 258 const AtomicString& attrValue = axObject->getAttribute(attr); |
| 259 nodeListValue->setValue(JSONString::create(attrValue)); | 259 nodeListValue->setValue(JSONString::create(attrValue).get()); |
| 260 return createProperty(key, nodeListValue.release()); | 260 return createProperty(key, nodeListValue.release()); |
| 261 } | 261 } |
| 262 | 262 |
| 263 void fillRelationships(AXObject* axObject, protocol::Array<AXProperty>* properti
es) | 263 void fillRelationships(AXObject* axObject, protocol::Array<AXProperty>* properti
es) |
| 264 { | 264 { |
| 265 if (AXObject* activeDescendant = axObject->activeDescendant()) { | 265 if (AXObject* activeDescendant = axObject->activeDescendant()) { |
| 266 properties->addItem(createProperty(AXRelationshipAttributesEnum::Actived
escendant, createRelatedNodeListValue(activeDescendant))); | 266 properties->addItem(createProperty(AXRelationshipAttributesEnum::Actived
escendant, createRelatedNodeListValue(activeDescendant))); |
| 267 } | 267 } |
| 268 | 268 |
| 269 AXObject::AXObjectVector results; | 269 AXObject::AXObjectVector results; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 } | 357 } |
| 358 | 358 |
| 359 } // namespace | 359 } // namespace |
| 360 | 360 |
| 361 InspectorAccessibilityAgent::InspectorAccessibilityAgent(Page* page) | 361 InspectorAccessibilityAgent::InspectorAccessibilityAgent(Page* page) |
| 362 : InspectorBaseAgent<InspectorAccessibilityAgent, protocol::Frontend::Access
ibility>("Accessibility") | 362 : InspectorBaseAgent<InspectorAccessibilityAgent, protocol::Frontend::Access
ibility>("Accessibility") |
| 363 , m_page(page) | 363 , m_page(page) |
| 364 { | 364 { |
| 365 } | 365 } |
| 366 | 366 |
| 367 void InspectorAccessibilityAgent::getAXNode(ErrorString* errorString, int nodeId
, OwnPtr<AXNode>* accessibilityNode) | 367 void InspectorAccessibilityAgent::getAXNode(ErrorString* errorString, int nodeId
, Maybe<AXNode>* accessibilityNode) |
| 368 { | 368 { |
| 369 Frame* mainFrame = m_page->mainFrame(); | 369 Frame* mainFrame = m_page->mainFrame(); |
| 370 if (!mainFrame->isLocalFrame()) { | 370 if (!mainFrame->isLocalFrame()) { |
| 371 *errorString = "Can't inspect out of process frames yet"; | 371 *errorString = "Can't inspect out of process frames yet"; |
| 372 return; | 372 return; |
| 373 } | 373 } |
| 374 | 374 |
| 375 InspectorDOMAgent* domAgent = toLocalFrame(mainFrame)->instrumentingAgents()
->inspectorDOMAgent(); | 375 InspectorDOMAgent* domAgent = toLocalFrame(mainFrame)->instrumentingAgents()
->inspectorDOMAgent(); |
| 376 if (!domAgent) { | 376 if (!domAgent) { |
| 377 *errorString = "DOM agent must be enabled"; | 377 *errorString = "DOM agent must be enabled"; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 400 *accessibilityNode = buildObjectForNode(node, axObject, cacheImpl, propertie
s.release()); | 400 *accessibilityNode = buildObjectForNode(node, axObject, cacheImpl, propertie
s.release()); |
| 401 } | 401 } |
| 402 | 402 |
| 403 DEFINE_TRACE(InspectorAccessibilityAgent) | 403 DEFINE_TRACE(InspectorAccessibilityAgent) |
| 404 { | 404 { |
| 405 visitor->trace(m_page); | 405 visitor->trace(m_page); |
| 406 InspectorBaseAgent::trace(visitor); | 406 InspectorBaseAgent::trace(visitor); |
| 407 } | 407 } |
| 408 | 408 |
| 409 } // namespace blink | 409 } // namespace blink |
| OLD | NEW |