You've already forked CEF4Delphi
							
							
				mirror of
				https://github.com/salvadordf/CEF4Delphi.git
				synced 2025-10-30 23:07:52 +02:00 
			
		
		
		
	- Modified CheckLocalFiles for D7 compatibility - Added WebRTC properties to TChromium
This commit is contained in:
		| @@ -147,7 +147,8 @@ object MiniBrowserFrm: TMiniBrowserFrm | ||||
|             'ples/streetview-embed?hl=fr' | ||||
|            | ||||
|             'https://www.w3schools.com/Tags/tryit.asp?filename=tryhtml_iframe' + | ||||
|             '_name') | ||||
|             '_name' | ||||
|           'https://www.browserleaks.com/webrtc') | ||||
|       end | ||||
|     end | ||||
|     object ConfigPnl: TPanel | ||||
| @@ -220,6 +221,7 @@ object MiniBrowserFrm: TMiniBrowserFrm | ||||
|   object Chromium1: TChromium | ||||
|     OnTextResultAvailable = Chromium1TextResultAvailable | ||||
|     OnPdfPrintFinished = Chromium1PdfPrintFinished | ||||
|     OnPrefsAvailable = Chromium1PrefsAvailable | ||||
|     OnResolvedHostAvailable = Chromium1ResolvedHostAvailable | ||||
|     OnLoadingStateChange = Chromium1LoadingStateChange | ||||
|     OnBeforeContextMenu = Chromium1BeforeContextMenu | ||||
| @@ -309,7 +311,7 @@ object MiniBrowserFrm: TMiniBrowserFrm | ||||
|   end | ||||
|   object Timer1: TTimer | ||||
|     Enabled = False | ||||
|     Interval = 200 | ||||
|     Interval = 300 | ||||
|     OnTimer = Timer1Timer | ||||
|     Left = 32 | ||||
|     Top = 344 | ||||
|   | ||||
| @@ -53,23 +53,25 @@ uses | ||||
|   uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants; | ||||
|  | ||||
| const | ||||
|   MINIBROWSER_SHOWDEVTOOLS   = WM_APP + $101; | ||||
|   MINIBROWSER_HIDEDEVTOOLS   = WM_APP + $102; | ||||
|   MINIBROWSER_COPYHTML       = WM_APP + $103; | ||||
|   MINIBROWSER_SHOWRESPONSE   = WM_APP + $104; | ||||
|   MINIBROWSER_COPYFRAMEIDS   = WM_APP + $105; | ||||
|   MINIBROWSER_COPYFRAMENAMES = WM_APP + $106; | ||||
|   MINIBROWSER_SHOWDEVTOOLS    = WM_APP + $101; | ||||
|   MINIBROWSER_HIDEDEVTOOLS    = WM_APP + $102; | ||||
|   MINIBROWSER_COPYHTML        = WM_APP + $103; | ||||
|   MINIBROWSER_SHOWRESPONSE    = WM_APP + $104; | ||||
|   MINIBROWSER_COPYFRAMEIDS    = WM_APP + $105; | ||||
|   MINIBROWSER_COPYFRAMENAMES  = WM_APP + $106; | ||||
|   MINIBROWSER_SAVEPREFERENCES = WM_APP + $107; | ||||
|  | ||||
|   MINIBROWSER_HOMEPAGE = 'https://www.google.com'; | ||||
|  | ||||
|   MINIBROWSER_CONTEXTMENU_SHOWDEVTOOLS   = MENU_ID_USER_FIRST + 1; | ||||
|   MINIBROWSER_CONTEXTMENU_HIDEDEVTOOLS   = MENU_ID_USER_FIRST + 2; | ||||
|   MINIBROWSER_CONTEXTMENU_COPYHTML       = MENU_ID_USER_FIRST + 3; | ||||
|   MINIBROWSER_CONTEXTMENU_JSWRITEDOC     = MENU_ID_USER_FIRST + 4; | ||||
|   MINIBROWSER_CONTEXTMENU_JSPRINTDOC     = MENU_ID_USER_FIRST + 5; | ||||
|   MINIBROWSER_CONTEXTMENU_SHOWRESPONSE   = MENU_ID_USER_FIRST + 6; | ||||
|   MINIBROWSER_CONTEXTMENU_COPYFRAMEIDS   = MENU_ID_USER_FIRST + 7; | ||||
|   MINIBROWSER_CONTEXTMENU_COPYFRAMENAMES = MENU_ID_USER_FIRST + 8; | ||||
|   MINIBROWSER_CONTEXTMENU_SHOWDEVTOOLS    = MENU_ID_USER_FIRST + 1; | ||||
|   MINIBROWSER_CONTEXTMENU_HIDEDEVTOOLS    = MENU_ID_USER_FIRST + 2; | ||||
|   MINIBROWSER_CONTEXTMENU_COPYHTML        = MENU_ID_USER_FIRST + 3; | ||||
|   MINIBROWSER_CONTEXTMENU_JSWRITEDOC      = MENU_ID_USER_FIRST + 4; | ||||
|   MINIBROWSER_CONTEXTMENU_JSPRINTDOC      = MENU_ID_USER_FIRST + 5; | ||||
|   MINIBROWSER_CONTEXTMENU_SHOWRESPONSE    = MENU_ID_USER_FIRST + 6; | ||||
|   MINIBROWSER_CONTEXTMENU_COPYFRAMEIDS    = MENU_ID_USER_FIRST + 7; | ||||
|   MINIBROWSER_CONTEXTMENU_COPYFRAMENAMES  = MENU_ID_USER_FIRST + 8; | ||||
|   MINIBROWSER_CONTEXTMENU_SAVEPREFERENCES = MENU_ID_USER_FIRST + 9; | ||||
|  | ||||
| type | ||||
|   TMiniBrowserFrm = class(TForm) | ||||
| @@ -165,6 +167,7 @@ type | ||||
|     procedure Chromium1ResolvedHostAvailable(Sender: TObject; | ||||
|       result: Integer; const resolvedIps: TStrings); | ||||
|     procedure Timer1Timer(Sender: TObject); | ||||
|     procedure Chromium1PrefsAvailable(Sender: TObject; aResultOK: Boolean); | ||||
|  | ||||
|   protected | ||||
|     FResponse : string; | ||||
| @@ -185,6 +188,7 @@ type | ||||
|     procedure CopyFramesIDsMsg(var aMessage : TMessage); message MINIBROWSER_COPYFRAMEIDS; | ||||
|     procedure CopyFramesNamesMsg(var aMessage : TMessage); message MINIBROWSER_COPYFRAMENAMES; | ||||
|     procedure ShowResponseMsg(var aMessage : TMessage); message MINIBROWSER_SHOWRESPONSE; | ||||
|     procedure SavePreferencesMsg(var aMessage : TMessage); message MINIBROWSER_SAVEPREFERENCES; | ||||
|     procedure WMMove(var aMessage : TWMMove); message WM_MOVE; | ||||
|     procedure WMMoving(var aMessage : TMessage); message WM_MOVING; | ||||
|  | ||||
| @@ -252,13 +256,15 @@ procedure TMiniBrowserFrm.Chromium1BeforeContextMenu(Sender: TObject; | ||||
|   const params: ICefContextMenuParams; const model: ICefMenuModel); | ||||
| begin | ||||
|   model.AddSeparator; | ||||
|   model.AddItem(MINIBROWSER_CONTEXTMENU_COPYHTML,       'Copy HTML to clipboard'); | ||||
|   model.AddItem(MINIBROWSER_CONTEXTMENU_COPYFRAMEIDS,   'Copy HTML frame identifiers to clipboard'); | ||||
|   model.AddItem(MINIBROWSER_CONTEXTMENU_COPYFRAMENAMES, 'Copy HTML frame names to clipboard'); | ||||
|   model.AddItem(MINIBROWSER_CONTEXTMENU_COPYHTML,        'Copy HTML to clipboard'); | ||||
|   model.AddItem(MINIBROWSER_CONTEXTMENU_COPYFRAMEIDS,    'Copy HTML frame identifiers to clipboard'); | ||||
|   model.AddItem(MINIBROWSER_CONTEXTMENU_COPYFRAMENAMES,  'Copy HTML frame names to clipboard'); | ||||
|   model.AddSeparator; | ||||
|   model.AddItem(MINIBROWSER_CONTEXTMENU_JSWRITEDOC,     'Modify HTML document'); | ||||
|   model.AddItem(MINIBROWSER_CONTEXTMENU_JSPRINTDOC,     'Print using Javascript'); | ||||
|   model.AddItem(MINIBROWSER_CONTEXTMENU_SHOWRESPONSE,   'Show last server response'); | ||||
|   model.AddItem(MINIBROWSER_CONTEXTMENU_SAVEPREFERENCES, 'Save preferences as...'); | ||||
|   model.AddSeparator; | ||||
|   model.AddItem(MINIBROWSER_CONTEXTMENU_JSWRITEDOC,      'Modify HTML document'); | ||||
|   model.AddItem(MINIBROWSER_CONTEXTMENU_JSPRINTDOC,      'Print using Javascript'); | ||||
|   model.AddItem(MINIBROWSER_CONTEXTMENU_SHOWRESPONSE,    'Show last server response'); | ||||
|  | ||||
|   if DevTools.Visible then | ||||
|     model.AddItem(MINIBROWSER_CONTEXTMENU_HIDEDEVTOOLS, 'Hide DevTools') | ||||
| @@ -297,6 +303,9 @@ begin | ||||
|     MINIBROWSER_CONTEXTMENU_SHOWRESPONSE : | ||||
|       PostMessage(Handle, MINIBROWSER_SHOWRESPONSE, 0, 0); | ||||
|  | ||||
|     MINIBROWSER_CONTEXTMENU_SAVEPREFERENCES : | ||||
|       PostMessage(Handle, MINIBROWSER_SAVEPREFERENCES, 0, 0); | ||||
|  | ||||
|     MINIBROWSER_CONTEXTMENU_JSWRITEDOC : | ||||
|       if (browser <> nil) and (browser.MainFrame <> nil) then | ||||
|         browser.MainFrame.ExecuteJavaScript( | ||||
| @@ -424,6 +433,14 @@ begin | ||||
|     showmessage('There was a problem generating the PDF file.'); | ||||
| end; | ||||
|  | ||||
| procedure TMiniBrowserFrm.Chromium1PrefsAvailable(Sender: TObject; aResultOK: Boolean); | ||||
| begin | ||||
|   if aResultOK then | ||||
|     showmessage('The preferences file was generated successfully') | ||||
|    else | ||||
|     showmessage('There was a problem generating the preferences file.'); | ||||
| end; | ||||
|  | ||||
| procedure TMiniBrowserFrm.Chromium1PreKeyEvent(Sender: TObject; | ||||
|   const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: PMsg; | ||||
|   out isKeyboardShortcut, Result: Boolean); | ||||
| @@ -496,6 +513,14 @@ end; | ||||
|  | ||||
| procedure TMiniBrowserFrm.FormShow(Sender: TObject); | ||||
| begin | ||||
|   ShowStatusText('Initializing browser. Please wait...'); | ||||
|  | ||||
|   // WebRTC's IP leaking can lowered/avoided by setting these preferences | ||||
|   // To test this go to https://www.browserleaks.com/webrtc | ||||
|   Chromium1.WebRTCIPHandlingPolicy := hpDisableNonProxiedUDP; | ||||
|   Chromium1.WebRTCMultipleRoutes   := STATE_DISABLED; | ||||
|   Chromium1.WebRTCNonproxiedUDP    := STATE_DISABLED; | ||||
|  | ||||
|   // GlobalCEFApp.GlobalContextInitialized has to be TRUE before creating any browser | ||||
|   // If it's not initialized yet, we use a simple timer to create the browser later. | ||||
|   if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) then Timer1.Enabled := True; | ||||
| @@ -655,6 +680,15 @@ begin | ||||
|   if (length(FResponse) > 0) then MessageDlg(FResponse, mtInformation, [mbOk], 0); | ||||
| end; | ||||
|  | ||||
| procedure TMiniBrowserFrm.SavePreferencesMsg(var aMessage : TMessage); | ||||
| begin | ||||
|   SaveDialog1.DefaultExt := 'txt'; | ||||
|   SaveDialog1.Filter     := 'Text files (*.txt)|*.TXT'; | ||||
|  | ||||
|   if SaveDialog1.Execute and (length(SaveDialog1.FileName) > 0) then | ||||
|     Chromium1.SavePreferences(SaveDialog1.FileName); | ||||
| end; | ||||
|  | ||||
| procedure TMiniBrowserFrm.WMMove(var aMessage : TWMMove); | ||||
| begin | ||||
|   inherited; | ||||
|   | ||||
| @@ -63,7 +63,7 @@ object Form1: TForm1 | ||||
|   end | ||||
|   object Timer1: TTimer | ||||
|     Enabled = False | ||||
|     Interval = 200 | ||||
|     Interval = 300 | ||||
|     OnTimer = Timer1Timer | ||||
|     Left = 552 | ||||
|     Top = 264 | ||||
|   | ||||
| @@ -91,6 +91,8 @@ implementation | ||||
|  | ||||
| procedure TForm1.FormShow(Sender: TObject); | ||||
| begin | ||||
|   Caption := 'Simple Browser - Initializing browser. Please wait...'; | ||||
|  | ||||
|   // You *MUST* call CreateBrowser to create and initialize the browser. | ||||
|   // This will trigger the AfterCreated event when the browser is fully | ||||
|   // initialized and ready to receive commands. | ||||
| @@ -103,6 +105,7 @@ end; | ||||
| procedure TForm1.ChromiumWindow1AfterCreated(Sender: TObject); | ||||
| begin | ||||
|   // Now the browser is fully initialized we can load the initial web page. | ||||
|   Caption            := 'Simple Browser'; | ||||
|   AddressPnl.Enabled := True; | ||||
|   GoBtn.Click; | ||||
| end; | ||||
|   | ||||
| @@ -150,6 +150,9 @@ contains | ||||
|   uCEFBaseRefCounted in 'uCEFBaseRefCounted.pas', | ||||
|   uCEFBaseScopedWrapper in 'uCEFBaseScopedWrapper.pas', | ||||
|   uCEFDragAndDropMgr in 'uCEFDragAndDropMgr.pas', | ||||
|   uOLEDragAndDrop in 'uOLEDragAndDrop.pas'; | ||||
|   uOLEDragAndDrop in 'uOLEDragAndDrop.pas', | ||||
|   uCEFGetExtensionResourceCallback in 'uCEFGetExtensionResourceCallback.pas', | ||||
|   uCEFExtension in 'uCEFExtension.pas', | ||||
|   uCEFExtensionHandler in 'uCEFExtensionHandler.pas'; | ||||
|  | ||||
| end. | ||||
|   | ||||
| @@ -104,6 +104,9 @@ type | ||||
|       FDragDropManager        : TCEFDragAndDropMgr; | ||||
|       FDropTargetCtrl         : TWinControl; | ||||
|       FDragAndDropInitialized : boolean; | ||||
|       FWebRTCIPHandlingPolicy : TCefWebRTCHandlingPolicy; | ||||
|       FWebRTCMultipleRoutes   : TCefState; | ||||
|       FWebRTCNonProxiedUDP    : TCefState; | ||||
|  | ||||
|       // ICefClient | ||||
|       FOnProcessMessageReceived       : TOnProcessMessageReceived; | ||||
| @@ -204,7 +207,7 @@ type | ||||
|       // Custom | ||||
|       FOnTextResultAvailable          : TOnTextResultAvailableEvent; | ||||
|       FOnPdfPrintFinished             : TOnPdfPrintFinishedEvent; | ||||
|       FOnPrefsAvailable               : TNotifyEvent; | ||||
|       FOnPrefsAvailable               : TOnPrefsAvailableEvent; | ||||
|       FOnCookiesDeleted               : TOnCookiesDeletedEvent; | ||||
|       FOnResolvedHostAvailable        : TOnResolvedIPsAvailableEvent; | ||||
|  | ||||
| @@ -234,6 +237,9 @@ type | ||||
|       procedure SetDoNotTrack(aValue : boolean); | ||||
|       procedure SetSendReferrer(aValue : boolean); | ||||
|       procedure SetHyperlinkAuditing(aValue : boolean); | ||||
|       procedure SetWebRTCIPHandlingPolicy(aValue : TCefWebRTCHandlingPolicy); | ||||
|       procedure SetWebRTCMultipleRoutes(aValue : TCefState); | ||||
|       procedure SetWebRTCNonProxiedUDP(aValue : TCefState); | ||||
|       procedure SetCookiePrefs(aValue : integer); | ||||
|       procedure SetImagesPrefs(aValue : integer); | ||||
|       procedure SetProxyType(aValue : integer); | ||||
| @@ -406,8 +412,8 @@ type | ||||
|       procedure   Internal_GetHTML(const aFrameIdentifier : int64); overload; | ||||
|       procedure   Internal_PdfPrintFinished(aResultOK : boolean); | ||||
|       procedure   Internal_TextResultAvailable(const aText : string); | ||||
|       procedure   Internal_UpdatePreferences; | ||||
|       procedure   Internal_SavePreferences; | ||||
|       procedure   Internal_UpdatePreferences; virtual; | ||||
|       function    Internal_SavePreferences : boolean; | ||||
|       procedure   Internal_ResolvedHostAvailable(result: TCefErrorCode; const resolvedIps: TStrings); | ||||
|  | ||||
|       procedure   LoadURL(const aURL : ustring); | ||||
| @@ -526,6 +532,10 @@ type | ||||
|       property  FrameCount              : NativeUInt                   read GetFrameCount; | ||||
|       property  DragOperations          : TCefDragOperations           read FDragOperations           write FDragOperations; | ||||
|  | ||||
|       property  WebRTCIPHandlingPolicy  : TCefWebRTCHandlingPolicy     read FWebRTCIPHandlingPolicy   write SetWebRTCIPHandlingPolicy; | ||||
|       property  WebRTCMultipleRoutes    : TCefState                    read FWebRTCMultipleRoutes     write SetWebRTCMultipleRoutes; | ||||
|       property  WebRTCNonproxiedUDP     : TCefState                    read FWebRTCNonProxiedUDP      write SetWebRTCNonProxiedUDP; | ||||
|  | ||||
|       property  ProxyType               : integer                      read FProxyType                write SetProxyType; | ||||
|       property  ProxyServer             : string                       read FProxyServer              write SetProxyServer; | ||||
|       property  ProxyPort               : integer                      read FProxyPort                write SetProxyPort; | ||||
| @@ -537,7 +547,7 @@ type | ||||
|     published | ||||
|       property  OnTextResultAvailable   : TOnTextResultAvailableEvent  read FOnTextResultAvailable    write FOnTextResultAvailable; | ||||
|       property  OnPdfPrintFinished      : TOnPdfPrintFinishedEvent     read FOnPdfPrintFinished       write FOnPdfPrintFinished; | ||||
|       property  OnPrefsAvailable        : TNotifyEvent                 read FOnPrefsAvailable         write FOnPrefsAvailable; | ||||
|       property  OnPrefsAvailable        : TOnPrefsAvailableEvent       read FOnPrefsAvailable         write FOnPrefsAvailable; | ||||
|       property  OnCookiesDeleted        : TOnCookiesDeletedEvent       read FOnCookiesDeleted         write FOnCookiesDeleted; | ||||
|       property  OnResolvedHostAvailable : TOnResolvedIPsAvailableEvent read FOnResolvedHostAvailable  write FOnResolvedHostAvailable; | ||||
|  | ||||
| @@ -681,11 +691,16 @@ begin | ||||
|   FImagesPrefs            := CEF_CONTENT_SETTING_ALLOW; | ||||
|   FZoomStep               := ZOOM_STEP_DEF; | ||||
|   FWindowName             := ''; | ||||
|  | ||||
|   FDragOperations         := DRAG_OPERATION_NONE; | ||||
|   FDragDropManager        := nil; | ||||
|   FDropTargetCtrl         := nil; | ||||
|   FDragAndDropInitialized := False; | ||||
|  | ||||
|   FWebRTCIPHandlingPolicy := hpDefault; | ||||
|   FWebRTCMultipleRoutes   := STATE_DEFAULT; | ||||
|   FWebRTCNonProxiedUDP    := STATE_DEFAULT; | ||||
|  | ||||
|   FProxyType         := CEF_PROXYTYPE_DIRECT; | ||||
|   FProxyServer       := ''; | ||||
|   FProxyPort         := 80; | ||||
| @@ -1640,6 +1655,33 @@ begin | ||||
|     end; | ||||
| end; | ||||
|  | ||||
| procedure TChromium.SetWebRTCIPHandlingPolicy(aValue : TCefWebRTCHandlingPolicy); | ||||
| begin | ||||
|   if (FWebRTCIPHandlingPolicy <> aValue) then | ||||
|     begin | ||||
|       FWebRTCIPHandlingPolicy := aValue; | ||||
|       FUpdatePreferences      := True; | ||||
|     end; | ||||
| end; | ||||
|  | ||||
| procedure TChromium.SetWebRTCMultipleRoutes(aValue : TCefState); | ||||
| begin | ||||
|   if (FWebRTCMultipleRoutes <> aValue) then | ||||
|     begin | ||||
|       FWebRTCMultipleRoutes := aValue; | ||||
|       FUpdatePreferences    := True; | ||||
|     end; | ||||
| end; | ||||
|  | ||||
| procedure TChromium.SetWebRTCNonProxiedUDP(aValue : TCefState); | ||||
| begin | ||||
|   if (FWebRTCNonProxiedUDP <> aValue) then | ||||
|     begin | ||||
|       FWebRTCNonProxiedUDP := aValue; | ||||
|       FUpdatePreferences   := True; | ||||
|     end; | ||||
| end; | ||||
|  | ||||
| procedure TChromium.SetCookiePrefs(aValue : integer); | ||||
| begin | ||||
|   if (FCookiePrefs <> aValue) then | ||||
| @@ -1912,6 +1954,23 @@ begin | ||||
|   UpdatePreference('enable_do_not_track', FDoNotTrack); | ||||
|   UpdatePreference('enable_referrers',    FSendReferrer); | ||||
|   UpdatePreference('enable_a_ping',       FHyperlinkAuditing); | ||||
|  | ||||
|   case FWebRTCIPHandlingPolicy of | ||||
|     hpDefaultPublicAndPrivateInterfaces : | ||||
|       UpdatePreference('webrtc.ip_handling_policy', 'default_public_and_private_interfaces'); | ||||
|  | ||||
|     hpDefaultPublicInterfaceOnly : | ||||
|       UpdatePreference('webrtc.ip_handling_policy', 'default_public_interface_only'); | ||||
|  | ||||
|     hpDisableNonProxiedUDP : | ||||
|       UpdatePreference('webrtc.ip_handling_policy', 'disable_non_proxied_udp'); | ||||
|   end; | ||||
|  | ||||
|   if (FWebRTCMultipleRoutes <> STATE_DEFAULT) then | ||||
|     UpdatePreference('webrtc.multiple_routes_enabled', (FWebRTCMultipleRoutes = STATE_ENABLED)); | ||||
|  | ||||
|   if (FWebRTCNonProxiedUDP <> STATE_DEFAULT) then | ||||
|     UpdatePreference('webrtc.nonproxied_udp_enabled', (FWebRTCNonProxiedUDP = STATE_ENABLED)); | ||||
| end; | ||||
|  | ||||
| function TChromium.UpdateProxyPrefs : boolean; | ||||
| @@ -2301,11 +2360,12 @@ begin | ||||
|   end; | ||||
| end; | ||||
|  | ||||
| procedure TChromium.Internal_SavePreferences; | ||||
| function TChromium.Internal_SavePreferences : boolean; | ||||
| var | ||||
|   TempDict  : ICefDictionaryValue; | ||||
|   TempPrefs : TStringList; | ||||
| begin | ||||
|   Result    := False; | ||||
|   TempPrefs := nil; | ||||
|  | ||||
|   try | ||||
| @@ -2316,13 +2376,14 @@ begin | ||||
|           TempDict  := FBrowser.Host.RequestContext.GetAllPreferences(True); | ||||
|           HandleDictionary(TempDict, TempPrefs, ''); | ||||
|           TempPrefs.SaveToFile(FPrefsFileName); | ||||
|           SendCompMessage(CEF_PREFERENCES_SAVED); | ||||
|           Result    := True; | ||||
|         end; | ||||
|     except | ||||
|       on e : exception do | ||||
|         if CustomExceptionHandler('TChromium.Internal_SavePreferences', e) then raise; | ||||
|     end; | ||||
|   finally | ||||
|     SendCompMessage(CEF_PREFERENCES_SAVED, Ord(Result)); | ||||
|     if (TempPrefs <> nil) then FreeAndNil(TempPrefs); | ||||
|   end; | ||||
| end; | ||||
| @@ -2334,7 +2395,7 @@ end; | ||||
|  | ||||
| procedure TChromium.PrefsAvailableMsg(var aMessage : TMessage); | ||||
| begin | ||||
|   if assigned(FOnPrefsAvailable) then FOnPrefsAvailable(self); | ||||
|   if assigned(FOnPrefsAvailable) then FOnPrefsAvailable(self, (aMessage.WParam <> 0)); | ||||
| end; | ||||
|  | ||||
| function TChromium.SendCompMessage(aMsg : cardinal; wParam : cardinal; lParam : integer) : boolean; | ||||
|   | ||||
| @@ -58,6 +58,7 @@ type | ||||
|   TOnAccessibilityEvent           = procedure(Sender: TObject; const value: ICefValue) of object; | ||||
|   TOnTextResultAvailableEvent     = procedure(Sender: TObject; const aText : string) of object; | ||||
|   TOnPdfPrintFinishedEvent        = procedure(Sender: TObject; aResultOK : boolean) of object; | ||||
|   TOnPrefsAvailableEvent          = procedure(Sender: TObject; aResultOK : boolean) of object; | ||||
|   TOnCookiesDeletedEvent          = procedure(Sender: TObject; numDeleted : integer) of object; | ||||
|   TOnResolvedIPsAvailableEvent    = procedure(Sender: TObject; result: TCefErrorCode; const resolvedIps: TStrings) of object; | ||||
|   TOnProcessMessageReceived       = procedure(Sender: TObject; const browser: ICefBrowser; sourceProcess: TCefProcessId; const message: ICefProcessMessage; out Result: Boolean) of object; | ||||
|   | ||||
| @@ -611,24 +611,31 @@ end; | ||||
|  | ||||
| function CheckLocaleFiles(const aLocalesDirPath, aLocalesRequired : string) : boolean; | ||||
| var | ||||
|   LLocaleList: TStrings; | ||||
|   LLocale: string; | ||||
|   TempLocaleList : TStrings; | ||||
|   TempLocale     : string; | ||||
|   i, j           : integer; | ||||
| begin | ||||
|   Result := True; | ||||
|   LLocaleList := TStringList.Create; | ||||
|   Result         := True; | ||||
|   TempLocaleList := TStringList.Create; | ||||
|  | ||||
|   try | ||||
|     LLocaleList.CommaText := aLocalesRequired; | ||||
|     for LLocale in LLocaleList do | ||||
|     begin | ||||
|       // avoid typing mistakes | ||||
|       if Length(LLocale) = 0 then | ||||
|         Continue; | ||||
|       Result := Result and CheckLocaleFile(aLocalesDirPath, LLocale); | ||||
|       if not Result then | ||||
|         Break; | ||||
|     end; | ||||
|     TempLocaleList.CommaText := aLocalesRequired; | ||||
|  | ||||
|     i := 0; | ||||
|     j := TempLocaleList.Count; | ||||
|  | ||||
|     while (i < j) and Result do | ||||
|       begin | ||||
|         TempLocale := trim(TempLocaleList[i]); | ||||
|  | ||||
|         // avoid typing mistakes | ||||
|         if (Length(TempLocale) > 0) then | ||||
|           Result := Result and CheckLocaleFile(aLocalesDirPath, TempLocale); | ||||
|  | ||||
|         inc(i); | ||||
|       end; | ||||
|   finally | ||||
|     FreeAndNil(LLocaleList); | ||||
|     FreeAndNil(TempLocaleList); | ||||
|   end; | ||||
| end; | ||||
|  | ||||
| @@ -689,8 +696,8 @@ const | ||||
|     'zh-CN,' + | ||||
|     'zh-TW'; | ||||
| var | ||||
|   TempDir : string; | ||||
|   LLocalesRequired: string; | ||||
|   TempDir             : string; | ||||
|   TempLocalesRequired : string; | ||||
| begin | ||||
|   Result := False; | ||||
|  | ||||
| @@ -703,12 +710,13 @@ begin | ||||
|     if DirectoryExists(TempDir) then | ||||
|       begin | ||||
|         TempDir := IncludeTrailingPathDelimiter(TempDir); | ||||
|         if Length(aLocalesRequired) > 0 then | ||||
|           LLocalesRequired := aLocalesRequired | ||||
|         else | ||||
|           LLocalesRequired := LOCALES_REQUIRED_DEFAULT; | ||||
|  | ||||
|         Result := CheckLocaleFiles(TempDir, LLocalesRequired); | ||||
|         if (length(aLocalesRequired) > 0) then | ||||
|           TempLocalesRequired := aLocalesRequired | ||||
|          else | ||||
|           TempLocalesRequired := LOCALES_REQUIRED_DEFAULT; | ||||
|  | ||||
|         Result := CheckLocaleFiles(TempDir, TempLocalesRequired); | ||||
|       end; | ||||
|   except | ||||
|     on e : exception do | ||||
|   | ||||
| @@ -287,6 +287,13 @@ type | ||||
|  | ||||
|   TCefProcessType = (ptBrowser, ptRenderer, ptZygote, ptOther); | ||||
|  | ||||
|   TCefWebRTCHandlingPolicy = ( | ||||
|     hpDefault, | ||||
|     hpDefaultPublicAndPrivateInterfaces, | ||||
|     hpDefaultPublicInterfaceOnly, | ||||
|     hpDisableNonProxiedUDP | ||||
|   ); | ||||
|  | ||||
|   // /include/internal/cef_types_win.h (cef_main_args_t) | ||||
|   TCefMainArgs = record | ||||
|     instance: HINST; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user