2017-05-12 20:28:25 +02:00
|
|
|
// Copyright 2017 The Chromium Embedded Framework Authors. Portions copyright
|
|
|
|
// 2013 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 CEF_TESTS_CEFCLIENT_BROWSER_OSR_ACCESSIBILITY_NODE_H_
|
|
|
|
#define CEF_TESTS_CEFCLIENT_BROWSER_OSR_ACCESSIBILITY_NODE_H_
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "include/cef_browser.h"
|
|
|
|
|
2020-08-29 00:39:23 +02:00
|
|
|
#if defined(OS_MAC)
|
2019-04-23 19:17:56 +02:00
|
|
|
typedef void CefNativeAccessible;
|
|
|
|
#if __OBJC__
|
|
|
|
#if __has_feature(objc_arc)
|
|
|
|
#define CAST_CEF_NATIVE_ACCESSIBLE_TO_NSOBJECT(accessible) \
|
|
|
|
(__bridge NSObject*)accessible
|
|
|
|
#define CAST_NSOBJECT_TO_CEF_NATIVE_ACCESSIBLE(object) \
|
|
|
|
(__bridge CefNativeAccessible*)object
|
|
|
|
#else // __has_feature(objc_arc)
|
|
|
|
#define CAST_CEF_NATIVE_ACCESSIBLE_TO_NSOBJECT(accessible) (NSObject*)accessible
|
|
|
|
#define CAST_NSOBJECT_TO_CEF_NATIVE_ACCESSIBLE(object) \
|
|
|
|
(__bridge CefNativeAccessible*)object
|
|
|
|
#endif // __has_feature(objc_arc)
|
|
|
|
#endif // __OBJC__
|
2017-05-12 20:28:25 +02:00
|
|
|
#elif defined(OS_WIN)
|
|
|
|
struct IAccessible;
|
|
|
|
typedef IAccessible CefNativeAccessible;
|
|
|
|
#else
|
|
|
|
#error "Unsupported platform"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
namespace client {
|
|
|
|
|
|
|
|
class OsrAccessibilityHelper;
|
|
|
|
|
|
|
|
// OsrAXNode is the base class for implementation for the NSAccessibility
|
|
|
|
// protocol for interacting with VoiceOver and other accessibility clients.
|
|
|
|
class OsrAXNode {
|
|
|
|
public:
|
|
|
|
// Create and return the platform specific OsrAXNode Object.
|
2020-04-02 23:19:25 +02:00
|
|
|
static OsrAXNode* CreateNode(const CefString& treeId,
|
2019-03-21 17:56:06 +01:00
|
|
|
int nodeId,
|
|
|
|
CefRefPtr<CefDictionaryValue> value,
|
2017-05-12 20:28:25 +02:00
|
|
|
OsrAccessibilityHelper* helper);
|
|
|
|
|
|
|
|
// Update Value.
|
|
|
|
void UpdateValue(CefRefPtr<CefDictionaryValue> value);
|
|
|
|
|
2019-03-21 17:56:06 +01:00
|
|
|
// UpdateLocation
|
|
|
|
void UpdateLocation(CefRefPtr<CefDictionaryValue> value);
|
|
|
|
|
2017-05-12 20:28:25 +02:00
|
|
|
// Fire a platform-specific notification that an event has occurred on
|
|
|
|
// this object.
|
|
|
|
void NotifyAccessibilityEvent(std::string event_type) const;
|
|
|
|
|
|
|
|
// Call Destroy rather than deleting this, because the subclass may
|
|
|
|
// use reference counting.
|
|
|
|
void Destroy();
|
|
|
|
|
|
|
|
// Return NSAccessibility Object for Mac/ IAccessible for Windows
|
|
|
|
CefNativeAccessible* GetNativeAccessibleObject(OsrAXNode* parent);
|
|
|
|
|
|
|
|
CefNativeAccessible* GetParentAccessibleObject() const {
|
2020-01-15 15:28:12 +01:00
|
|
|
return parent_ ? parent_->platform_accessibility_ : nullptr;
|
2017-05-12 20:28:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
OsrAccessibilityHelper* GetAccessibilityHelper() const {
|
|
|
|
return accessibility_helper_;
|
2019-03-13 22:27:37 +01:00
|
|
|
}
|
2017-05-12 20:28:25 +02:00
|
|
|
|
2019-03-21 17:56:06 +01:00
|
|
|
int GetChildCount() const;
|
2017-05-12 20:28:25 +02:00
|
|
|
|
|
|
|
// Return the Child at the specified index
|
|
|
|
OsrAXNode* ChildAtIndex(int index) const;
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
const CefString& AxRole() const { return role_; }
|
2017-05-12 20:28:25 +02:00
|
|
|
|
2020-04-02 23:19:25 +02:00
|
|
|
const CefString& OsrAXTreeId() const { return tree_id_; }
|
2019-03-21 17:56:06 +01:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
int OsrAXNodeId() const { return node_id_; }
|
2017-05-12 20:28:25 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
const CefString& AxValue() const { return value_; }
|
2017-05-12 20:28:25 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
const CefString& AxName() const { return name_; }
|
2017-05-12 20:28:25 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
const CefString& AxDescription() const { return description_; }
|
2017-05-12 20:28:25 +02:00
|
|
|
|
|
|
|
CefRect AxLocation() const;
|
|
|
|
|
|
|
|
CefWindowHandle GetWindowHandle() const;
|
|
|
|
|
|
|
|
CefRefPtr<CefBrowser> GetBrowser() const;
|
|
|
|
|
|
|
|
void SetParent(OsrAXNode* parent);
|
|
|
|
|
|
|
|
protected:
|
2020-04-02 23:19:25 +02:00
|
|
|
OsrAXNode(const CefString& treeId,
|
2019-03-21 17:56:06 +01:00
|
|
|
int nodeId,
|
|
|
|
CefRefPtr<CefDictionaryValue> value,
|
2017-05-12 20:28:25 +02:00
|
|
|
OsrAccessibilityHelper* helper);
|
|
|
|
|
2020-04-02 23:19:25 +02:00
|
|
|
CefString tree_id_;
|
2017-05-12 20:28:25 +02:00
|
|
|
int node_id_;
|
2020-04-02 23:19:25 +02:00
|
|
|
CefString child_tree_id_;
|
2017-05-12 20:28:25 +02:00
|
|
|
CefString role_;
|
|
|
|
CefString value_;
|
|
|
|
CefString name_;
|
|
|
|
CefString description_;
|
|
|
|
CefRect location_;
|
2019-03-21 17:56:06 +01:00
|
|
|
CefPoint scroll_;
|
2017-05-12 20:28:25 +02:00
|
|
|
std::vector<int> child_ids_;
|
2024-01-20 03:22:56 +01:00
|
|
|
CefNativeAccessible* platform_accessibility_ = nullptr;
|
|
|
|
OsrAXNode* parent_ = nullptr;
|
|
|
|
int offset_container_id_ = -1;
|
2017-05-12 20:28:25 +02:00
|
|
|
OsrAccessibilityHelper* accessibility_helper_;
|
|
|
|
CefRefPtr<CefDictionaryValue> attributes_;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace client
|
|
|
|
|
|
|
|
#endif // CEF_TESTS_CEFCLIENT_BROWSER_OSR_ACCESSIBILITY_NODE_H_
|