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

Side by Side Diff: ui/views/win/hwnd_message_handler.cc

Issue 2781613003: Added a class acting as a fake caret for accessibility. (Closed)
Patch Set: Created 3 years, 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/win/hwnd_message_handler.h" 5 #include "ui/views/win/hwnd_message_handler.h"
6 6
7 #include <atlbase.h>
8 #include <atlcom.h>
7 #include <dwmapi.h> 9 #include <dwmapi.h>
8 #include <oleacc.h> 10 #include <oleacc.h>
9 #include <shellapi.h> 11 #include <shellapi.h>
10 #include <tchar.h> 12 #include <tchar.h>
11 13
12 #include <utility> 14 #include <utility>
13 15
14 #include "base/bind.h" 16 #include "base/bind.h"
15 #include "base/bind_helpers.h" 17 #include "base/bind_helpers.h"
16 #include "base/debug/alias.h" 18 #include "base/debug/alias.h"
17 #include "base/location.h" 19 #include "base/location.h"
18 #include "base/macros.h" 20 #include "base/macros.h"
19 #include "base/single_thread_task_runner.h" 21 #include "base/single_thread_task_runner.h"
20 #include "base/threading/thread_task_runner_handle.h" 22 #include "base/threading/thread_task_runner_handle.h"
21 #include "base/time/time.h" 23 #include "base/time/time.h"
22 #include "base/trace_event/trace_event.h" 24 #include "base/trace_event/trace_event.h"
23 #include "base/win/scoped_gdi_object.h" 25 #include "base/win/scoped_gdi_object.h"
24 #include "base/win/windows_version.h" 26 #include "base/win/windows_version.h"
27 #include "ui/accessibility/platform/ax_fake_caret_win.h"
25 #include "ui/base/view_prop.h" 28 #include "ui/base/view_prop.h"
26 #include "ui/base/win/internal_constants.h" 29 #include "ui/base/win/internal_constants.h"
27 #include "ui/base/win/lock_state.h" 30 #include "ui/base/win/lock_state.h"
28 #include "ui/base/win/mouse_wheel_util.h" 31 #include "ui/base/win/mouse_wheel_util.h"
29 #include "ui/base/win/shell.h" 32 #include "ui/base/win/shell.h"
30 #include "ui/base/win/touch_input.h" 33 #include "ui/base/win/touch_input.h"
31 #include "ui/display/win/dpi.h" 34 #include "ui/display/win/dpi.h"
32 #include "ui/display/win/screen_win.h" 35 #include "ui/display/win/screen_win.h"
33 #include "ui/events/event.h" 36 #include "ui/events/event.h"
34 #include "ui/events/event_utils.h" 37 #include "ui/events/event_utils.h"
(...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after
1503 1506
1504 // Only the lower 32 bits of l_param are valid when checking the object id 1507 // Only the lower 32 bits of l_param are valid when checking the object id
1505 // because it sometimes gets sign-extended incorrectly (but not always). 1508 // because it sometimes gets sign-extended incorrectly (but not always).
1506 DWORD obj_id = static_cast<DWORD>(static_cast<DWORD_PTR>(l_param)); 1509 DWORD obj_id = static_cast<DWORD>(static_cast<DWORD_PTR>(l_param));
1507 1510
1508 // Accessibility readers will send an OBJID_CLIENT message 1511 // Accessibility readers will send an OBJID_CLIENT message
1509 if (static_cast<DWORD>(OBJID_CLIENT) == obj_id) { 1512 if (static_cast<DWORD>(OBJID_CLIENT) == obj_id) {
1510 // Retrieve MSAA dispatch object for the root view. 1513 // Retrieve MSAA dispatch object for the root view.
1511 base::win::ScopedComPtr<IAccessible> root( 1514 base::win::ScopedComPtr<IAccessible> root(
1512 delegate_->GetNativeViewAccessible()); 1515 delegate_->GetNativeViewAccessible());
1513
1514 // Create a reference that MSAA will marshall to the client.
1515 reference_result = LresultFromObject(IID_IAccessible, w_param, 1516 reference_result = LresultFromObject(IID_IAccessible, w_param,
1516 static_cast<IAccessible*>(root.Detach())); 1517 static_cast<IAccessible*>(root.Detach()));
1518 } else if (static_cast<DWORD>(OBJID_CARET) == obj_id) {
1519 // Used by some assistive software to retrieve the location of the caret.
1520 CComObjectStack<ui::AXFakeCaretWin> fake_caret;
1521 DCHECK_EQ(fake_caret.m_hResFinalConstruct, S_OK);
1522 reference_result = LresultFromObject(
1523 IID_IAccessible, w_param, static_cast<IAccessible*>(&fake_caret));
1517 } 1524 }
1518 1525
1519 return reference_result; 1526 return reference_result;
1520 } 1527 }
1521 1528
1522 LRESULT HWNDMessageHandler::OnImeMessages(UINT message, 1529 LRESULT HWNDMessageHandler::OnImeMessages(UINT message,
1523 WPARAM w_param, 1530 WPARAM w_param,
1524 LPARAM l_param) { 1531 LPARAM l_param) {
1525 LRESULT result = 0; 1532 LRESULT result = 0;
1526 base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr()); 1533 base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr());
(...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after
2783 MONITORINFO monitor_info = {sizeof(monitor_info)}; 2790 MONITORINFO monitor_info = {sizeof(monitor_info)};
2784 GetMonitorInfo(MonitorFromWindow(hwnd(), MONITOR_DEFAULTTOPRIMARY), 2791 GetMonitorInfo(MonitorFromWindow(hwnd(), MONITOR_DEFAULTTOPRIMARY),
2785 &monitor_info); 2792 &monitor_info);
2786 gfx::Rect shrunk_rect(monitor_info.rcMonitor); 2793 gfx::Rect shrunk_rect(monitor_info.rcMonitor);
2787 shrunk_rect.set_height(shrunk_rect.height() - 1); 2794 shrunk_rect.set_height(shrunk_rect.height() - 1);
2788 background_fullscreen_hack_ = true; 2795 background_fullscreen_hack_ = true;
2789 SetBoundsInternal(shrunk_rect, false); 2796 SetBoundsInternal(shrunk_rect, false);
2790 } 2797 }
2791 2798
2792 } // namespace views 2799 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698