Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Side by Side Diff: content/browser/accessibility/browser_accessibility_manager.cc

Issue 214243005: Fire accessibility focus/blur events on root web document. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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() {
David Tseng 2014/04/02 22:05:05 Was this unused?
dmazzoni 2014/04/02 22:09:55 This used to be called from render_widget_host_vie
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_)
David Tseng 2014/04/02 22:05:05 |focus_| could be anything in the accessibility tr
dmazzoni 2014/04/02 22:09:55 The way I implemented it, all platforms will fire
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698