| 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" |
| 11 #include "base/histogram.h" | 11 #include "base/histogram.h" |
| 12 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
| 13 #include "base/process_util.h" | 13 #include "base/process_util.h" |
| 14 #include "base/scoped_comptr_win.h" |
| 14 #include "base/thread.h" | 15 #include "base/thread.h" |
| 15 #include "base/win_util.h" | 16 #include "base/win_util.h" |
| 16 #include "chrome/browser/browser_accessibility_win.h" | 17 #include "chrome/browser/accessibility/browser_accessibility.h" |
| 17 #include "chrome/browser/browser_accessibility_manager_win.h" | 18 #include "chrome/browser/accessibility/browser_accessibility_manager.h" |
| 18 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/browser_trial.h" | 20 #include "chrome/browser/browser_trial.h" |
| 20 #include "chrome/browser/chrome_thread.h" | 21 #include "chrome/browser/chrome_thread.h" |
| 21 #include "chrome/browser/plugin_process_host.h" | 22 #include "chrome/browser/plugin_process_host.h" |
| 22 #include "chrome/browser/renderer_host/backing_store.h" | 23 #include "chrome/browser/renderer_host/backing_store.h" |
| 23 #include "chrome/browser/renderer_host/backing_store_win.h" | 24 #include "chrome/browser/renderer_host/backing_store_win.h" |
| 24 #include "chrome/browser/renderer_host/gpu_view_host.h" | 25 #include "chrome/browser/renderer_host/gpu_view_host.h" |
| 25 #include "chrome/browser/renderer_host/render_process_host.h" | 26 #include "chrome/browser/renderer_host/render_process_host.h" |
| 26 #include "chrome/browser/renderer_host/render_widget_host.h" | 27 #include "chrome/browser/renderer_host/render_widget_host.h" |
| 27 #include "chrome/common/chrome_constants.h" | 28 #include "chrome/common/chrome_constants.h" |
| (...skipping 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1481 } | 1482 } |
| 1482 | 1483 |
| 1483 void RenderWidgetHostViewWin::OnAccessibilityNotifications( | 1484 void RenderWidgetHostViewWin::OnAccessibilityNotifications( |
| 1484 const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params) { | 1485 const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params) { |
| 1485 if (!browser_accessibility_manager_.get()) { | 1486 if (!browser_accessibility_manager_.get()) { |
| 1486 // Use empty document to process notifications | 1487 // Use empty document to process notifications |
| 1487 webkit_glue::WebAccessibility empty_document; | 1488 webkit_glue::WebAccessibility empty_document; |
| 1488 empty_document.role = WebAccessibility::ROLE_DOCUMENT; | 1489 empty_document.role = WebAccessibility::ROLE_DOCUMENT; |
| 1489 empty_document.state = 0; | 1490 empty_document.state = 0; |
| 1490 browser_accessibility_manager_.reset( | 1491 browser_accessibility_manager_.reset( |
| 1491 new BrowserAccessibilityManager(m_hWnd, empty_document, this)); | 1492 BrowserAccessibilityManager::Create(m_hWnd, empty_document, this)); |
| 1492 } | 1493 } |
| 1493 | 1494 |
| 1494 browser_accessibility_manager_->OnAccessibilityNotifications(params); | 1495 browser_accessibility_manager_->OnAccessibilityNotifications(params); |
| 1495 } | 1496 } |
| 1496 | 1497 |
| 1497 void RenderWidgetHostViewWin::Observe(NotificationType type, | 1498 void RenderWidgetHostViewWin::Observe(NotificationType type, |
| 1498 const NotificationSource& source, | 1499 const NotificationSource& source, |
| 1499 const NotificationDetails& details) { | 1500 const NotificationDetails& details) { |
| 1500 DCHECK(type == NotificationType::RENDERER_PROCESS_TERMINATED); | 1501 DCHECK(type == NotificationType::RENDERER_PROCESS_TERMINATED); |
| 1501 | 1502 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1544 } | 1545 } |
| 1545 | 1546 |
| 1546 if (!browser_accessibility_manager_.get()) { | 1547 if (!browser_accessibility_manager_.get()) { |
| 1547 render_widget_host_->EnableRendererAccessibility(); | 1548 render_widget_host_->EnableRendererAccessibility(); |
| 1548 | 1549 |
| 1549 // Return busy document tree while renderer accessibility tree loads. | 1550 // Return busy document tree while renderer accessibility tree loads. |
| 1550 webkit_glue::WebAccessibility loading_tree; | 1551 webkit_glue::WebAccessibility loading_tree; |
| 1551 loading_tree.role = WebAccessibility::ROLE_DOCUMENT; | 1552 loading_tree.role = WebAccessibility::ROLE_DOCUMENT; |
| 1552 loading_tree.state = (1 << WebAccessibility::STATE_BUSY); | 1553 loading_tree.state = (1 << WebAccessibility::STATE_BUSY); |
| 1553 browser_accessibility_manager_.reset( | 1554 browser_accessibility_manager_.reset( |
| 1554 new BrowserAccessibilityManager(m_hWnd, loading_tree, this)); | 1555 BrowserAccessibilityManager::Create(m_hWnd, loading_tree, this)); |
| 1555 } | 1556 } |
| 1556 | 1557 |
| 1557 BrowserAccessibility* root = browser_accessibility_manager_->GetRoot(); | 1558 ScopedComPtr<IAccessible> root( |
| 1558 if (root) { | 1559 browser_accessibility_manager_->GetRootAccessible()); |
| 1559 return LresultFromObject(IID_IAccessible, wparam, | 1560 if (root.get()) { |
| 1560 static_cast<IAccessible*>(root->NewReference())); | 1561 return LresultFromObject(IID_IAccessible, wparam, root.Detach()); |
| 1561 } | 1562 } |
| 1562 | 1563 |
| 1563 handled = false; | 1564 handled = false; |
| 1564 return static_cast<LRESULT>(0L); | 1565 return static_cast<LRESULT>(0L); |
| 1565 } | 1566 } |
| 1566 | 1567 |
| 1567 void RenderWidgetHostViewWin::OnFinalMessage(HWND window) { | 1568 void RenderWidgetHostViewWin::OnFinalMessage(HWND window) { |
| 1568 // When the render widget host is being destroyed, it ends up calling | 1569 // When the render widget host is being destroyed, it ends up calling |
| 1569 // WillDestroyRenderWidget (through the RENDER_WIDGET_HOST_DESTROYED | 1570 // WillDestroyRenderWidget (through the RENDER_WIDGET_HOST_DESTROYED |
| 1570 // notification) which NULLs render_widget_host_. | 1571 // notification) which NULLs render_widget_host_. |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1684 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( | 1685 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( |
| 1685 gfx::NativeView native_view) { | 1686 gfx::NativeView native_view) { |
| 1686 if (::IsWindow(native_view)) { | 1687 if (::IsWindow(native_view)) { |
| 1687 HANDLE raw_render_host_view = ::GetProp(native_view, | 1688 HANDLE raw_render_host_view = ::GetProp(native_view, |
| 1688 kRenderWidgetHostViewKey); | 1689 kRenderWidgetHostViewKey); |
| 1689 if (raw_render_host_view) | 1690 if (raw_render_host_view) |
| 1690 return reinterpret_cast<RenderWidgetHostView*>(raw_render_host_view); | 1691 return reinterpret_cast<RenderWidgetHostView*>(raw_render_host_view); |
| 1691 } | 1692 } |
| 1692 return NULL; | 1693 return NULL; |
| 1693 } | 1694 } |
| OLD | NEW |