Chromium Code Reviews| Index: content/browser/accessibility/browser_accessibility_com_win.h |
| diff --git a/content/browser/accessibility/browser_accessibility_win.h b/content/browser/accessibility/browser_accessibility_com_win.h |
| similarity index 76% |
| copy from content/browser/accessibility/browser_accessibility_win.h |
| copy to content/browser/accessibility/browser_accessibility_com_win.h |
| index 1ebf93102c34b58a34882ba44f9da74ca4f05ab5..03cb483a3ec91a049ea50cd1da6d95393f27bc20 100644 |
| --- a/content/browser/accessibility/browser_accessibility_win.h |
| +++ b/content/browser/accessibility/browser_accessibility_com_win.h |
| @@ -1,23 +1,24 @@ |
| -// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Copyright (c) 2017 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_ |
| -#define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_ |
| +#ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_COM_WIN_H_ |
| +#define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_COM_WIN_H_ |
| #include <atlbase.h> |
| #include <atlcom.h> |
| #include <oleacc.h> |
| #include <stddef.h> |
| #include <stdint.h> |
| -#include <UIAutomationCore.h> |
| - |
| #include <vector> |
| +#include <UIAutomationCore.h> |
| + |
| #include "base/compiler_specific.h" |
| #include "base/gtest_prod_util.h" |
| #include "base/macros.h" |
| #include "content/browser/accessibility/browser_accessibility.h" |
| +#include "content/browser/accessibility/browser_accessibility_win.h" |
| #include "content/common/content_export.h" |
| #include "third_party/iaccessible2/ia2_api_all.h" |
| #include "third_party/isimpledom/ISimpleDOMDocument.h" |
| @@ -25,59 +26,58 @@ |
| #include "third_party/isimpledom/ISimpleDOMText.h" |
| #include "ui/accessibility/platform/ax_platform_node_win.h" |
| +namespace ui { |
| +enum TextBoundaryDirection; |
| +enum TextBoundaryType; |
| +} |
| + |
| namespace content { |
| +class BrowserAccessibilityWin; |
| class BrowserAccessibilityRelation; |
| //////////////////////////////////////////////////////////////////////////////// |
| // |
| -// BrowserAccessibilityWin |
| +// BrowserAccessibilityComWin |
| // |
| -// Class implementing the windows accessible interface for the Browser-Renderer |
| -// communication of accessibility information, providing accessibility |
| -// to be used by screen readers and other assistive technology (AT). |
| +// Class implementing the windows accessible interface used by screen readers |
| +// and other assistive technology (AT). It typically is created and owned by |
| +// a BrowserAccessibilityCom |owner_|. When this owner goes away, the |
|
dmazzoni
2017/05/08 04:45:24
BrowserAccessibilityCom -> BrowserAccessibilityWin
dougt
2017/05/08 16:53:36
Done.
|
| +// BrowserAccessibilityComWin objects may continue to exists being held onto by |
|
dmazzoni
2017/05/08 04:45:24
Mention due to reference counting
dougt
2017/05/08 16:53:36
Done.
|
| +// MSCOM. However, such objects are invalid and should gracefully fail. |
|
dmazzoni
2017/05/08 04:45:24
Should return E_FAIL from everything when instance
dougt
2017/05/08 16:53:36
Done.
|
| // |
| //////////////////////////////////////////////////////////////////////////////// |
| class __declspec(uuid("562072fe-3390-43b1-9e2c-dd4118f5ac79")) |
| -BrowserAccessibilityWin |
| - : public BrowserAccessibility, |
| - public CComObjectRootEx<CComMultiThreadModel>, |
| - public IDispatchImpl<IAccessible2, &IID_IAccessible2, |
| - &LIBID_IAccessible2Lib>, |
| - public IAccessibleApplication, |
| - public IAccessibleHyperlink, |
| - public IAccessibleHypertext, |
| - public IAccessibleImage, |
| - public IAccessibleTable, |
| - public IAccessibleTable2, |
| - public IAccessibleTableCell, |
| - public IAccessibleValue, |
| - public IServiceProvider, |
| - public ISimpleDOMDocument, |
| - public ISimpleDOMNode, |
| - public ISimpleDOMText, |
| - public IAccessibleEx, |
| - public IRawElementProviderSimple { |
| + BrowserAccessibilityComWin : public ui::AXPlatformNodeWin, |
| + public IAccessibleApplication, |
| + public IAccessibleHyperlink, |
| + public IAccessibleHypertext, |
| + public IAccessibleImage, |
| + public IAccessibleTable, |
| + public IAccessibleTable2, |
| + public IAccessibleTableCell, |
| + public IAccessibleValue, |
| + public ISimpleDOMDocument, |
| + public ISimpleDOMNode, |
| + public ISimpleDOMText, |
| + public IAccessibleEx, |
| + public IRawElementProviderSimple { |
| public: |
| - BEGIN_COM_MAP(BrowserAccessibilityWin) |
| - COM_INTERFACE_ENTRY2(IDispatch, IAccessible2) |
| - COM_INTERFACE_ENTRY(IAccessible) |
| - COM_INTERFACE_ENTRY(IAccessible2) |
| - COM_INTERFACE_ENTRY(IAccessibleAction) |
| - COM_INTERFACE_ENTRY(IAccessibleApplication) |
| - COM_INTERFACE_ENTRY(IAccessibleEx) |
| - COM_INTERFACE_ENTRY(IAccessibleHyperlink) |
| - COM_INTERFACE_ENTRY(IAccessibleHypertext) |
| - COM_INTERFACE_ENTRY(IAccessibleImage) |
| - COM_INTERFACE_ENTRY(IAccessibleTable) |
| - COM_INTERFACE_ENTRY(IAccessibleTable2) |
| - COM_INTERFACE_ENTRY(IAccessibleTableCell) |
| - COM_INTERFACE_ENTRY(IAccessibleText) |
| - COM_INTERFACE_ENTRY(IAccessibleValue) |
| - COM_INTERFACE_ENTRY(IRawElementProviderSimple) |
| - COM_INTERFACE_ENTRY(IServiceProvider) |
| - COM_INTERFACE_ENTRY(ISimpleDOMDocument) |
| - COM_INTERFACE_ENTRY(ISimpleDOMNode) |
| - COM_INTERFACE_ENTRY(ISimpleDOMText) |
| + BEGIN_COM_MAP(BrowserAccessibilityComWin) |
| + COM_INTERFACE_ENTRY(IAccessibleAction) |
| + COM_INTERFACE_ENTRY(IAccessibleApplication) |
| + COM_INTERFACE_ENTRY(IAccessibleEx) |
| + COM_INTERFACE_ENTRY(IAccessibleHyperlink) |
| + COM_INTERFACE_ENTRY(IAccessibleHypertext) |
| + COM_INTERFACE_ENTRY(IAccessibleImage) |
| + COM_INTERFACE_ENTRY(IAccessibleTable) |
| + COM_INTERFACE_ENTRY(IAccessibleTable2) |
| + COM_INTERFACE_ENTRY(IAccessibleTableCell) |
| + COM_INTERFACE_ENTRY(IAccessibleValue) |
| + COM_INTERFACE_ENTRY(IRawElementProviderSimple) |
| + COM_INTERFACE_ENTRY(ISimpleDOMDocument) |
| + COM_INTERFACE_ENTRY(ISimpleDOMNode) |
| + COM_INTERFACE_ENTRY(ISimpleDOMText) |
| + COM_INTERFACE_ENTRY_CHAIN(ui::AXPlatformNodeWin) |
| END_COM_MAP() |
| // Represents a non-static text node in IAccessibleHypertext. This character |
| @@ -90,9 +90,8 @@ BrowserAccessibilityWin |
| static std::map<int32_t, base::string16> role_string_map; |
| static std::map<int32_t, base::string16> state_string_map; |
| - CONTENT_EXPORT BrowserAccessibilityWin(); |
| - |
| - CONTENT_EXPORT ~BrowserAccessibilityWin() override; |
| + CONTENT_EXPORT BrowserAccessibilityComWin(); |
| + CONTENT_EXPORT ~BrowserAccessibilityComWin() override; |
| // Called after an atomic tree update completes. See |
| // BrowserAccessibilityManagerWin::OnAtomicUpdateFinished for more |
| @@ -101,20 +100,6 @@ BrowserAccessibilityWin |
| CONTENT_EXPORT void UpdateStep2ComputeHypertext(); |
| CONTENT_EXPORT void UpdateStep3FireEvents(bool is_subtree_creation); |
| - // This is used to call UpdateStep1ComputeWinAttributes, ... above when |
| - // a node needs to be updated for some other reason other than via |
| - // OnAtomicUpdateFinished. |
| - CONTENT_EXPORT void UpdatePlatformAttributes() override; |
| - |
| - // |
| - // BrowserAccessibility methods. |
| - // |
| - CONTENT_EXPORT void OnSubtreeWillBeDeleted() override; |
| - CONTENT_EXPORT void NativeAddReference() override; |
| - CONTENT_EXPORT void NativeReleaseReference() override; |
| - CONTENT_EXPORT bool IsNative() const override; |
| - CONTENT_EXPORT void OnLocationChanged() override; |
| - |
| // |
| // IAccessible methods. |
| // |
| @@ -123,8 +108,9 @@ BrowserAccessibilityWin |
| CONTENT_EXPORT STDMETHODIMP accDoDefaultAction(VARIANT var_id) override; |
| // Retrieves the child element or child object at a given point on the screen. |
| - CONTENT_EXPORT STDMETHODIMP |
| - accHitTest(LONG x_left, LONG y_top, VARIANT* child) override; |
| + CONTENT_EXPORT STDMETHODIMP accHitTest(LONG x_left, |
| + LONG y_top, |
| + VARIANT* child) override; |
| // Retrieves the specified object's current screen location. |
| CONTENT_EXPORT STDMETHODIMP accLocation(LONG* x_left, |
| @@ -134,12 +120,13 @@ BrowserAccessibilityWin |
| VARIANT var_id) override; |
| // Traverses to another UI element and retrieves the object. |
| - CONTENT_EXPORT STDMETHODIMP |
| - accNavigate(LONG nav_dir, VARIANT start, VARIANT* end) override; |
| + CONTENT_EXPORT STDMETHODIMP accNavigate(LONG nav_dir, |
| + VARIANT start, |
| + VARIANT* end) override; |
| // Retrieves an IDispatch interface pointer for the specified child. |
| - CONTENT_EXPORT STDMETHODIMP |
| - get_accChild(VARIANT var_child, IDispatch** disp_child) override; |
| + CONTENT_EXPORT STDMETHODIMP get_accChild(VARIANT var_child, |
| + IDispatch** disp_child) override; |
| // Retrieves the number of accessible children. |
| CONTENT_EXPORT STDMETHODIMP get_accChildCount(LONG* child_count) override; |
| @@ -149,8 +136,8 @@ BrowserAccessibilityWin |
| get_accDefaultAction(VARIANT var_id, BSTR* default_action) override; |
| // Retrieves the object's description. |
| - CONTENT_EXPORT STDMETHODIMP |
| - get_accDescription(VARIANT var_id, BSTR* desc) override; |
| + CONTENT_EXPORT STDMETHODIMP get_accDescription(VARIANT var_id, |
| + BSTR* desc) override; |
| // Retrieves the object that has the keyboard focus. |
| CONTENT_EXPORT STDMETHODIMP get_accFocus(VARIANT* focus_child) override; |
| @@ -169,31 +156,32 @@ BrowserAccessibilityWin |
| CONTENT_EXPORT STDMETHODIMP get_accParent(IDispatch** disp_parent) override; |
| // Retrieves information describing the role of the specified object. |
| - CONTENT_EXPORT STDMETHODIMP |
| - get_accRole(VARIANT var_id, VARIANT* role) override; |
| + CONTENT_EXPORT STDMETHODIMP get_accRole(VARIANT var_id, |
| + VARIANT* role) override; |
| // Retrieves the current state of the specified object. |
| - CONTENT_EXPORT STDMETHODIMP |
| - get_accState(VARIANT var_id, VARIANT* state) override; |
| + CONTENT_EXPORT STDMETHODIMP get_accState(VARIANT var_id, |
| + VARIANT* state) override; |
| // Returns the value associated with the object. |
| - CONTENT_EXPORT STDMETHODIMP |
| - get_accValue(VARIANT var_id, BSTR* value) override; |
| + CONTENT_EXPORT STDMETHODIMP get_accValue(VARIANT var_id, |
| + BSTR* value) override; |
| // Make an object take focus or extend the selection. |
| - CONTENT_EXPORT STDMETHODIMP |
| - accSelect(LONG flags_sel, VARIANT var_id) override; |
| + CONTENT_EXPORT STDMETHODIMP accSelect(LONG flags_sel, |
| + VARIANT var_id) override; |
| - CONTENT_EXPORT STDMETHODIMP |
| - get_accHelpTopic(BSTR* help_file, VARIANT var_id, LONG* topic_id) override; |
| + CONTENT_EXPORT STDMETHODIMP get_accHelpTopic(BSTR* help_file, |
| + VARIANT var_id, |
| + LONG* topic_id) override; |
| CONTENT_EXPORT STDMETHODIMP get_accSelection(VARIANT* selected) override; |
| // Deprecated methods, not implemented. |
| - CONTENT_EXPORT STDMETHODIMP |
| - put_accName(VARIANT var_id, BSTR put_name) override; |
| - CONTENT_EXPORT STDMETHODIMP |
| - put_accValue(VARIANT var_id, BSTR put_val) override; |
| + CONTENT_EXPORT STDMETHODIMP put_accName(VARIANT var_id, |
| + BSTR put_name) override; |
| + CONTENT_EXPORT STDMETHODIMP put_accValue(VARIANT var_id, |
| + BSTR put_val) override; |
| // |
| // IAccessible2 methods. |
| @@ -289,16 +277,18 @@ BrowserAccessibilityWin |
| // get_description - also used by IAccessibleImage |
| - CONTENT_EXPORT STDMETHODIMP |
| - get_accessibleAt(long row, long column, IUnknown** accessible) override; |
| + CONTENT_EXPORT STDMETHODIMP get_accessibleAt(long row, |
| + long column, |
| + IUnknown** accessible) override; |
| CONTENT_EXPORT STDMETHODIMP get_caption(IUnknown** accessible) override; |
| - CONTENT_EXPORT STDMETHODIMP |
| - get_childIndex(long row_index, long column_index, long* cell_index) override; |
| + CONTENT_EXPORT STDMETHODIMP get_childIndex(long row_index, |
| + long column_index, |
| + long* cell_index) override; |
| - CONTENT_EXPORT STDMETHODIMP |
| - get_columnDescription(long column, BSTR* description) override; |
| + CONTENT_EXPORT STDMETHODIMP get_columnDescription(long column, |
| + BSTR* description) override; |
| CONTENT_EXPORT STDMETHODIMP |
| get_columnExtentAt(long row, long column, long* n_columns_spanned) override; |
| @@ -307,8 +297,8 @@ BrowserAccessibilityWin |
| get_columnHeader(IAccessibleTable** accessible_table, |
| long* starting_row_index) override; |
| - CONTENT_EXPORT STDMETHODIMP |
| - get_columnIndex(long cell_index, long* column_index) override; |
| + CONTENT_EXPORT STDMETHODIMP get_columnIndex(long cell_index, |
| + long* column_index) override; |
| CONTENT_EXPORT STDMETHODIMP get_nColumns(long* column_count) override; |
| @@ -320,18 +310,19 @@ BrowserAccessibilityWin |
| CONTENT_EXPORT STDMETHODIMP get_nSelectedRows(long* row_count) override; |
| - CONTENT_EXPORT STDMETHODIMP |
| - get_rowDescription(long row, BSTR* description) override; |
| + CONTENT_EXPORT STDMETHODIMP get_rowDescription(long row, |
| + BSTR* description) override; |
| - CONTENT_EXPORT STDMETHODIMP |
| - get_rowExtentAt(long row, long column, long* n_rows_spanned) override; |
| + CONTENT_EXPORT STDMETHODIMP get_rowExtentAt(long row, |
| + long column, |
| + long* n_rows_spanned) override; |
| CONTENT_EXPORT STDMETHODIMP |
| get_rowHeader(IAccessibleTable** accessible_table, |
| long* starting_column_index) override; |
| - CONTENT_EXPORT STDMETHODIMP |
| - get_rowIndex(long cell_index, long* row_index) override; |
| + CONTENT_EXPORT STDMETHODIMP get_rowIndex(long cell_index, |
| + long* row_index) override; |
| CONTENT_EXPORT STDMETHODIMP get_selectedChildren(long max_children, |
| long** children, |
| @@ -341,19 +332,21 @@ BrowserAccessibilityWin |
| long** columns, |
| long* n_columns) override; |
| - CONTENT_EXPORT STDMETHODIMP |
| - get_selectedRows(long max_rows, long** rows, long* n_rows) override; |
| + CONTENT_EXPORT STDMETHODIMP get_selectedRows(long max_rows, |
| + long** rows, |
| + long* n_rows) override; |
| CONTENT_EXPORT STDMETHODIMP get_summary(IUnknown** accessible) override; |
| CONTENT_EXPORT STDMETHODIMP |
| get_isColumnSelected(long column, boolean* is_selected) override; |
| - CONTENT_EXPORT STDMETHODIMP |
| - get_isRowSelected(long row, boolean* is_selected) override; |
| + CONTENT_EXPORT STDMETHODIMP get_isRowSelected(long row, |
| + boolean* is_selected) override; |
| - CONTENT_EXPORT STDMETHODIMP |
| - get_isSelected(long row, long column, boolean* is_selected) override; |
| + CONTENT_EXPORT STDMETHODIMP get_isSelected(long row, |
| + long column, |
| + boolean* is_selected) override; |
| CONTENT_EXPORT STDMETHODIMP |
| get_rowColumnExtentsAtIndex(long index, |
| @@ -381,19 +374,20 @@ BrowserAccessibilityWin |
| // unique ones are included here.) |
| // |
| - CONTENT_EXPORT STDMETHODIMP |
| - get_cellAt(long row, long column, IUnknown** cell) override; |
| + CONTENT_EXPORT STDMETHODIMP get_cellAt(long row, |
| + long column, |
| + IUnknown** cell) override; |
| CONTENT_EXPORT STDMETHODIMP get_nSelectedCells(long* cell_count) override; |
| CONTENT_EXPORT STDMETHODIMP |
| get_selectedCells(IUnknown*** cells, long* n_selected_cells) override; |
| - CONTENT_EXPORT STDMETHODIMP |
| - get_selectedColumns(long** columns, long* n_columns) override; |
| + CONTENT_EXPORT STDMETHODIMP get_selectedColumns(long** columns, |
| + long* n_columns) override; |
| - CONTENT_EXPORT STDMETHODIMP |
| - get_selectedRows(long** rows, long* n_rows) override; |
| + CONTENT_EXPORT STDMETHODIMP get_selectedRows(long** rows, |
| + long* n_rows) override; |
| // |
| // IAccessibleTableCell methods. |
| @@ -449,8 +443,9 @@ BrowserAccessibilityWin |
| LONG* start_offset, |
| LONG* end_offset) override; |
| - CONTENT_EXPORT STDMETHODIMP |
| - get_text(LONG start_offset, LONG end_offset, BSTR* text) override; |
| + CONTENT_EXPORT STDMETHODIMP get_text(LONG start_offset, |
| + LONG end_offset, |
| + BSTR* text) override; |
| CONTENT_EXPORT STDMETHODIMP |
| get_textAtOffset(LONG offset, |
| @@ -495,8 +490,8 @@ BrowserAccessibilityWin |
| LONG x, |
| LONG y) override; |
| - CONTENT_EXPORT STDMETHODIMP |
| - addSelection(LONG start_offset, LONG end_offset) override; |
| + CONTENT_EXPORT STDMETHODIMP addSelection(LONG start_offset, |
| + LONG end_offset) override; |
| CONTENT_EXPORT STDMETHODIMP removeSelection(LONG selection_index) override; |
| @@ -536,15 +531,15 @@ BrowserAccessibilityWin |
| // IAccessibleAction mostly not implemented. |
| CONTENT_EXPORT STDMETHODIMP nActions(long* n_actions) override; |
| CONTENT_EXPORT STDMETHODIMP doAction(long action_index) override; |
| - CONTENT_EXPORT STDMETHODIMP |
| - get_description(long action_index, BSTR* description) override; |
| + CONTENT_EXPORT STDMETHODIMP get_description(long action_index, |
| + BSTR* description) override; |
| CONTENT_EXPORT STDMETHODIMP get_keyBinding(long action_index, |
| long n_max_bindings, |
| BSTR** key_bindings, |
| long* n_bindings) override; |
| CONTENT_EXPORT STDMETHODIMP get_name(long action_index, BSTR* name) override; |
| - CONTENT_EXPORT STDMETHODIMP |
| - get_localizedName(long action_index, BSTR* localized_name) override; |
| + CONTENT_EXPORT STDMETHODIMP get_localizedName(long action_index, |
| + BSTR* localized_name) override; |
| // |
| // IAccessibleValue methods. |
| @@ -625,8 +620,8 @@ BrowserAccessibilityWin |
| CONTENT_EXPORT STDMETHODIMP get_nextSibling(ISimpleDOMNode** node) override; |
| - CONTENT_EXPORT STDMETHODIMP |
| - get_childAt(unsigned int child_index, ISimpleDOMNode** node) override; |
| + CONTENT_EXPORT STDMETHODIMP get_childAt(unsigned int child_index, |
| + ISimpleDOMNode** node) override; |
| CONTENT_EXPORT STDMETHODIMP get_innerHTML(BSTR* innerHTML) override; |
| @@ -666,15 +661,16 @@ BrowserAccessibilityWin |
| // IServiceProvider methods. |
| // |
| - CONTENT_EXPORT STDMETHODIMP |
| - QueryService(REFGUID guidService, REFIID riid, void** object) override; |
| + CONTENT_EXPORT STDMETHODIMP QueryService(REFGUID guidService, |
| + REFIID riid, |
| + void** object) override; |
| // IAccessibleEx methods not implemented. |
| - CONTENT_EXPORT STDMETHODIMP |
| - GetObjectForChild(long child_id, IAccessibleEx** ret) override; |
| + CONTENT_EXPORT STDMETHODIMP GetObjectForChild(long child_id, |
| + IAccessibleEx** ret) override; |
| - CONTENT_EXPORT STDMETHODIMP |
| - GetIAccessiblePair(IAccessible** acc, long* child_id) override; |
| + CONTENT_EXPORT STDMETHODIMP GetIAccessiblePair(IAccessible** acc, |
| + long* child_id) override; |
| CONTENT_EXPORT STDMETHODIMP GetRuntimeId(SAFEARRAY** runtime_id) override; |
| @@ -687,10 +683,10 @@ BrowserAccessibilityWin |
| // |
| // The GetPatternProvider/GetPropertyValue methods need to be implemented for |
| // the on-screen keyboard to show up in Windows 8 metro. |
| - CONTENT_EXPORT STDMETHODIMP |
| - GetPatternProvider(PATTERNID id, IUnknown** provider) override; |
| - CONTENT_EXPORT STDMETHODIMP |
| - GetPropertyValue(PROPERTYID id, VARIANT* ret) override; |
| + CONTENT_EXPORT STDMETHODIMP GetPatternProvider(PATTERNID id, |
| + IUnknown** provider) override; |
| + CONTENT_EXPORT STDMETHODIMP GetPropertyValue(PROPERTYID id, |
| + VARIANT* ret) override; |
| // |
| // IRawElementProviderSimple methods not implemented |
| @@ -720,8 +716,6 @@ BrowserAccessibilityWin |
| AXPlatformPosition::AXPositionInstance CreatePositionForSelectionAt( |
| int offset) const; |
| - CONTENT_EXPORT base::string16 GetText() const override; |
| - |
| // Accessors. |
| int32_t ia_role() const { return win_attributes_->ia_role; } |
| int32_t ia_state() const { return win_attributes_->ia_state; } |
| @@ -746,25 +740,29 @@ BrowserAccessibilityWin |
| } |
| private: |
| + // Setter and getter for the browser accessibility owner |
| + BrowserAccessibilityWin* GetOwner() const { return owner_; } |
| + void SetOwner(BrowserAccessibilityWin* owner) { owner_ = owner; } |
|
dmazzoni
2017/05/08 04:45:24
I wonder if this should be called Init() or merged
dougt
2017/05/08 16:53:36
I do agree with you that this is a bit funky. Sim
|
| + |
| // Returns the IA2 text attributes for this object. |
| std::vector<base::string16> ComputeTextAttributes() const; |
| // Add one to the reference count and return the same object. Always |
| - // use this method when returning a BrowserAccessibilityWin object as |
| + // use this method when returning a BrowserAccessibilityComWin object as |
| // an output parameter to a COM interface, never use it otherwise. |
| - BrowserAccessibilityWin* NewReference(); |
| + BrowserAccessibilityComWin* NewReference(); |
| // Returns a list of IA2 attributes indicating the offsets in the text of a |
| // leaf object, such as a text field or static text, where spelling errors are |
| // present. |
| - std::map<int, std::vector<base::string16>> GetSpellingAttributes() const; |
| + std::map<int, std::vector<base::string16>> GetSpellingAttributes(); |
| // Many MSAA methods take a var_id parameter indicating that the operation |
| // should be performed on a particular child ID, rather than this object. |
| // This method tries to figure out the target object from |var_id| and |
| // returns a pointer to the target object if it exists, otherwise NULL. |
| // Does not return a new reference. |
| - BrowserAccessibilityWin* GetTargetFromChildID(const VARIANT& var_id); |
| + BrowserAccessibilityComWin* GetTargetFromChildID(const VARIANT& var_id); |
| // Initialize the role and state metadata from the role enum and state |
| // bitmasks defined in ui::AXNodeData. |
| @@ -773,9 +771,8 @@ BrowserAccessibilityWin |
| // Retrieve the value of an attribute from the string attribute map and |
| // if found and nonempty, allocate a new BSTR (with SysAllocString) |
| // and return S_OK. If not found or empty, return S_FALSE. |
| - HRESULT GetStringAttributeAsBstr( |
| - ui::AXStringAttribute attribute, |
| - BSTR* value_bstr); |
| + HRESULT GetStringAttributeAsBstr(ui::AXStringAttribute attribute, |
| + BSTR* value_bstr); |
| // Escapes characters in string attributes as required by the IA2 Spec. |
| // It's okay for input to be the same as output. |
| @@ -795,13 +792,11 @@ BrowserAccessibilityWin |
| // If the bool attribute |attribute| is present, add its value as an |
| // IAccessible2 attribute with the name |ia2_attr|. |
| - void BoolAttributeToIA2(ui::AXBoolAttribute attribute, |
| - const char* ia2_attr); |
| + void BoolAttributeToIA2(ui::AXBoolAttribute attribute, const char* ia2_attr); |
| // If the int attribute |attribute| is present, add its value as an |
| // IAccessible2 attribute with the name |ia2_attr|. |
| - void IntAttributeToIA2(ui::AXIntAttribute attribute, |
| - const char* ia2_attr); |
| + void IntAttributeToIA2(ui::AXIntAttribute attribute, const char* ia2_attr); |
| // |
| // Helper methods for IA2 hyperlinks. |
| @@ -814,17 +809,16 @@ BrowserAccessibilityWin |
| bool IsHyperlink() const; |
| // Returns the hyperlink at the given text position, or nullptr if no |
| // hyperlink can be found. |
| - BrowserAccessibilityWin* GetHyperlinkFromHypertextOffset(int offset) const; |
| + BrowserAccessibilityComWin* GetHyperlinkFromHypertextOffset(int offset) const; |
| // Functions for retrieving offsets for hyperlinks and hypertext. |
| // Return -1 in case of failure. |
| int32_t GetHyperlinkIndexFromChild( |
| - const BrowserAccessibilityWin& child) const; |
| + const BrowserAccessibilityComWin& child) const; |
| int32_t GetHypertextOffsetFromHyperlinkIndex(int32_t hyperlink_index) const; |
| - int32_t GetHypertextOffsetFromChild( |
| - const BrowserAccessibilityWin& child) const; |
| + int32_t GetHypertextOffsetFromChild(BrowserAccessibilityComWin& child); |
| int32_t GetHypertextOffsetFromDescendant( |
| - const BrowserAccessibilityWin& descendant) const; |
| + const BrowserAccessibilityComWin& descendant) const; |
| // If the selection endpoint is either equal to or an ancestor of this object, |
| // returns endpoint_offset. |
| @@ -834,7 +828,7 @@ BrowserAccessibilityWin |
| // Returns -1 in case of unexpected failure, e.g. the selection endpoint |
| // cannot be found in the accessibility tree. |
| int GetHypertextOffsetFromEndpoint( |
| - const BrowserAccessibilityWin& endpoint_object, |
| + const BrowserAccessibilityComWin& endpoint_object, |
| int endpoint_offset) const; |
| // |
| @@ -858,8 +852,9 @@ BrowserAccessibilityWin |
| base::string16 GetValueText(); |
| bool IsSameHypertextCharacter(size_t old_char_index, size_t new_char_index); |
| - void ComputeHypertextRemovedAndInserted( |
| - int* start, int* old_len, int* new_len); |
| + void ComputeHypertextRemovedAndInserted(int* start, |
| + int* old_len, |
| + int* new_len); |
| // If offset is a member of IA2TextSpecialOffsets this function updates the |
| // value of offset and returns, otherwise offset remains unchanged. |
| @@ -885,7 +880,7 @@ BrowserAccessibilityWin |
| // ID refers to the node ID in the current tree, not the globally unique ID. |
| // TODO(nektar): Could we use globally unique IDs everywhere? |
| // TODO(nektar): Rename this function to GetFromNodeID. |
| - BrowserAccessibilityWin* GetFromID(int32_t id) const; |
| + BrowserAccessibilityComWin* GetFromID(int32_t id) const; |
| // Returns true if this is a list box option with a parent of type list box, |
| // or a menu list option with a parent of type menu list popup. |
| @@ -913,8 +908,6 @@ BrowserAccessibilityWin |
| // Fire a Windows-specific accessibility event notification on this node. |
| void FireNativeEvent(LONG win_event_type) const; |
| - ui::AXPlatformNodeWin* GetPlatformNodeWin() const; |
| - |
| static bool IsInTreeGrid(const BrowserAccessibility* item); |
| struct WinAttributes { |
| @@ -948,13 +941,15 @@ BrowserAccessibilityWin |
| // |hyperlinks_|. |
| std::map<int32_t, int32_t> hyperlink_offset_to_index; |
| - // The unique id of a BrowserAccessibilityWin for each hyperlink. |
| + // The unique id of a BrowserAccessibilityComWin for each hyperlink. |
| // TODO(nektar): Replace object IDs with child indices if we decide that |
| // we are not implementing IA2 hyperlinks for anything other than IA2 |
| // Hypertext. |
| std::vector<int32_t> hyperlinks; |
| }; |
| + BrowserAccessibilityWin* owner_; |
| + |
| std::unique_ptr<WinAttributes> win_attributes_; |
| // Only valid during the scope of a IA2_EVENT_TEXT_REMOVED or |
| @@ -970,17 +965,15 @@ BrowserAccessibilityWin |
| // Give BrowserAccessibility::Create access to our constructor. |
| friend class BrowserAccessibility; |
| + friend class BrowserAccessibilityWin; |
| friend class BrowserAccessibilityRelation; |
| - DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityWin); |
| + DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityComWin); |
| }; |
| -CONTENT_EXPORT BrowserAccessibilityWin* |
| -ToBrowserAccessibilityWin(BrowserAccessibility* obj); |
|
dmazzoni
2017/05/08 04:45:24
Is there really no time we'll ever also want ToBro
dougt
2017/05/08 16:53:36
Tests use it. But, by far, the most common cast i
dmazzoni
2017/05/08 18:31:04
Nevermind, I see now it's just in a different file
|
| - |
| -CONTENT_EXPORT const BrowserAccessibilityWin* |
| -ToBrowserAccessibilityWin(const BrowserAccessibility* obj); |
| +CONTENT_EXPORT BrowserAccessibilityComWin* ToBrowserAccessibilityComWin( |
| + BrowserAccessibility* obj); |
| } // namespace content |
| -#endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_ |
| +#endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_COM_WIN_H_ |