OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/renderer_host/render_widget_host_view_win.h" | 5 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/l10n_util_win.h" | 8 #include "app/l10n_util_win.h" |
9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1559 LRESULT RenderWidgetHostViewWin::OnGetObject(UINT message, WPARAM wparam, | 1559 LRESULT RenderWidgetHostViewWin::OnGetObject(UINT message, WPARAM wparam, |
1560 LPARAM lparam, BOOL& handled) { | 1560 LPARAM lparam, BOOL& handled) { |
1561 if (lparam != OBJID_CLIENT) { | 1561 if (lparam != OBJID_CLIENT) { |
1562 handled = false; | 1562 handled = false; |
1563 return static_cast<LRESULT>(0L); | 1563 return static_cast<LRESULT>(0L); |
1564 } | 1564 } |
1565 | 1565 |
1566 if (!browser_accessibility_manager_.get()) { | 1566 if (!browser_accessibility_manager_.get()) { |
1567 render_widget_host_->EnableRendererAccessibility(); | 1567 render_widget_host_->EnableRendererAccessibility(); |
1568 | 1568 |
1569 if (!loading_accessible_.get()) { | 1569 // Return busy document tree while renderer accessibility tree loads. |
1570 // Create IAccessible to return while waiting for the accessibility tree | 1570 webkit_glue::WebAccessibility loading_tree; |
1571 // from the renderer. | 1571 loading_tree.role = WebAccessibility::ROLE_DOCUMENT; |
1572 HRESULT hr = ::CreateStdAccessibleObject( | 1572 loading_tree.state = (1 << WebAccessibility::STATE_BUSY); |
1573 m_hWnd, OBJID_CLIENT, IID_IAccessible, | 1573 browser_accessibility_manager_.reset( |
1574 reinterpret_cast<void **>(&loading_accessible_)); | 1574 new BrowserAccessibilityManager(m_hWnd, loading_tree, this)); |
| 1575 } |
1575 | 1576 |
1576 // Annotate with STATE_SYSTEM_BUSY to indicate that the page is loading. | 1577 BrowserAccessibility* root = browser_accessibility_manager_->GetRoot(); |
1577 // We annotate the HWND, not the loading_accessible IAccessible, but the | 1578 if (root) { |
1578 // IAccessible will reflect the state annotation. | 1579 return LresultFromObject(IID_IAccessible, wparam, |
1579 ScopedComPtr<IAccPropServices> pAccPropServices; | 1580 static_cast<IAccessible*>(root->NewReference())); |
1580 hr = CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER, | |
1581 IID_IAccPropServices, reinterpret_cast<void**>(&pAccPropServices)); | |
1582 if (SUCCEEDED(hr)) { | |
1583 VARIANT var; | |
1584 var.vt = VT_I4; | |
1585 var.lVal = STATE_SYSTEM_BUSY; | |
1586 pAccPropServices->SetHwndProp( | |
1587 m_hWnd, OBJID_CLIENT, CHILDID_SELF, PROPID_ACC_STATE, var); | |
1588 | |
1589 // Annotate with ROLE_SYSTEM_DOCUMENT, indicates page is a document. | |
1590 var.lVal = ROLE_SYSTEM_DOCUMENT; | |
1591 pAccPropServices->SetHwndProp( | |
1592 m_hWnd, OBJID_CLIENT, CHILDID_SELF, PROPID_ACC_ROLE, var); | |
1593 } | |
1594 } | |
1595 | |
1596 if (loading_accessible_.get()) { | |
1597 return LresultFromObject( | |
1598 IID_IAccessible, wparam, | |
1599 static_cast<IAccessible*>(loading_accessible_)); | |
1600 } | |
1601 } else { | |
1602 BrowserAccessibility* root = browser_accessibility_manager_->GetRoot(); | |
1603 if (root) { | |
1604 return LresultFromObject(IID_IAccessible, wparam, | |
1605 static_cast<IAccessible*>(root->NewReference())); | |
1606 } | |
1607 } | 1581 } |
1608 | 1582 |
1609 handled = false; | 1583 handled = false; |
1610 return static_cast<LRESULT>(0L); | 1584 return static_cast<LRESULT>(0L); |
1611 } | 1585 } |
1612 | 1586 |
1613 void RenderWidgetHostViewWin::OnFinalMessage(HWND window) { | 1587 void RenderWidgetHostViewWin::OnFinalMessage(HWND window) { |
1614 // When the render widget host is being destroyed, it ends up calling | 1588 // When the render widget host is being destroyed, it ends up calling |
1615 // WillDestroyRenderWidget (through the RENDER_WIDGET_HOST_DESTROYED | 1589 // WillDestroyRenderWidget (through the RENDER_WIDGET_HOST_DESTROYED |
1616 // notification) which NULLs render_widget_host_. | 1590 // notification) which NULLs render_widget_host_. |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1730 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( | 1704 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( |
1731 gfx::NativeView native_view) { | 1705 gfx::NativeView native_view) { |
1732 if (::IsWindow(native_view)) { | 1706 if (::IsWindow(native_view)) { |
1733 HANDLE raw_render_host_view = ::GetProp(native_view, | 1707 HANDLE raw_render_host_view = ::GetProp(native_view, |
1734 kRenderWidgetHostViewKey); | 1708 kRenderWidgetHostViewKey); |
1735 if (raw_render_host_view) | 1709 if (raw_render_host_view) |
1736 return reinterpret_cast<RenderWidgetHostView*>(raw_render_host_view); | 1710 return reinterpret_cast<RenderWidgetHostView*>(raw_render_host_view); |
1737 } | 1711 } |
1738 return NULL; | 1712 return NULL; |
1739 } | 1713 } |
OLD | NEW |