1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-07-12 22:30:17 +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

@ -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