| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/browser_accessibility_manager.h" | 5 #include "chrome/browser/browser_accessibility_manager.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser_accessibility.h" | 7 #include "chrome/browser/browser_accessibility.h" |
| 8 #include "chrome/browser/renderer_host/render_process_host.h" | 8 #include "chrome/browser/renderer_host/render_process_host.h" |
| 9 #include "chrome/browser/renderer_host/render_view_host.h" | 9 #include "chrome/browser/renderer_host/render_view_host.h" |
| 10 #include "chrome/common/notification_service.h" | 10 #include "chrome/common/notification_service.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 } | 70 } |
| 71 | 71 |
| 72 bool BrowserAccessibilityManager::RequestAccessibilityInfo( | 72 bool BrowserAccessibilityManager::RequestAccessibilityInfo( |
| 73 WebAccessibility::InParams* in, int routing_id, int process_id) { | 73 WebAccessibility::InParams* in, int routing_id, int process_id) { |
| 74 // Create and populate IPC message structure, for retrieval of accessibility | 74 // Create and populate IPC message structure, for retrieval of accessibility |
| 75 // information from the renderer. | 75 // information from the renderer. |
| 76 WebAccessibility::InParams in_params; | 76 WebAccessibility::InParams in_params; |
| 77 in_params.object_id = in->object_id; | 77 in_params.object_id = in->object_id; |
| 78 in_params.function_id = in->function_id; | 78 in_params.function_id = in->function_id; |
| 79 in_params.child_id = in->child_id; | 79 in_params.child_id = in->child_id; |
| 80 in_params.direct_descendant = in->direct_descendant; | |
| 81 in_params.input_long1 = in->input_long1; | 80 in_params.input_long1 = in->input_long1; |
| 82 in_params.input_long2 = in->input_long2; | 81 in_params.input_long2 = in->input_long2; |
| 83 | 82 |
| 84 // Retrieve the RenderViewHost connected to this request. | 83 // Retrieve the RenderViewHost connected to this request. |
| 85 RenderViewHost* rvh = RenderViewHost::FromID(process_id, routing_id); | 84 RenderViewHost* rvh = RenderViewHost::FromID(process_id, routing_id); |
| 86 | 85 |
| 87 // Send accessibility information retrieval message to the renderer. | 86 // Send accessibility information retrieval message to the renderer. |
| 88 bool success = false; | 87 bool success = false; |
| 89 if (rvh && rvh->process() && rvh->process()->channel()) { | 88 if (rvh && rvh->process() && rvh->process()->channel()) { |
| 90 IPC::SyncMessage* msg = | 89 IPC::SyncMessage* msg = |
| 91 new ViewMsg_GetAccessibilityInfo(routing_id, in_params, &out_params_); | 90 new ViewMsg_GetAccessibilityInfo(routing_id, in_params, &out_params_); |
| 92 // Necessary for the send to keep the UI responsive. | 91 // Necessary for the send to keep the UI responsive. |
| 93 msg->EnableMessagePumping(); | 92 msg->EnableMessagePumping(); |
| 94 success = rvh->process()->channel()->SendWithTimeout(msg, | 93 success = rvh->process()->channel()->SendWithTimeout(msg, |
| 95 kAccessibilityMessageTimeOut); | 94 kAccessibilityMessageTimeOut); |
| 96 } | 95 } |
| 97 return success; | 96 return success; |
| 98 } | 97 } |
| 99 | 98 |
| 100 bool BrowserAccessibilityManager::ChangeAccessibilityFocus(int acc_obj_id, | 99 bool BrowserAccessibilityManager::ChangeAccessibilityFocus(int acc_obj_id, |
| 101 int process_id, | 100 int process_id, |
| 102 int routing_id) { | 101 int routing_id) { |
| 103 BrowserAccessibility* browser_acc = | 102 BrowserAccessibility* browser_acc = |
| 104 GetBrowserAccessibility(process_id, routing_id); | 103 GetBrowserAccessibility(process_id, routing_id); |
| 105 if (browser_acc) { | 104 if (browser_acc) { |
| 106 // Indicate that the request for child information is referring to a non- | |
| 107 // direct descendant of the root. | |
| 108 browser_acc->set_direct_descendant(false); | |
| 109 | |
| 110 // Notify Access Technology that there was a change in keyboard focus. | 105 // Notify Access Technology that there was a change in keyboard focus. |
| 111 ::NotifyWinEvent(EVENT_OBJECT_FOCUS, browser_acc->parent_hwnd(), | 106 ::NotifyWinEvent(EVENT_OBJECT_FOCUS, browser_acc->parent_hwnd(), |
| 112 OBJID_CLIENT, static_cast<LONG>(acc_obj_id)); | 107 OBJID_CLIENT, static_cast<LONG>(acc_obj_id)); |
| 113 return true; | 108 return true; |
| 114 } | 109 } |
| 115 return false; | 110 return false; |
| 116 } | 111 } |
| 117 | 112 |
| 118 const WebAccessibility::OutParams& BrowserAccessibilityManager::response() { | 113 const WebAccessibility::OutParams& BrowserAccessibilityManager::response() { |
| 119 return out_params_; | 114 return out_params_; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 render_process_host_map_.upper_bound(rph->pid()); | 146 render_process_host_map_.upper_bound(rph->pid()); |
| 152 | 147 |
| 153 for (; it != end_of_matching_objects; ++it) { | 148 for (; it != end_of_matching_objects; ++it) { |
| 154 if (it->second) { | 149 if (it->second) { |
| 155 // Set all matching BrowserAccessibility instances to inactive state. | 150 // Set all matching BrowserAccessibility instances to inactive state. |
| 156 // TODO(klink): Do more active memory cleanup as well. | 151 // TODO(klink): Do more active memory cleanup as well. |
| 157 it->second->set_instance_active(false); | 152 it->second->set_instance_active(false); |
| 158 } | 153 } |
| 159 } | 154 } |
| 160 } | 155 } |
| OLD | NEW |