| Index: chrome/browser/browser_accessibility.cc
|
| ===================================================================
|
| --- chrome/browser/browser_accessibility.cc (revision 16095)
|
| +++ chrome/browser/browser_accessibility.cc (working copy)
|
| @@ -9,15 +9,29 @@
|
|
|
| using webkit_glue::WebAccessibility;
|
|
|
| -BrowserAccessibility::BrowserAccessibility()
|
| - : iaccessible_id_(-1),
|
| - instance_active_(true) {
|
| +HRESULT BrowserAccessibility::Initialize(int iaccessible_id, int routing_id,
|
| + int process_id, HWND parent_hwnd) {
|
| + if (!parent_hwnd || iaccessible_id < 0)
|
| + return E_INVALIDARG;
|
| +
|
| + iaccessible_id_ = iaccessible_id;
|
| + routing_id_ = routing_id;
|
| + process_id_ = process_id;
|
| + parent_hwnd_ = parent_hwnd;
|
| +
|
| + // Mark instance as active.
|
| + instance_active_ = true;
|
| +
|
| + // Treat child ids intitially as referring to direct children of the object.
|
| + direct_descendant_ = true;
|
| +
|
| + return S_OK;
|
| }
|
|
|
| HRESULT BrowserAccessibility::accDoDefaultAction(VARIANT var_id) {
|
| if (!instance_active()) {
|
| // Instance no longer active, fail gracefully.
|
| - // TODO(klink): Once we have MSAA events, change these fails for having
|
| + // TODO(klink): Once we have MSAA events, change these fails to having
|
| // BrowserAccessibilityManager firing the right event.
|
| return E_FAIL;
|
| }
|
| @@ -46,7 +60,7 @@
|
| if (!child)
|
| return E_INVALIDARG;
|
|
|
| - if (!parent_hwnd()) {
|
| + if (!parent_hwnd_) {
|
| // Parent HWND needed for coordinate conversion.
|
| return E_FAIL;
|
| }
|
| @@ -54,7 +68,7 @@
|
| // Convert coordinates to test from screen into client window coordinates, to
|
| // maintain sandbox functionality on renderer side.
|
| POINT p = {x_left, y_top};
|
| - ::ScreenToClient(parent_hwnd(), &p);
|
| + ::ScreenToClient(parent_hwnd_, &p);
|
|
|
| if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_HITTEST,
|
| EmptyVariant(), p.x, p.y)) {
|
| @@ -93,7 +107,7 @@
|
| }
|
|
|
| if (var_id.vt != VT_I4 || !x_left || !y_top || !width || !height ||
|
| - !parent_hwnd()) {
|
| + !parent_hwnd_) {
|
| return E_INVALIDARG;
|
| }
|
|
|
| @@ -106,7 +120,7 @@
|
|
|
| // Find the top left corner of the containing window in screen coords, and
|
| // adjust the output position by this amount.
|
| - ::ClientToScreen(parent_hwnd(), &top_left);
|
| + ::ClientToScreen(parent_hwnd_, &top_left);
|
|
|
| *x_left = response().output_long1 + top_left.x;
|
| *y_top = response().output_long2 + top_left.y;
|
| @@ -393,15 +407,15 @@
|
| return E_FAIL;
|
| }
|
|
|
| - if (!disp_parent || !parent_hwnd())
|
| + if (!disp_parent || !parent_hwnd_)
|
| return E_INVALIDARG;
|
|
|
| // Root node's parent is the containing HWND's IAccessible.
|
| - if (iaccessible_id() == 0) {
|
| + if (iaccessible_id_ == 0) {
|
| // For an object that has no parent (e.g. root), point the accessible parent
|
| // to the default implementation.
|
| HRESULT hr =
|
| - ::CreateStdAccessibleObject(parent_hwnd(), OBJID_WINDOW,
|
| + ::CreateStdAccessibleObject(parent_hwnd_, OBJID_WINDOW,
|
| IID_IAccessible,
|
| reinterpret_cast<void**>(disp_parent));
|
|
|
| @@ -498,20 +512,15 @@
|
| return S_OK;
|
| }
|
|
|
| -STDMETHODIMP BrowserAccessibility::accSelect(LONG flags_select,
|
| - VARIANT var_id) {
|
| - return E_NOTIMPL;
|
| -}
|
| -
|
| STDMETHODIMP BrowserAccessibility::get_accHelpTopic(BSTR* help_file,
|
| VARIANT var_id,
|
| LONG* topic_id) {
|
| - if (help_file) {
|
| + if (help_file)
|
| *help_file = NULL;
|
| - }
|
| - if (topic_id) {
|
| +
|
| + if (topic_id)
|
| *topic_id = static_cast<LONG>(-1);
|
| - }
|
| +
|
| return E_NOTIMPL;
|
| }
|
|
|
| @@ -522,38 +531,38 @@
|
| return E_NOTIMPL;
|
| }
|
|
|
| -STDMETHODIMP BrowserAccessibility::put_accName(VARIANT var_id, BSTR put_name) {
|
| - return E_NOTIMPL;
|
| -}
|
| -
|
| -STDMETHODIMP BrowserAccessibility::put_accValue(VARIANT var_id, BSTR put_val) {
|
| - return E_NOTIMPL;
|
| -}
|
| -
|
| STDMETHODIMP BrowserAccessibility::CreateInstance(REFIID iid,
|
| int iaccessible_id,
|
| void** interface_ptr) {
|
| return BrowserAccessibilityManager::GetInstance()->
|
| - CreateAccessibilityInstance(iid, iaccessible_id, instance_id(),
|
| - interface_ptr);
|
| + CreateAccessibilityInstance(iid, iaccessible_id, routing_id_,
|
| + process_id_, parent_hwnd_, interface_ptr);
|
| }
|
|
|
| bool BrowserAccessibility::RequestAccessibilityInfo(int iaccessible_func_id,
|
| VARIANT var_id, LONG input1,
|
| LONG input2) {
|
| - return BrowserAccessibilityManager::GetInstance()->RequestAccessibilityInfo(
|
| - iaccessible_id(), instance_id(), iaccessible_func_id, var_id.lVal, input1,
|
| - input2);
|
| + // Create and populate IPC message structure, for retrieval of accessibility
|
| + // information from the renderer.
|
| + WebAccessibility::InParams in_params;
|
| + in_params.object_id = iaccessible_id_;
|
| + in_params.function_id = iaccessible_func_id;
|
| + in_params.child_id = var_id.lVal;
|
| + in_params.direct_descendant = direct_descendant();
|
| + in_params.input_long1 = input1;
|
| + in_params.input_long2 = input2;
|
| +
|
| + if (!direct_descendant())
|
| + set_direct_descendant(true);
|
| +
|
| + return BrowserAccessibilityManager::GetInstance()->
|
| + RequestAccessibilityInfo(&in_params, routing_id_, process_id_);
|
| }
|
|
|
| const WebAccessibility::OutParams& BrowserAccessibility::response() {
|
| return BrowserAccessibilityManager::GetInstance()->response();
|
| }
|
|
|
| -HWND BrowserAccessibility::parent_hwnd() {
|
| - return BrowserAccessibilityManager::GetInstance()->parent_hwnd(instance_id());
|
| -}
|
| -
|
| long BrowserAccessibility::MSAARole(long browser_accessibility_role) {
|
| switch (browser_accessibility_role) {
|
| case WebAccessibility::ROLE_PUSHBUTTON :
|
|
|