| Flutter macOS Embedder |

FlutterPlatformNodeDelegateMac.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_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERPLATFORMNODEDELEGATEMAC_H_
6 #define FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERPLATFORMNODEDELEGATEMAC_H_
7
8 #import <Cocoa/Cocoa.h>
9
10 #import "flutter/shell/platform/darwin/macos/framework/Headers/FlutterViewController.h"
11
12 #include "flutter/fml/macros.h"
13 #include "flutter/shell/platform/common/accessibility_bridge.h"
14 #include "flutter/shell/platform/common/flutter_platform_node_delegate.h"
15 #include "flutter/shell/platform/embedder/embedder.h"
16
17 namespace flutter {
18
19 //------------------------------------------------------------------------------
20 /// The macOS implementation of FlutterPlatformNodeDelegate. This class uses
21 /// AXPlatformNodeMac to manage the macOS-specific accessibility objects.
22 class FlutterPlatformNodeDelegateMac : public FlutterPlatformNodeDelegate {
23 public:
24 FlutterPlatformNodeDelegateMac(std::weak_ptr<AccessibilityBridge> bridge,
25 __weak FlutterViewController* view_controller);
26 virtual ~FlutterPlatformNodeDelegateMac();
27
28 void Init(std::weak_ptr<OwnerBridge> bridge, ui::AXNode* node) override;
29
30 //---------------------------------------------------------------------------
31 /// @brief Gets the live region text of this node in UTF-8 format. This
32 /// is useful to determine the changes in between semantics
33 /// updates when generating accessibility events.
34 std::string GetLiveRegionText() const;
35
36 // |ui::AXPlatformNodeDelegate|
37 gfx::NativeViewAccessible GetNativeViewAccessible() override;
38
39 // |ui::AXPlatformNodeDelegate|
40 gfx::NativeViewAccessible GetNSWindow() override;
41
42 // |FlutterPlatformNodeDelegate|
43 gfx::NativeViewAccessible GetParent() override;
44
45 // |FlutterPlatformNodeDelegate|
46 gfx::Rect GetBoundsRect(
47 const ui::AXCoordinateSystem coordinate_system,
48 const ui::AXClippingBehavior clipping_behavior,
49 ui::AXOffscreenResult* offscreen_result) const override;
50
51 private:
52 ui::AXPlatformNode* ax_platform_node_;
53 std::weak_ptr<AccessibilityBridge> bridge_;
54 __weak FlutterViewController* view_controller_;
55
56 gfx::RectF ConvertBoundsFromLocalToScreen(
57 const gfx::RectF& local_bounds) const;
58 gfx::RectF ConvertBoundsFromScreenToGlobal(
59 const gfx::RectF& window_bounds) const;
60
61 FML_DISALLOW_COPY_AND_ASSIGN(FlutterPlatformNodeDelegateMac);
62 };
63
64 } // namespace flutter
65
66 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERPLATFORMNODEDELEGATEMAC_H_
flutter::FlutterPlatformNodeDelegateMac::Init
void Init(std::weak_ptr< OwnerBridge > bridge, ui::AXNode *node) override
Called only once, immediately after construction. The constructor doesn't take any arguments because ...
Definition: FlutterPlatformNodeDelegateMac.mm:28
flutter::FlutterPlatformNodeDelegateMac::GetLiveRegionText
std::string GetLiveRegionText() const
Gets the live region text of this node in UTF-8 format. This is useful to determine the changes in be...
Definition: FlutterPlatformNodeDelegateMac.mm:73
FlutterViewController
Definition: FlutterViewController.h:62
flutter::FlutterPlatformNodeDelegateMac::FlutterPlatformNodeDelegateMac
FlutterPlatformNodeDelegateMac(std::weak_ptr< AccessibilityBridge > bridge, __weak FlutterViewController *view_controller)
Definition: FlutterPlatformNodeDelegateMac.mm:23
flutter::FlutterPlatformNodeDelegateMac::GetNSWindow
gfx::NativeViewAccessible GetNSWindow() override
Definition: FlutterPlatformNodeDelegateMac.mm:68
flutter::FlutterPlatformNodeDelegateMac::GetParent
gfx::NativeViewAccessible GetParent() override
Definition: FlutterPlatformNodeDelegateMac.mm:48
flutter
Definition: AccessibilityBridgeMac.h:16
flutter_platform_node_delegate.h
flutter::FlutterPlatformNodeDelegateMac::~FlutterPlatformNodeDelegateMac
virtual ~FlutterPlatformNodeDelegateMac()
Definition: FlutterPlatformNodeDelegateMac.mm:38
flutter::FlutterPlatformNodeDelegateMac::GetBoundsRect
gfx::Rect GetBoundsRect(const ui::AXCoordinateSystem coordinate_system, const ui::AXClippingBehavior clipping_behavior, ui::AXOffscreenResult *offscreen_result) const override
Definition: FlutterPlatformNodeDelegateMac.mm:57
flutter::FlutterPlatformNodeDelegateMac::GetNativeViewAccessible
gfx::NativeViewAccessible GetNativeViewAccessible() override
Definition: FlutterPlatformNodeDelegateMac.mm:43
flutter::FlutterPlatformNodeDelegate
Definition: flutter_platform_node_delegate.h:33
accessibility_bridge.h
flutter::FlutterPlatformNodeDelegateMac
Definition: FlutterPlatformNodeDelegateMac.h:22
FlutterViewController.h