Index: content/browser/frame_host/render_frame_host_impl.cc |
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc |
index 80bb605d5ae6ba2c40f13c9a46020f95f856ed1b..884a302506fda493e26710eb6804b31d6f5d72af 100644 |
--- a/content/browser/frame_host/render_frame_host_impl.cc |
+++ b/content/browser/frame_host/render_frame_host_impl.cc |
@@ -64,6 +64,7 @@ |
#include "content/public/common/url_constants.h" |
#include "content/public/common/url_utils.h" |
#include "ui/accessibility/ax_tree.h" |
+#include "ui/accessibility/ax_tree_update.h" |
#include "url/gurl.h" |
#if defined(OS_MACOSX) |
@@ -381,6 +382,8 @@ bool RenderFrameHostImpl::OnMessageReceived(const IPC::Message &msg) { |
OnAccessibilityLocationChanges) |
IPC_MESSAGE_HANDLER(AccessibilityHostMsg_FindInPageResult, |
OnAccessibilityFindInPageResult) |
+ IPC_MESSAGE_HANDLER(AccessibilityHostMsg_SnapshotResponse, |
+ OnAccessibilitySnapshotResponse) |
IPC_MESSAGE_HANDLER(FrameHostMsg_ToggleFullscreen, OnToggleFullscreen) |
// The following message is synthetic and doesn't come from RenderFrame, but |
// from RenderProcessHost. |
@@ -1392,6 +1395,19 @@ void RenderFrameHostImpl::OnAccessibilityFindInPageResult( |
} |
} |
+void RenderFrameHostImpl::OnAccessibilitySnapshotResponse( |
+ int token, |
Charlie Reis
2015/04/02 23:09:06
"token" seems like an ambiguous name here.
dmazzoni
2015/04/03 22:49:41
Happy to switch to "id" if you prefer, but deferri
Charlie Reis
2015/04/06 21:56:51
"id" isn't any less ambiguous, but at least it's c
dmazzoni
2015/04/09 18:39:01
Done.
|
+ const ui::AXTreeUpdate& snapshot) { |
+ std::map<int, AXTreeSnapshotCallback>::iterator it = |
+ ax_tree_snapshot_callbacks_.find(token); |
+ if (it != ax_tree_snapshot_callbacks_.end()) { |
+ it->second.Run(snapshot); |
+ ax_tree_snapshot_callbacks_.erase(it); |
+ } else { |
+ NOTREACHED() << "Received AX tree snapshot response for unknown request"; |
+ } |
+} |
+ |
void RenderFrameHostImpl::OnToggleFullscreen(bool enter_fullscreen) { |
if (enter_fullscreen) |
delegate_->EnterFullscreenMode(GetLastCommittedURL().GetOrigin()); |
@@ -1805,6 +1821,14 @@ void RenderFrameHostImpl::SetAccessibilityMode(AccessibilityMode mode) { |
Send(new FrameMsg_SetAccessibilityMode(routing_id_, mode)); |
} |
+void RenderFrameHostImpl::RequestAXTreeSnapshot( |
+ AXTreeSnapshotCallback callback) { |
+ static int next_token = 1; |
Charlie Reis
2015/04/02 23:09:06
This feels like an awkward pattern. We haven't re
dmazzoni
2015/04/03 22:49:41
FWIW, I copied this code nearly verbatim from Exec
Charlie Reis
2015/04/06 21:56:50
Oh, I'd never seen that. Ok, I'll defer, since th
|
+ int token = next_token++; |
+ Send(new AccessibilityMsg_SnapshotTree(routing_id_, token)); |
+ ax_tree_snapshot_callbacks_.insert(std::make_pair(token, callback)); |
+} |
+ |
void RenderFrameHostImpl::SetAccessibilityCallbackForTesting( |
const base::Callback<void(ui::AXEvent, int)>& callback) { |
accessibility_testing_callback_ = callback; |