summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/views/hwnd_view_container.cc48
-rw-r--r--chrome/views/hwnd_view_container.h16
2 files changed, 63 insertions, 1 deletions
diff --git a/chrome/views/hwnd_view_container.cc b/chrome/views/hwnd_view_container.cc
index 69545c9..12c0de4 100644
--- a/chrome/views/hwnd_view_container.cc
+++ b/chrome/views/hwnd_view_container.cc
@@ -36,6 +36,7 @@
#include "chrome/common/notification_service.h"
#include "chrome/common/win_util.h"
#include "chrome/views/aero_tooltip_manager.h"
+#include "chrome/views/accessibility/view_accessibility.h"
#include "chrome/views/focus_manager.h"
#include "chrome/views/hwnd_notification_source.h"
#include "chrome/views/root_view.h"
@@ -473,6 +474,53 @@ LRESULT HWNDViewContainer::OnEraseBkgnd(HDC dc) {
return 1;
}
+LRESULT HWNDViewContainer::OnGetObject(UINT uMsg, WPARAM w_param,
+ LPARAM l_param) {
+ LRESULT reference_result = static_cast<LRESULT>(0L);
+
+ // Accessibility readers will send an OBJID_CLIENT message
+ if (OBJID_CLIENT == l_param) {
+ // If our MSAA root is already created, reuse that pointer. Otherwise,
+ // create a new one.
+ if (!accessibility_root_) {
+ CComObject<ViewAccessibility>* instance = NULL;
+
+ HRESULT hr = CComObject<ViewAccessibility>::CreateInstance(&instance);
+ DCHECK(SUCCEEDED(hr));
+
+ if (!instance) {
+ // Return with failure.
+ return static_cast<LRESULT>(0L);
+ }
+
+ CComPtr<IAccessible> accessibility_instance(instance);
+
+ if (!SUCCEEDED(instance->Initialize(root_view_.get()))) {
+ // Return with failure.
+ return static_cast<LRESULT>(0L);
+ }
+
+ // All is well, assign the temp instance to the class smart pointer
+ accessibility_root_.Attach(accessibility_instance.Detach());
+
+ if (!accessibility_root_) {
+ // Return with failure.
+ return static_cast<LRESULT>(0L);
+ }
+
+ // Notify that an instance of IAccessible was allocated for m_hWnd
+ ::NotifyWinEvent(EVENT_OBJECT_CREATE, GetHWND(), OBJID_CLIENT,
+ CHILDID_SELF);
+ }
+
+ // Create a reference to ViewAccessibility that MSAA will marshall
+ // to the client.
+ reference_result = LresultFromObject(IID_IAccessible, w_param,
+ static_cast<IAccessible*>(accessibility_root_));
+ }
+ return reference_result;
+}
+
void HWNDViewContainer::OnKeyDown(TCHAR c, UINT rep_cnt, UINT flags) {
KeyEvent event(Event::ET_KEY_PRESSED, c, rep_cnt, flags);
root_view_->ProcessKeyEvent(event);
diff --git a/chrome/views/hwnd_view_container.h b/chrome/views/hwnd_view_container.h
index c9ceb12..c420e42 100644
--- a/chrome/views/hwnd_view_container.h
+++ b/chrome/views/hwnd_view_container.h
@@ -178,6 +178,9 @@ class HWNDViewContainer : public ViewContainer,
// Reflected message handler
MESSAGE_HANDLER_EX(kReflectedMessage, OnReflectedMessage)
+
+ // Non-atlcrack.h handlers
+ MESSAGE_HANDLER_EX(WM_GETOBJECT, OnGetObject)
// This list is in _ALPHABETICAL_ order! OR I WILL HURT YOU.
MSG_WM_ACTIVATE(OnActivate)
@@ -188,6 +191,7 @@ class HWNDViewContainer : public ViewContainer,
MSG_WM_CREATE(OnCreate)
MSG_WM_DESTROY(OnDestroy)
MSG_WM_ERASEBKGND(OnEraseBkgnd)
+ MSG_WM_ENDSESSION(OnEndSession)
MSG_WM_GETMINMAXINFO(OnGetMinMaxInfo)
MSG_WM_HSCROLL(OnHScroll)
MSG_WM_INITMENU(OnInitMenu)
@@ -217,6 +221,7 @@ class HWNDViewContainer : public ViewContainer,
MSG_WM_NCRBUTTONUP(OnNCRButtonUp)
MSG_WM_NOTIFY(OnNotify)
MSG_WM_PAINT(OnPaint)
+ MSG_WM_POWERBROADCAST(OnPowerBroadcast)
MSG_WM_RBUTTONDBLCLK(OnRButtonDblClk)
MSG_WM_RBUTTONDOWN(OnRButtonDown)
MSG_WM_RBUTTONUP(OnRButtonUp)
@@ -338,8 +343,10 @@ class HWNDViewContainer : public ViewContainer,
// WARNING: If you override this be sure and invoke super, otherwise we'll
// leak a few things.
virtual void OnDestroy();
+ virtual void OnEndSession(BOOL ending, UINT logoff) { SetMsgHandled(FALSE); }
virtual LRESULT OnEraseBkgnd(HDC dc);
virtual void OnGetMinMaxInfo(LPMINMAXINFO mm_info) { }
+ virtual LRESULT OnGetObject(UINT uMsg, WPARAM w_param, LPARAM l_param);
virtual void OnHScroll(int scroll_type, short position, HWND scrollbar) {
SetMsgHandled(FALSE);
}
@@ -371,6 +378,10 @@ class HWNDViewContainer : public ViewContainer,
virtual void OnNCRButtonUp(UINT flags, const CPoint& point);
virtual LRESULT OnNotify(int w_param, NMHDR* l_param);
virtual void OnPaint(HDC dc);
+ virtual LRESULT OnPowerBroadcast(DWORD power_event, DWORD data) {
+ SetMsgHandled(FALSE);
+ return 0;
+ }
virtual void OnRButtonDblClk(UINT flags, const CPoint& point);
virtual void OnRButtonDown(UINT flags, const CPoint& point);
virtual void OnRButtonUp(UINT flags, const CPoint& point);
@@ -517,10 +528,13 @@ class HWNDViewContainer : public ViewContainer,
// If true, the last event was a mouse move event.
bool last_mouse_event_was_move_;
- // Coordinates of the last mouse move event, in terms of the screen.
+ // Coordinates of the last mouse move event, in screen coordinates.
int last_mouse_move_x_;
int last_mouse_move_y_;
+ // Instance of accessibility information and handling for MSAA root
+ CComPtr<IAccessible> accessibility_root_;
+
// Our hwnd.
HWND hwnd_;
};