Flutter Windows Embedder
alert_platform_node_delegate.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter 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 FLUTTER_SHELL_PLATFORM_COMMON_ALERT_PLATFORM_NODE_DELEGATE_H_
6 #define FLUTTER_SHELL_PLATFORM_COMMON_ALERT_PLATFORM_NODE_DELEGATE_H_
7 
8 #include "flutter/fml/macros.h"
9 #include "flutter/third_party/accessibility/ax/ax_node_data.h"
10 #include "flutter/third_party/accessibility/ax/platform/ax_platform_node_delegate_base.h"
11 
12 namespace flutter {
13 
14 // A delegate for a node that holds the text of an a11y alert that a
15 // screen-reader should announce. The delegate is used to construct an
16 // AXPlatformNode, and in order to serve as an alert, only needs to be able to
17 // hold a text announcement and make that text available to the platform node.
18 class AlertPlatformNodeDelegate : public ui::AXPlatformNodeDelegateBase {
19  public:
21  ui::AXPlatformNodeDelegate& parent_delegate);
23 
24  // Set the alert text of the node for which this is the delegate.
25  void SetText(const std::u16string& text);
26 
27  // |AXPlatformNodeDelegate|
28  gfx::NativeViewAccessible GetParent() override;
29 
30  private:
31  // AXPlatformNodeDelegate overrides.
32  gfx::AcceleratedWidget GetTargetForNativeAccessibilityEvent() override;
33  const ui::AXUniqueId& GetUniqueId() const override;
34  const ui::AXNodeData& GetData() const override;
35 
36  // Delegate of the parent of this node. Returned by GetParent.
37  ui::AXPlatformNodeDelegate& parent_delegate_;
38 
39  // Node Data that contains the alert text. Returned by GetData.
40  ui::AXNodeData data_;
41 
42  // A unique ID used to identify this node. Returned by GetUniqueId.
43  ui::AXUniqueId id_;
44 
45  FML_DISALLOW_COPY_AND_ASSIGN(AlertPlatformNodeDelegate);
46 };
47 
48 } // namespace flutter
49 
50 #endif // FLUTTER_SHELL_PLATFORM_COMMON_ALERT_PLATFORM_NODE_DELEGATE_H_
flutter::AlertPlatformNodeDelegate::GetParent
gfx::NativeViewAccessible GetParent() override
Definition: alert_platform_node_delegate.cc:23
flutter::AlertPlatformNodeDelegate
Definition: alert_platform_node_delegate.h:18
flutter::AlertPlatformNodeDelegate::AlertPlatformNodeDelegate
AlertPlatformNodeDelegate(ui::AXPlatformNodeDelegate &parent_delegate)
Definition: alert_platform_node_delegate.cc:9
text
std::u16string text
Definition: keyboard_unittests.cc:332
flutter::AlertPlatformNodeDelegate::~AlertPlatformNodeDelegate
~AlertPlatformNodeDelegate()
Definition: alert_platform_node_delegate.cc:16
flutter
Definition: accessibility_bridge_windows.cc:11
flutter::AlertPlatformNodeDelegate::SetText
void SetText(const std::u16string &text)
Definition: alert_platform_node_delegate.cc:35