summaryrefslogtreecommitdiffstats
path: root/chrome/browser/accessibility
diff options
context:
space:
mode:
authorctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-05 00:07:56 +0000
committerctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-05 00:07:56 +0000
commit37b82e00d9960b8e54d57b2defd80805d57331bb (patch)
treefd9a9a537c16916b9fa0039a8bf432fdc4dcf181 /chrome/browser/accessibility
parent22d2240e40cb7138bb1c31def31195af899c726b (diff)
downloadchromium_src-37b82e00d9960b8e54d57b2defd80805d57331bb.zip
chromium_src-37b82e00d9960b8e54d57b2defd80805d57331bb.tar.gz
chromium_src-37b82e00d9960b8e54d57b2defd80805d57331bb.tar.bz2
Notify AT about the currently focused control when the render widget window receives focus.
BUG=47492,36217 TEST=Manual: Select text in a text box. Press F6 until focus returns to the webpage. NVDA should read the selected text. Review URL: http://codereview.chromium.org/3561010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61447 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/accessibility')
-rw-r--r--chrome/browser/accessibility/browser_accessibility_manager.h5
-rw-r--r--chrome/browser/accessibility/browser_accessibility_manager_win.cc24
-rw-r--r--chrome/browser/accessibility/browser_accessibility_manager_win.h2
3 files changed, 27 insertions, 4 deletions
diff --git a/chrome/browser/accessibility/browser_accessibility_manager.h b/chrome/browser/accessibility/browser_accessibility_manager.h
index 984623e5..4fe5f85 100644
--- a/chrome/browser/accessibility/browser_accessibility_manager.h
+++ b/chrome/browser/accessibility/browser_accessibility_manager.h
@@ -27,6 +27,7 @@ class BrowserAccessibilityDelegate {
virtual ~BrowserAccessibilityDelegate() {}
virtual void SetAccessibilityFocus(int acc_obj_id) = 0;
virtual void AccessibilityDoDefaultAction(int acc_obj_id) = 0;
+ virtual bool HasFocus() = 0;
};
// Manages a tree of BrowserAccessibility objects.
@@ -41,6 +42,10 @@ class BrowserAccessibilityManager {
virtual ~BrowserAccessibilityManager();
+ // Called to notify the accessibility manager that its associated native
+ // window got focused.
+ virtual void GotFocus() = 0;
+
// Called when the renderer process has notified us of about tree changes.
// Send a notification to MSAA clients of the change.
void OnAccessibilityNotifications(
diff --git a/chrome/browser/accessibility/browser_accessibility_manager_win.cc b/chrome/browser/accessibility/browser_accessibility_manager_win.cc
index e470f24..2bcd599 100644
--- a/chrome/browser/accessibility/browser_accessibility_manager_win.cc
+++ b/chrome/browser/accessibility/browser_accessibility_manager_win.cc
@@ -176,6 +176,18 @@ BrowserAccessibilityWin* BrowserAccessibilityManagerWin::UpdateTree(
return new_browser_acc;
}
+void BrowserAccessibilityManagerWin::GotFocus() {
+ // TODO(ctguil): Remove when tree update logic handles focus changes.
+ if (!focus_)
+ return;
+
+ NotifyWinEvent(
+ EVENT_OBJECT_FOCUS,
+ GetParentWindow(),
+ OBJID_CLIENT,
+ focus_->child_id());
+}
+
IAccessible* BrowserAccessibilityManagerWin::GetRootAccessible() {
return root_;
}
@@ -216,7 +228,8 @@ void BrowserAccessibilityManagerWin::OnAccessibilityObjectFocusChange(
focus_ = new_browser_acc;
LONG child_id = new_browser_acc->child_id();
- NotifyWinEvent(EVENT_OBJECT_FOCUS, GetParentWindow(), OBJID_CLIENT, child_id);
+ if (delegate_ && delegate_->HasFocus())
+ GotFocus();
}
void BrowserAccessibilityManagerWin::OnAccessibilityObjectLoadComplete(
@@ -229,10 +242,13 @@ void BrowserAccessibilityManagerWin::OnAccessibilityObjectLoadComplete(
if (!focus_)
focus_ = root_;
- LONG root_id = root_->child_id();
- NotifyWinEvent(EVENT_OBJECT_FOCUS, GetParentWindow(), OBJID_CLIENT, root_id);
NotifyWinEvent(
- IA2_EVENT_DOCUMENT_LOAD_COMPLETE, GetParentWindow(), OBJID_CLIENT, root_id);
+ IA2_EVENT_DOCUMENT_LOAD_COMPLETE,
+ GetParentWindow(),
+ OBJID_CLIENT,
+ root_->child_id());
+ if (delegate_ && delegate_->HasFocus())
+ GotFocus();
}
void BrowserAccessibilityManagerWin::OnAccessibilityObjectValueChange(
diff --git a/chrome/browser/accessibility/browser_accessibility_manager_win.h b/chrome/browser/accessibility/browser_accessibility_manager_win.h
index 4bdca66..d216796 100644
--- a/chrome/browser/accessibility/browser_accessibility_manager_win.h
+++ b/chrome/browser/accessibility/browser_accessibility_manager_win.h
@@ -10,6 +10,7 @@
#include <atlcom.h>
#include <oleacc.h>
+#include <hash_map>
#include <vector>
#include "chrome/browser/accessibility/browser_accessibility_manager.h"
@@ -67,6 +68,7 @@ class BrowserAccessibilityManagerWin : public BrowserAccessibilityManager {
void DoDefaultAction(const BrowserAccessibilityWin& node);
// BrowserAccessibilityManager Methods
+ virtual void GotFocus();
virtual IAccessible* GetRootAccessible();
virtual void OnAccessibilityObjectStateChange(
const webkit_glue::WebAccessibility& acc_obj);