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_widget_host.h" | 9 #include "chrome/browser/renderer_host/render_widget_host.h" |
10 #include "chrome/common/notification_service.h" | 10 #include "chrome/common/notification_service.h" |
| 11 #include "chrome/common/render_messages.h" |
11 | 12 |
12 // The time in ms after which we give up and return an error when processing an | 13 // The time in ms after which we give up and return an error when processing an |
13 // accessibility message and no response has been received from the renderer. | 14 // accessibility message and no response has been received from the renderer. |
14 static const int kAccessibilityMessageTimeOut = 500; | 15 static const int kAccessibilityMessageTimeOut = 500; |
15 | 16 |
16 // static | 17 // static |
17 BrowserAccessibilityManager* BrowserAccessibilityManager::GetInstance() { | 18 BrowserAccessibilityManager* BrowserAccessibilityManager::GetInstance() { |
18 return Singleton<BrowserAccessibilityManager>::get(); | 19 return Singleton<BrowserAccessibilityManager>::get(); |
19 } | 20 } |
20 | 21 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 } | 74 } |
74 // No supported interface found, return error. | 75 // No supported interface found, return error. |
75 *interface_ptr = NULL; | 76 *interface_ptr = NULL; |
76 return E_NOINTERFACE; | 77 return E_NOINTERFACE; |
77 } | 78 } |
78 | 79 |
79 bool BrowserAccessibilityManager::RequestAccessibilityInfo( | 80 bool BrowserAccessibilityManager::RequestAccessibilityInfo( |
80 int iaccessible_id, int instance_id, int iaccessible_func_id, | 81 int iaccessible_id, int instance_id, int iaccessible_func_id, |
81 VARIANT var_id, LONG input1, LONG input2) { | 82 VARIANT var_id, LONG input1, LONG input2) { |
82 // Create and populate input message structure. | 83 // Create and populate input message structure. |
83 ViewMsg_Accessibility_In_Params in_params; | 84 AccessibilityInParams in_params; |
84 | 85 |
85 in_params.iaccessible_id = iaccessible_id; | 86 in_params.iaccessible_id = iaccessible_id; |
86 in_params.iaccessible_function_id = iaccessible_func_id; | 87 in_params.iaccessible_function_id = iaccessible_func_id; |
87 in_params.input_variant_lval = var_id.lVal; | 88 in_params.input_variant_lval = var_id.lVal; |
88 in_params.input_long1 = input1; | 89 in_params.input_long1 = input1; |
89 in_params.input_long2 = input2; | 90 in_params.input_long2 = input2; |
90 | 91 |
91 // Retrieve the RenderWidgetHost connected to this request. | 92 // Retrieve the RenderWidgetHost connected to this request. |
92 InstanceMap::iterator it = instance_map_.find(instance_id); | 93 InstanceMap::iterator it = instance_map_.find(instance_id); |
93 | 94 |
(...skipping 15 matching lines...) Expand all Loading... |
109 routing_id(), in_params, &out_params_); | 110 routing_id(), in_params, &out_params_); |
110 // Necessary for the send to keep the UI responsive. | 111 // Necessary for the send to keep the UI responsive. |
111 msg->EnableMessagePumping(); | 112 msg->EnableMessagePumping(); |
112 success = members->render_widget_host_->process()->channel()-> | 113 success = members->render_widget_host_->process()->channel()-> |
113 SendWithTimeout(msg, kAccessibilityMessageTimeOut); | 114 SendWithTimeout(msg, kAccessibilityMessageTimeOut); |
114 } | 115 } |
115 | 116 |
116 return success; | 117 return success; |
117 } | 118 } |
118 | 119 |
119 const ViewHostMsg_Accessibility_Out_Params& | 120 const AccessibilityOutParams& BrowserAccessibilityManager::response() { |
120 BrowserAccessibilityManager::response() { | |
121 return out_params_; | 121 return out_params_; |
122 } | 122 } |
123 | 123 |
124 HWND BrowserAccessibilityManager::parent_hwnd(int id) { | 124 HWND BrowserAccessibilityManager::parent_hwnd(int id) { |
125 // Retrieve the parent HWND connected to the requester's id. | 125 // Retrieve the parent HWND connected to the requester's id. |
126 InstanceMap::iterator it = instance_map_.find(id); | 126 InstanceMap::iterator it = instance_map_.find(id); |
127 | 127 |
128 if (it == instance_map_.end()) { | 128 if (it == instance_map_.end()) { |
129 // Id not found. | 129 // Id not found. |
130 return NULL; | 130 return NULL; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 166 |
167 // Delete entry also from InstanceMap. | 167 // Delete entry also from InstanceMap. |
168 InstanceMap::iterator it2 = instance_map_.find(it->second->instance_id()); | 168 InstanceMap::iterator it2 = instance_map_.find(it->second->instance_id()); |
169 | 169 |
170 if (it2 != instance_map_.end()) | 170 if (it2 != instance_map_.end()) |
171 instance_map_.erase(it2); | 171 instance_map_.erase(it2); |
172 | 172 |
173 // Only delete the first entry once it is no longer in use. | 173 // Only delete the first entry once it is no longer in use. |
174 render_process_host_map_.erase(it); | 174 render_process_host_map_.erase(it); |
175 } | 175 } |
OLD | NEW |