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

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

Issue 2694413006: Scope and clean up uses of AccessibilityMode. (Closed)
Patch Set: merge Created 3 years, 9 months 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"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 AccessibilityMode mode = 122 AccessibilityMode mode =
123 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode(); 123 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode();
124 if (!(mode & ACCESSIBILITY_MODE_FLAG_NATIVE_APIS)) { 124 if (!mode.has_mode(AccessibilityMode::kNativeAPIs)) {
125 // Attempt to detect screen readers or other clients who want full 125 // Attempt to detect screen readers or other clients who want full
126 // accessibility support, by seeing if they respond to this event. 126 // accessibility support, by seeing if they respond to this event.
127 NotifyWinEvent(EVENT_SYSTEM_ALERT, hwnd(), kIdScreenReaderHoneyPot, 127 NotifyWinEvent(EVENT_SYSTEM_ALERT, hwnd(), kIdScreenReaderHoneyPot,
128 CHILDID_SELF); 128 CHILDID_SELF);
129 } 129 }
130 130
131 // Direct Manipulation is enabled on Windows 10+. The CreateInstance function 131 // Direct Manipulation is enabled on Windows 10+. The CreateInstance function
132 // returns NULL if Direct Manipulation is not available. 132 // returns NULL if Direct Manipulation is not available.
133 direct_manipulation_helper_ = 133 direct_manipulation_helper_ =
134 gfx::win::DirectManipulationHelper::CreateInstance(); 134 gfx::win::DirectManipulationHelper::CreateInstance();
(...skipping 24 matching lines...) Expand all
159 LPARAM l_param) { 159 LPARAM l_param) {
160 // 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
161 // because it sometimes gets sign-extended incorrectly (but not always). 161 // because it sometimes gets sign-extended incorrectly (but not always).
162 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));
163 163
164 if (kIdScreenReaderHoneyPot == obj_id) { 164 if (kIdScreenReaderHoneyPot == obj_id) {
165 // 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,
166 // enable basic accessibility support. (Full screen reader support is 166 // enable basic accessibility support. (Full screen reader support is
167 // detected later when specific more advanced APIs are accessed.) 167 // detected later when specific more advanced APIs are accessed.)
168 BrowserAccessibilityStateImpl::GetInstance()->AddAccessibilityModeFlags( 168 BrowserAccessibilityStateImpl::GetInstance()->AddAccessibilityModeFlags(
169 ACCESSIBILITY_MODE_FLAG_NATIVE_APIS | 169 AccessibilityMode::kNativeAPIs | AccessibilityMode::kWebContents);
170 ACCESSIBILITY_MODE_FLAG_WEB_CONTENTS);
171 return static_cast<LRESULT>(0L); 170 return static_cast<LRESULT>(0L);
172 } 171 }
173 172
174 if (static_cast<DWORD>(OBJID_CLIENT) != obj_id || !host_) 173 if (static_cast<DWORD>(OBJID_CLIENT) != obj_id || !host_)
175 return static_cast<LRESULT>(0L); 174 return static_cast<LRESULT>(0L);
176 175
177 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From( 176 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(
178 host_->GetRenderWidgetHost()); 177 host_->GetRenderWidgetHost());
179 if (!rwhi) 178 if (!rwhi)
180 return static_cast<LRESULT>(0L); 179 return static_cast<LRESULT>(0L);
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 direct_manipulation_helper_->Activate(hwnd()); 408 direct_manipulation_helper_->Activate(hwnd());
410 } else if (window_pos->flags & SWP_HIDEWINDOW) { 409 } else if (window_pos->flags & SWP_HIDEWINDOW) {
411 direct_manipulation_helper_->Deactivate(hwnd()); 410 direct_manipulation_helper_->Deactivate(hwnd());
412 } 411 }
413 } 412 }
414 SetMsgHandled(FALSE); 413 SetMsgHandled(FALSE);
415 return 0; 414 return 0;
416 } 415 }
417 416
418 } // namespace content 417 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.cc ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698