diff --git a/README.md b/README.md index d63e8bfe..8812a818 100644 --- a/README.md +++ b/README.md @@ -3,15 +3,15 @@ CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chro CEF4Delphi is based on DCEF3 and fpCEF3. The original license of those projects still applies to CEF4Delphi. Read the license terms in the LICENSE.md file. -CEF4Delphi uses CEF 117.2.5 which includes Chromium 117.0.5938.152. +CEF4Delphi uses CEF 118.6.6 which includes Chromium 117.0.5993.96. The CEF binaries used by CEF4Delphi are available for download at Spotify : -* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_117.2.5%2Bgda4c36a%2Bchromium-117.0.5938.152_windows32.tar.bz2) -* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_117.2.5%2Bgda4c36a%2Bchromium-117.0.5938.152_windows64.tar.bz2) -* [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_117.2.5%2Bgda4c36a%2Bchromium-117.0.5938.152_linux64.tar.bz2) -* [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_117.2.5%2Bgda4c36a%2Bchromium-117.0.5938.152_linuxarm.tar.bz2) -* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_117.2.5%2Bgda4c36a%2Bchromium-117.0.5938.152_linuxarm64.tar.bz2) -* [MacOS x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_117.2.5%2Bgda4c36a%2Bchromium-117.0.5938.152_macosx64.tar.bz2) +* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_118.6.6%2Bg3cffa57%2Bchromium-117.0.5993.96_windows32.tar.bz2) +* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_118.6.6%2Bg3cffa57%2Bchromium-118.0.5993.96_windows64.tar.bz2) +* [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_118.6.6%2Bg3cffa57%2Bchromium-117.0.5993.96_linux64.tar.bz2) +* [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_118.6.6%2Bg3cffa57%2Bchromium-117.0.5993.96_linuxarm.tar.bz2) +* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_118.6.6%2Bg3cffa57%2Bchromium-117.0.5993.96_linuxarm64.tar.bz2) +* [MacOS x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_118.6.6%2Bg3cffa57%2Bchromium-117.0.5993.96_macosx64.tar.bz2) CEF4Delphi was developed and tested on Delphi 11.3 and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2, Delphi 10.3, Delphi 10.4 and Lazarus 2.2.6/FPC 3.2.2. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components. diff --git a/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas b/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas index a4c7db68..4d03a4dc 100644 --- a/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas +++ b/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas @@ -54,6 +54,9 @@ const MINIBROWSER_CONTEXTMENU_GETNAVIGATION = MENU_ID_USER_FIRST + 12; MINIBROWSER_CONTEXTMENU_MUTEAUDIO = MENU_ID_USER_FIRST + 13; MINIBROWSER_CONTEXTMENU_UNMUTEAUDIO = MENU_ID_USER_FIRST + 14; + MINIBROWSER_CONTEXTMENU_INCZOOM = MENU_ID_USER_FIRST + 15; + MINIBROWSER_CONTEXTMENU_DECZOOM = MENU_ID_USER_FIRST + 16; + MINIBROWSER_CONTEXTMENU_RESETZOOM = MENU_ID_USER_FIRST + 17; DEVTOOLS_SCREENSHOT_MSGID = 1; DEVTOOLS_MHTML_MSGID = 2; @@ -407,6 +410,16 @@ begin model.AddItem(MINIBROWSER_CONTEXTMENU_UNMUTEAUDIO, 'Unmute audio') else model.AddItem(MINIBROWSER_CONTEXTMENU_MUTEAUDIO, 'Mute audio'); + + model.AddSeparator; + if Chromium1.CanIncZoom then + model.AddItem(MINIBROWSER_CONTEXTMENU_INCZOOM, 'Increment zoom'); + + if Chromium1.CanDecZoom then + model.AddItem(MINIBROWSER_CONTEXTMENU_DECZOOM, 'Decrement zoom'); + + if Chromium1.CanResetZoom then + model.AddItem(MINIBROWSER_CONTEXTMENU_RESETZOOM, 'Reset zoom'); end else model.AddItem(MINIBROWSER_CONTEXTMENU_SHOWDEVTOOLS, 'Show DevTools'); @@ -585,6 +598,16 @@ begin MINIBROWSER_CONTEXTMENU_MUTEAUDIO : Chromium1.AudioMuted := True; + + MINIBROWSER_CONTEXTMENU_INCZOOM : + Chromium1.IncZoomCommand; + + MINIBROWSER_CONTEXTMENU_DECZOOM : + Chromium1.DecZoomCommand; + + MINIBROWSER_CONTEXTMENU_RESETZOOM : + Chromium1.ResetZoomCommand; + end else case commandId of @@ -1436,7 +1459,6 @@ var TempLanguageList : ustring; begin TempLanguageList := Chromium1.AcceptLanguageList; - if (length(TempLanguageList) = 0) then TempLanguageList := Chromium1.Options.AcceptLanguageList; if (length(TempLanguageList) = 0) then TempLanguageList := GlobalCEFApp.AcceptLanguageList; Chromium1.AcceptLanguageList := InputBox('Language', 'Accept language list', TempLanguageList); diff --git a/demos/Lazarus_Windows/MiniBrowser/uMiniBrowser.pas b/demos/Lazarus_Windows/MiniBrowser/uMiniBrowser.pas index acaa5eec..bd938565 100644 --- a/demos/Lazarus_Windows/MiniBrowser/uMiniBrowser.pas +++ b/demos/Lazarus_Windows/MiniBrowser/uMiniBrowser.pas @@ -79,7 +79,10 @@ const MINIBROWSER_CONTEXTMENU_TAKESNAPSHOT = MENU_ID_USER_FIRST + 11; MINIBROWSER_CONTEXTMENU_GETNAVIGATION = MENU_ID_USER_FIRST + 12; MINIBROWSER_CONTEXTMENU_MUTEAUDIO = MENU_ID_USER_FIRST + 13; - MINIBROWSER_CONTEXTMENU_UNMUTEAUDIO = MENU_ID_USER_FIRST + 14; + MINIBROWSER_CONTEXTMENU_UNMUTEAUDIO = MENU_ID_USER_FIRST + 14; + MINIBROWSER_CONTEXTMENU_INCZOOM = MENU_ID_USER_FIRST + 15; + MINIBROWSER_CONTEXTMENU_DECZOOM = MENU_ID_USER_FIRST + 16; + MINIBROWSER_CONTEXTMENU_RESETZOOM = MENU_ID_USER_FIRST + 17; DEVTOOLS_SCREENSHOT_MSGID = 1; DEVTOOLS_MHTML_MSGID = 2; @@ -409,7 +412,6 @@ var TempLanguageList : ustring; begin TempLanguageList := Chromium1.AcceptLanguageList; - if (length(TempLanguageList) = 0) then TempLanguageList := Chromium1.Options.AcceptLanguageList; if (length(TempLanguageList) = 0) then TempLanguageList := GlobalCEFApp.AcceptLanguageList; Chromium1.AcceptLanguageList := InputBox('Language', 'Accept language list', TempLanguageList); @@ -519,7 +521,17 @@ begin if Chromium1.AudioMuted then model.AddItem(MINIBROWSER_CONTEXTMENU_UNMUTEAUDIO, 'Unmute audio') else - model.AddItem(MINIBROWSER_CONTEXTMENU_MUTEAUDIO, 'Mute audio'); + model.AddItem(MINIBROWSER_CONTEXTMENU_MUTEAUDIO, 'Mute audio'); + + model.AddSeparator; + if Chromium1.CanIncZoom then + model.AddItem(MINIBROWSER_CONTEXTMENU_INCZOOM, 'Increment zoom'); + + if Chromium1.CanDecZoom then + model.AddItem(MINIBROWSER_CONTEXTMENU_DECZOOM, 'Decrement zoom'); + + if Chromium1.CanResetZoom then + model.AddItem(MINIBROWSER_CONTEXTMENU_RESETZOOM, 'Reset zoom'); end else model.AddItem(MINIBROWSER_CONTEXTMENU_SHOWDEVTOOLS, 'Show DevTools'); @@ -679,7 +691,16 @@ begin Chromium1.AudioMuted := False; MINIBROWSER_CONTEXTMENU_MUTEAUDIO : - Chromium1.AudioMuted := True; + Chromium1.AudioMuted := True; + + MINIBROWSER_CONTEXTMENU_INCZOOM : + Chromium1.IncZoomCommand; + + MINIBROWSER_CONTEXTMENU_DECZOOM : + Chromium1.DecZoomCommand; + + MINIBROWSER_CONTEXTMENU_RESETZOOM : + Chromium1.ResetZoomCommand; end else case commandId of diff --git a/docs/cef4delphi.chm b/docs/cef4delphi.chm index 64e1da9e..629f447e 100644 Binary files a/docs/cef4delphi.chm and b/docs/cef4delphi.chm differ diff --git a/packages/cef4delphi_lazarus.lpk b/packages/cef4delphi_lazarus.lpk index 6ae51e28..a12780d3 100644 --- a/packages/cef4delphi_lazarus.lpk +++ b/packages/cef4delphi_lazarus.lpk @@ -21,7 +21,7 @@ - + diff --git a/source/uCEFApplicationCore.pas b/source/uCEFApplicationCore.pas index e8bd75be..a013893e 100644 --- a/source/uCEFApplicationCore.pas +++ b/source/uCEFApplicationCore.pas @@ -90,6 +90,7 @@ type FAcceptLanguageList : ustring; FCookieableSchemesList : ustring; FCookieableSchemesExcludeDefaults : boolean; + FChromePolicyId : ustring; // Fields used to set command line switches FSingleProcess : boolean; @@ -669,11 +670,10 @@ type property BackgroundColor : TCefColor read FBackgroundColor write FBackgroundColor; /// /// Comma delimited ordered list of language codes without any whitespace that - /// will be used in the "Accept-Language" HTTP header. May be overridden on a - /// per-browser basis using the TCefBrowserSettings.accept_language_list value. - /// If both values are empty then "en-US,en" will be used. Can be overridden - /// for individual ICefRequestContext instances via the - /// TCefRequestContextSettings.accept_language_list value. + /// will be used in the "Accept-Language" HTTP request header and + /// "navigator.language" JS attribute. Can be overridden for individual + /// ICefRequestContext instances via the + /// TCefRequestContextSettingsCefRequestContextSettings.accept_language_list value. /// property AcceptLanguageList : ustring read FAcceptLanguageList write FAcceptLanguageList; /// @@ -693,6 +693,19 @@ type /// property CookieableSchemesExcludeDefaults : boolean read FCookieableSchemesExcludeDefaults write FCookieableSchemesExcludeDefaults; /// + /// Specify an ID to enable Chrome policy management via Platform and OS-user + /// policies. On Windows, this is a registry key like + /// "SOFTWARE\\Policies\\Google\\Chrome". On MacOS, this is a bundle ID like + /// "com.google.Chrome". On Linux, this is an absolute directory path like + /// "/etc/opt/chrome/policies". Only supported with the Chrome runtime. See + /// https://support.google.com/chrome/a/answer/9037717 for details. + /// Chrome Browser Cloud Management integration, when enabled via the + /// "enable-chrome-browser-cloud-management" command-line flag, will also use + /// the specified ID. See https://support.google.com/chrome/a/answer/9116814 + /// for details. + /// + property ChromePolicyId : ustring read FChromePolicyId write FChromePolicyId; + /// /// Runs the renderer and plugins in the same process as the browser. /// /// @@ -1727,6 +1740,7 @@ begin FAcceptLanguageList := ''; FCookieableSchemesList := ''; FCookieableSchemesExcludeDefaults := False; + FChromePolicyId := ''; // Fields used to set command line switches FSingleProcess := False; @@ -2674,6 +2688,7 @@ begin aSettings.accept_language_list := CefString(FAcceptLanguageList); aSettings.cookieable_schemes_list := CefString(FCookieableSchemesList); aSettings.cookieable_schemes_exclude_defaults := Ord(FCookieableSchemesExcludeDefaults); + aSettings.chrome_policy_id := CefString(FChromePolicyId); end; function TCefApplicationCore.InitializeLibrary(const aApp : ICefApp) : boolean; diff --git a/source/uCEFBrowser.pas b/source/uCEFBrowser.pas index 383e6e3f..677de3bc 100644 --- a/source/uCEFBrowser.pas +++ b/source/uCEFBrowser.pas @@ -59,6 +59,9 @@ type function HasView: Boolean; function GetClient: ICefClient; function GetRequestContext: ICefRequestContext; + function CanZoom(command: TCefZoomCommand): boolean; + procedure Zoom(command: TCefZoomCommand); + function GetDefaultZoomLevel: Double; function GetZoomLevel: Double; procedure SetZoomLevel(const zoomLevel: Double); procedure RunFileDialog(mode: TCefFileDialogMode; const title, defaultFilePath: ustring; const acceptFilters: TStrings; const callback: ICefRunFileDialogCallback); @@ -535,6 +538,21 @@ begin Result := TCefRequestContextRef.UnWrap(PCefBrowserHost(FData)^.get_request_context(PCefBrowserHost(FData))); end; +function TCefBrowserHostRef.CanZoom(command: TCefZoomCommand): boolean; +begin + Result := (PCefBrowserHost(FData)^.can_zoom(PCefBrowserHost(FData), command) <> 0); +end; + +procedure TCefBrowserHostRef.Zoom(command: TCefZoomCommand); +begin + PCefBrowserHost(FData)^.zoom(PCefBrowserHost(FData), command); +end; + +function TCefBrowserHostRef.GetDefaultZoomLevel: Double; +begin + Result := PCefBrowserHost(FData)^.get_default_zoom_level(PCefBrowserHost(FData)); +end; + procedure TCefBrowserHostRef.GetNavigationEntries(const visitor: ICefNavigationEntryVisitor; currentOnly: Boolean); begin PCefBrowserHost(FData)^.get_navigation_entries(PCefBrowserHost(FData), CefGetData(visitor), Ord(currentOnly)); diff --git a/source/uCEFChromiumCore.pas b/source/uCEFChromiumCore.pas index 0832fcb6..7aef676b 100644 --- a/source/uCEFChromiumCore.pas +++ b/source/uCEFChromiumCore.pas @@ -345,6 +345,10 @@ type function GetZoomLevel : double; function GetZoomPct : double; function GetZoomStep : byte; + function GetDefaultZoomLevel : double; + function GetCanIncZoom: boolean; + function GetCanDecZoom: boolean; + function GetCanResetZoom: boolean; function GetIsPopUp : boolean; function GetWindowHandle : TCefWindowHandle; function GetOpenerWindowHandle : TCefWindowHandle; @@ -1215,6 +1219,24 @@ type /// procedure ReadZoom; /// + /// Execute a zoom IN command in this browser. If called on the CEF UI thread the + /// change will be applied immediately. Otherwise, the change will be applied + /// asynchronously on the CEF UI thread. + /// + procedure IncZoomCommand; + /// + /// Execute a zoom OUT command in this browser. If called on the CEF UI thread the + /// change will be applied immediately. Otherwise, the change will be applied + /// asynchronously on the CEF UI thread. + /// + procedure DecZoomCommand; + /// + /// Execute a zoom RESET command in this browser. If called on the CEF UI thread the + /// change will be applied immediately. Otherwise, the change will be applied + /// asynchronously on the CEF UI thread. + /// + procedure ResetZoomCommand; + /// /// Notify the browser that the widget has been resized. The browser will /// first call ICefRenderHandler.GetViewRect to get the new size and then /// call ICefRenderHandler.OnPaint asynchronously with the updated @@ -1833,6 +1855,27 @@ type /// property ZoomLevel : double read GetZoomLevel write SetZoomLevel; /// + /// Get the default zoom level. This value will be 0.0 by default but can be + /// configured with the Chrome runtime. This function can only be called on + /// the CEF UI thread. + /// + property DefaultZoomLevel : double read GetDefaultZoomLevel; + /// + /// Returns true (1) if this browser can execute the zoom IN command. + /// This function can only be called on the CEF UI thread. + /// + property CanIncZoom : boolean read GetCanIncZoom; + /// + /// Returns true (1) if this browser can execute the zoom OUT command. + /// This function can only be called on the CEF UI thread. + /// + property CanDecZoom : boolean read GetCanDecZoom; + /// + /// Returns true (1) if this browser can execute the zoom RESET command. + /// This function can only be called on the CEF UI thread. + /// + property CanResetZoom : boolean read GetCanResetZoom; + /// /// Returns the current zoom value. This property is based on the CefBrowserHost.ZoomLevel value which can only be read in the CEF UI thread. /// property ZoomPct : double read GetZoomPct write SetZoomPct; @@ -5027,8 +5070,8 @@ begin aSettings.databases := FOptions.Databases; aSettings.webgl := FOptions.Webgl; aSettings.background_color := FOptions.BackgroundColor; - aSettings.accept_language_list := CefString(FOptions.AcceptLanguageList); aSettings.chrome_status_bubble := FOptions.ChromeStatusBubble; + aSettings.chrome_zoom_bubble := FOptions.ChromeZoomBubble; end; end; @@ -5605,6 +5648,32 @@ begin end; end; +function TChromiumCore.GetDefaultZoomLevel : double; +begin + if Initialized then + Result := Browser.Host.DefaultZoomLevel + else + Result := 0; +end; + +function TChromiumCore.GetCanIncZoom: boolean; +begin + Result := Initialized and + Browser.Host.CanZoom(CEF_ZOOM_COMMAND_IN); +end; + +function TChromiumCore.GetCanDecZoom: boolean; +begin + Result := Initialized and + Browser.Host.CanZoom(CEF_ZOOM_COMMAND_OUT); +end; + +function TChromiumCore.GetCanResetZoom: boolean; +begin + Result := Initialized and + Browser.Host.CanZoom(CEF_ZOOM_COMMAND_RESET); +end; + procedure TChromiumCore.SetZoomLevel(const aValue : double); begin if CefCurrentlyOn(TID_UI) then @@ -5629,7 +5698,6 @@ begin ExecuteSetZoomStepTask(aValue); end; -// Increments the Zoom Step value and triggers the TChromium.OnZoomPctAvailable event with the new value procedure TChromiumCore.IncZoomStep; begin if CefCurrentlyOn(TID_UI) then @@ -5638,7 +5706,6 @@ begin ExecuteUpdateZoomStepTask(True); end; -// Decrements the Zoom Step value and triggers the TChromium.OnZoomPctAvailable event with the new value procedure TChromiumCore.DecZoomStep; begin if CefCurrentlyOn(TID_UI) then @@ -5647,7 +5714,6 @@ begin ExecuteUpdateZoomStepTask(False); end; -// Increments the Zoom Percent value and triggers the TChromium.OnZoomPctAvailable event with the new value procedure TChromiumCore.IncZoomPct; begin if CefCurrentlyOn(TID_UI) then @@ -5656,7 +5722,6 @@ begin ExecuteUpdateZoomPctTask(True); end; -// Decrements the Zoom Percent value and triggers the TChromium.OnZoomPctAvailable event with the new value procedure TChromiumCore.DecZoomPct; begin if CefCurrentlyOn(TID_UI) then @@ -5665,25 +5730,21 @@ begin ExecuteUpdateZoomPctTask(False); end; -// Sets the Zoom Step to the default value and triggers the TChromium.OnZoomPctAvailable event procedure TChromiumCore.ResetZoomStep; begin ZoomStep := ZOOM_STEP_DEF; end; -// Sets the Zoom Level to the default value and triggers the TChromium.OnZoomPctAvailable event procedure TChromiumCore.ResetZoomLevel; begin ZoomLevel := 0; end; -// Sets the Zoom Percent to the default value and triggers the TChromium.OnZoomPctAvailable event procedure TChromiumCore.ResetZoomPct; begin ZoomPct := ZoomStepValues[ZOOM_STEP_DEF]; end; -// Triggers the TChromium.OnZoomPctAvailable event with the current Zoom Percent value procedure TChromiumCore.ReadZoom; begin if CefCurrentlyOn(TID_UI) then @@ -5692,6 +5753,24 @@ begin ExecuteReadZoomTask; end; +procedure TChromiumCore.IncZoomCommand; +begin + if Initialized then + Browser.Host.Zoom(CEF_ZOOM_COMMAND_IN); +end; + +procedure TChromiumCore.DecZoomCommand; +begin + if Initialized then + Browser.Host.Zoom(CEF_ZOOM_COMMAND_OUT); +end; + +procedure TChromiumCore.ResetZoomCommand; +begin + if Initialized then + Browser.Host.Zoom(CEF_ZOOM_COMMAND_RESET); +end; + function TChromiumCore.ExecuteUpdateZoomStepTask(aInc : boolean) : boolean; var TempTask : ICefTask; @@ -6678,9 +6757,6 @@ begin TempLanguagesList := FAcceptLanguageList; - if (length(TempLanguagesList) = 0) and (FOptions <> nil) then - TempLanguagesList := FOptions.AcceptLanguageList; - if (length(TempLanguagesList) = 0) then TempLanguagesList := GlobalCEFApp.AcceptLanguageList; diff --git a/source/uCEFChromiumOptions.pas b/source/uCEFChromiumOptions.pas index 7d6d89f5..2664bd1b 100644 --- a/source/uCEFChromiumOptions.pas +++ b/source/uCEFChromiumOptions.pas @@ -38,8 +38,8 @@ type FDatabases : TCefState; FWebgl : TCefState; FBackgroundColor : TCefColor; - FAcceptLanguageList : ustring; FChromeStatusBubble : TCefState; + FChromeZoomBubble : TCefState; public /// @@ -123,13 +123,6 @@ type /// property BackgroundColor : TCefColor read FBackgroundColor write FBackgroundColor default 0; /// - /// Comma delimited ordered list of language codes without any whitespace that - /// will be used in the "Accept-Language" HTTP header. May be set globally - /// using the TCefSettings.accept_language_list value. If both values are - /// empty then "en-US,en" will be used. - /// - property AcceptLanguageList : ustring read FAcceptLanguageList write FAcceptLanguageList; - /// /// The maximum rate in frames per second (fps) that ICefRenderHandler.OnPaint /// will be called for a windowless browser. The actual fps may be lower if /// the browser cannot generate frames at the requested rate. The minimum @@ -147,6 +140,11 @@ type /// https://www.chromium.org/user-experience/status-bubble/ /// property ChromeStatusBubble : TCefState read FChromeStatusBubble write FChromeStatusBubble default STATE_DEFAULT; + /// + /// Controls whether the Chrome zoom bubble will be shown when zooming. Only + /// supported with the Chrome runtime. + /// + property ChromeZoomBubble : TCefState read FChromeZoomBubble write FChromeZoomBubble default STATE_DEFAULT; end; implementation @@ -167,6 +165,7 @@ begin FWebgl := STATE_DEFAULT; FBackgroundColor := 0; FChromeStatusBubble := STATE_DEFAULT; + FChromeZoomBubble := STATE_DEFAULT; end; end. diff --git a/source/uCEFDragData.pas b/source/uCEFDragData.pas index 66e5a34a..2793715c 100644 --- a/source/uCEFDragData.pas +++ b/source/uCEFDragData.pas @@ -36,6 +36,7 @@ type function GetFileName: ustring; function GetFileContents(const writer: ICefStreamWriter): NativeUInt; function GetFileNames(var names: TStrings): Integer; + function GetFilePaths(var paths: TStrings): Integer; procedure SetLinkUrl(const url: ustring); procedure SetLinkTitle(const title: ustring); procedure SetLinkMetadata(const data: ustring); @@ -120,6 +121,24 @@ begin end; end; +function TCefDragDataRef.GetFilePaths(var paths: TStrings): Integer; +var + TempSL : ICefStringList; +begin + Result := 0; + + if (paths <> nil) then + begin + TempSL := TCefStringListOwn.Create; + + if (PCefDragData(FData)^.get_file_paths(FData, TempSL.Handle) <> 0) then + begin + TempSL.CopyToStrings(paths); + Result := paths.Count; + end; + end; +end; + function TCefDragDataRef.GetFragmentBaseUrl: ustring; begin Result := CefStringFreeAndGet(PCefDragData(FData)^.get_fragment_base_url(FData)); diff --git a/source/uCEFInterfaces.pas b/source/uCEFInterfaces.pas index 67ae7fc1..61ae826a 100644 --- a/source/uCEFInterfaces.pas +++ b/source/uCEFInterfaces.pas @@ -845,15 +845,32 @@ type /// function GetRequestContext: ICefRequestContext; /// - /// Get the current zoom level. The default zoom level is 0.0. This function - /// can only be called on the UI thread. + /// Returns true (1) if this browser can execute the specified zoom command. + /// This function can only be called on the UI thread. + /// + function CanZoom(command: TCefZoomCommand): boolean; + /// + /// Execute a zoom command in this browser. If called on the UI thread the + /// change will be applied immediately. Otherwise, the change will be applied + /// asynchronously on the UI thread. + /// + procedure Zoom(command: TCefZoomCommand); + /// + /// Get the default zoom level. This value will be 0.0 by default but can be + /// configured with the Chrome runtime. This function can only be called on + /// the UI thread. + /// + function GetDefaultZoomLevel: Double; + /// + /// Get the current zoom level. This function can only be called on the UI + /// thread. /// function GetZoomLevel: Double; /// /// Change the zoom level to the specified value. Specify 0.0 to reset the - /// zoom level. If called on the UI thread the change will be applied - /// immediately. Otherwise, the change will be applied asynchronously on the - /// UI thread. + /// zoom level to the default. If called on the UI thread the change will be + /// applied immediately. Otherwise, the change will be applied asynchronously + /// on the UI thread. /// procedure SetZoomLevel(const zoomLevel: Double); /// @@ -1305,6 +1322,12 @@ type /// property ZoomLevel : Double read GetZoomLevel write SetZoomLevel; /// + /// Get the default zoom level. This value will be 0.0 by default but can be + /// configured with the Chrome runtime. This function can only be called on + /// the UI thread. + /// + property DefaultZoomLevel : Double read GetDefaultZoomLevel; + /// /// Returns the request context for this browser. /// property RequestContext : ICefRequestContext read GetRequestContext; @@ -7642,6 +7665,11 @@ type /// function GetFileNames(var names: TStrings): Integer; /// + /// Retrieve the list of file paths that are being dragged into the browser + /// window. + /// + function GetFilePaths(var paths: TStrings): Integer; + /// /// Set the link URL that is being dragged. /// procedure SetLinkUrl(const url: ustring); diff --git a/source/uCEFTypes.pas b/source/uCEFTypes.pas index c09496a7..0ed6a786 100644 --- a/source/uCEFTypes.pas +++ b/source/uCEFTypes.pas @@ -2638,6 +2638,18 @@ type CEF_GESTURE_COMMAND_FORWARD ); + /// + /// Specifies the zoom commands supported by ICefBrowserHost.Zoom. + /// + /// + /// CEF source file: /include/internal/cef_types.h (cef_zoom_command_t) + /// + TCefZoomCommand = ( + CEF_ZOOM_COMMAND_OUT, + CEF_ZOOM_COMMAND_RESET, + CEF_ZOOM_COMMAND_IN + ); + /// /// Specifies the gesture commands. /// @@ -3128,11 +3140,10 @@ type background_color : TCefColor; /// /// Comma delimited ordered list of language codes without any whitespace that - /// will be used in the "Accept-Language" HTTP header. May be overridden on a - /// per-browser basis using the TCefBrowserSettings.accept_language_list value. - /// If both values are empty then "en-US,en" will be used. Can be overridden - /// for individual ICefRequestContext instances via the - /// TCefRequestContextSettings.accept_language_list value. + /// will be used in the "Accept-Language" HTTP request header and + /// "navigator.language" JS attribute. Can be overridden for individual + /// ICefRequestContext instances via the + /// TCefRequestContextSettingsCefRequestContextSettings.accept_language_list value. /// accept_language_list : TCefString; /// @@ -3148,6 +3159,20 @@ type /// cookieable_schemes_list : TCefString; cookieable_schemes_exclude_defaults : integer; + + /// + /// Specify an ID to enable Chrome policy management via Platform and OS-user + /// policies. On Windows, this is a registry key like + /// "SOFTWARE\\Policies\\Google\\Chrome". On MacOS, this is a bundle ID like + /// "com.google.Chrome". On Linux, this is an absolute directory path like + /// "/etc/opt/chrome/policies". Only supported with the Chrome runtime. See + /// https://support.google.com/chrome/a/answer/9037717 for details. + /// Chrome Browser Cloud Management integration, when enabled via the + /// "enable-chrome-browser-cloud-management" command-line flag, will also use + /// the specified ID. See https://support.google.com/chrome/a/answer/9116814 + /// for details. + /// + chrome_policy_id : TCefString; end; /// @@ -3498,18 +3523,16 @@ type /// background_color : TCefColor; /// - /// Comma delimited ordered list of language codes without any whitespace that - /// will be used in the "Accept-Language" HTTP header. May be set globally - /// using the TCefSettings.accept_language_list value. If both values are - /// empty then "en-US,en" will be used. - /// - accept_language_list : TCefString; - /// /// Controls whether the Chrome status bubble will be used. Only supported /// with the Chrome runtime. For details about the status bubble see /// https://www.chromium.org/user-experience/status-bubble/ /// chrome_status_bubble : TCefState; + /// + /// Controls whether the Chrome zoom bubble will be shown when zooming. Only + /// supported with the Chrome runtime. + /// + chrome_zoom_bubble : TCefState; end; /// @@ -3916,6 +3939,12 @@ type /// CEF source file: /include/internal/cef_types.h (cef_content_setting_types_t) /// TCefContentSettingTypes = ( + /// + /// This setting governs whether cookies are enabled by the user in the + /// provided context. However, it may be overridden by other settings. This + /// enum should NOT be read directly to determine whether cookies are enabled; + /// the client should instead rely on the CookieSettings API. + /// CEF_CONTENT_SETTING_TYPE_COOKIES = 0, CEF_CONTENT_SETTING_TYPE_IMAGES, CEF_CONTENT_SETTING_TYPE_JAVASCRIPT, @@ -3934,6 +3963,12 @@ type CEF_CONTENT_SETTING_TYPE_PROTOCOL_HANDLERS, CEF_CONTENT_SETTING_TYPE_DEPRECATED_PPAPI_BROKER, CEF_CONTENT_SETTING_TYPE_AUTOMATIC_DOWNLOADS, + + /// + /// Advanced device-specific functions on MIDI devices. MIDI-SysEx + /// communications can be used for changing the MIDI device's persistent state + /// such as firmware. + /// CEF_CONTENT_SETTING_TYPE_MIDI_SYSEX, CEF_CONTENT_SETTING_TYPE_SSL_CERT_DECISIONS, CEF_CONTENT_SETTING_TYPE_PROTECTED_MEDIA_IDENTIFIER, @@ -3953,8 +3988,9 @@ type /// CEF_CONTENT_SETTING_TYPE_ADS_DATA, /// - /// This is special-cased in the permissions layer to always allow, and as - /// such doesn't have associated prefs data. + /// MIDI stands for Musical Instrument Digital Interface. It is a standard + /// that allows electronic musical instruments, computers, and other devices + /// to communicate with each other. /// CEF_CONTENT_SETTING_TYPE_MIDI, /// @@ -4021,10 +4057,6 @@ type /// CEF_CONTENT_SETTING_TYPE_IDLE_DETECTION, /// - /// Setting for enabling auto-select of all screens for getDisplayMediaSet. - /// - CEF_CONTENT_SETTING_TYPE_GET_DISPLAY_MEDIA_SET_SELECT_ALL_SCREENS, - /// /// Content settings for access to serial ports. The "guard" content setting /// stores whether to allow sites to ask for permission to access a port. The /// permissions granted to access particular ports are stored in the "chooser @@ -4133,11 +4165,12 @@ type /// CEF_CONTENT_SETTING_TYPE_WINDOW_MANAGEMENT, /// - /// Stores whether to allow insecure websites to make local network requests. - /// See also: https://wicg.github.io/local-network-access + /// Stores whether to allow insecure websites to make private network + /// requests. + /// See also: https://wicg.github.io/cors-rfc1918 /// Set through enterprise policies only. /// - CEF_CONTENT_SETTING_TYPE_INSECURE_LOCAL_NETWORK, + CEF_CONTENT_SETTING_TYPE_INSECURE_PRIVATE_NETWORK, /// /// Content setting which stores whether or not a site can access low-level /// locally installed font data using the Local Fonts Access API. @@ -4276,13 +4309,29 @@ type /// CEF_CONTENT_SETTING_TYPE_HTTPS_ENFORCED, /// + /// Setting for enabling the `getAllScreensMedia` API. Spec link: + /// https://github.com/screen-share/capture-all-screens + /// + CEF_CONTENT_SETTING_TYPE_ALL_SCREEN_CAPTURE, + /// /// Stores per origin metadata for cookie controls. /// CEF_CONTENT_SETTING_TYPE_COOKIE_CONTROLS_METADATA, /// - /// Setting for supporting 3PCD. + /// Content Setting for 3PC accesses granted via 3PC deprecation trial. /// CEF_CONTENT_SETTING_TYPE_TPCD_SUPPORT, + /// + /// Content setting used to indicate whether entering picture-in-picture + /// automatically should be enabled. + /// + CEF_CONTENT_SETTING_TYPE_AUTO_PICTURE_IN_PICTURE, + /// + /// Content Setting for 3PC accesses granted by metadata delivered via the + /// component updater service. This type will only be used when + /// `net::features::kTpcdMetadataGrants` is enabled. + /// + CEF_CONTENT_SETTING_TYPE_TPCD_METADATA_GRANTS, CEF_CONTENT_SETTING_TYPE_NUM_TYPES ); @@ -5878,6 +5927,7 @@ type get_file_name : function(self: PCefDragData): PCefStringUserFree; stdcall; get_file_contents : function(self: PCefDragData; writer: PCefStreamWriter): NativeUInt; stdcall; get_file_names : function(self: PCefDragData; names: TCefStringList): Integer; stdcall; + get_file_paths : function(self: PCefDragData; paths: TCefStringList): Integer; stdcall; set_link_url : procedure(self: PCefDragData; const url: PCefString); stdcall; set_link_title : procedure(self: PCefDragData; const title: PCefString); stdcall; set_link_metadata : procedure(self: PCefDragData; const data: PCefString); stdcall; @@ -6830,6 +6880,9 @@ type has_view : function(self: PCefBrowserHost): Integer; stdcall; get_client : function(self: PCefBrowserHost): PCefClient; stdcall; get_request_context : function(self: PCefBrowserHost): PCefRequestContext; stdcall; + can_zoom : function(self: PCefBrowserHost; command: TCefZoomCommand): Integer; stdcall; + zoom : procedure(self: PCefBrowserHost; command: TCefZoomCommand); stdcall; + get_default_zoom_level : function(self: PCefBrowserHost): Double; stdcall; get_zoom_level : function(self: PCefBrowserHost): Double; stdcall; set_zoom_level : procedure(self: PCefBrowserHost; zoomLevel: Double); stdcall; run_file_dialog : procedure(self: PCefBrowserHost; mode: TCefFileDialogMode; const title, default_file_path: PCefString; accept_filters: TCefStringList; callback: PCefRunFileDialogCallback); stdcall; diff --git a/source/uCEFVersion.inc b/source/uCEFVersion.inc index d5dac4c4..e707b8f9 100644 --- a/source/uCEFVersion.inc +++ b/source/uCEFVersion.inc @@ -1,9 +1,9 @@ - CEF_SUPPORTED_VERSION_MAJOR = 117; - CEF_SUPPORTED_VERSION_MINOR = 2; - CEF_SUPPORTED_VERSION_RELEASE = 5; + CEF_SUPPORTED_VERSION_MAJOR = 118; + CEF_SUPPORTED_VERSION_MINOR = 6; + CEF_SUPPORTED_VERSION_RELEASE = 6; CEF_SUPPORTED_VERSION_BUILD = 0; CEF_CHROMEELF_VERSION_MAJOR = CEF_SUPPORTED_VERSION_MAJOR; CEF_CHROMEELF_VERSION_MINOR = 0; - CEF_CHROMEELF_VERSION_RELEASE = 5938; - CEF_CHROMEELF_VERSION_BUILD = 152; + CEF_CHROMEELF_VERSION_RELEASE = 5993; + CEF_CHROMEELF_VERSION_BUILD = 96; diff --git a/update_CEF4Delphi.json b/update_CEF4Delphi.json index 4ff8afb5..59d23d77 100644 --- a/update_CEF4Delphi.json +++ b/update_CEF4Delphi.json @@ -2,9 +2,9 @@ "UpdateLazPackages" : [ { "ForceNotify" : true, - "InternalVersion" : 529, + "InternalVersion" : 530, "Name" : "cef4delphi_lazarus.lpk", - "Version" : "117.2.5" + "Version" : "118.6.6" } ], "UpdatePackageData" : {