Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: content/browser/renderer_host/legacy_render_widget_host_win.cc

Issue 2581483002: Add support for faster, more limited accessibility modes. (Closed)
Patch Set: Disable tests that can't pass on Android with TODO Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_win.h" 14 #include "content/browser/accessibility/browser_accessibility_win.h"
14 #include "content/browser/renderer_host/render_widget_host_impl.h" 15 #include "content/browser/renderer_host/render_widget_host_impl.h"
15 #include "content/browser/renderer_host/render_widget_host_view_aura.h" 16 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
16 #include "content/public/browser/browser_accessibility_state.h"
17 #include "content/public/common/content_switches.h" 17 #include "content/public/common/content_switches.h"
18 #include "ui/base/view_prop.h" 18 #include "ui/base/view_prop.h"
19 #include "ui/base/win/internal_constants.h" 19 #include "ui/base/win/internal_constants.h"
20 #include "ui/base/win/window_event_target.h" 20 #include "ui/base/win/window_event_target.h"
21 #include "ui/display/win/screen_win.h" 21 #include "ui/display/win/screen_win.h"
22 #include "ui/gfx/geometry/rect.h" 22 #include "ui/gfx/geometry/rect.h"
23 #include "ui/gfx/win/direct_manipulation.h" 23 #include "ui/gfx/win/direct_manipulation.h"
24 24
25 namespace content { 25 namespace content {
26 26
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 bool LegacyRenderWidgetHostHWND::Init() { 113 bool LegacyRenderWidgetHostHWND::Init() {
114 if (base::win::GetVersion() >= base::win::VERSION_WIN7) 114 if (base::win::GetVersion() >= base::win::VERSION_WIN7)
115 RegisterTouchWindow(hwnd(), TWF_WANTPALM); 115 RegisterTouchWindow(hwnd(), TWF_WANTPALM);
116 116
117 HRESULT hr = ::CreateStdAccessibleObject( 117 HRESULT hr = ::CreateStdAccessibleObject(
118 hwnd(), OBJID_WINDOW, IID_IAccessible, 118 hwnd(), OBJID_WINDOW, IID_IAccessible,
119 reinterpret_cast<void **>(window_accessible_.Receive())); 119 reinterpret_cast<void **>(window_accessible_.Receive()));
120 DCHECK(SUCCEEDED(hr)); 120 DCHECK(SUCCEEDED(hr));
121 121
122 if (!BrowserAccessibilityState::GetInstance()->IsAccessibleBrowser()) { 122 AccessibilityMode mode =
123 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode();
124 if (!(mode & ACCESSIBILITY_MODE_FLAG_NATIVE_APIS)) {
123 // Attempt to detect screen readers or other clients who want full 125 // Attempt to detect screen readers or other clients who want full
124 // accessibility support, by seeing if they respond to this event. 126 // accessibility support, by seeing if they respond to this event.
125 NotifyWinEvent(EVENT_SYSTEM_ALERT, hwnd(), kIdScreenReaderHoneyPot, 127 NotifyWinEvent(EVENT_SYSTEM_ALERT, hwnd(), kIdScreenReaderHoneyPot,
126 CHILDID_SELF); 128 CHILDID_SELF);
127 } 129 }
128 130
129 // Direct Manipulation is enabled on Windows 10+. The CreateInstance function 131 // Direct Manipulation is enabled on Windows 10+. The CreateInstance function
130 // returns NULL if Direct Manipulation is not available. 132 // returns NULL if Direct Manipulation is not available.
131 direct_manipulation_helper_ = 133 direct_manipulation_helper_ =
132 gfx::win::DirectManipulationHelper::CreateInstance(); 134 gfx::win::DirectManipulationHelper::CreateInstance();
(...skipping 21 matching lines...) Expand all
154 156
155 LRESULT LegacyRenderWidgetHostHWND::OnGetObject(UINT message, 157 LRESULT LegacyRenderWidgetHostHWND::OnGetObject(UINT message,
156 WPARAM w_param, 158 WPARAM w_param,
157 LPARAM l_param) { 159 LPARAM l_param) {
158 // Only the lower 32 bits of l_param are valid when checking the object id 160 // Only the lower 32 bits of l_param are valid when checking the object id
159 // because it sometimes gets sign-extended incorrectly (but not always). 161 // because it sometimes gets sign-extended incorrectly (but not always).
160 DWORD obj_id = static_cast<DWORD>(static_cast<DWORD_PTR>(l_param)); 162 DWORD obj_id = static_cast<DWORD>(static_cast<DWORD_PTR>(l_param));
161 163
162 if (kIdScreenReaderHoneyPot == obj_id) { 164 if (kIdScreenReaderHoneyPot == obj_id) {
163 // When an MSAA client has responded to our fake event on this id, 165 // When an MSAA client has responded to our fake event on this id,
164 // enable screen reader support. 166 // enable basic accessibility support. (Full screen reader support is
165 BrowserAccessibilityState::GetInstance()->OnScreenReaderDetected(); 167 // detected later when specific more advanced APIs are accessed.)
168 BrowserAccessibilityStateImpl::GetInstance()->AddAccessibilityModeFlags(
169 ACCESSIBILITY_MODE_FLAG_NATIVE_APIS |
170 ACCESSIBILITY_MODE_FLAG_WEB_CONTENTS);
166 return static_cast<LRESULT>(0L); 171 return static_cast<LRESULT>(0L);
167 } 172 }
168 173
169 if (static_cast<DWORD>(OBJID_CLIENT) != obj_id || !host_) 174 if (static_cast<DWORD>(OBJID_CLIENT) != obj_id || !host_)
170 return static_cast<LRESULT>(0L); 175 return static_cast<LRESULT>(0L);
171 176
172 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From( 177 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(
173 host_->GetRenderWidgetHost()); 178 host_->GetRenderWidgetHost());
174 if (!rwhi) 179 if (!rwhi)
175 return static_cast<LRESULT>(0L); 180 return static_cast<LRESULT>(0L);
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 direct_manipulation_helper_->Activate(hwnd()); 409 direct_manipulation_helper_->Activate(hwnd());
405 } else if (window_pos->flags & SWP_HIDEWINDOW) { 410 } else if (window_pos->flags & SWP_HIDEWINDOW) {
406 direct_manipulation_helper_->Deactivate(hwnd()); 411 direct_manipulation_helper_->Deactivate(hwnd());
407 } 412 }
408 } 413 }
409 SetMsgHandled(FALSE); 414 SetMsgHandled(FALSE);
410 return 0; 415 return 0;
411 } 416 }
412 417
413 } // namespace content 418 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/accessibility/browser_accessibility_win.cc ('k') | content/renderer/accessibility/blink_ax_tree_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698