1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-11-23 21:34:53 +02:00

CrAppProtocol for cocoa / Add Cocoa CloseChildHandle

This commit is contained in:
martin
2021-02-25 15:10:58 +01:00
parent 08d8c3076f
commit 121a43e824
8 changed files with 225 additions and 7 deletions

View File

@@ -5,4 +5,9 @@ cd "$(dirname "$0")"
../../Lazarus_any_OS/AppHelper/create_mac_helper_apps.sh ../../../bin/ExternalPumpBrowser.app
if [ "$(grep -i TCrCocoaApplication ../../../bin/ExternalPumpBrowser.app/Contents/Info.plist)" = "" ];
then
sed -i '' "1,4s/<dict>/<dict>\n <key>NSPrincipalClass<\/key>\n <string>TCrCocoaApplication<\/string>/" ../../../bin/ExternalPumpBrowser.app/Contents/Info.plist
fi
cd "$CDIR"

View File

@@ -43,7 +43,9 @@ unit uExternalPumpBrowser;
interface
uses
GlobalCefApplication, Classes, SysUtils, Messages, Forms, Controls, Graphics,
GlobalCefApplication,
uCEFLazarusCocoa, // required for Cocoa
Classes, SysUtils, Messages, Forms, Controls, Graphics,
Dialogs, ExtCtrls, StdCtrls, LMessages, uCEFChromium, uCEFWindowParent,
uCEFConstants, uCEFTypes, uCEFInterfaces, uCEFChromiumEvents,
uCEFLinkedWindowParent, uCEFWorkScheduler;
@@ -194,7 +196,9 @@ end;
procedure TForm1.Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction: TCefCloseBrowserAction);
begin
aAction := cbaClose;
// continue closing the browser
CEFLinkedWindowParent1.DestroyChildWindow;
aAction := cbaDelay;
end;
procedure TForm1.Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
@@ -267,6 +271,7 @@ begin
end;
initialization
AddCrDelegate;
if GlobalCEFApp = nil then begin
CreateGlobalCEFApp;
if not GlobalCEFApp.StartMainProcess then begin

View File

@@ -5,4 +5,9 @@ cd "$(dirname "$0")"
../AppHelper/create_mac_helper_apps.sh ../../../bin/ExternalPumpBrowser.app
if [ "$(grep -i TCrCocoaApplication ../../../bin/ExternalPumpBrowser.app/Contents/Info.plist)" = "" ];
then
sed -i '' "1,4s/<dict>/<dict>\n <key>NSPrincipalClass<\/key>\n <string>TCrCocoaApplication<\/string>/" ../../../bin/ExternalPumpBrowser.app/Contents/Info.plist
fi
cd "$CDIR"

View File

@@ -43,7 +43,9 @@ unit uExternalPumpBrowser;
interface
uses
GlobalCefApplication, Classes, SysUtils, Messages, Forms, Controls, Graphics,
GlobalCefApplication,
uCEFLazarusCocoa, // required for Cocoa
Classes, SysUtils, Messages, Forms, Controls, Graphics,
Dialogs, ExtCtrls, StdCtrls, LMessages, uCEFChromium, uCEFWindowParent,
uCEFConstants, uCEFTypes, uCEFInterfaces, uCEFChromiumEvents,
uCEFLinkedWindowParent, uCEFWorkScheduler;
@@ -291,6 +293,9 @@ end;
{$ENDIF}
initialization
{$IFDEF DARWIN} // $IFDEF MACOSX
AddCrDelegate;
{$ENDIF}
if GlobalCEFApp = nil then begin
CreateGlobalCEFApp;
if not GlobalCEFApp.StartMainProcess then begin