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

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

Issue 329863003: Fix accessibility in Windows x64 build. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typecase Created 6 years, 6 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 "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"
11 #include "content/browser/accessibility/browser_accessibility_win.h" 11 #include "content/browser/accessibility/browser_accessibility_win.h"
12 #include "content/public/browser/browser_accessibility_state.h" 12 #include "content/public/browser/browser_accessibility_state.h"
13 #include "content/public/common/content_switches.h" 13 #include "content/public/common/content_switches.h"
14 #include "ui/base/touch/touch_enabled.h" 14 #include "ui/base/touch/touch_enabled.h"
15 #include "ui/base/view_prop.h" 15 #include "ui/base/view_prop.h"
16 #include "ui/base/win/internal_constants.h" 16 #include "ui/base/win/internal_constants.h"
17 #include "ui/base/win/window_event_target.h" 17 #include "ui/base/win/window_event_target.h"
18 #include "ui/gfx/geometry/rect.h" 18 #include "ui/gfx/geometry/rect.h"
19 19
20 namespace content { 20 namespace content {
21 21
22 // A custom MSAA object id used to determine if a screen reader or some 22 // A custom MSAA object id used to determine if a screen reader or some
23 // other client is listening on MSAA events - if so, we enable full web 23 // other client is listening on MSAA events - if so, we enable full web
24 // accessibility support. 24 // accessibility support.
25 const int kIdScreenReaderHoneyPot = 1; 25 const int kIdScreenReaderHoneyPot = 1;
26 26
27 // A version of the OBJID_CLIENT constant that works in 64-bit mode too.
28 static const LPARAM kObjIdClient = static_cast<ULONG>(OBJID_CLIENT);
29
27 LegacyRenderWidgetHostHWND::~LegacyRenderWidgetHostHWND() { 30 LegacyRenderWidgetHostHWND::~LegacyRenderWidgetHostHWND() {
28 ::DestroyWindow(hwnd()); 31 ::DestroyWindow(hwnd());
29 } 32 }
30 33
31 // static 34 // static
32 scoped_ptr<LegacyRenderWidgetHostHWND> LegacyRenderWidgetHostHWND::Create( 35 scoped_ptr<LegacyRenderWidgetHostHWND> LegacyRenderWidgetHostHWND::Create(
33 HWND parent) { 36 HWND parent) {
34 // content_unittests passes in the desktop window as the parent. We allow 37 // content_unittests passes in the desktop window as the parent. We allow
35 // the LegacyRenderWidgetHostHWND instance to be created in this case for 38 // the LegacyRenderWidgetHostHWND instance to be created in this case for
36 // these tests to pass. 39 // these tests to pass.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 LRESULT LegacyRenderWidgetHostHWND::OnGetObject(UINT message, 136 LRESULT LegacyRenderWidgetHostHWND::OnGetObject(UINT message,
134 WPARAM w_param, 137 WPARAM w_param,
135 LPARAM l_param) { 138 LPARAM l_param) {
136 if (kIdScreenReaderHoneyPot == l_param) { 139 if (kIdScreenReaderHoneyPot == l_param) {
137 // When an MSAA client has responded to our fake event on this id, 140 // When an MSAA client has responded to our fake event on this id,
138 // enable screen reader support. 141 // enable screen reader support.
139 BrowserAccessibilityState::GetInstance()->OnScreenReaderDetected(); 142 BrowserAccessibilityState::GetInstance()->OnScreenReaderDetected();
140 return static_cast<LRESULT>(0L); 143 return static_cast<LRESULT>(0L);
141 } 144 }
142 145
143 if (OBJID_CLIENT != l_param || !manager_) 146 if (kObjIdClient != l_param || !manager_)
144 return static_cast<LRESULT>(0L); 147 return static_cast<LRESULT>(0L);
145 148
146 base::win::ScopedComPtr<IAccessible> root( 149 base::win::ScopedComPtr<IAccessible> root(
147 manager_->GetRoot()->ToBrowserAccessibilityWin()); 150 manager_->GetRoot()->ToBrowserAccessibilityWin());
148 return LresultFromObject(IID_IAccessible, w_param, 151 return LresultFromObject(IID_IAccessible, w_param,
149 static_cast<IAccessible*>(root.Detach())); 152 static_cast<IAccessible*>(root.Detach()));
150 } 153 }
151 154
152 // We send keyboard/mouse/touch messages to the parent window via SendMessage. 155 // We send keyboard/mouse/touch messages to the parent window via SendMessage.
153 // While this works, this has the side effect of converting input messages into 156 // While this works, this has the side effect of converting input messages into
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 // generate the legacy WM_VSCROLL/WM_HSCROLL messages. 321 // generate the legacy WM_VSCROLL/WM_HSCROLL messages.
319 // We add these styles to ensure that trackpad/trackpoint scrolling 322 // We add these styles to ensure that trackpad/trackpoint scrolling
320 // work. 323 // work.
321 long current_style = ::GetWindowLong(hwnd(), GWL_STYLE); 324 long current_style = ::GetWindowLong(hwnd(), GWL_STYLE);
322 ::SetWindowLong(hwnd(), GWL_STYLE, 325 ::SetWindowLong(hwnd(), GWL_STYLE,
323 current_style | WS_VSCROLL | WS_HSCROLL); 326 current_style | WS_VSCROLL | WS_HSCROLL);
324 return 0; 327 return 0;
325 } 328 }
326 329
327 } // namespace content 330 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/accessibility/accessibility_win_browsertest.cc ('k') | content/content_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698