| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/renderer_host/render_widget_host_view_win.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_win.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 return 1; | 1075 return 1; |
| 1076 } | 1076 } |
| 1077 | 1077 |
| 1078 LRESULT RenderWidgetHostViewWin::OnSetCursor(HWND window, UINT hittest_code, | 1078 LRESULT RenderWidgetHostViewWin::OnSetCursor(HWND window, UINT hittest_code, |
| 1079 UINT mouse_message_id) { | 1079 UINT mouse_message_id) { |
| 1080 UpdateCursorIfOverSelf(); | 1080 UpdateCursorIfOverSelf(); |
| 1081 return 0; | 1081 return 0; |
| 1082 } | 1082 } |
| 1083 | 1083 |
| 1084 void RenderWidgetHostViewWin::OnSetFocus(HWND window) { | 1084 void RenderWidgetHostViewWin::OnSetFocus(HWND window) { |
| 1085 if (browser_accessibility_manager_.get()) | 1085 if (browser_accessibility_manager()) |
| 1086 browser_accessibility_manager_->GotFocus(); | 1086 browser_accessibility_manager()->GotFocus(); |
| 1087 if (render_widget_host_) { | 1087 if (render_widget_host_) { |
| 1088 render_widget_host_->GotFocus(); | 1088 render_widget_host_->GotFocus(); |
| 1089 render_widget_host_->SetActive(true); | 1089 render_widget_host_->SetActive(true); |
| 1090 } | 1090 } |
| 1091 if (touch_state_.ReleaseTouchPoints()) | 1091 if (touch_state_.ReleaseTouchPoints()) |
| 1092 render_widget_host_->ForwardTouchEvent(touch_state_.touch_event()); | 1092 render_widget_host_->ForwardTouchEvent(touch_state_.touch_event()); |
| 1093 } | 1093 } |
| 1094 | 1094 |
| 1095 void RenderWidgetHostViewWin::OnKillFocus(HWND window) { | 1095 void RenderWidgetHostViewWin::OnKillFocus(HWND window) { |
| 1096 if (render_widget_host_) { | 1096 if (render_widget_host_) { |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1808 render_widget_host_->ForwardWheelEvent( | 1808 render_widget_host_->ForwardWheelEvent( |
| 1809 MakeFakeScrollWheelEvent(m_hWnd, start, delta)); | 1809 MakeFakeScrollWheelEvent(m_hWnd, start, delta)); |
| 1810 } | 1810 } |
| 1811 } | 1811 } |
| 1812 ::CloseGestureInfoHandle(gi_handle); | 1812 ::CloseGestureInfoHandle(gi_handle); |
| 1813 return 0; | 1813 return 0; |
| 1814 } | 1814 } |
| 1815 | 1815 |
| 1816 void RenderWidgetHostViewWin::OnAccessibilityNotifications( | 1816 void RenderWidgetHostViewWin::OnAccessibilityNotifications( |
| 1817 const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params) { | 1817 const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params) { |
| 1818 if (!browser_accessibility_manager_.get()) { | 1818 if (!browser_accessibility_manager()) { |
| 1819 browser_accessibility_manager_.reset( | 1819 browser_accessibility_manager( |
| 1820 BrowserAccessibilityManager::CreateEmptyDocument( | 1820 BrowserAccessibilityManager::CreateEmptyDocument( |
| 1821 m_hWnd, static_cast<WebAccessibility::State>(0), this)); | 1821 m_hWnd, static_cast<WebAccessibility::State>(0), this)); |
| 1822 } | 1822 } |
| 1823 browser_accessibility_manager_->OnAccessibilityNotifications(params); | 1823 browser_accessibility_manager()->OnAccessibilityNotifications(params); |
| 1824 } | 1824 } |
| 1825 | 1825 |
| 1826 bool RenderWidgetHostViewWin::LockMouse() { | 1826 bool RenderWidgetHostViewWin::LockMouse() { |
| 1827 if (mouse_locked_) | 1827 if (mouse_locked_) |
| 1828 return true; | 1828 return true; |
| 1829 | 1829 |
| 1830 mouse_locked_ = true; | 1830 mouse_locked_ = true; |
| 1831 | 1831 |
| 1832 // Hide the tooltip window if it is currently visible. When the mouse is | 1832 // Hide the tooltip window if it is currently visible. When the mouse is |
| 1833 // locked, no mouse message is relayed to the tooltip window, so we don't need | 1833 // locked, no mouse message is relayed to the tooltip window, so we don't need |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1881 content::RenderProcessHost* render_process_host = | 1881 content::RenderProcessHost* render_process_host = |
| 1882 content::Source<content::RenderProcessHost>(source).ptr(); | 1882 content::Source<content::RenderProcessHost>(source).ptr(); |
| 1883 DCHECK(render_process_host); | 1883 DCHECK(render_process_host); |
| 1884 if (!render_widget_host_ || | 1884 if (!render_widget_host_ || |
| 1885 render_process_host != render_widget_host_->process()) | 1885 render_process_host != render_widget_host_->process()) |
| 1886 return; | 1886 return; |
| 1887 | 1887 |
| 1888 // If it was our RenderProcessHost that posted the notification, | 1888 // If it was our RenderProcessHost that posted the notification, |
| 1889 // clear the BrowserAccessibilityManager, because the renderer is | 1889 // clear the BrowserAccessibilityManager, because the renderer is |
| 1890 // dead and any accessibility information we have is now stale. | 1890 // dead and any accessibility information we have is now stale. |
| 1891 browser_accessibility_manager_.reset(NULL); | 1891 browser_accessibility_manager(NULL); |
| 1892 } | 1892 } |
| 1893 | 1893 |
| 1894 static void PaintCompositorHostWindow(HWND hWnd) { | 1894 static void PaintCompositorHostWindow(HWND hWnd) { |
| 1895 PAINTSTRUCT paint; | 1895 PAINTSTRUCT paint; |
| 1896 BeginPaint(hWnd, &paint); | 1896 BeginPaint(hWnd, &paint); |
| 1897 | 1897 |
| 1898 RenderWidgetHostViewWin* win = static_cast<RenderWidgetHostViewWin*>( | 1898 RenderWidgetHostViewWin* win = static_cast<RenderWidgetHostViewWin*>( |
| 1899 ui::GetWindowUserData(hWnd)); | 1899 ui::GetWindowUserData(hWnd)); |
| 1900 // Trigger composite to rerender window. | 1900 // Trigger composite to rerender window. |
| 1901 if (win) | 1901 if (win) |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2083 render_widget_host_->AccessibilitySetTextSelection( | 2083 render_widget_host_->AccessibilitySetTextSelection( |
| 2084 acc_obj_id, start_offset, end_offset); | 2084 acc_obj_id, start_offset, end_offset); |
| 2085 } | 2085 } |
| 2086 | 2086 |
| 2087 IAccessible* RenderWidgetHostViewWin::GetIAccessible() { | 2087 IAccessible* RenderWidgetHostViewWin::GetIAccessible() { |
| 2088 if (render_widget_host_ && !render_widget_host_->renderer_accessible()) { | 2088 if (render_widget_host_ && !render_widget_host_->renderer_accessible()) { |
| 2089 // Attempt to detect screen readers by sending an event with our custom id. | 2089 // Attempt to detect screen readers by sending an event with our custom id. |
| 2090 NotifyWinEvent(EVENT_SYSTEM_ALERT, m_hWnd, kIdCustom, CHILDID_SELF); | 2090 NotifyWinEvent(EVENT_SYSTEM_ALERT, m_hWnd, kIdCustom, CHILDID_SELF); |
| 2091 } | 2091 } |
| 2092 | 2092 |
| 2093 if (!browser_accessibility_manager_.get()) { | 2093 if (!browser_accessibility_manager()) { |
| 2094 // Return busy document tree while renderer accessibility tree loads. | 2094 // Return busy document tree while renderer accessibility tree loads. |
| 2095 WebAccessibility::State busy_state = | 2095 WebAccessibility::State busy_state = |
| 2096 static_cast<WebAccessibility::State>(1 << WebAccessibility::STATE_BUSY); | 2096 static_cast<WebAccessibility::State>(1 << WebAccessibility::STATE_BUSY); |
| 2097 browser_accessibility_manager_.reset( | 2097 browser_accessibility_manager( |
| 2098 BrowserAccessibilityManager::CreateEmptyDocument( | 2098 BrowserAccessibilityManager::CreateEmptyDocument( |
| 2099 m_hWnd, busy_state, this)); | 2099 m_hWnd, busy_state, this)); |
| 2100 } | 2100 } |
| 2101 | 2101 |
| 2102 return browser_accessibility_manager_->GetRoot()->toBrowserAccessibilityWin(); | 2102 return browser_accessibility_manager()->GetRoot()-> |
| 2103 toBrowserAccessibilityWin(); |
| 2103 } | 2104 } |
| 2104 | 2105 |
| 2105 LRESULT RenderWidgetHostViewWin::OnGetObject(UINT message, WPARAM wparam, | 2106 LRESULT RenderWidgetHostViewWin::OnGetObject(UINT message, WPARAM wparam, |
| 2106 LPARAM lparam, BOOL& handled) { | 2107 LPARAM lparam, BOOL& handled) { |
| 2107 if (kIdCustom == lparam) { | 2108 if (kIdCustom == lparam) { |
| 2108 // An MSAA client requestes our custom id. Assume that we have detected an | 2109 // An MSAA client requestes our custom id. Assume that we have detected an |
| 2109 // active windows screen reader. | 2110 // active windows screen reader. |
| 2110 BrowserAccessibilityState::GetInstance()->OnScreenReaderDetected(); | 2111 BrowserAccessibilityState::GetInstance()->OnScreenReaderDetected(); |
| 2111 render_widget_host_->EnableRendererAccessibility(); | 2112 render_widget_host_->EnableRendererAccessibility(); |
| 2112 | 2113 |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2471 | 2472 |
| 2472 size_t offset = selection_range_.GetMin() - selection_text_offset_; | 2473 size_t offset = selection_range_.GetMin() - selection_text_offset_; |
| 2473 memcpy(reinterpret_cast<char*>(reconv) + sizeof(RECONVERTSTRING), | 2474 memcpy(reinterpret_cast<char*>(reconv) + sizeof(RECONVERTSTRING), |
| 2474 selection_text_.c_str() + offset, len * sizeof(WCHAR)); | 2475 selection_text_.c_str() + offset, len * sizeof(WCHAR)); |
| 2475 | 2476 |
| 2476 // According to Microsft API document, IMR_RECONVERTSTRING and | 2477 // According to Microsft API document, IMR_RECONVERTSTRING and |
| 2477 // IMR_DOCUMENTFEED should return reconv, but some applications return | 2478 // IMR_DOCUMENTFEED should return reconv, but some applications return |
| 2478 // need_size. | 2479 // need_size. |
| 2479 return reinterpret_cast<LRESULT>(reconv); | 2480 return reinterpret_cast<LRESULT>(reconv); |
| 2480 } | 2481 } |
| OLD | NEW |