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

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: Activate the fake caret only when Windows is focused. 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 <dwmapi.h> 7 #include <dwmapi.h>
8 #include <oleacc.h> 8 #include <oleacc.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #include <tchar.h> 10 #include <tchar.h>
11 11
12 #include <utility> 12 #include <utility>
13 13
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/bind_helpers.h" 15 #include "base/bind_helpers.h"
16 #include "base/debug/alias.h" 16 #include "base/debug/alias.h"
17 #include "base/location.h" 17 #include "base/location.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/single_thread_task_runner.h" 19 #include "base/single_thread_task_runner.h"
20 #include "base/threading/thread_task_runner_handle.h" 20 #include "base/threading/thread_task_runner_handle.h"
21 #include "base/time/time.h" 21 #include "base/time/time.h"
22 #include "base/trace_event/trace_event.h" 22 #include "base/trace_event/trace_event.h"
23 #include "base/win/scoped_comptr.h"
23 #include "base/win/scoped_gdi_object.h" 24 #include "base/win/scoped_gdi_object.h"
24 #include "base/win/windows_version.h" 25 #include "base/win/windows_version.h"
26 #include "ui/accessibility/platform/ax_fake_caret_win.h"
27 #include "ui/accessibility/platform/ax_platform_node_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_constants.h" 37 #include "ui/events/event_constants.h"
(...skipping 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 1517
1515 // Only the lower 32 bits of l_param are valid when checking the object id 1518 // Only the lower 32 bits of l_param are valid when checking the object id
1516 // because it sometimes gets sign-extended incorrectly (but not always). 1519 // because it sometimes gets sign-extended incorrectly (but not always).
1517 DWORD obj_id = static_cast<DWORD>(static_cast<DWORD_PTR>(l_param)); 1520 DWORD obj_id = static_cast<DWORD>(static_cast<DWORD_PTR>(l_param));
1518 1521
1519 // Accessibility readers will send an OBJID_CLIENT message 1522 // Accessibility readers will send an OBJID_CLIENT message
1520 if (static_cast<DWORD>(OBJID_CLIENT) == obj_id) { 1523 if (static_cast<DWORD>(OBJID_CLIENT) == obj_id) {
1521 // Retrieve MSAA dispatch object for the root view. 1524 // Retrieve MSAA dispatch object for the root view.
1522 base::win::ScopedComPtr<IAccessible> root( 1525 base::win::ScopedComPtr<IAccessible> root(
1523 delegate_->GetNativeViewAccessible()); 1526 delegate_->GetNativeViewAccessible());
1524
1525 // Create a reference that MSAA will marshall to the client.
1526 reference_result = LresultFromObject(IID_IAccessible, w_param, 1527 reference_result = LresultFromObject(IID_IAccessible, w_param,
1527 static_cast<IAccessible*>(root.Detach())); 1528 static_cast<IAccessible*>(root.Detach()));
1529 } else if (static_cast<DWORD>(OBJID_CARET) == obj_id) {
1530 // Used by some assistive software to retrieve the location of the caret.
1531 ui::AXFakeCaretWin* fake_caret = ui::g_ax_fake_caret_win.Pointer();
1532 DCHECK(fake_caret);
1533 base::win::ScopedComPtr<IAccessible> fake_caret_accessible =
1534 fake_caret->GetCaret();
1535 reference_result = LresultFromObject(IID_IAccessible, w_param,
1536 fake_caret_accessible.Detach());
1528 } 1537 }
1529 1538
1530 return reference_result; 1539 return reference_result;
1531 } 1540 }
1532 1541
1533 LRESULT HWNDMessageHandler::OnImeMessages(UINT message, 1542 LRESULT HWNDMessageHandler::OnImeMessages(UINT message,
1534 WPARAM w_param, 1543 WPARAM w_param,
1535 LPARAM l_param) { 1544 LPARAM l_param) {
1536 LRESULT result = 0; 1545 LRESULT result = 0;
1537 base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr()); 1546 base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr());
(...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after
2902 MONITORINFO monitor_info = {sizeof(monitor_info)}; 2911 MONITORINFO monitor_info = {sizeof(monitor_info)};
2903 GetMonitorInfo(MonitorFromWindow(hwnd(), MONITOR_DEFAULTTOPRIMARY), 2912 GetMonitorInfo(MonitorFromWindow(hwnd(), MONITOR_DEFAULTTOPRIMARY),
2904 &monitor_info); 2913 &monitor_info);
2905 gfx::Rect shrunk_rect(monitor_info.rcMonitor); 2914 gfx::Rect shrunk_rect(monitor_info.rcMonitor);
2906 shrunk_rect.set_height(shrunk_rect.height() - 1); 2915 shrunk_rect.set_height(shrunk_rect.height() - 1);
2907 background_fullscreen_hack_ = true; 2916 background_fullscreen_hack_ = true;
2908 SetBoundsInternal(shrunk_rect, false); 2917 SetBoundsInternal(shrunk_rect, false);
2909 } 2918 }
2910 2919
2911 } // namespace views 2920 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698