Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_LEGACY_RENDER_WIDGET_HOST_WIN_H_ | |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_LEGACY_RENDER_WIDGET_HOST_WIN_H_ | |
| 7 | |
| 8 #include <atlbase.h> | |
| 9 #include <atlapp.h> | |
|
cpu_(ooo_6.6-7.5)
2014/02/04 22:35:58
do wee need atlapp? and atlcom ?
ananta
2014/02/04 23:30:45
Changed to only include atlwin.h
| |
| 10 #include <atlcom.h> | |
| 11 #include <atlcrack.h> | |
| 12 #include <oleacc.h> | |
| 13 | |
| 14 #include "base/basictypes.h" | |
| 15 #include "base/win/scoped_comptr.h" | |
| 16 #include "content/common/content_export.h" | |
| 17 | |
| 18 namespace content { | |
| 19 class BrowserAccessibilityManagerWin; | |
| 20 | |
| 21 // Some screen readers expect every tab / every unique web content container | |
|
cpu_(ooo_6.6-7.5)
2014/02/04 22:35:58
Please update this comment to reflect the other re
ananta
2014/02/04 23:30:45
Done.
| |
| 22 // to be in its own HWND with class name Chrome_RenderWidgetHostHWND. | |
| 23 // With Aura there is one main HWND which comprises the whole browser window or | |
| 24 // the whole desktop. So, we need a fake HWND with the window class as | |
| 25 // Chrome_RenderWidgetHostHWND as the root of the accessibility tree for each | |
| 26 // tab. Additionally there are legacy drivers for trackpads/trackpoints which | |
| 27 // also have special code for sending mouse wheel and scroll events to the | |
| 28 // Chrome_RenderWidgetHostHWND window. | |
| 29 // We should get rid of this code when the latest two versions of all | |
| 30 // supported screen readers and legacy drivers no longer make this assumption. | |
| 31 | |
| 32 // This class implements a child HWND with the same size as the content area, | |
| 33 // that delegates its accessibility implementation to the root of the | |
| 34 // BrowserAccessibilityManager tree. This HWND is hooked up as the parent of | |
| 35 // the root object in the BrowserAccessibilityManager tree, so when any | |
| 36 // accessibility client calls ::WindowFromAccessibleObject, they get this | |
| 37 // HWND instead of the DesktopWindowTreeHostWin. | |
| 38 class CONTENT_EXPORT LegacyRenderWidgetHostHWND | |
| 39 : public ATL::CWindowImpl<LegacyRenderWidgetHostHWND, | |
| 40 NON_EXPORTED_BASE(ATL::CWindow), | |
| 41 ATL::CWinTraits<WS_CHILD> > { | |
| 42 public: | |
| 43 // Unfortunately, some screen readers trackpoint drivers look for this exact | |
| 44 //window class to enable certain features. It'd be great to remove this. | |
|
cpu_(ooo_6.6-7.5)
2014/02/04 22:35:58
remove comment 43/44 since we'll have a better exp
ananta
2014/02/04 23:30:45
Done.
| |
| 45 DECLARE_WND_CLASS_EX(L"Chrome_RenderWidgetHostHWND", CS_DBLCLKS, 0); | |
| 46 | |
| 47 explicit LegacyRenderWidgetHostHWND(HWND parent); | |
| 48 ~LegacyRenderWidgetHostHWND(); | |
| 49 | |
| 50 BEGIN_MSG_MAP_EX(LegacyRenderWidgetHostHWND) | |
| 51 MESSAGE_HANDLER_EX(WM_GETOBJECT, OnGetObject) | |
| 52 MESSAGE_RANGE_HANDLER(WM_KEYFIRST, WM_KEYLAST, OnKeyboardRange) | |
| 53 MESSAGE_HANDLER_EX(WM_PAINT, OnPaint) | |
| 54 MESSAGE_HANDLER_EX(WM_NCPAINT, OnNCPaint) | |
| 55 MESSAGE_HANDLER_EX(WM_ERASEBKGND, OnEraseBkGnd) | |
| 56 MESSAGE_RANGE_HANDLER(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseRange) | |
| 57 MESSAGE_HANDLER_EX(WM_MOUSEACTIVATE, OnMouseActivate) | |
| 58 MESSAGE_HANDLER_EX(WM_SETCURSOR, OnSetCursor) | |
| 59 MESSAGE_HANDLER_EX(WM_TOUCH, OnTouch) | |
| 60 END_MSG_MAP() | |
| 61 | |
| 62 HWND hwnd() { return m_hWnd; } | |
| 63 | |
| 64 // This function handles setting the parent window if it changed, etc. | |
| 65 void SetParentWindow(HWND parent); | |
| 66 | |
| 67 HWND parent() { return parent_; } | |
| 68 | |
| 69 IAccessible* window_accessible() { return window_accessible_; } | |
| 70 | |
| 71 void set_browser_accessibility_manager( | |
| 72 content::BrowserAccessibilityManagerWin* manager) { | |
| 73 manager_ = manager; | |
| 74 } | |
| 75 | |
| 76 void OnManagerDeleted(); | |
| 77 | |
| 78 void Show(); | |
| 79 void Hide(); | |
| 80 | |
| 81 protected: | |
| 82 virtual void OnFinalMessage(HWND hwnd) OVERRIDE; | |
| 83 | |
| 84 private: | |
| 85 LRESULT OnEraseBkGnd(UINT message, WPARAM w_param, LPARAM l_param); | |
| 86 LRESULT OnGetObject(UINT message, WPARAM w_param, LPARAM l_param); | |
| 87 LRESULT OnKeyboardRange(UINT message, WPARAM w_param, LPARAM l_param, | |
| 88 BOOL& handled); | |
| 89 LRESULT OnMouseRange(UINT message, WPARAM w_param, LPARAM l_param, | |
| 90 BOOL& handled); | |
| 91 LRESULT OnMouseActivate(UINT message, WPARAM w_param, LPARAM l_param); | |
| 92 LRESULT OnTouch(UINT message, WPARAM w_param, LPARAM l_param); | |
| 93 | |
| 94 LRESULT OnNCPaint(UINT message, WPARAM w_param, LPARAM l_param); | |
| 95 LRESULT OnPaint(UINT message, WPARAM w_param, LPARAM l_param); | |
| 96 LRESULT OnSetCursor(UINT message, WPARAM w_param, LPARAM l_param); | |
| 97 | |
| 98 content::BrowserAccessibilityManagerWin* manager_; | |
| 99 base::win::ScopedComPtr<IAccessible> window_accessible_; | |
| 100 HWND parent_; | |
| 101 | |
| 102 DISALLOW_COPY_AND_ASSIGN(LegacyRenderWidgetHostHWND); | |
| 103 }; | |
| 104 | |
| 105 } // namespace content | |
| 106 | |
| 107 #endif // CONTENT_BROWSER_RENDERER_HOST_LEGACY_RENDER_WIDGET_HOST_WIN_H_ | |
| 108 | |
| OLD | NEW |