| 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 #ifndef CONTENT_RENDERER_ACCESSIBILITY_RENDERER_ACCESSIBILITY_H_ | 5 #ifndef CONTENT_RENDERER_ACCESSIBILITY_RENDERER_ACCESSIBILITY_H_ |
| 6 #define CONTENT_RENDERER_ACCESSIBILITY_RENDERER_ACCESSIBILITY_H_ | 6 #define CONTENT_RENDERER_ACCESSIBILITY_RENDERER_ACCESSIBILITY_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 // technology. It turns on Blink's accessibility code and sends a serialized | 45 // technology. It turns on Blink's accessibility code and sends a serialized |
| 46 // representation of that tree whenever it changes. It also handles requests | 46 // representation of that tree whenever it changes. It also handles requests |
| 47 // from the browser to perform accessibility actions on nodes in the tree | 47 // from the browser to perform accessibility actions on nodes in the tree |
| 48 // (e.g., change focus, or click on a button). | 48 // (e.g., change focus, or click on a button). |
| 49 class CONTENT_EXPORT RendererAccessibility : public RenderFrameObserver { | 49 class CONTENT_EXPORT RendererAccessibility : public RenderFrameObserver { |
| 50 public: | 50 public: |
| 51 // Request a one-time snapshot of the accessibility tree without | 51 // Request a one-time snapshot of the accessibility tree without |
| 52 // enabling accessibility if it wasn't already enabled. | 52 // enabling accessibility if it wasn't already enabled. |
| 53 static void SnapshotAccessibilityTree( | 53 static void SnapshotAccessibilityTree( |
| 54 RenderFrameImpl* render_frame, | 54 RenderFrameImpl* render_frame, |
| 55 ui::AXTreeUpdate<AXContentNodeData>* response); | 55 AXContentTreeUpdate* response); |
| 56 | 56 |
| 57 explicit RendererAccessibility(RenderFrameImpl* render_frame); | 57 explicit RendererAccessibility(RenderFrameImpl* render_frame); |
| 58 ~RendererAccessibility() override; | 58 ~RendererAccessibility() override; |
| 59 | 59 |
| 60 // RenderFrameObserver implementation. | 60 // RenderFrameObserver implementation. |
| 61 bool OnMessageReceived(const IPC::Message& message) override; | 61 bool OnMessageReceived(const IPC::Message& message) override; |
| 62 | 62 |
| 63 // Called when an accessibility notification occurs in Blink. | 63 // Called when an accessibility notification occurs in Blink. |
| 64 void HandleWebAccessibilityEvent(const blink::WebAXObject& obj, | 64 void HandleWebAccessibilityEvent(const blink::WebAXObject& obj, |
| 65 blink::WebAXEvent event); | 65 blink::WebAXEvent event); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 119 |
| 120 // Events from Blink are collected until they are ready to be | 120 // Events from Blink are collected until they are ready to be |
| 121 // sent to the browser. | 121 // sent to the browser. |
| 122 std::vector<AccessibilityHostMsg_EventParams> pending_events_; | 122 std::vector<AccessibilityHostMsg_EventParams> pending_events_; |
| 123 | 123 |
| 124 // The adapter that exposes Blink's accessibility tree to AXTreeSerializer. | 124 // The adapter that exposes Blink's accessibility tree to AXTreeSerializer. |
| 125 BlinkAXTreeSource tree_source_; | 125 BlinkAXTreeSource tree_source_; |
| 126 | 126 |
| 127 // The serializer that sends accessibility messages to the browser process. | 127 // The serializer that sends accessibility messages to the browser process. |
| 128 using BlinkAXTreeSerializer = | 128 using BlinkAXTreeSerializer = |
| 129 ui::AXTreeSerializer<blink::WebAXObject, AXContentNodeData>; | 129 ui::AXTreeSerializer<blink::WebAXObject, |
| 130 AXContentNodeData, |
| 131 AXContentTreeData>; |
| 130 BlinkAXTreeSerializer serializer_; | 132 BlinkAXTreeSerializer serializer_; |
| 131 | 133 |
| 132 // Current location of every object, so we can detect when it moves. | 134 // Current location of every object, so we can detect when it moves. |
| 133 base::hash_map<int, gfx::Rect> locations_; | 135 base::hash_map<int, gfx::Rect> locations_; |
| 134 | 136 |
| 135 // The most recently observed scroll offset of the root document element. | 137 // The most recently observed scroll offset of the root document element. |
| 136 // TODO(dmazzoni): remove once https://bugs.webkit.org/show_bug.cgi?id=73460 | 138 // TODO(dmazzoni): remove once https://bugs.webkit.org/show_bug.cgi?id=73460 |
| 137 // is fixed. | 139 // is fixed. |
| 138 gfx::Size last_scroll_offset_; | 140 gfx::Size last_scroll_offset_; |
| 139 | 141 |
| 140 // Set if we are waiting for an accessibility event ack. | 142 // Set if we are waiting for an accessibility event ack. |
| 141 bool ack_pending_; | 143 bool ack_pending_; |
| 142 | 144 |
| 143 // Nonzero if the browser requested we reset the accessibility state. | 145 // Nonzero if the browser requested we reset the accessibility state. |
| 144 // We need to return this token in the next IPC. | 146 // We need to return this token in the next IPC. |
| 145 int reset_token_; | 147 int reset_token_; |
| 146 | 148 |
| 147 // So we can queue up tasks to be executed later. | 149 // So we can queue up tasks to be executed later. |
| 148 base::WeakPtrFactory<RendererAccessibility> weak_factory_; | 150 base::WeakPtrFactory<RendererAccessibility> weak_factory_; |
| 149 | 151 |
| 150 DISALLOW_COPY_AND_ASSIGN(RendererAccessibility); | 152 DISALLOW_COPY_AND_ASSIGN(RendererAccessibility); |
| 151 }; | 153 }; |
| 152 | 154 |
| 153 } // namespace content | 155 } // namespace content |
| 154 | 156 |
| 155 #endif // CONTENT_RENDERER_ACCESSIBILITY_RENDERER_ACCESSIBILITY_H_ | 157 #endif // CONTENT_RENDERER_ACCESSIBILITY_RENDERER_ACCESSIBILITY_H_ |
| OLD | NEW |