| 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_RENDER_ACCESSIBILITY_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_ACCESSIBILITY_RENDER_ACCESSIBILITY_IMPL_H_ |
| 6 #define CONTENT_RENDERER_ACCESSIBILITY_RENDER_ACCESSIBILITY_IMPL_H_ | 6 #define CONTENT_RENDERER_ACCESSIBILITY_RENDER_ACCESSIBILITY_IMPL_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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // enabling accessibility if it wasn't already enabled. | 59 // enabling accessibility if it wasn't already enabled. |
| 60 static void SnapshotAccessibilityTree( | 60 static void SnapshotAccessibilityTree( |
| 61 RenderFrameImpl* render_frame, | 61 RenderFrameImpl* render_frame, |
| 62 AXContentTreeUpdate* response); | 62 AXContentTreeUpdate* response); |
| 63 | 63 |
| 64 explicit RenderAccessibilityImpl(RenderFrameImpl* render_frame); | 64 explicit RenderAccessibilityImpl(RenderFrameImpl* render_frame); |
| 65 ~RenderAccessibilityImpl() override; | 65 ~RenderAccessibilityImpl() override; |
| 66 | 66 |
| 67 // RenderAccessibility implementation. | 67 // RenderAccessibility implementation. |
| 68 int GenerateAXID() override; | 68 int GenerateAXID() override; |
| 69 void SetPdfTreeSource(PdfAXTreeSource* source) override; | 69 void SetPluginTreeSource(PluginAXTreeSource* source) override; |
| 70 void OnPluginRootNodeUpdated() override; |
| 70 | 71 |
| 71 // RenderFrameObserver implementation. | 72 // RenderFrameObserver implementation. |
| 72 bool OnMessageReceived(const IPC::Message& message) override; | 73 bool OnMessageReceived(const IPC::Message& message) override; |
| 73 | 74 |
| 74 // Called when an accessibility notification occurs in Blink. | 75 // Called when an accessibility notification occurs in Blink. |
| 75 void HandleWebAccessibilityEvent(const blink::WebAXObject& obj, | 76 void HandleWebAccessibilityEvent(const blink::WebAXObject& obj, |
| 76 blink::WebAXEvent event); | 77 blink::WebAXEvent event); |
| 77 | 78 |
| 78 // Called when a new find in page result is highlighted. | 79 // Called when a new find in page result is highlighted. |
| 79 void HandleAccessibilityFindInPageResult( | 80 void HandleAccessibilityFindInPageResult( |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 void OnScrollToPoint(int acc_obj_id, gfx::Point point); | 125 void OnScrollToPoint(int acc_obj_id, gfx::Point point); |
| 125 void OnSetScrollOffset(int acc_obj_id, gfx::Point offset); | 126 void OnSetScrollOffset(int acc_obj_id, gfx::Point offset); |
| 126 void OnSetFocus(int acc_obj_id); | 127 void OnSetFocus(int acc_obj_id); |
| 127 void OnSetSelection(int anchor_acc_obj_id, | 128 void OnSetSelection(int anchor_acc_obj_id, |
| 128 int anchor_offset, | 129 int anchor_offset, |
| 129 int focus_acc_obj_id, | 130 int focus_acc_obj_id, |
| 130 int focus_offset); | 131 int focus_offset); |
| 131 void OnSetValue(int acc_obj_id, base::string16 value); | 132 void OnSetValue(int acc_obj_id, base::string16 value); |
| 132 void OnShowContextMenu(int acc_obj_id); | 133 void OnShowContextMenu(int acc_obj_id); |
| 133 | 134 |
| 134 void AddPdfTreeToUpdate(AXContentTreeUpdate* update); | 135 void AddPluginTreeToUpdate(AXContentTreeUpdate* update); |
| 135 void ScrollPdf(int id_to_make_visible); | 136 void ScrollPlugin(int id_to_make_visible); |
| 136 | 137 |
| 137 // Events from Blink are collected until they are ready to be | 138 // Events from Blink are collected until they are ready to be |
| 138 // sent to the browser. | 139 // sent to the browser. |
| 139 std::vector<AccessibilityHostMsg_EventParams> pending_events_; | 140 std::vector<AccessibilityHostMsg_EventParams> pending_events_; |
| 140 | 141 |
| 141 // The adapter that exposes Blink's accessibility tree to AXTreeSerializer. | 142 // The adapter that exposes Blink's accessibility tree to AXTreeSerializer. |
| 142 BlinkAXTreeSource tree_source_; | 143 BlinkAXTreeSource tree_source_; |
| 143 | 144 |
| 144 // The serializer that sends accessibility messages to the browser process. | 145 // The serializer that sends accessibility messages to the browser process. |
| 145 using BlinkAXTreeSerializer = | 146 using BlinkAXTreeSerializer = |
| 146 ui::AXTreeSerializer<blink::WebAXObject, | 147 ui::AXTreeSerializer<blink::WebAXObject, |
| 147 AXContentNodeData, | 148 AXContentNodeData, |
| 148 AXContentTreeData>; | 149 AXContentTreeData>; |
| 149 BlinkAXTreeSerializer serializer_; | 150 BlinkAXTreeSerializer serializer_; |
| 150 | 151 |
| 151 using PdfAXTreeSerializer = ui::AXTreeSerializer<const ui::AXNode*, | 152 using PluginAXTreeSerializer = ui::AXTreeSerializer<const ui::AXNode*, |
| 152 ui::AXNodeData, | 153 ui::AXNodeData, |
| 153 ui::AXTreeData>; | 154 ui::AXTreeData>; |
| 154 std::unique_ptr<PdfAXTreeSerializer> pdf_serializer_; | 155 std::unique_ptr<PluginAXTreeSerializer> plugin_serializer_; |
| 155 PdfAXTreeSource* pdf_tree_source_; | 156 PluginAXTreeSource* plugin_tree_source_; |
| 156 | 157 |
| 157 // Current location of every object, so we can detect when it moves. | 158 // Current location of every object, so we can detect when it moves. |
| 158 base::hash_map<int, ui::AXRelativeBounds> locations_; | 159 base::hash_map<int, ui::AXRelativeBounds> locations_; |
| 159 | 160 |
| 160 // The most recently observed scroll offset of the root document element. | 161 // The most recently observed scroll offset of the root document element. |
| 161 // TODO(dmazzoni): remove once https://bugs.webkit.org/show_bug.cgi?id=73460 | 162 // TODO(dmazzoni): remove once https://bugs.webkit.org/show_bug.cgi?id=73460 |
| 162 // is fixed. | 163 // is fixed. |
| 163 gfx::Size last_scroll_offset_; | 164 gfx::Size last_scroll_offset_; |
| 164 | 165 |
| 165 // Set if we are waiting for an accessibility event ack. | 166 // Set if we are waiting for an accessibility event ack. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 177 | 178 |
| 178 // So we can queue up tasks to be executed later. | 179 // So we can queue up tasks to be executed later. |
| 179 base::WeakPtrFactory<RenderAccessibilityImpl> weak_factory_; | 180 base::WeakPtrFactory<RenderAccessibilityImpl> weak_factory_; |
| 180 | 181 |
| 181 DISALLOW_COPY_AND_ASSIGN(RenderAccessibilityImpl); | 182 DISALLOW_COPY_AND_ASSIGN(RenderAccessibilityImpl); |
| 182 }; | 183 }; |
| 183 | 184 |
| 184 } // namespace content | 185 } // namespace content |
| 185 | 186 |
| 186 #endif // CONTENT_RENDERER_ACCESSIBILITY_RENDERER_ACCESSIBILITY_H_ | 187 #endif // CONTENT_RENDERER_ACCESSIBILITY_RENDERER_ACCESSIBILITY_H_ |
| OLD | NEW |