diff --git a/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.dfm b/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.dfm index 4ba998cd..8782e4b0 100644 --- a/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.dfm +++ b/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.dfm @@ -312,6 +312,7 @@ object MiniBrowserFrm: TMiniBrowserFrm OnResourceResponse = Chromium1ResourceResponse OnFileDialog = Chromium1FileDialog OnDevToolsMethodResult = Chromium1DevToolsMethodResult + OnChromeCommand = Chromium1ChromeCommand OnRequestMediaAccessPermission = Chromium1RequestMediaAccessPermission Left = 32 Top = 224 diff --git a/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas b/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas index b13c3bd0..680ba3d1 100644 --- a/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas +++ b/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas @@ -175,6 +175,7 @@ type procedure Chromium1FileDialog(Sender: TObject; const browser: ICefBrowser; mode: TCefFileDialogMode; const title, defaultFilePath: ustring; const acceptFilters, accept_extensions, accept_descriptions: TStrings; const callback: ICefFileDialogCallback; var Result: Boolean); procedure Chromium1LoadError(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; errorCode: TCefErrorCode; const errorText, failedUrl: ustring); procedure Chromium1ResolvedHostAvailable(Sender: TObject; result: TCefErrorCode; const resolvedIps: TStrings); + procedure Chromium1ChromeCommand(Sender: TObject; const browser: ICefBrowser; command_id: Integer; disposition: TCefWindowOpenDisposition; var aResult: Boolean); procedure BackBtnClick(Sender: TObject); procedure ForwardBtnClick(Sender: TObject); @@ -553,6 +554,14 @@ begin Result := False; end; +procedure TMiniBrowserFrm.Chromium1ChromeCommand(Sender: TObject; + const browser: ICefBrowser; command_id: Integer; + disposition: TCefWindowOpenDisposition; var aResult: Boolean); +begin + aResult := (command_id = IDC_HELP_PAGE_VIA_KEYBOARD) or // Block the new Chromium window created when the user presses F1 for help. + (command_id = IDC_FULLSCREEN); // Block the "switch to full screen" command when the user presses F11. +end; + procedure TMiniBrowserFrm.Chromium1ConsoleMessage(Sender: TObject; const browser: ICefBrowser; level: TCefLogSeverity; const message_, source: ustring; line: Integer; out Result: Boolean); diff --git a/demos/Delphi_VCL/MiniBrowserD7/MiniBrowser.res b/demos/Delphi_VCL/MiniBrowserD7/MiniBrowser.res new file mode 100644 index 00000000..3aaf24bc Binary files /dev/null and b/demos/Delphi_VCL/MiniBrowserD7/MiniBrowser.res differ diff --git a/demos/Delphi_VCL/MiniBrowserD7/uMiniBrowser.dfm b/demos/Delphi_VCL/MiniBrowserD7/uMiniBrowser.dfm index 09f6dfd6..23db2f8d 100644 --- a/demos/Delphi_VCL/MiniBrowserD7/uMiniBrowser.dfm +++ b/demos/Delphi_VCL/MiniBrowserD7/uMiniBrowser.dfm @@ -264,6 +264,7 @@ object MiniBrowserFrm: TMiniBrowserFrm OnAfterCreated = Chromium1AfterCreated OnBeforeClose = Chromium1BeforeClose OnClose = Chromium1Close + OnChromeCommand = Chromium1ChromeCommand Left = 32 Top = 224 end diff --git a/demos/Delphi_VCL/MiniBrowserD7/uMiniBrowser.pas b/demos/Delphi_VCL/MiniBrowserD7/uMiniBrowser.pas index 4b706a3b..19764bde 100644 --- a/demos/Delphi_VCL/MiniBrowserD7/uMiniBrowser.pas +++ b/demos/Delphi_VCL/MiniBrowserD7/uMiniBrowser.pas @@ -57,7 +57,8 @@ type procedure Chromium1LoadEnd(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer); procedure Chromium1LoadError(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; errorCode: TCefErrorCode; const errorText, failedUrl: ustring); procedure Chromium1StatusMessage(Sender: TObject; const browser: ICefBrowser; const value: ustring); - procedure Chromium1TitleChange(Sender: TObject; const browser: ICefBrowser; const title: ustring); + procedure Chromium1TitleChange(Sender: TObject; const browser: ICefBrowser; const title: ustring); + procedure Chromium1ChromeCommand(Sender: TObject; const browser: ICefBrowser; command_id: Integer; disposition: TCefWindowOpenDisposition; var aResult: Boolean); procedure BackBtnClick(Sender: TObject); procedure ConfigBtnClick(Sender: TObject); @@ -320,10 +321,7 @@ begin // if TChromium.MultiBrowserMode is enabled then we have to close all // stored browsers and not only the main browser. Chromium1.CloseAllBrowsers; - - // Workaround for the missing TChormium.OnClose event when "Chrome runtime" is enabled. - if GlobalCEFApp.ChromeRuntime then - CEFWindowParent1.Free; + CEFWindowParent1.Free; end; end; @@ -341,7 +339,6 @@ begin // used when you call any method or property in TChromium. Chromium1.MultiBrowserMode := True; Chromium1.DefaultURL := MINIBROWSER_HOMEPAGE; - Chromium1.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY; end; procedure TMiniBrowserFrm.FormShow(Sender: TObject); @@ -412,4 +409,12 @@ begin GlobalCEFApp.OsmodalLoop := False; end; +procedure TMiniBrowserFrm.Chromium1ChromeCommand(Sender: TObject; + const browser: ICefBrowser; command_id: Integer; + disposition: TCefWindowOpenDisposition; var aResult: Boolean); +begin + aResult := (command_id = IDC_HELP_PAGE_VIA_KEYBOARD) or // Block the new Chromium window created when the user presses F1 for help. + (command_id = IDC_FULLSCREEN); // Block the "switch to full screen" command when the user presses F11. +end; + end. diff --git a/demos/Lazarus_Linux_GTK2/MiniBrowser/uMiniBrowser.lfm b/demos/Lazarus_Linux_GTK2/MiniBrowser/uMiniBrowser.lfm index 0ef2052a..7bdb7b8d 100644 --- a/demos/Lazarus_Linux_GTK2/MiniBrowser/uMiniBrowser.lfm +++ b/demos/Lazarus_Linux_GTK2/MiniBrowser/uMiniBrowser.lfm @@ -15,7 +15,6 @@ object MiniBrowserFrm: TMiniBrowserFrm OnCreate = FormCreate OnDestroy = FormDestroy Position = poScreenCenter - LCLVersion = '3.4.0.0' object NavControlPnl: TPanel Left = 0 Height = 25 @@ -250,6 +249,7 @@ object MiniBrowserFrm: TMiniBrowserFrm OnPrintJob = Chromium1PrintJob OnPrintReset = Chromium1PrintReset OnGetPDFPaperSize = Chromium1GetPDFPaperSize + OnChromeCommand = Chromium1ChromeCommand Left = 32 Top = 224 end diff --git a/demos/Lazarus_Linux_GTK2/MiniBrowser/uMiniBrowser.pas b/demos/Lazarus_Linux_GTK2/MiniBrowser/uMiniBrowser.pas index 1225d78e..aa1ba5f2 100644 --- a/demos/Lazarus_Linux_GTK2/MiniBrowser/uMiniBrowser.pas +++ b/demos/Lazarus_Linux_GTK2/MiniBrowser/uMiniBrowser.pas @@ -59,6 +59,7 @@ type OpenfilewithaDAT1: TMenuItem; procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); + procedure Chromium1ChromeCommand(Sender: TObject; const browser: ICefBrowser; command_id: integer; disposition: TCefWindowOpenDisposition; var aResult: boolean); procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction); procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser); procedure Chromium1GetPDFPaperSize(Sender: TObject; const browser: ICefBrowser; deviceUnitsPerInch: Integer; var aResult: TCefSize); @@ -620,6 +621,14 @@ begin SendCompMessage(CEF_AFTERCREATED); end; +procedure TMiniBrowserFrm.Chromium1ChromeCommand(Sender: TObject; + const browser: ICefBrowser; command_id: integer; + disposition: TCefWindowOpenDisposition; var aResult: boolean); +begin + aResult := (command_id = IDC_HELP_PAGE_VIA_KEYBOARD) or // Block the new Chromium window created when the user presses F1 for help. + (command_id = IDC_FULLSCREEN); // Block the "switch to full screen" command when the user presses F11. +end; + procedure TMiniBrowserFrm.Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser); begin // The main browser is being destroyed diff --git a/demos/Lazarus_Windows/MiniBrowser/uMiniBrowser.lfm b/demos/Lazarus_Windows/MiniBrowser/uMiniBrowser.lfm index 4909d6d3..2f05f1b5 100644 --- a/demos/Lazarus_Windows/MiniBrowser/uMiniBrowser.lfm +++ b/demos/Lazarus_Windows/MiniBrowser/uMiniBrowser.lfm @@ -15,6 +15,7 @@ object MiniBrowserFrm: TMiniBrowserFrm OnDestroy = FormDestroy OnShow = FormShow Position = poScreenCenter + LCLVersion = '3.4.0.0' object Splitter1: TSplitter Left = 1179 Height = 663 @@ -117,11 +118,11 @@ object MiniBrowserFrm: TMiniBrowserFrm TabOrder = 1 object URLCbx: TComboBox Left = 0 - Height = 22 + Height = 21 Top = 3 Width = 978 Anchors = [akTop, akLeft, akRight, akBottom] - ItemHeight = 14 + ItemHeight = 13 ItemIndex = 0 Items.Strings = ( 'https://www.google.com' @@ -274,6 +275,7 @@ object MiniBrowserFrm: TMiniBrowserFrm OnBeforeResourceLoad = Chromium1BeforeResourceLoad OnResourceResponse = Chromium1ResourceResponse OnDevToolsMethodResult = Chromium1DevToolsMethodResult + OnChromeCommand = Chromium1ChromeCommand OnRequestMediaAccessPermission = Chromium1RequestMediaAccessPermission Left = 32 Top = 224 diff --git a/demos/Lazarus_Windows/MiniBrowser/uMiniBrowser.pas b/demos/Lazarus_Windows/MiniBrowser/uMiniBrowser.pas index 3c3697ed..5f0d38ce 100644 --- a/demos/Lazarus_Windows/MiniBrowser/uMiniBrowser.pas +++ b/demos/Lazarus_Windows/MiniBrowser/uMiniBrowser.pas @@ -118,7 +118,7 @@ type N5: TMenuItem; Memoryinfo1: TMenuItem; - procedure FormShow(Sender: TObject); + procedure FormShow(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); @@ -186,6 +186,7 @@ type procedure Chromium1LoadError(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; errorCode: Integer; const errorText, failedUrl: ustring); procedure Chromium1CertificateError(Sender: TObject; const browser: ICefBrowser; certError: Integer; const requestUrl: ustring; const sslInfo: ICefSslInfo; const callback: ICefCallback; out Result: Boolean); procedure Chromium1NavigationVisitorResultAvailable(Sender: TObject; const entry: ICefNavigationEntry; current: Boolean; index, total: Integer; var aResult: Boolean); + procedure Chromium1ChromeCommand(Sender: TObject; const browser: ICefBrowser; command_id: integer; disposition: TCefWindowOpenDisposition; var aResult: boolean); protected FResponse : TStringList; @@ -1142,6 +1143,14 @@ begin if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) then Timer1.Enabled := True; end; +procedure TMiniBrowserFrm.Chromium1ChromeCommand(Sender: TObject; + const browser: ICefBrowser; command_id: integer; + disposition: TCefWindowOpenDisposition; var aResult: boolean); +begin + aResult := (command_id = IDC_HELP_PAGE_VIA_KEYBOARD) or // Block the new Chromium window created when the user presses F1 for help. + (command_id = IDC_FULLSCREEN); // Block the "switch to full screen" command when the user presses F11. +end; + procedure TMiniBrowserFrm.Chromium1CookiesFlushed(Sender: TObject); begin PostMessage(Handle, MINIBROWSER_COOKIESFLUSHED, 0, 0); diff --git a/update_CEF4Delphi.json b/update_CEF4Delphi.json index 18b73c5c..dacd0907 100644 --- a/update_CEF4Delphi.json +++ b/update_CEF4Delphi.json @@ -2,7 +2,7 @@ "UpdateLazPackages" : [ { "ForceNotify" : true, - "InternalVersion" : 653, + "InternalVersion" : 654, "Name" : "cef4delphi_lazarus.lpk", "Version" : "128.4.9" }