| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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/legacy_render_widget_host_win.h" | 5 #include "content/browser/renderer_host/legacy_render_widget_host_win.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
| 10 #include "content/browser/accessibility/browser_accessibility_manager_win.h" | 10 #include "content/browser/accessibility/browser_accessibility_manager_win.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 return 1; | 140 return 1; |
| 141 } | 141 } |
| 142 | 142 |
| 143 LRESULT LegacyRenderWidgetHostHWND::OnGetObject(UINT message, | 143 LRESULT LegacyRenderWidgetHostHWND::OnGetObject(UINT message, |
| 144 WPARAM w_param, | 144 WPARAM w_param, |
| 145 LPARAM l_param) { | 145 LPARAM l_param) { |
| 146 // Only the lower 32 bits of l_param are valid when checking the object id | 146 // Only the lower 32 bits of l_param are valid when checking the object id |
| 147 // because it sometimes gets sign-extended incorrectly (but not always). | 147 // because it sometimes gets sign-extended incorrectly (but not always). |
| 148 DWORD obj_id = static_cast<DWORD>(static_cast<DWORD_PTR>(l_param)); | 148 DWORD obj_id = static_cast<DWORD>(static_cast<DWORD_PTR>(l_param)); |
| 149 | 149 |
| 150 // http://crbug.com/440579 TODO(dmazzoni): remove this logging when |
| 151 // flakiness is fixed. |
| 152 LOG(INFO) << "LegacyRenderWidgetHostHWND::OnGetObject" |
| 153 << " message=" << message |
| 154 << " w_param=" << w_param |
| 155 << " l_param=" << l_param |
| 156 << " obj_id=" << obj_id |
| 157 << " host_=" << host_; |
| 158 |
| 150 if (kIdScreenReaderHoneyPot == obj_id) { | 159 if (kIdScreenReaderHoneyPot == obj_id) { |
| 151 // When an MSAA client has responded to our fake event on this id, | 160 // When an MSAA client has responded to our fake event on this id, |
| 152 // enable screen reader support. | 161 // enable screen reader support. |
| 153 BrowserAccessibilityState::GetInstance()->OnScreenReaderDetected(); | 162 BrowserAccessibilityState::GetInstance()->OnScreenReaderDetected(); |
| 154 return static_cast<LRESULT>(0L); | 163 return static_cast<LRESULT>(0L); |
| 155 } | 164 } |
| 156 | 165 |
| 157 if (OBJID_CLIENT != obj_id || !host_) | 166 if (OBJID_CLIENT != obj_id || !host_) |
| 158 return static_cast<LRESULT>(0L); | 167 return static_cast<LRESULT>(0L); |
| 159 | 168 |
| 160 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From( | 169 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From( |
| 161 host_->GetRenderWidgetHost()); | 170 host_->GetRenderWidgetHost()); |
| 162 if (!rwhi) | 171 if (!rwhi) { |
| 172 LOG(WARNING) << "No RWHI"; |
| 163 return static_cast<LRESULT>(0L); | 173 return static_cast<LRESULT>(0L); |
| 174 } |
| 164 | 175 |
| 165 BrowserAccessibilityManagerWin* manager = | 176 BrowserAccessibilityManagerWin* manager = |
| 166 static_cast<BrowserAccessibilityManagerWin*>( | 177 static_cast<BrowserAccessibilityManagerWin*>( |
| 167 rwhi->GetRootBrowserAccessibilityManager()); | 178 rwhi->GetRootBrowserAccessibilityManager()); |
| 168 if (!manager) | 179 if (!manager) { |
| 180 LOG(WARNING) << "No manager"; |
| 169 return static_cast<LRESULT>(0L); | 181 return static_cast<LRESULT>(0L); |
| 182 } |
| 170 | 183 |
| 171 base::win::ScopedComPtr<IAccessible> root( | 184 base::win::ScopedComPtr<IAccessible> root( |
| 172 manager->GetRoot()->ToBrowserAccessibilityWin()); | 185 manager->GetRoot()->ToBrowserAccessibilityWin()); |
| 173 return LresultFromObject(IID_IAccessible, w_param, | 186 return LresultFromObject(IID_IAccessible, w_param, |
| 174 static_cast<IAccessible*>(root.Detach())); | 187 static_cast<IAccessible*>(root.Detach())); |
| 175 } | 188 } |
| 176 | 189 |
| 177 // We send keyboard/mouse/touch messages to the parent window via SendMessage. | 190 // We send keyboard/mouse/touch messages to the parent window via SendMessage. |
| 178 // While this works, this has the side effect of converting input messages into | 191 // While this works, this has the side effect of converting input messages into |
| 179 // sent messages which changes their priority and could technically result | 192 // sent messages which changes their priority and could technically result |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 // generate the legacy WM_VSCROLL/WM_HSCROLL messages. | 384 // generate the legacy WM_VSCROLL/WM_HSCROLL messages. |
| 372 // We add these styles to ensure that trackpad/trackpoint scrolling | 385 // We add these styles to ensure that trackpad/trackpoint scrolling |
| 373 // work. | 386 // work. |
| 374 long current_style = ::GetWindowLong(hwnd(), GWL_STYLE); | 387 long current_style = ::GetWindowLong(hwnd(), GWL_STYLE); |
| 375 ::SetWindowLong(hwnd(), GWL_STYLE, | 388 ::SetWindowLong(hwnd(), GWL_STYLE, |
| 376 current_style | WS_VSCROLL | WS_HSCROLL); | 389 current_style | WS_VSCROLL | WS_HSCROLL); |
| 377 return 0; | 390 return 0; |
| 378 } | 391 } |
| 379 | 392 |
| 380 } // namespace content | 393 } // namespace content |
| OLD | NEW |