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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/win/win_util.h" | 10 #include "base/win/win_util.h" |
11 #include "base/win/windows_version.h" | 11 #include "base/win/windows_version.h" |
12 #include "content/browser/accessibility/browser_accessibility_manager_win.h" | 12 #include "content/browser/accessibility/browser_accessibility_manager_win.h" |
13 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 13 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
14 #include "content/browser/accessibility/browser_accessibility_win.h" | 14 #include "content/browser/accessibility/browser_accessibility_win.h" |
15 #include "content/browser/renderer_host/render_widget_host_impl.h" | 15 #include "content/browser/renderer_host/render_widget_host_impl.h" |
16 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 16 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
17 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
| 18 #include "ui/accessibility/platform/ax_fake_caret_win.h" |
18 #include "ui/base/view_prop.h" | 19 #include "ui/base/view_prop.h" |
19 #include "ui/base/win/internal_constants.h" | 20 #include "ui/base/win/internal_constants.h" |
20 #include "ui/base/win/window_event_target.h" | 21 #include "ui/base/win/window_event_target.h" |
21 #include "ui/display/win/screen_win.h" | 22 #include "ui/display/win/screen_win.h" |
22 #include "ui/gfx/geometry/rect.h" | 23 #include "ui/gfx/geometry/rect.h" |
23 #include "ui/gfx/win/direct_manipulation.h" | 24 #include "ui/gfx/win/direct_manipulation.h" |
24 | 25 |
25 namespace content { | 26 namespace content { |
26 | 27 |
27 // A custom MSAA object id used to determine if a screen reader or some | 28 // A custom MSAA object id used to determine if a screen reader or some |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 164 |
164 if (kIdScreenReaderHoneyPot == obj_id) { | 165 if (kIdScreenReaderHoneyPot == obj_id) { |
165 // When an MSAA client has responded to our fake event on this id, | 166 // When an MSAA client has responded to our fake event on this id, |
166 // enable basic accessibility support. (Full screen reader support is | 167 // enable basic accessibility support. (Full screen reader support is |
167 // detected later when specific more advanced APIs are accessed.) | 168 // detected later when specific more advanced APIs are accessed.) |
168 BrowserAccessibilityStateImpl::GetInstance()->AddAccessibilityModeFlags( | 169 BrowserAccessibilityStateImpl::GetInstance()->AddAccessibilityModeFlags( |
169 AccessibilityMode::kNativeAPIs | AccessibilityMode::kWebContents); | 170 AccessibilityMode::kNativeAPIs | AccessibilityMode::kWebContents); |
170 return static_cast<LRESULT>(0L); | 171 return static_cast<LRESULT>(0L); |
171 } | 172 } |
172 | 173 |
173 if (static_cast<DWORD>(OBJID_CLIENT) != obj_id || !host_) | 174 if (!host_) |
174 return static_cast<LRESULT>(0L); | 175 return static_cast<LRESULT>(0L); |
175 | 176 |
176 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From( | 177 if (static_cast<DWORD>(OBJID_CLIENT) == obj_id) { |
177 host_->GetRenderWidgetHost()); | 178 RenderWidgetHostImpl* rwhi = |
178 if (!rwhi) | 179 RenderWidgetHostImpl::From(host_->GetRenderWidgetHost()); |
179 return static_cast<LRESULT>(0L); | 180 if (!rwhi) |
| 181 return static_cast<LRESULT>(0L); |
180 | 182 |
181 BrowserAccessibilityManagerWin* manager = | 183 BrowserAccessibilityManagerWin* manager = |
182 static_cast<BrowserAccessibilityManagerWin*>( | 184 static_cast<BrowserAccessibilityManagerWin*>( |
183 rwhi->GetRootBrowserAccessibilityManager()); | 185 rwhi->GetRootBrowserAccessibilityManager()); |
184 if (!manager) | 186 if (!manager) |
185 return static_cast<LRESULT>(0L); | 187 return static_cast<LRESULT>(0L); |
186 | 188 |
187 base::win::ScopedComPtr<IAccessible> root( | 189 base::win::ScopedComPtr<IAccessible> root( |
188 ToBrowserAccessibilityWin(manager->GetRoot())); | 190 ToBrowserAccessibilityWin(manager->GetRoot())); |
189 return LresultFromObject(IID_IAccessible, w_param, | 191 return LresultFromObject(IID_IAccessible, w_param, |
190 static_cast<IAccessible*>(root.Detach())); | 192 static_cast<IAccessible*>(root.Detach())); |
| 193 } |
| 194 |
| 195 if (static_cast<DWORD>(OBJID_CARET) == obj_id && host_->HasFocus()) { |
| 196 // Used by some assistive software to retrieve the location of the caret. |
| 197 ui::AXFakeCaretWin* fake_caret = ui::AXFakeCaretWin::Get(); |
| 198 DCHECK(fake_caret); |
| 199 base::win::ScopedComPtr<IAccessible> fake_caret_accessible = |
| 200 fake_caret->GetCaret(); |
| 201 return LresultFromObject(IID_IAccessible, w_param, |
| 202 fake_caret_accessible.Detach()); |
| 203 } |
| 204 |
| 205 return static_cast<LRESULT>(0L); |
191 } | 206 } |
192 | 207 |
193 // We send keyboard/mouse/touch messages to the parent window via SendMessage. | 208 // We send keyboard/mouse/touch messages to the parent window via SendMessage. |
194 // While this works, this has the side effect of converting input messages into | 209 // While this works, this has the side effect of converting input messages into |
195 // sent messages which changes their priority and could technically result | 210 // sent messages which changes their priority and could technically result |
196 // in these messages starving other messages in the queue. Additionally | 211 // in these messages starving other messages in the queue. Additionally |
197 // keyboard/mouse hooks would not see these messages. The alternative approach | 212 // keyboard/mouse hooks would not see these messages. The alternative approach |
198 // is to set and release capture as needed on the parent to ensure that it | 213 // is to set and release capture as needed on the parent to ensure that it |
199 // receives all mouse events. However that was shelved due to possible issues | 214 // receives all mouse events. However that was shelved due to possible issues |
200 // with capture changes. | 215 // with capture changes. |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 direct_manipulation_helper_->Activate(hwnd()); | 436 direct_manipulation_helper_->Activate(hwnd()); |
422 } else if (window_pos->flags & SWP_HIDEWINDOW) { | 437 } else if (window_pos->flags & SWP_HIDEWINDOW) { |
423 direct_manipulation_helper_->Deactivate(hwnd()); | 438 direct_manipulation_helper_->Deactivate(hwnd()); |
424 } | 439 } |
425 } | 440 } |
426 SetMsgHandled(FALSE); | 441 SetMsgHandled(FALSE); |
427 return 0; | 442 return 0; |
428 } | 443 } |
429 | 444 |
430 } // namespace content | 445 } // namespace content |
OLD | NEW |