From b731deee3b98f570140c7abf7516e6c7decca74a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Salvador=20D=C3=ADaz=20Fau?= Date: Sat, 15 Mar 2025 15:36:47 +0100 Subject: [PATCH] Added a menu option to download a file in MiniBrowser --- demos/Delphi_VCL/MiniBrowser/uMiniBrowser.dfm | 7 +++++++ demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas | 12 ++++++++++++ update_CEF4Delphi.json | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.dfm b/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.dfm index 8782e4b0..dc9d7681 100644 --- a/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.dfm +++ b/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.dfm @@ -177,6 +177,9 @@ object MiniBrowserFrm: TMiniBrowserFrm 'https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/acc' + 'ept' + + 'https://codesandbox.io/p/sandbox/image-blob-example-0igon?file=%' + + '2Fsrc%2FApp.js' 'chrome://version/' 'chrome://net-internals/' 'chrome://tracing/' @@ -384,6 +387,10 @@ object MiniBrowserFrm: TMiniBrowserFrm Caption = 'Download image...' OnClick = Downloadimage1Click end + object Downloadfile1: TMenuItem + Caption = 'Download file...' + OnClick = Downloadfile1Click + end object Simulatekeyboardpresses1: TMenuItem Caption = 'Simulate keyboard presses' OnClick = Simulatekeyboardpresses1Click diff --git a/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas b/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas index bdce46a1..f9965ca5 100644 --- a/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas +++ b/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas @@ -132,6 +132,7 @@ type SaveasMHTML1: TMenuItem; Allowdownloads1: TMenuItem; Toggleaudio1: TMenuItem; + Downloadfile1: TMenuItem; procedure FormShow(Sender: TObject); procedure FormCreate(Sender: TObject); @@ -209,6 +210,7 @@ type procedure SaveasMHTML1Click(Sender: TObject); procedure Allowdownloads1Click(Sender: TObject); procedure Toggleaudio1Click(Sender: TObject); + procedure Downloadfile1Click(Sender: TObject); protected FPendingMsgID : integer; @@ -2118,6 +2120,16 @@ begin ShowDevTools; end; +procedure TMiniBrowserFrm.Downloadfile1Click(Sender: TObject); +var + TempURL : string; +begin + TempURL := InputBox('Download File', 'URL:', ''); + + if (length(TempURL) > 0) then + Chromium1.StartDownload(TempURL); +end; + procedure TMiniBrowserFrm.Downloadimage1Click(Sender: TObject); var TempURL : string; diff --git a/update_CEF4Delphi.json b/update_CEF4Delphi.json index a487614d..cd007efe 100644 --- a/update_CEF4Delphi.json +++ b/update_CEF4Delphi.json @@ -2,7 +2,7 @@ "UpdateLazPackages" : [ { "ForceNotify" : true, - "InternalVersion" : 713, + "InternalVersion" : 714, "Name" : "cef4delphi_lazarus.lpk", "Version" : "134.3.2" }