| OLD | NEW | 
|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_WIN_H_ | 5 #ifndef VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_WIN_H_ | 
| 6 #define VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_WIN_H_ | 6 #define VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_WIN_H_ | 
| 7 #pragma once | 7 #pragma once | 
| 8 | 8 | 
| 9 #include <atlbase.h> | 9 #include <atlbase.h> | 
| 10 #include <atlcom.h> | 10 #include <atlcom.h> | 
| 11 | 11 | 
| 12 #include <oleacc.h> | 12 #include <oleacc.h> | 
| 13 | 13 | 
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" | 
| 15 #include "ui/base/accessibility/accessible_view_state.h" | 15 #include "ui/base/accessibility/accessible_view_state.h" | 
| 16 #include "views/controls/native/native_view_host.h" | 16 #include "views/controls/native/native_view_host.h" | 
| 17 #include "views/view.h" | 17 #include "views/view.h" | 
| 18 | 18 | 
| 19 namespace views { |  | 
| 20 extern const char kViewsNativeHostPropForAccessibility[]; |  | 
| 21 // Note: do not put NativeViewAccessibilityWin in the namespace "views"; | 19 // Note: do not put NativeViewAccessibilityWin in the namespace "views"; | 
| 22 // Visual Studio 2005 does not allow an ATL::CComObject symbol in a namespace. | 20 // Visual Studio 2005 does not allow an ATL::CComObject symbol in a namespace. | 
| 23 } |  | 
| 24 | 21 | 
| 25 //////////////////////////////////////////////////////////////////////////////// | 22 //////////////////////////////////////////////////////////////////////////////// | 
| 26 // | 23 // | 
| 27 // NativeViewAccessibilityWin | 24 // NativeViewAccessibilityWin | 
| 28 // | 25 // | 
| 29 // Class implementing the MSAA IAccessible COM interface for a generic View, | 26 // Class implementing the MSAA IAccessible COM interface for a generic View, | 
| 30 // providing accessibility to be used by screen readers and other assistive | 27 // providing accessibility to be used by screen readers and other assistive | 
| 31 // technology (AT). | 28 // technology (AT). | 
| 32 // | 29 // | 
| 33 //////////////////////////////////////////////////////////////////////////////// | 30 //////////////////////////////////////////////////////////////////////////////// | 
| 34 class ATL_NO_VTABLE NativeViewAccessibilityWin | 31 class ATL_NO_VTABLE NativeViewAccessibilityWin | 
| 35   : public CComObjectRootEx<CComMultiThreadModel>, | 32   : public CComObjectRootEx<CComMultiThreadModel>, | 
| 36     public IDispatchImpl<IAccessible, &IID_IAccessible, &LIBID_Accessibility> { | 33     public IDispatchImpl<IAccessible, &IID_IAccessible, &LIBID_Accessibility> { | 
| 37  public: | 34  public: | 
| 38   BEGIN_COM_MAP(NativeViewAccessibilityWin) | 35   BEGIN_COM_MAP(NativeViewAccessibilityWin) | 
| 39     COM_INTERFACE_ENTRY2(IDispatch, IAccessible) | 36     COM_INTERFACE_ENTRY2(IDispatch, IAccessible) | 
| 40     COM_INTERFACE_ENTRY(IAccessible) | 37     COM_INTERFACE_ENTRY(IAccessible) | 
| 41   END_COM_MAP() | 38   END_COM_MAP() | 
| 42 | 39 | 
| 43   // Create method for view accessibility. | 40   // Create method for view accessibility. | 
| 44   static scoped_refptr<NativeViewAccessibilityWin> Create(views::View* view); | 41   static scoped_refptr<NativeViewAccessibilityWin> Create(views::View* view); | 
| 45 | 42 | 
| 46   // Returns the IAccessible interface for a view. |  | 
| 47   static IAccessible* GetAccessibleForView(views::View* view); |  | 
| 48 |  | 
| 49   virtual ~NativeViewAccessibilityWin(); | 43   virtual ~NativeViewAccessibilityWin(); | 
| 50 | 44 | 
| 51   void set_view(views::View* view) { view_ = view; } | 45   void set_view(views::View* view) { view_ = view; } | 
| 52 | 46 | 
| 53   // Supported IAccessible methods. | 47   // Supported IAccessible methods. | 
| 54 | 48 | 
| 55   // Retrieves the child element or child object at a given point on the screen. | 49   // Retrieves the child element or child object at a given point on the screen. | 
| 56   STDMETHODIMP accHitTest(LONG x_left, LONG y_top, VARIANT* child); | 50   STDMETHODIMP accHitTest(LONG x_left, LONG y_top, VARIANT* child); | 
| 57 | 51 | 
| 58   // Performs the object's default action. | 52   // Performs the object's default action. | 
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 143                   int start_id, | 137                   int start_id, | 
| 144                   int lower_bound, | 138                   int lower_bound, | 
| 145                   int upper_bound) const; | 139                   int upper_bound) const; | 
| 146 | 140 | 
| 147   // Determines if the child id variant is valid. | 141   // Determines if the child id variant is valid. | 
| 148   bool IsValidId(const VARIANT& child) const; | 142   bool IsValidId(const VARIANT& child) const; | 
| 149 | 143 | 
| 150   // Helper function which sets applicable states of view. | 144   // Helper function which sets applicable states of view. | 
| 151   void SetState(VARIANT* msaa_state, views::View* view); | 145   void SetState(VARIANT* msaa_state, views::View* view); | 
| 152 | 146 | 
| 153   // Returns the IAccessible interface for a native view if applicable. |  | 
| 154   // Returns S_OK on success. |  | 
| 155   static HRESULT GetNativeIAccessibleInterface( |  | 
| 156       views::NativeViewHost* native_host, IAccessible** accessible); |  | 
| 157 |  | 
| 158   static HRESULT GetNativeIAccessibleInterface( |  | 
| 159       HWND native_view_window, IAccessible** accessible); |  | 
| 160 |  | 
| 161   // Give CComObject access to the class constructor. | 147   // Give CComObject access to the class constructor. | 
| 162   template <class Base> friend class CComObject; | 148   template <class Base> friend class CComObject; | 
| 163 | 149 | 
| 164   // Member View needed for view-specific calls. | 150   // Member View needed for view-specific calls. | 
| 165   views::View* view_; | 151   views::View* view_; | 
| 166 | 152 | 
| 167   DISALLOW_COPY_AND_ASSIGN(NativeViewAccessibilityWin); | 153   DISALLOW_COPY_AND_ASSIGN(NativeViewAccessibilityWin); | 
| 168 }; | 154 }; | 
| 169 | 155 | 
| 170 #endif  // VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_WIN_H_ | 156 #endif  // VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_WIN_H_ | 
| OLD | NEW | 
|---|