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..d9303d739d28c8945ea2538c8c4ce4c1e96c2058 |
--- /dev/null |
+++ b/ui/accessibility/platform/text_marker_helper_mac.h |
@@ -0,0 +1,57 @@ |
+// 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 "ui/accessibility/ax_abstract_position.h" |
+#include "ui/accessibility/ax_export.h" |
+ |
+namespace ui { |
+ |
+// Provides concrete a AXPosition from the source AXNode for initial text marker |
+// requests. |
+class AX_EXPORT PositionFactory { |
+ public: |
+ PositionFactory() {} |
+ virtual ~PositionFactory() {} |
+ |
+ virtual AXPositionPointer GetRoot() const = 0; |
+ virtual AXRangePointer GetSelection() const = 0; |
+ virtual AXPositionPointer GetFromData(const AXPositionData& data) const = 0; |
+ virtual id GetAccessibilityObject(const AXPositionData& data) const = 0; |
+}; |
+ |
+} // namespace ui |
+ |
+// A component that can be placed in an AXNode to satisfy requests from Cocoa |
+// accessibility to create and manipulate AXTextMarker objects. |
+AX_EXPORT |
+@interface TextMarkerHelperMac : NSObject |
+ |
+- (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; |
+ |
+// Given an AXTextMarkerRangeRef, extract the stored AXPositionData for the |
+// start and end markers. Returns NO if either marker is nil, or if the stored |
+// data is the wrong size. |
++ (BOOL)getRangeDataFromMarkerRange:(id)parameter |
+ start:(ui::AXPositionData*)start |
+ end:(ui::AXPositionData*)end; |
+ |
+@end |
+ |
+#endif // UI_ACCESSIBILITY_PLATFORM_TEXT_MARKER_HELPER_MAC_H_ |