| OLD | NEW |
| 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 "content/renderer/accessibility/renderer_accessibility_complete.h" | 5 #include "content/renderer/accessibility/renderer_accessibility_complete.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 if (document.isNull()) | 91 if (document.isNull()) |
| 92 return; | 92 return; |
| 93 | 93 |
| 94 if (node.isNull()) { | 94 if (node.isNull()) { |
| 95 // When focus is cleared, implicitly focus the document. | 95 // When focus is cleared, implicitly focus the document. |
| 96 // TODO(dmazzoni): Make Blink send this notification instead. | 96 // TODO(dmazzoni): Make Blink send this notification instead. |
| 97 HandleAXEvent(document.accessibilityObject(), ui::AX_EVENT_BLUR); | 97 HandleAXEvent(document.accessibilityObject(), ui::AX_EVENT_BLUR); |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 | 100 |
| 101 void RendererAccessibilityComplete::DisableAccessibility() { |
| 102 RenderView* render_view = render_frame_->GetRenderView(); |
| 103 if (!render_view) |
| 104 return; |
| 105 |
| 106 WebView* web_view = render_view->GetWebView(); |
| 107 if (!web_view) |
| 108 return; |
| 109 |
| 110 WebSettings* settings = web_view->settings(); |
| 111 if (!settings) |
| 112 return; |
| 113 |
| 114 settings->setAccessibilityEnabled(false); |
| 115 } |
| 116 |
| 101 void RendererAccessibilityComplete::HandleWebAccessibilityEvent( | 117 void RendererAccessibilityComplete::HandleWebAccessibilityEvent( |
| 102 const blink::WebAXObject& obj, blink::WebAXEvent event) { | 118 const blink::WebAXObject& obj, blink::WebAXEvent event) { |
| 103 HandleAXEvent(obj, AXEventFromBlink(event)); | 119 HandleAXEvent(obj, AXEventFromBlink(event)); |
| 104 } | 120 } |
| 105 | 121 |
| 106 void RendererAccessibilityComplete::HandleAXEvent( | 122 void RendererAccessibilityComplete::HandleAXEvent( |
| 107 const blink::WebAXObject& obj, ui::AXEvent event) { | 123 const blink::WebAXObject& obj, ui::AXEvent event) { |
| 108 const WebDocument& document = GetMainDocument(); | 124 const WebDocument& document = GetMainDocument(); |
| 109 if (document.isNull()) | 125 if (document.isNull()) |
| 110 return; | 126 return; |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 render_frame_->GetRenderView()->GetWebView()->clearFocusedElement(); | 432 render_frame_->GetRenderView()->GetWebView()->clearFocusedElement(); |
| 417 else | 433 else |
| 418 obj.setFocused(true); | 434 obj.setFocused(true); |
| 419 } | 435 } |
| 420 | 436 |
| 421 void RendererAccessibilityComplete::OnFatalError() { | 437 void RendererAccessibilityComplete::OnFatalError() { |
| 422 CHECK(false) << "Invalid accessibility tree."; | 438 CHECK(false) << "Invalid accessibility tree."; |
| 423 } | 439 } |
| 424 | 440 |
| 425 } // namespace content | 441 } // namespace content |
| OLD | NEW |