Bug 1890277: part 4) Add CSPParser support for the `trusted-types` directive, guarded...
[gecko.git] / accessible / base / Platform.h
blob68529d176a1d95c2fb9f477be45e927adfeef1f2
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_a11y_Platform_h
8 #define mozilla_a11y_Platform_h
10 #include <stdint.h>
11 #include "nsStringFwd.h"
12 #include "Units.h"
14 #if defined(ANDROID)
15 # include "nsTArray.h"
16 # include "nsRect.h"
17 #endif
19 #ifdef MOZ_WIDGET_COCOA
20 # include "mozilla/a11y/Role.h"
21 # include "nsTArray.h"
22 #endif
24 namespace mozilla {
25 namespace a11y {
27 class Accessible;
28 class RemoteAccessible;
30 enum EPlatformDisabledState {
31 ePlatformIsForceEnabled = -1,
32 ePlatformIsEnabled = 0,
33 ePlatformIsDisabled = 1
36 /**
37 * Return the platform disabled state.
39 EPlatformDisabledState PlatformDisabledState();
41 #ifdef MOZ_ACCESSIBILITY_ATK
42 /**
43 * Perform initialization that should be done as soon as possible, in order
44 * to minimize startup time.
45 * XXX: this function and the next defined in ApplicationAccessibleWrap.cpp
47 void PreInit();
48 #endif
50 #if defined(MOZ_ACCESSIBILITY_ATK) || defined(XP_DARWIN)
51 /**
52 * Is platform accessibility enabled.
53 * Only used on Linux, MacOS and iOS for now.
55 bool ShouldA11yBeEnabled();
56 #endif
58 #if defined(XP_WIN)
60 * Name of platform service that instantiated accessibility
62 void SetInstantiator(const uint32_t aInstantiatorPid);
63 bool GetInstantiator(nsIFile** aOutInstantiator);
64 #endif
66 /**
67 * Called to initialize platform specific accessibility support.
68 * Note this is called after internal accessibility support is initialized.
70 void PlatformInit();
72 /**
73 * Shutdown platform accessibility.
74 * Note this is called before internal accessibility support is shutdown.
76 void PlatformShutdown();
78 /**
79 * called when a new RemoteAccessible is created, so the platform may setup a
80 * wrapper for it, or take other action.
82 void ProxyCreated(RemoteAccessible* aProxy);
84 /**
85 * Called just before a RemoteAccessible is destroyed so its wrapper can be
86 * disposed of and other action taken.
88 void ProxyDestroyed(RemoteAccessible*);
90 /**
91 * Called when an event is fired on an Accessible so that platforms may fire
92 * events if appropriate.
94 void PlatformEvent(Accessible* aTarget, uint32_t aEventType);
95 void PlatformStateChangeEvent(Accessible* aTarget, uint64_t aState,
96 bool aEnabled);
98 void PlatformFocusEvent(Accessible* aTarget,
99 const LayoutDeviceIntRect& aCaretRect);
100 void PlatformCaretMoveEvent(Accessible* aTarget, int32_t aOffset,
101 bool aIsSelectionCollapsed, int32_t aGranularity,
102 const LayoutDeviceIntRect& aCaretRect,
103 bool aFromUser);
104 void PlatformTextChangeEvent(Accessible* aTarget, const nsAString& aStr,
105 int32_t aStart, uint32_t aLen, bool aIsInsert,
106 bool aFromUser);
107 void PlatformShowHideEvent(Accessible* aTarget, Accessible* aParent,
108 bool aInsert, bool aFromUser);
109 void PlatformSelectionEvent(Accessible* aTarget, Accessible* aWidget,
110 uint32_t aType);
112 #if defined(ANDROID)
113 void PlatformScrollingEvent(Accessible* aTarget, uint32_t aEventType,
114 uint32_t aScrollX, uint32_t aScrollY,
115 uint32_t aMaxScrollX, uint32_t aMaxScrollY);
117 void PlatformAnnouncementEvent(Accessible* aTarget,
118 const nsAString& aAnnouncement,
119 uint16_t aPriority);
121 bool LocalizeString(const nsAString& aToken, nsAString& aLocalized);
122 #endif
124 #ifdef MOZ_WIDGET_COCOA
125 class TextRange;
126 void PlatformTextSelectionChangeEvent(Accessible* aTarget,
127 const nsTArray<TextRange>& aSelection);
129 void PlatformRoleChangedEvent(Accessible* aTarget, const a11y::role& aRole,
130 uint8_t aRoleMapEntryIndex);
131 #endif
133 } // namespace a11y
134 } // namespace mozilla
136 #endif // mozilla_a11y_Platform_h