1 // Copyright 2018 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 UI_BASE_COCOA_REMOTE_ACCESSIBILITY_API_H_
6 #define UI_BASE_COCOA_REMOTE_ACCESSIBILITY_API_H_
7 
8 #import <Cocoa/Cocoa.h>
9 #include <vector>
10 
11 #include "base/mac/scoped_nsobject.h"
12 #include "ui/base/ui_base_export.h"
13 
14 @interface NSAccessibilityRemoteUIElement : NSObject
15 + (void)registerRemoteUIProcessIdentifier:(int)pid;
16 + (NSData*)remoteTokenForLocalUIElement:(id)element;
17 - (id)initWithRemoteToken:(NSData*)token;
18 @property(retain) id windowUIElement;
19 @property(retain) id topLevelUIElement;
20 @end
21 
22 namespace ui {
23 
24 // Helper functions to implement the above functions using std::vectors intsead
25 // of NSData.
26 class UI_BASE_EXPORT RemoteAccessibility {
27  public:
28   static std::vector<uint8_t> GetTokenForLocalElement(id element);
29   static base::scoped_nsobject<NSAccessibilityRemoteUIElement>
30   GetRemoteElementFromToken(const std::vector<uint8_t>& token);
31 };
32 
33 }  // namespace ui
34 
35 #endif  // UI_BASE_COCOA_REMOTE_ACCESSIBILITY_API_H_
36