Index: chrome/renderer/render_view.cc |
=================================================================== |
--- chrome/renderer/render_view.cc (revision 47913) |
+++ chrome/renderer/render_view.cc (working copy) |
@@ -685,6 +685,9 @@ |
IPC_MESSAGE_HANDLER(ViewMsg_TranslatePage, OnTranslatePage) |
IPC_MESSAGE_HANDLER(ViewMsg_RevertTranslation, OnRevertTranslation) |
IPC_MESSAGE_HANDLER(ViewMsg_GetAccessibilityTree, OnGetAccessibilityTree) |
+ IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityFocus, OnSetAccessibilityFocus) |
+ IPC_MESSAGE_HANDLER(ViewMsg_AccessibilityDoDefaultAction, |
+ OnAccessibilityDoDefaultAction) |
// Have the super handle all other messages. |
IPC_MESSAGE_UNHANDLED(RenderWidget::OnMessageReceived(message)) |
@@ -3929,9 +3932,8 @@ |
} |
void RenderView::OnGetAccessibilityTree() { |
- if (accessibility_.get()) { |
+ if (accessibility_.get()) |
accessibility_->clear(); |
- } |
accessibility_.reset(WebAccessibilityCache::create()); |
accessibility_->initialize(webview()); |
@@ -3940,6 +3942,29 @@ |
Send(new ViewHostMsg_AccessibilityTree(routing_id_, dst_tree)); |
} |
+void RenderView::OnSetAccessibilityFocus(int acc_obj_id) { |
+ if (!accessibility_.get()) |
+ return; |
+ if (accessibility_->isValidId(acc_obj_id)) { |
+ // TODO(dmazzoni) fix the cache so that id=1000 is not a magic number. |
+ // By convention, calling SetFocus on the root of the tree (id = 1000) |
+ // should clear the current focus. Otherwise set the focus to the new |
+ // node. |
+ if (acc_obj_id == 1000) |
+ webview()->clearFocusedNode(); |
+ else |
+ accessibility_->getObjectById(acc_obj_id).setFocused(true); |
+ } |
+} |
+ |
+void RenderView::OnAccessibilityDoDefaultAction(int acc_obj_id) { |
+ if (!accessibility_.get()) |
+ return; |
+ if (accessibility_->isValidId(acc_obj_id)) { |
+ accessibility_->getObjectById(acc_obj_id).performDefaultAction(); |
+ } |
+} |
+ |
void RenderView::OnGetAllSavableResourceLinksForCurrentPage( |
const GURL& page_url) { |
// Prepare list to storage all savable resource links. |