| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/accessibility/browser_accessibility_manager_mac.h" | 5 #include "content/browser/accessibility/browser_accessibility_manager_mac.h" |
| 6 | 6 |
| 7 #import "base/logging.h" | 7 #import "base/logging.h" |
| 8 #import "content/browser/accessibility/browser_accessibility_cocoa.h" | 8 #import "content/browser/accessibility/browser_accessibility_cocoa.h" |
| 9 #import "content/browser/accessibility/browser_accessibility_mac.h" | 9 #import "content/browser/accessibility/browser_accessibility_mac.h" |
| 10 #include "content/common/accessibility_messages.h" | 10 #include "content/common/accessibility_messages.h" |
| 11 | 11 |
| 12 namespace content { | 12 namespace content { |
| 13 | 13 |
| 14 // static | 14 // static |
| 15 BrowserAccessibilityManager* BrowserAccessibilityManager::Create( | 15 BrowserAccessibilityManager* BrowserAccessibilityManager::Create( |
| 16 const SimpleAXTreeUpdate& initial_tree, | 16 const ui::AXTreeUpdate& initial_tree, |
| 17 BrowserAccessibilityDelegate* delegate, | 17 BrowserAccessibilityDelegate* delegate, |
| 18 BrowserAccessibilityFactory* factory) { | 18 BrowserAccessibilityFactory* factory) { |
| 19 return new BrowserAccessibilityManagerMac( | 19 return new BrowserAccessibilityManagerMac( |
| 20 NULL, initial_tree, delegate, factory); | 20 NULL, initial_tree, delegate, factory); |
| 21 } | 21 } |
| 22 | 22 |
| 23 BrowserAccessibilityManagerMac::BrowserAccessibilityManagerMac( | 23 BrowserAccessibilityManagerMac::BrowserAccessibilityManagerMac( |
| 24 NSView* parent_view, | 24 NSView* parent_view, |
| 25 const SimpleAXTreeUpdate& initial_tree, | 25 const ui::AXTreeUpdate& initial_tree, |
| 26 BrowserAccessibilityDelegate* delegate, | 26 BrowserAccessibilityDelegate* delegate, |
| 27 BrowserAccessibilityFactory* factory) | 27 BrowserAccessibilityFactory* factory) |
| 28 : BrowserAccessibilityManager(delegate, factory), | 28 : BrowserAccessibilityManager(delegate, factory), |
| 29 parent_view_(parent_view) { | 29 parent_view_(parent_view) { |
| 30 Initialize(initial_tree); | 30 Initialize(initial_tree); |
| 31 } | 31 } |
| 32 | 32 |
| 33 // static | 33 // static |
| 34 SimpleAXTreeUpdate | 34 ui::AXTreeUpdate |
| 35 BrowserAccessibilityManagerMac::GetEmptyDocument() { | 35 BrowserAccessibilityManagerMac::GetEmptyDocument() { |
| 36 ui::AXNodeData empty_document; | 36 ui::AXNodeData empty_document; |
| 37 empty_document.id = 0; | 37 empty_document.id = 0; |
| 38 empty_document.role = ui::AX_ROLE_ROOT_WEB_AREA; | 38 empty_document.role = ui::AX_ROLE_ROOT_WEB_AREA; |
| 39 empty_document.state = | 39 empty_document.state = |
| 40 1 << ui::AX_STATE_READ_ONLY; | 40 1 << ui::AX_STATE_READ_ONLY; |
| 41 SimpleAXTreeUpdate update; | 41 ui::AXTreeUpdate update; |
| 42 update.nodes.push_back(empty_document); | 42 update.nodes.push_back(empty_document); |
| 43 return update; | 43 return update; |
| 44 } | 44 } |
| 45 | 45 |
| 46 BrowserAccessibility* BrowserAccessibilityManagerMac::GetFocus( | 46 BrowserAccessibility* BrowserAccessibilityManagerMac::GetFocus( |
| 47 BrowserAccessibility* root) { | 47 BrowserAccessibility* root) { |
| 48 // On Mac, list boxes should always get focus on the whole list, otherwise | 48 // On Mac, list boxes should always get focus on the whole list, otherwise |
| 49 // information about the number of selected items will never be reported. | 49 // information about the number of selected items will never be reported. |
| 50 BrowserAccessibility* node = BrowserAccessibilityManager::GetFocus(root); | 50 BrowserAccessibility* node = BrowserAccessibilityManager::GetFocus(root); |
| 51 if (node && node->GetRole() == ui::AX_ROLE_LIST_BOX) | 51 if (node && node->GetRole() == ui::AX_ROLE_LIST_BOX) |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 // internal state and find newly-added live regions this time. | 195 // internal state and find newly-added live regions this time. |
| 196 BrowserAccessibilityMac* root = | 196 BrowserAccessibilityMac* root = |
| 197 static_cast<BrowserAccessibilityMac*>(GetRoot()); | 197 static_cast<BrowserAccessibilityMac*>(GetRoot()); |
| 198 if (root) { | 198 if (root) { |
| 199 root->RecreateNativeObject(); | 199 root->RecreateNativeObject(); |
| 200 NotifyAccessibilityEvent(ui::AX_EVENT_CHILDREN_CHANGED, root); | 200 NotifyAccessibilityEvent(ui::AX_EVENT_CHILDREN_CHANGED, root); |
| 201 } | 201 } |
| 202 } | 202 } |
| 203 | 203 |
| 204 } // namespace content | 204 } // namespace content |
| OLD | NEW |