| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_win.h" | 5 #include "chrome/browser/browser_accessibility_manager_win.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser_accessibility_win.h" | 7 #include "chrome/browser/browser_accessibility_win.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/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 if (delegate_) | 93 if (delegate_) |
| 94 delegate_->SetAccessibilityFocus(node.renderer_id()); | 94 delegate_->SetAccessibilityFocus(node.renderer_id()); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void BrowserAccessibilityManager::DoDefaultAction( | 97 void BrowserAccessibilityManager::DoDefaultAction( |
| 98 const BrowserAccessibility& node) { | 98 const BrowserAccessibility& node) { |
| 99 if (delegate_) | 99 if (delegate_) |
| 100 delegate_->AccessibilityDoDefaultAction(node.renderer_id()); | 100 delegate_->AccessibilityDoDefaultAction(node.renderer_id()); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void BrowserAccessibilityManager::OnAccessibilityFocusChange(int renderer_id) { | |
| 104 base::hash_map<int, LONG>::iterator iter = | |
| 105 renderer_id_to_child_id_map_.find(renderer_id); | |
| 106 if (iter == renderer_id_to_child_id_map_.end()) | |
| 107 return; | |
| 108 | |
| 109 LONG child_id = iter->second; | |
| 110 base::hash_map<LONG, BrowserAccessibility*>::iterator uniq_iter = | |
| 111 child_id_map_.find(child_id); | |
| 112 if (uniq_iter != child_id_map_.end()) | |
| 113 focus_ = uniq_iter->second; | |
| 114 ::NotifyWinEvent(EVENT_OBJECT_FOCUS, parent_hwnd_, OBJID_CLIENT, child_id); | |
| 115 } | |
| 116 | |
| 117 void BrowserAccessibilityManager::OnAccessibilityNotifications( | 103 void BrowserAccessibilityManager::OnAccessibilityNotifications( |
| 118 const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params) { | 104 const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params) { |
| 119 if (delegate_) | 105 if (delegate_) |
| 120 delegate_->AccessibilityNotificationsAck(); | 106 delegate_->AccessibilityNotificationsAck(); |
| 121 | 107 |
| 122 for (uint32 index = 0; index < params.size(); index++) { | 108 for (uint32 index = 0; index < params.size(); index++) { |
| 123 const ViewHostMsg_AccessibilityNotification_Params& param = params[index]; | 109 const ViewHostMsg_AccessibilityNotification_Params& param = params[index]; |
| 124 | 110 |
| 125 switch (param.notification_type) { | 111 switch (param.notification_type) { |
| 126 case ViewHostMsg_AccessibilityNotification_Params:: | 112 case ViewHostMsg_AccessibilityNotification_Params:: |
| 127 NOTIFICATION_TYPE_CHECK_STATE_CHANGED: | 113 NOTIFICATION_TYPE_CHECK_STATE_CHANGED: |
| 128 OnAccessibilityObjectStateChange(param.acc_obj); | 114 OnAccessibilityObjectStateChange(param.acc_obj); |
| 129 break; | 115 break; |
| 130 case ViewHostMsg_AccessibilityNotification_Params:: | 116 case ViewHostMsg_AccessibilityNotification_Params:: |
| 131 NOTIFICATION_TYPE_CHILDREN_CHANGED: | 117 NOTIFICATION_TYPE_CHILDREN_CHANGED: |
| 132 OnAccessibilityObjectChildrenChange(param.acc_obj); | 118 OnAccessibilityObjectChildrenChange(param.acc_obj); |
| 133 break; | 119 break; |
| 134 case ViewHostMsg_AccessibilityNotification_Params:: | 120 case ViewHostMsg_AccessibilityNotification_Params:: |
| 121 NOTIFICATION_TYPE_FOCUS_CHANGED: |
| 122 OnAccessibilityObjectFocusChange(param.acc_obj); |
| 123 break; |
| 124 case ViewHostMsg_AccessibilityNotification_Params:: |
| 125 NOTIFICATION_TYPE_LOAD_COMPLETE: |
| 126 OnAccessibilityObjectLoadComplete(param.acc_obj); |
| 127 break; |
| 128 case ViewHostMsg_AccessibilityNotification_Params:: |
| 135 NOTIFICATION_TYPE_VALUE_CHANGED: | 129 NOTIFICATION_TYPE_VALUE_CHANGED: |
| 136 OnAccessibilityObjectValueChange(param.acc_obj); | 130 OnAccessibilityObjectValueChange(param.acc_obj); |
| 137 break; | 131 break; |
| 138 default: | 132 default: |
| 139 DCHECK(0); | 133 DCHECK(0); |
| 140 break; | 134 break; |
| 141 } | 135 } |
| 142 } | 136 } |
| 143 } | 137 } |
| 144 | 138 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 LONG child_id; | 201 LONG child_id; |
| 208 if (root_ != new_browser_acc) { | 202 if (root_ != new_browser_acc) { |
| 209 child_id = new_browser_acc->GetParent()->child_id(); | 203 child_id = new_browser_acc->GetParent()->child_id(); |
| 210 } else { | 204 } else { |
| 211 child_id = CHILDID_SELF; | 205 child_id = CHILDID_SELF; |
| 212 } | 206 } |
| 213 | 207 |
| 214 NotifyWinEvent(EVENT_OBJECT_REORDER, parent_hwnd_, OBJID_CLIENT, child_id); | 208 NotifyWinEvent(EVENT_OBJECT_REORDER, parent_hwnd_, OBJID_CLIENT, child_id); |
| 215 } | 209 } |
| 216 | 210 |
| 211 void BrowserAccessibilityManager::OnAccessibilityObjectFocusChange( |
| 212 const webkit_glue::WebAccessibility& acc_obj) { |
| 213 BrowserAccessibility* new_browser_acc = UpdateTree(acc_obj); |
| 214 if (!new_browser_acc) |
| 215 return; |
| 216 |
| 217 focus_ = new_browser_acc; |
| 218 LONG child_id = new_browser_acc->child_id(); |
| 219 NotifyWinEvent(EVENT_OBJECT_FOCUS, parent_hwnd_, OBJID_CLIENT, child_id); |
| 220 } |
| 221 |
| 222 void BrowserAccessibilityManager::OnAccessibilityObjectLoadComplete( |
| 223 const webkit_glue::WebAccessibility& acc_obj) { |
| 224 root_->InactivateTree(); |
| 225 root_->Release(); |
| 226 focus_ = NULL; |
| 227 |
| 228 root_ = CreateAccessibilityTree(NULL, GetNextChildID(), acc_obj, 0); |
| 229 if (!focus_) |
| 230 focus_ = root_; |
| 231 |
| 232 LONG root_id = root_->child_id(); |
| 233 NotifyWinEvent(EVENT_OBJECT_FOCUS, parent_hwnd_, OBJID_CLIENT, root_id); |
| 234 NotifyWinEvent( |
| 235 IA2_EVENT_DOCUMENT_LOAD_COMPLETE, parent_hwnd_, OBJID_CLIENT, root_id); |
| 236 } |
| 237 |
| 217 void BrowserAccessibilityManager::OnAccessibilityObjectValueChange( | 238 void BrowserAccessibilityManager::OnAccessibilityObjectValueChange( |
| 218 const webkit_glue::WebAccessibility& acc_obj) { | 239 const webkit_glue::WebAccessibility& acc_obj) { |
| 219 BrowserAccessibility* new_browser_acc = UpdateTree(acc_obj); | 240 BrowserAccessibility* new_browser_acc = UpdateTree(acc_obj); |
| 220 if (!new_browser_acc) | 241 if (!new_browser_acc) |
| 221 return; | 242 return; |
| 222 | 243 |
| 223 LONG child_id = new_browser_acc->child_id(); | 244 LONG child_id = new_browser_acc->child_id(); |
| 224 NotifyWinEvent( | 245 NotifyWinEvent( |
| 225 EVENT_OBJECT_VALUECHANGE, parent_hwnd_, OBJID_CLIENT, child_id); | 246 EVENT_OBJECT_VALUECHANGE, parent_hwnd_, OBJID_CLIENT, child_id); |
| 226 } | 247 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 250 if ((src.state >> WebAccessibility::STATE_FOCUSED) & 1) | 271 if ((src.state >> WebAccessibility::STATE_FOCUSED) & 1) |
| 251 focus_ = instance; | 272 focus_ = instance; |
| 252 for (int i = 0; i < static_cast<int>(src.children.size()); ++i) { | 273 for (int i = 0; i < static_cast<int>(src.children.size()); ++i) { |
| 253 BrowserAccessibility* child = CreateAccessibilityTree( | 274 BrowserAccessibility* child = CreateAccessibilityTree( |
| 254 instance, GetNextChildID(), src.children[i], i); | 275 instance, GetNextChildID(), src.children[i], i); |
| 255 instance->AddChild(child); | 276 instance->AddChild(child); |
| 256 } | 277 } |
| 257 | 278 |
| 258 return instance; | 279 return instance; |
| 259 } | 280 } |
| OLD | NEW |