From 158598ad48447bca03cfe0f544e237f95bcf93fb Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Tue, 4 Apr 2023 15:23:53 -0700 Subject: [PATCH] [macOS] Remove FlutterApplication class The need for the FlutterApplication NSApplication subclass was eliminated in 8679b67cb324f5f5a4a8e76c5c8f1f08bd1ec447. The relevant app termination logic was moved into FlutterAppDelegate in that patch. Removing FlutterApplication needs to be done in three stages: 1. Migrate logic to FlutterAppDelegate (done in above patch) 2. Update Flutter tool template. Update migrator to migrate all apps using FlutterApplication back to NSApplication. This is done in https://github.com/flutter/flutter/pull/124173. 3. Eliminate FlutterApplication.h header since all references to it have now been removed. Issue: https://github.com/flutter/flutter/issues/30735 --- ci/licenses_golden/licenses_flutter | 4 -- shell/platform/darwin/macos/BUILD.gn | 2 - .../framework/Headers/FlutterApplication.h | 47 ------------------- .../macos/framework/Headers/FlutterMacOS.h | 1 - .../framework/Source/FlutterApplication.mm | 8 ---- 5 files changed, 62 deletions(-) delete mode 100644 shell/platform/darwin/macos/framework/Headers/FlutterApplication.h delete mode 100644 shell/platform/darwin/macos/framework/Source/FlutterApplication.mm diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 8732f9462824d..e5011256a6f6a 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -2603,7 +2603,6 @@ ORIGIN: ../../../flutter/shell/platform/darwin/ios/platform_view_ios.mm + ../../ ORIGIN: ../../../flutter/shell/platform/darwin/ios/rendering_api_selection.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/platform/darwin/ios/rendering_api_selection.mm + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterAppDelegate.h + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterApplication.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterDartProject.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterEngine.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterMacOS.h + ../../../flutter/LICENSE @@ -2616,7 +2615,6 @@ ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/Accessibil ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/AccessibilityBridgeMacTest.mm + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterAppDelegate.mm + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterAppDelegate_Internal.h + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterApplication.mm + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterBackingStore.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterBackingStore.mm + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterChannelKeyResponder.h + ../../../flutter/LICENSE @@ -5196,7 +5194,6 @@ FILE: ../../../flutter/shell/platform/darwin/ios/platform_view_ios.mm FILE: ../../../flutter/shell/platform/darwin/ios/rendering_api_selection.h FILE: ../../../flutter/shell/platform/darwin/ios/rendering_api_selection.mm FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterAppDelegate.h -FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterApplication.h FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterDartProject.h FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterEngine.h FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterMacOS.h @@ -5210,7 +5207,6 @@ FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/Accessibilit FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/AccessibilityBridgeMacTest.mm FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterAppDelegate.mm FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterAppDelegate_Internal.h -FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterApplication.mm FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterBackingStore.h FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterBackingStore.mm FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterChannelKeyResponder.h diff --git a/shell/platform/darwin/macos/BUILD.gn b/shell/platform/darwin/macos/BUILD.gn index 4cbf37b8c0513..d672f9551736c 100644 --- a/shell/platform/darwin/macos/BUILD.gn +++ b/shell/platform/darwin/macos/BUILD.gn @@ -38,7 +38,6 @@ _framework_binary_subpath = "Versions/A/$_flutter_framework_name" # the Flutter engine source root. _flutter_framework_headers = [ "framework/Headers/FlutterAppDelegate.h", - "framework/Headers/FlutterApplication.h", "framework/Headers/FlutterDartProject.h", "framework/Headers/FlutterEngine.h", "framework/Headers/FlutterMacOS.h", @@ -58,7 +57,6 @@ source_set("flutter_framework_source") { "framework/Source/AccessibilityBridgeMac.h", "framework/Source/AccessibilityBridgeMac.mm", "framework/Source/FlutterAppDelegate.mm", - "framework/Source/FlutterApplication.mm", "framework/Source/FlutterBackingStore.h", "framework/Source/FlutterBackingStore.mm", "framework/Source/FlutterChannelKeyResponder.h", diff --git a/shell/platform/darwin/macos/framework/Headers/FlutterApplication.h b/shell/platform/darwin/macos/framework/Headers/FlutterApplication.h deleted file mode 100644 index 38b5439ede7e8..0000000000000 --- a/shell/platform/darwin/macos/framework/Headers/FlutterApplication.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2013 The Flutter 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 FLUTTER_FLUTTERAPPLICATION_H_ -#define FLUTTER_FLUTTERAPPLICATION_H_ - -#import - -/** - * A Flutter-specific subclass of NSApplication that overrides |terminate| and - * provides an additional |terminateApplication| method so that Flutter can - * handle requests for termination in an asynchronous fashion. - * - * When a call to |terminate| comes in, either from the OS through a Quit menu - * item, through the Quit item in the dock context menu, or from the application - * itself, a request is sent to the Flutter framework. If that request is - * granted, this subclass will (in |terminateApplication|) call - * |NSApplication|'s version of |terminate| to proceed with terminating the - * application normally by calling |applicationShouldTerminate|, etc. - * - * If the termination request is denied by the framework, then the application - * will continue to execute normally, as if no |terminate| call were made. - * - * The |FlutterAppDelegate| always returns |NSTerminateNow| from - * |applicationShouldTerminate|, since it has already decided by that point that - * it should terminate. - * - * In order for this class to be used in place of |NSApplication|, the - * "NSPrincipalClass" entry in the Info.plist for the application must be set to - * "FlutterApplication". If it is not, then the application will not be given - * the chance to deny a termination request, and calls to requestAppExit on the - * engine (from the framework, typically) will simply exit the application - * without ceremony. - * - * If the |NSApp| global isn't of type |FlutterApplication|, a log message will - * be printed once in debug mode when the application is first accessed through - * the singleton's |sharedApplication|, describing how to fix this. - * - * Flutter applications are *not* required to inherit from this class. - * Developers of custom |NSApplication| subclasses should copy and paste code as - * necessary from FlutterApplication.mm. - */ -@interface FlutterApplication : NSApplication -@end - -#endif // FLUTTER_FLUTTERAPPLICATION_H_ diff --git a/shell/platform/darwin/macos/framework/Headers/FlutterMacOS.h b/shell/platform/darwin/macos/framework/Headers/FlutterMacOS.h index 13c7f78775ec4..5fc794b92995d 100644 --- a/shell/platform/darwin/macos/framework/Headers/FlutterMacOS.h +++ b/shell/platform/darwin/macos/framework/Headers/FlutterMacOS.h @@ -3,7 +3,6 @@ // found in the LICENSE file. #import "FlutterAppDelegate.h" -#import "FlutterApplication.h" #import "FlutterBinaryMessenger.h" #import "FlutterChannels.h" #import "FlutterCodecs.h" diff --git a/shell/platform/darwin/macos/framework/Source/FlutterApplication.mm b/shell/platform/darwin/macos/framework/Source/FlutterApplication.mm deleted file mode 100644 index 8c9797192c23a..0000000000000 --- a/shell/platform/darwin/macos/framework/Source/FlutterApplication.mm +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import "flutter/shell/platform/darwin/macos/framework/Headers/FlutterApplication.h" - -@implementation FlutterApplication -@end