Chromium Code Reviews| Index: ui/accessibility/platform/text_marker_helper_mac.h |
| diff --git a/ui/accessibility/platform/text_marker_helper_mac.h b/ui/accessibility/platform/text_marker_helper_mac.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..082728ed4ce29bd443df7cd121c8611418e8f4b0 |
| --- /dev/null |
| +++ b/ui/accessibility/platform/text_marker_helper_mac.h |
| @@ -0,0 +1,65 @@ |
| +// Copyright 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 UI_ACCESSIBILITY_PLATFORM_TEXT_MARKER_HELPER_MAC_H_ |
| +#define UI_ACCESSIBILITY_PLATFORM_TEXT_MARKER_HELPER_MAC_H_ |
| + |
| +#import <Foundation/Foundation.h> |
| + |
| +#include <memory> |
| + |
| +#include "base/macros.h" |
| +#include "ui/accessibility/ax_enums.h" |
| +#include "ui/accessibility/ax_export.h" |
| + |
| +typedef struct OpaqueAXTextMarkerRef* AXTextMarkerRef; |
| +typedef struct OpaqueAXTextMarkerRangeRef* AXTextMarkerRangeRef; |
| + |
| +// TODO(tapted): Hide these. |
| +extern "C" { |
| +const UInt8* AXTextMarkerGetBytePtr(AXTextMarkerRef text_marker); |
| +size_t AXTextMarkerGetLength(AXTextMarkerRef text_marker); |
| +AXTextMarkerRef AXTextMarkerRangeCopyStartMarker( |
| + AXTextMarkerRangeRef text_marker_range); |
| +AXTextMarkerRef AXTextMarkerRangeCopyEndMarker( |
| + AXTextMarkerRangeRef text_marker_range); |
| +} |
| + |
| +namespace ui { |
| + |
| +class AXAbstractRange; |
| +class AXPositionBase; |
| + |
| +class AX_EXPORT PositionFactory { |
|
tapted
2017/06/19 11:44:30
(self review: comment)
|
| + public: |
| + PositionFactory() {} |
| + virtual ~PositionFactory() {} |
| + |
| + virtual std::unique_ptr<AXPositionBase> GetRoot() const = 0; |
|
tapted
2017/06/19 11:44:30
(self review: these too)
|
| + virtual std::unique_ptr<AXAbstractRange> GetSelection() const = 0; |
| + virtual std::unique_ptr<AXPositionBase> ExtractFromMarker( |
| + AXTextMarkerRef marker) const = 0; |
| +}; |
| + |
| +} // namespace ui |
| + |
| +AX_EXPORT |
| +@interface TextMarkerHelperMac : NSObject |
|
tapted
2017/06/19 11:44:30
(self review: comment)
|
| + |
| +- (instancetype)initWithFactory:(std::unique_ptr<ui::PositionFactory>)factory; |
| + |
| +// Returns a text marker that points to the first character in the document that |
| +// can be selected with VoiceOver. |
| +- (id)startTextMarker; |
| + |
| +// Returns a text marker that points to the last character in the document that |
| +// can be selected with VoiceOver. |
| +- (id)endTextMarker; |
| + |
| +// Returns a text marker range corresponding to the current selection. |
| +- (id)selectedTextMarkerRange; |
| + |
| +@end |
| + |
| +#endif // UI_ACCESSIBILITY_PLATFORM_TEXT_MARKER_HELPER_MAC_H_ |