Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Rename macOS FLEPlugin* to FlutterPlugin* #9074

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -745,12 +745,12 @@ FILE: ../../../flutter/shell/platform/darwin/ios/platform_view_ios.h
FILE: ../../../flutter/shell/platform/darwin/ios/platform_view_ios.mm
FILE: ../../../flutter/shell/platform/darwin/macos/framework/FlutterMacOS.podspec
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FLEOpenGLContextHandling.h
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FLEPlugin.h
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FLEPluginRegistrar.h
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FLEReshapeListener.h
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FLEView.h
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FLEViewController.h
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterMacOS.h
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterPluginMacOS.h
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterPluginRegistrarMacOS.h
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Info.plist
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FLETextInputModel.h
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FLETextInputModel.mm
Expand Down
4 changes: 2 additions & 2 deletions shell/platform/darwin/macos/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ _flutter_framework_dir = "$root_out_dir/$_flutter_framework_filename"
# the Flutter engine source root.
_flutter_framework_headers = [
"framework/Headers/FlutterMacOS.h",
"framework/Headers/FlutterPluginMacOS.h",
"framework/Headers/FlutterPluginRegistrarMacOS.h",
"framework/Headers/FLEOpenGLContextHandling.h",
"framework/Headers/FLEPlugin.h",
"framework/Headers/FLEPluginRegistrar.h",
"framework/Headers/FLEReshapeListener.h",
"framework/Headers/FLEView.h",
"framework/Headers/FLEViewController.h",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#import <Cocoa/Cocoa.h>

#import "FLEOpenGLContextHandling.h"
#import "FLEPluginRegistrar.h"
#import "FLEReshapeListener.h"
#import "FlutterPluginRegistrarMacOS.h"

#if defined(FLUTTER_FRAMEWORK)
#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterBinaryMessenger.h"
Expand Down Expand Up @@ -36,8 +36,8 @@ typedef NS_ENUM(NSInteger, FlutterMouseTrackingMode) {
*/
FLUTTER_EXPORT
@interface FLEViewController : NSViewController <FlutterBinaryMessenger,
FLEPluginRegistrar,
FLEPluginRegistry,
FlutterPluginRegistrar,
FlutterPluginRegistry,
FLEReshapeListener>

/**
Expand Down
4 changes: 2 additions & 2 deletions shell/platform/darwin/macos/framework/Headers/FlutterMacOS.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
// found in the LICENSE file.

#import "FLEOpenGLContextHandling.h"
#import "FLEPlugin.h"
#import "FLEPluginRegistrar.h"
#import "FLEReshapeListener.h"
#import "FLEView.h"
#import "FLEViewController.h"
#import "FlutterBinaryMessenger.h"
#import "FlutterChannels.h"
#import "FlutterCodecs.h"
#import "FlutterMacros.h"
#import "FlutterPluginMacOS.h"
#import "FlutterPluginRegistrarMacOS.h"
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,34 @@
#import "FlutterMacros.h"
#endif

@protocol FLEPluginRegistrar;
// TODO: Merge this file and FlutterPluginRegistrarMacOS.h with the iOS FlutterPlugin.h, sharing
// all but the platform-specific methods.

@protocol FlutterPluginRegistrar;

/**
* Implemented by the platform side of a Flutter plugin.
*
* Defines a set of optional callback methods and a method to set up the plugin
* and register it to be called by other application components.
*
* Currently FLEPlugin has very limited functionality, but is expected to expand over time to
* more closely match the functionality of FlutterPlugin.
* Currently the macOS version of FlutterPlugin has very limited functionality, but is expected to
* expand over time to more closely match the functionality of the iOS FlutterPlugin.
*/
FLUTTER_EXPORT
@protocol FLEPlugin <NSObject>
@protocol FlutterPlugin <NSObject>

/**
* Creates an instance of the plugin to register with |registrar| using the desired
* FLEPluginRegistrar methods.
* FlutterPluginRegistrar methods.
*/
+ (void)registerWithRegistrar:(nonnull id<FLEPluginRegistrar>)registrar;
+ (void)registerWithRegistrar:(nonnull id<FlutterPluginRegistrar>)registrar;

@optional

/**
* Called when a message is sent from Flutter on a channel that a plugin instance has subscribed
* to via -[FLEPluginRegistrar addMethodCallDelegate:channel:].
* to via -[FlutterPluginRegistrar addMethodCallDelegate:channel:].
*
* The |result| callback must be called exactly once, with one of:
* - FlutterMethodNotImplemented, if the method call is unknown.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#import <Cocoa/Cocoa.h>

#import "FLEPlugin.h"
#import "FlutterPluginMacOS.h"

#if defined(FLUTTER_FRAMEWORK)
#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterBinaryMessenger.h"
Expand All @@ -16,36 +16,36 @@
#import "FlutterMacros.h"
#endif

// TODO: Merge this file and FLEPlugin.h with FlutterPlugin.h, sharing all but
// TODO: Merge this file and FlutterPluginMacOS.h with the iOS FlutterPlugin.h, sharing all but
// the platform-specific methods.

/**
* The protocol for an object managing registration for a plugin. It provides access to application
* context, as as allowing registering for callbacks for handling various conditions.
*
* Currently FLEPluginRegistrar has very limited functionality, but is expected to expand over time
* to more closely match the functionality of FlutterPluginRegistrar.
* Currently the macOS PluginRegistrar has very limited functionality, but is expected to expand
* over time to more closely match the functionality of FlutterPluginRegistrar.
*/
FLUTTER_EXPORT
@protocol FLEPluginRegistrar <NSObject>
@protocol FlutterPluginRegistrar <NSObject>

/**
* The binary messenger used for creating channels to communicate with the Flutter engine.
*/
@property(nonnull, readonly) id<FlutterBinaryMessenger> messenger;

/**
* The view displaying Flutter content.
* The view displaying Flutter content. May return |nil|, for instance in a headless environment.
*
* WARNING: If/when multiple Flutter views within the same application are supported (#98), this
* WARNING: If/when multiple Flutter views within the same application are supported (#30701), this
* API will change.
*/
@property(nullable, readonly) NSView* view;

/**
* Registers |delegate| to receive handleMethodCall:result: callbacks for the given |channel|.
*/
- (void)addMethodCallDelegate:(nonnull id<FLEPlugin>)delegate
- (void)addMethodCallDelegate:(nonnull id<FlutterPlugin>)delegate
channel:(nonnull FlutterMethodChannel*)channel;

@end
Expand All @@ -66,13 +66,13 @@ FLUTTER_EXPORT
* Specifically, callbacks registered by the plugin via the registrar may be
* relayed directly to the underlying iOS application objects.
*/
@protocol FLEPluginRegistry <NSObject>
@protocol FlutterPluginRegistry <NSObject>

/**
* Returns a registrar for registering a plugin.
*
* @param pluginKey The unique key identifying the plugin.
*/
- (nonnull id<FLEPluginRegistrar>)registrarForPlugin:(nonnull NSString*)pluginKey;
- (nonnull id<FlutterPluginRegistrar>)registrarForPlugin:(nonnull NSString*)pluginKey;

@end
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Responsible for bridging the native macOS text input system with the Flutter framework text
* editing classes, via system channels.
*
* This is not an FLEPlugin since it needs access to FLEViewController internals, so needs to be
* This is not an FlutterPlugin since it needs access to FLEViewController internals, so needs to be
* managed differently.
*/
@interface FLETextInputPlugin : NSResponder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ @implementation FLEViewController {
// A mapping of channel names to the registered handlers for those channels.
NSMutableDictionary<NSString*, FlutterBinaryMessageHandler>* _messageHandlers;

// The plugin used to handle text input. This is not an FLEPlugin, so must be owned separately.
// The plugin used to handle text input. This is not an FlutterPlugin, so must be owned
// separately.
FLETextInputPlugin* _textInputPlugin;

// A message channel for passing key events to the Flutter engine. This should be replaced with
Expand Down Expand Up @@ -653,22 +654,22 @@ - (void)setMessageHandlerOnChannel:(nonnull NSString*)channel
_messageHandlers[channel] = [handler copy];
}

#pragma mark - FLEPluginRegistrar
#pragma mark - FlutterPluginRegistrar

- (id<FlutterBinaryMessenger>)messenger {
return self;
}

- (void)addMethodCallDelegate:(nonnull id<FLEPlugin>)delegate
- (void)addMethodCallDelegate:(nonnull id<FlutterPlugin>)delegate
channel:(nonnull FlutterMethodChannel*)channel {
[channel setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) {
[delegate handleMethodCall:call result:result];
}];
}

#pragma mark - FLEPluginRegistry
#pragma mark - FlutterPluginRegistry

- (id<FLEPluginRegistrar>)registrarForPlugin:(NSString*)pluginName {
- (id<FlutterPluginRegistrar>)registrarForPlugin:(NSString*)pluginName {
// Currently, the view controller acts as the registrar for all plugins, so the
// name is ignored.
return self;
Expand Down