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.h" | 5 #include "content/browser/accessibility/browser_accessibility_manager.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/browser/accessibility/browser_accessibility.h" | 8 #include "content/browser/accessibility/browser_accessibility.h" |
9 #include "content/common/accessibility_messages.h" | 9 #include "content/common/accessibility_messages.h" |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 BrowserAccessibility* BrowserAccessibilityManager::GetFromRendererID( | 80 BrowserAccessibility* BrowserAccessibilityManager::GetFromRendererID( |
81 int32 renderer_id) { | 81 int32 renderer_id) { |
82 base::hash_map<int32, BrowserAccessibility*>::iterator iter = | 82 base::hash_map<int32, BrowserAccessibility*>::iterator iter = |
83 renderer_id_map_.find(renderer_id); | 83 renderer_id_map_.find(renderer_id); |
84 if (iter != renderer_id_map_.end()) | 84 if (iter != renderer_id_map_.end()) |
85 return iter->second; | 85 return iter->second; |
86 return NULL; | 86 return NULL; |
87 } | 87 } |
88 | 88 |
89 void BrowserAccessibilityManager::GotFocus(bool touch_event_context) { | 89 void BrowserAccessibilityManager::OnWindowFocused() { |
90 if (!touch_event_context) | 90 if (focus_) |
91 osk_state_ = OSK_DISALLOWED_BECAUSE_TAB_JUST_APPEARED; | 91 NotifyAccessibilityEvent(ui::AX_EVENT_FOCUS, focus_); |
92 | |
93 if (!focus_) | |
94 return; | |
95 | |
96 NotifyAccessibilityEvent(ui::AX_EVENT_FOCUS, focus_); | |
97 } | 92 } |
98 | 93 |
99 void BrowserAccessibilityManager::WasHidden() { | 94 void BrowserAccessibilityManager::OnWindowBlurred() { |
100 osk_state_ = OSK_DISALLOWED_BECAUSE_TAB_HIDDEN; | 95 if (focus_) |
| 96 NotifyAccessibilityEvent(ui::AX_EVENT_BLUR, focus_); |
101 } | 97 } |
102 | 98 |
103 void BrowserAccessibilityManager::GotMouseDown() { | 99 void BrowserAccessibilityManager::GotMouseDown() { |
104 osk_state_ = OSK_ALLOWED_WITHIN_FOCUSED_OBJECT; | 100 osk_state_ = OSK_ALLOWED_WITHIN_FOCUSED_OBJECT; |
105 NotifyAccessibilityEvent(ui::AX_EVENT_FOCUS, focus_); | 101 NotifyAccessibilityEvent(ui::AX_EVENT_FOCUS, focus_); |
106 } | 102 } |
107 | 103 |
108 bool BrowserAccessibilityManager::IsOSKAllowed(const gfx::Rect& bounds) { | 104 bool BrowserAccessibilityManager::IsOSKAllowed(const gfx::Rect& bounds) { |
109 if (!delegate_ || !delegate_->HasFocus()) | 105 if (!delegate_ || !delegate_->HasFocus()) |
110 return false; | 106 return false; |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 // Keep track of what node is focused. | 454 // Keep track of what node is focused. |
459 if (src.role != ui::AX_ROLE_ROOT_WEB_AREA && | 455 if (src.role != ui::AX_ROLE_ROOT_WEB_AREA && |
460 src.role != ui::AX_ROLE_WEB_AREA && | 456 src.role != ui::AX_ROLE_WEB_AREA && |
461 (src.state >> ui::AX_STATE_FOCUSED & 1)) { | 457 (src.state >> ui::AX_STATE_FOCUSED & 1)) { |
462 SetFocus(instance, false); | 458 SetFocus(instance, false); |
463 } | 459 } |
464 return success; | 460 return success; |
465 } | 461 } |
466 | 462 |
467 } // namespace content | 463 } // namespace content |
OLD | NEW |