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

Added TChromium.SafeSearch and TChromium.YouTubeRestrict

This commit is contained in:
Salvador Díaz Fau
2019-10-06 22:30:36 +02:00
parent 29f5f3475d
commit 00552ef117
5 changed files with 66 additions and 3 deletions

View File

@ -105,6 +105,8 @@ type
FIsOSR : boolean;
FInitialized : boolean;
FClosing : boolean;
FSafeSearch : boolean;
FYouTubeRestrict : integer;
FWindowInfo : TCefWindowInfo;
FBrowserSettings : TCefBrowserSettings;
FDevWindowInfo : TCefWindowInfo;
@ -302,6 +304,8 @@ type
procedure SetZoomStep(aValue : byte);
procedure SetWindowlessFrameRate(aValue : integer);
procedure SetAudioMuted(aValue : boolean);
procedure SetSafeSearch(aValue : boolean);
procedure SetYouTubeRestrict(aValue : integer);
function CreateBrowserHost(aWindowInfo : PCefWindowInfo; const aURL : ustring; const aSettings : PCefBrowserSettings; const aExtraInfo : ICefDictionaryValue; const aContext : ICefRequestContext): boolean;
@ -662,6 +666,8 @@ type
property FrameCount : NativeUInt read GetFrameCount;
property DragOperations : TCefDragOperations read FDragOperations write FDragOperations;
property AudioMuted : boolean read GetAudioMuted write SetAudioMuted;
property SafeSearch : boolean read FSafeSearch write SetSafeSearch;
property YouTubeRestrict : integer read FYouTubeRestrict write SetYouTubeRestrict;
property WebRTCIPHandlingPolicy : TCefWebRTCHandlingPolicy read FWebRTCIPHandlingPolicy write SetWebRTCIPHandlingPolicy;
property WebRTCMultipleRoutes : TCefState read FWebRTCMultipleRoutes write SetWebRTCMultipleRoutes;
@ -844,6 +850,9 @@ begin
FCookiePrefs := CEF_CONTENT_SETTING_ALLOW;
FImagesPrefs := CEF_CONTENT_SETTING_ALLOW;
FZoomStep := ZOOM_STEP_DEF;
FSafeSearch := False;
FYouTubeRestrict := YOUTUBE_RESTRICT_OFF;
{$IFNDEF FPC}
FOldBrowserCompWndPrc := nil;
FOldWidgetCompWndPrc := nil;
@ -2032,6 +2041,24 @@ begin
end;
end;
procedure TChromium.SetSafeSearch(aValue : boolean);
begin
if (FSafeSearch <> aValue) then
begin
FSafeSearch := aValue;
FUpdatePreferences := True;
end;
end;
procedure TChromium.SetYouTubeRestrict(aValue : integer);
begin
if (FYouTubeRestrict <> aValue) then
begin
FYouTubeRestrict := aValue;
FUpdatePreferences := True;
end;
end;
procedure TChromium.SetWebRTCIPHandlingPolicy(aValue : TCefWebRTCHandlingPolicy);
begin
if (FWebRTCIPHandlingPolicy <> aValue) then
@ -2485,6 +2512,8 @@ begin
UpdatePreference(aBrowser, 'plugins.always_authorize', FAlwaysAuthorizePlugins);
UpdatePreference(aBrowser, 'browser.enable_spellchecking', FSpellChecking);
UpdateStringListPref(aBrowser, 'spellcheck.dictionaries', FSpellCheckerDicts);
UpdatePreference(aBrowser, 'settings.force_google_safesearch', FSafeSearch);
UpdatePreference(aBrowser, 'settings.force_youtube_restrict', FYouTubeRestrict);
if (FMaxConnectionsPerProxy <> CEF_MAX_CONNECTIONS_PER_PROXY_DEFAULT_VALUE) then
UpdatePreference(aBrowser, 'net.max_connections_per_proxy', FMaxConnectionsPerProxy);