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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/win/hwnd_message_handler.cc
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
index 94ba71385f4323bd06674ea29a4fb9beabdf41cf..74c92cf9d5f8a380ed0cb4e29c78d3e60c661f18 100644
--- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc
@@ -20,8 +20,11 @@
#include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
+#include "base/win/scoped_comptr.h"
#include "base/win/scoped_gdi_object.h"
#include "base/win/windows_version.h"
+#include "ui/accessibility/platform/ax_fake_caret_win.h"
+#include "ui/accessibility/platform/ax_platform_node_win.h"
#include "ui/base/view_prop.h"
#include "ui/base/win/internal_constants.h"
#include "ui/base/win/lock_state.h"
@@ -1521,10 +1524,16 @@ LRESULT HWNDMessageHandler::OnGetObject(UINT message,
// Retrieve MSAA dispatch object for the root view.
base::win::ScopedComPtr<IAccessible> root(
delegate_->GetNativeViewAccessible());
-
- // Create a reference that MSAA will marshall to the client.
reference_result = LresultFromObject(IID_IAccessible, w_param,
static_cast<IAccessible*>(root.Detach()));
+ } else if (static_cast<DWORD>(OBJID_CARET) == obj_id) {
+ // Used by some assistive software to retrieve the location of the caret.
+ ui::AXFakeCaretWin* fake_caret = ui::g_ax_fake_caret_win.Pointer();
+ DCHECK(fake_caret);
+ base::win::ScopedComPtr<IAccessible> fake_caret_accessible =
+ fake_caret->GetCaret();
+ reference_result = LresultFromObject(IID_IAccessible, w_param,
+ fake_caret_accessible.Detach());
}
return reference_result;

Powered by Google App Engine
This is Rietveld 408576698