1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-06-12 22:07:39 +02:00

Update to CEF 3.3440.1802.g9512b3f

- GlobalCEFApp.SitePerProcess default value is now TRUE .
- Added TChromium.SpellChecking and TChromium.SpellCheckerDicts properties.
This commit is contained in:
Salvador Díaz Fau
2018-07-31 09:47:43 +02:00
parent 61ff40bd9d
commit eba3058fd5
4 changed files with 203 additions and 18 deletions

View File

@ -60,14 +60,14 @@ uses
const
CEF_SUPPORTED_VERSION_MAJOR = 3;
CEF_SUPPORTED_VERSION_MINOR = 3396;
CEF_SUPPORTED_VERSION_RELEASE = 1786;
CEF_SUPPORTED_VERSION_MINOR = 3440;
CEF_SUPPORTED_VERSION_RELEASE = 1802;
CEF_SUPPORTED_VERSION_BUILD = 0;
CEF_CHROMEELF_VERSION_MAJOR = 67;
CEF_CHROMEELF_VERSION_MAJOR = 68;
CEF_CHROMEELF_VERSION_MINOR = 0;
CEF_CHROMEELF_VERSION_RELEASE = 3396;
CEF_CHROMEELF_VERSION_BUILD = 79;
CEF_CHROMEELF_VERSION_RELEASE = 3440;
CEF_CHROMEELF_VERSION_BUILD = 75;
LIBCEF_DLL = 'libcef.dll';
CHROMEELF_DLL = 'chrome_elf.dll';
@ -473,7 +473,7 @@ begin
FOnRegisterCustomSchemes := nil;
FEnableHighDPISupport := False;
FMuteAudio := False;
FSitePerProcess := False;
FSitePerProcess := True;
FDisableWebSecurity := False;
FDisablePDFExtension := False;
FReRaiseExceptions := False;
@ -939,7 +939,6 @@ end;
procedure TCefApplication.InitializeSettings(var aSettings : TCefSettings);
begin
aSettings.size := SizeOf(TCefSettings);
aSettings.single_process := Ord(FSingleProcess);
aSettings.no_sandbox := Ord(FNoSandbox);
aSettings.browser_subprocess_path := CefString(FBrowserSubprocessPath);
aSettings.framework_dir_path := CefString(FFrameworkDirPath);
@ -1314,6 +1313,9 @@ begin
commandLine.AppendSwitch('--disable-gpu-compositing');
end;
if FSingleProcess then
commandLine.AppendSwitch('--single-process');
case FSmoothScrolling of
STATE_ENABLED : commandLine.AppendSwitch('--enable-smooth-scrolling');
STATE_DISABLED : commandLine.AppendSwitch('--disable-smooth-scrolling');

View File

@ -96,6 +96,8 @@ type
FRunAllFlashInAllowMode : boolean;
FAllowOutdatedPlugins : boolean;
FAlwaysAuthorizePlugins : boolean;
FSpellChecking : boolean;
FSpellCheckerDicts : ustring;
FCookiePrefs : integer;
FImagesPrefs : integer;
FZoomStep : byte;
@ -266,6 +268,8 @@ type
procedure SetRunAllFlashInAllowMode(aValue : boolean);
procedure SetAllowOutdatedPlugins(aValue : boolean);
procedure SetAlwaysAuthorizePlugins(aValue : boolean);
procedure SetSpellChecking(aValue : boolean);
procedure SetSpellCheckerDicts(const aValue : ustring);
procedure SetWebRTCIPHandlingPolicy(aValue : TCefWebRTCHandlingPolicy);
procedure SetWebRTCMultipleRoutes(aValue : TCefState);
procedure SetWebRTCNonProxiedUDP(aValue : TCefState);
@ -304,6 +308,8 @@ type
function UpdatePreference(const aBrowser: ICefBrowser; const aName : ustring; aValue : integer) : boolean; overload;
function UpdatePreference(const aBrowser: ICefBrowser; const aName : ustring; const aValue : double) : boolean; overload;
function UpdatePreference(const aBrowser: ICefBrowser; const aName, aValue : ustring) : boolean; overload;
function UpdatePreference(const aBrowser: ICefBrowser; const aName : ustring; const aValue : TStringList) : boolean; overload;
function UpdateStringListPref(const aBrowser: ICefBrowser; const aName, aValue : ustring) : boolean;
procedure HandleDictionary(const aDict : ICefDictionaryValue; var aResultSL : TStringList; const aRoot : string);
procedure HandleNull(const aValue : ICefValue; var aResultSL : TStringList; const aRoot, aKey : string);
@ -597,6 +603,8 @@ type
property RunAllFlashInAllowMode : boolean read FRunAllFlashInAllowMode write SetRunAllFlashInAllowMode;
property AllowOutdatedPlugins : boolean read FAllowOutdatedPlugins write SetAllowOutdatedPlugins;
property AlwaysAuthorizePlugins : boolean read FAlwaysAuthorizePlugins write SetAlwaysAuthorizePlugins;
property SpellChecking : boolean read FSpellChecking write SetSpellChecking;
property SpellCheckerDicts : ustring read FSpellCheckerDicts write SetSpellCheckerDicts;
property HasValidMainFrame : boolean read GetHasValidMainFrame;
property FrameCount : NativeUInt read GetFrameCount;
property DragOperations : TCefDragOperations read FDragOperations write FDragOperations;
@ -739,7 +747,8 @@ uses
{$ENDIF}
uCEFBrowser, uCEFValue, uCEFDictionaryValue, uCEFStringMultimap, uCEFFrame,
uCEFApplication, uCEFProcessMessage, uCEFRequestContext, {$IFNDEF FPC}uOLEDragAndDrop,{$ENDIF}
uCEFPDFPrintCallback, uCEFResolveCallback, uCEFDeleteCookiesCallback, uCEFStringVisitor;
uCEFPDFPrintCallback, uCEFResolveCallback, uCEFDeleteCookiesCallback, uCEFStringVisitor,
uCEFListValue;
constructor TChromium.Create(AOwner: TComponent);
begin
@ -766,6 +775,8 @@ begin
FRunAllFlashInAllowMode := False;
FAllowOutdatedPlugins := False;
FAlwaysAuthorizePlugins := False;
FSpellChecking := True;
FSpellCheckerDicts := '';
FCookiePrefs := CEF_CONTENT_SETTING_ALLOW;
FImagesPrefs := CEF_CONTENT_SETTING_ALLOW;
FZoomStep := ZOOM_STEP_DEF;
@ -1882,6 +1893,24 @@ begin
end;
end;
procedure TChromium.SetSpellChecking(aValue : boolean);
begin
if (FSpellChecking <> aValue) then
begin
FSpellChecking := aValue;
FUpdatePreferences := True;
end;
end;
procedure TChromium.SetSpellCheckerDicts(const aValue : ustring);
begin
if (FSpellCheckerDicts <> aValue) then
begin
FSpellCheckerDicts := aValue;
FUpdatePreferences := True;
end;
end;
procedure TChromium.SetWebRTCIPHandlingPolicy(aValue : TCefWebRTCHandlingPolicy);
begin
if (FWebRTCIPHandlingPolicy <> aValue) then
@ -2263,6 +2292,8 @@ begin
UpdatePreference(aBrowser, 'plugins.run_all_flash_in_allow_mode', FRunAllFlashInAllowMode);
UpdatePreference(aBrowser, 'plugins.allow_outdated', FAllowOutdatedPlugins);
UpdatePreference(aBrowser, 'plugins.always_authorize', FAlwaysAuthorizePlugins);
UpdatePreference(aBrowser, 'browser.enable_spellchecking', FSpellChecking);
UpdateStringListPref(aBrowser, 'spellcheck.dictionaries', FSpellCheckerDicts);
if FRunAllFlashInAllowMode then
UpdatePreference(aBrowser, 'profile.default_content_setting_values.plugins', 1);
@ -2466,6 +2497,68 @@ begin
end;
end;
function TChromium.UpdatePreference(const aBrowser: ICefBrowser; const aName : ustring; const aValue : TStringList) : boolean;
var
TempError : ustring;
TempValue : ICefValue;
TempList : ICefListValue;
i : NativeUInt;
TempSize : NativeUInt;
begin
Result := False;
try
if (aValue <> nil) and
(aValue.Count > 0) and
(aBrowser <> nil) and
(aBrowser.Host <> nil) and
aBrowser.Host.RequestContext.CanSetPreference(aName) then
begin
TempSize := aValue.Count;
TempList := TCefListValueRef.New;
if TempList.SetSize(TempSize) then
begin
i := 0;
while (i < TempSize) do
begin
TempList.SetString(i, aValue[i]);
inc(i);
end;
TempValue := TCefValueRef.New;
Result := TempValue.SetList(TempList) and
aBrowser.Host.RequestContext.SetPreference(aName, TempValue, TempError);
if not(Result) then
OutputDebugMessage('TChromium.UpdatePreference error : ' + quotedstr(TempError));
end;
end;
except
on e : exception do
if CustomExceptionHandler('TChromium.UpdatePreference', e) then raise;
end;
end;
function TChromium.UpdateStringListPref(const aBrowser: ICefBrowser; const aName, aValue : ustring) : boolean;
var
TempSL : TStringList;
begin
Result := False;
TempSL := nil;
try
if (length(name) > 0) and (length(aValue) > 0) then
begin
TempSL := TStringList.Create;
TempSL.CommaText := aValue;
Result := UpdatePreference(aBrowser, aName, TempSL);
end;
finally
if (TempSL <> nil) then FreeAndNil(TempSL);
end;
end;
procedure TChromium.HandleNull(const aValue : ICefValue; var aResultSL : TStringList; const aRoot, aKey : string);
var
TempKey : string;
@ -2583,10 +2676,10 @@ begin
case TempValue.GetType of
VTYPE_NULL : TempResult := TempResult + '-null-,';
VTYPE_BOOL : TempResult := TempResult + BoolToStr(aValue.GetBool, true) + ',';
VTYPE_INT : TempResult := TempResult + IntToStr(aValue.GetInt) + ',';
VTYPE_DOUBLE : TempResult := TempResult + FloatToStr(aValue.GetDouble) + ',';
VTYPE_STRING : TempResult := TempResult + aValue.GetString + ',';
VTYPE_BOOL : TempResult := TempResult + BoolToStr(TempValue.GetBool, true) + ',';
VTYPE_INT : TempResult := TempResult + IntToStr(TempValue.GetInt) + ',';
VTYPE_DOUBLE : TempResult := TempResult + FloatToStr(TempValue.GetDouble) + ',';
VTYPE_STRING : TempResult := TempResult + TempValue.GetString + ',';
VTYPE_BINARY : TempResult := TempResult + '-binary-,';
VTYPE_DICTIONARY :
begin

View File

@ -967,7 +967,6 @@ type
// /include/internal/cef_types.h (cef_settings_t)
TCefSettings = record
size : NativeUInt;
single_process : Integer;
no_sandbox : Integer;
browser_subprocess_path : TCefString;
framework_dir_path : TCefString;

View File

@ -85,6 +85,8 @@ type
FRunAllFlashInAllowMode : boolean;
FAllowOutdatedPlugins : boolean;
FAlwaysAuthorizePlugins : boolean;
FSpellChecking : boolean;
FSpellCheckerDicts : ustring;
FCookiePrefs : integer;
FImagesPrefs : integer;
FZoomStep : byte;
@ -249,6 +251,8 @@ type
procedure SetRunAllFlashInAllowMode(aValue : boolean);
procedure SetAllowOutdatedPlugins(aValue : boolean);
procedure SetAlwaysAuthorizePlugins(aValue : boolean);
procedure SetSpellChecking(aValue : boolean);
procedure SetSpellCheckerDicts(const aValue : ustring);
procedure SetWebRTCIPHandlingPolicy(aValue : TCefWebRTCHandlingPolicy);
procedure SetWebRTCMultipleRoutes(aValue : TCefState);
procedure SetWebRTCNonProxiedUDP(aValue : TCefState);
@ -287,6 +291,8 @@ type
function UpdatePreference(const aBrowser: ICefBrowser; const aName : ustring; aValue : integer) : boolean; overload;
function UpdatePreference(const aBrowser: ICefBrowser; const aName : ustring; const aValue : double) : boolean; overload;
function UpdatePreference(const aBrowser: ICefBrowser; const aName, aValue : ustring) : boolean; overload;
function UpdatePreference(const aBrowser: ICefBrowser; const aName : ustring; const aValue : TStringList) : boolean; overload;
function UpdateStringListPref(const aBrowser: ICefBrowser; const aName, aValue : ustring) : boolean;
procedure HandleDictionary(const aDict : ICefDictionaryValue; var aResultSL : TStringList; const aRoot : string);
procedure HandleNull(const aValue : ICefValue; var aResultSL : TStringList; const aRoot, aKey : string);
@ -565,6 +571,8 @@ type
property RunAllFlashInAllowMode : boolean read FRunAllFlashInAllowMode write SetRunAllFlashInAllowMode;
property AllowOutdatedPlugins : boolean read FAllowOutdatedPlugins write SetAllowOutdatedPlugins;
property AlwaysAuthorizePlugins : boolean read FAlwaysAuthorizePlugins write SetAlwaysAuthorizePlugins;
property SpellChecking : boolean read FSpellChecking write SetSpellChecking;
property SpellCheckerDicts : ustring read FSpellCheckerDicts write SetSpellCheckerDicts;
property HasValidMainFrame : boolean read GetHasValidMainFrame;
property FrameCount : NativeUInt read GetFrameCount;
property DragOperations : TCefDragOperations read FDragOperations write FDragOperations;
@ -696,7 +704,8 @@ uses
System.SysUtils, System.Math,
uCEFBrowser, uCEFValue, uCEFDictionaryValue, uCEFStringMultimap, uCEFFrame,
uCEFApplication, uCEFProcessMessage, uCEFRequestContext,
uCEFPDFPrintCallback, uCEFResolveCallback, uCEFDeleteCookiesCallback, uCEFStringVisitor;
uCEFPDFPrintCallback, uCEFResolveCallback, uCEFDeleteCookiesCallback, uCEFStringVisitor,
uCEFListValue;
constructor TFMXChromium.Create(AOwner: TComponent);
begin
@ -722,6 +731,8 @@ begin
FRunAllFlashInAllowMode := False;
FAllowOutdatedPlugins := False;
FAlwaysAuthorizePlugins := False;
FSpellChecking := True;
FSpellCheckerDicts := '';
FCookiePrefs := CEF_CONTENT_SETTING_ALLOW;
FImagesPrefs := CEF_CONTENT_SETTING_ALLOW;
FZoomStep := ZOOM_STEP_DEF;
@ -1716,6 +1727,24 @@ begin
end;
end;
procedure TFMXChromium.SetSpellChecking(aValue : boolean);
begin
if (FSpellChecking <> aValue) then
begin
FSpellChecking := aValue;
FUpdatePreferences := True;
end;
end;
procedure TFMXChromium.SetSpellCheckerDicts(const aValue : ustring);
begin
if (FSpellCheckerDicts <> aValue) then
begin
FSpellCheckerDicts := aValue;
FUpdatePreferences := True;
end;
end;
procedure TFMXChromium.SetWebRTCIPHandlingPolicy(aValue : TCefWebRTCHandlingPolicy);
begin
if (FWebRTCIPHandlingPolicy <> aValue) then
@ -2251,6 +2280,68 @@ begin
end;
end;
function TFMXChromium.UpdatePreference(const aBrowser: ICefBrowser; const aName : ustring; const aValue : TStringList) : boolean;
var
TempError : ustring;
TempValue : ICefValue;
TempList : ICefListValue;
i : NativeUInt;
TempSize : NativeUInt;
begin
Result := False;
try
if (aValue <> nil) and
(aValue.Count > 0) and
(aBrowser <> nil) and
(aBrowser.Host <> nil) and
aBrowser.Host.RequestContext.CanSetPreference(aName) then
begin
TempSize := aValue.Count;
TempList := TCefListValueRef.New;
if TempList.SetSize(TempSize) then
begin
i := 0;
while (i < TempSize) do
begin
TempList.SetString(i, aValue[i]);
inc(i);
end;
TempValue := TCefValueRef.New;
Result := TempValue.SetList(TempList) and
aBrowser.Host.RequestContext.SetPreference(aName, TempValue, TempError);
if not(Result) then
OutputDebugMessage('TFMXChromium.UpdatePreference error : ' + quotedstr(TempError));
end;
end;
except
on e : exception do
if CustomExceptionHandler('TFMXChromium.UpdatePreference', e) then raise;
end;
end;
function TFMXChromium.UpdateStringListPref(const aBrowser: ICefBrowser; const aName, aValue : ustring) : boolean;
var
TempSL : TStringList;
begin
Result := False;
TempSL := nil;
try
if (length(name) > 0) and (length(aValue) > 0) then
begin
TempSL := TStringList.Create;
TempSL.CommaText := aValue;
Result := UpdatePreference(aBrowser, aName, TempSL);
end;
finally
if (TempSL <> nil) then FreeAndNil(TempSL);
end;
end;
procedure TFMXChromium.HandleNull(const aValue : ICefValue; var aResultSL : TStringList; const aRoot, aKey : string);
var
TempKey : string;
@ -2368,10 +2459,10 @@ begin
case TempValue.GetType of
VTYPE_NULL : TempResult := TempResult + '-null-,';
VTYPE_BOOL : TempResult := TempResult + BoolToStr(aValue.GetBool, true) + ',';
VTYPE_INT : TempResult := TempResult + IntToStr(aValue.GetInt) + ',';
VTYPE_DOUBLE : TempResult := TempResult + FloatToStr(aValue.GetDouble) + ',';
VTYPE_STRING : TempResult := TempResult + aValue.GetString + ',';
VTYPE_BOOL : TempResult := TempResult + BoolToStr(TempValue.GetBool, true) + ',';
VTYPE_INT : TempResult := TempResult + IntToStr(TempValue.GetInt) + ',';
VTYPE_DOUBLE : TempResult := TempResult + FloatToStr(TempValue.GetDouble) + ',';
VTYPE_STRING : TempResult := TempResult + TempValue.GetString + ',';
VTYPE_BINARY : TempResult := TempResult + '-binary-,';
VTYPE_DICTIONARY :
begin