diff --git a/demos/MDIBrowser/MDIBrowser.dpr b/demos/MDIBrowser/MDIBrowser.dpr index 19edee8f..25bc276b 100644 --- a/demos/MDIBrowser/MDIBrowser.dpr +++ b/demos/MDIBrowser/MDIBrowser.dpr @@ -46,6 +46,7 @@ uses Forms, Windows, {$ENDIF } uCEFApplication, + uCEFTypes, uMainForm in 'uMainForm.pas' {MainForm}, uChildForm in 'uChildForm.pas' {ChildForm}; diff --git a/demos/MDIBrowser/MDIBrowser.dproj.local b/demos/MDIBrowser/MDIBrowser.dproj.local index 785999d0..14b2383a 100644 --- a/demos/MDIBrowser/MDIBrowser.dproj.local +++ b/demos/MDIBrowser/MDIBrowser.dproj.local @@ -2,10 +2,10 @@ 2017/05/01 10:03:03.000.353,C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\about.pas= - 2017/05/01 11:22:18.000.397,C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\MDIAPP.dproj=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\MDIBrowser.dproj - 2017/05/01 12:25:35.000.397,C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\Main.pas=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\uMainForm.pas - 2017/05/01 12:25:35.000.397,C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\Main.dfm=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\uMainForm.dfm - 2017/05/01 12:26:13.000.106,C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\ChildWin.pas=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\uChildForm.pas - 2017/05/01 12:26:13.000.106,C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\ChildWin.dfm=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\uChildForm.dfm + 2017/05/01 11:22:18.000.397,C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\MDIBrowser.dproj=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\MDIAPP.dproj + 2017/05/01 12:25:35.000.397,C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\uMainForm.pas=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\Main.pas + 2017/05/01 12:25:35.000.397,C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\uMainForm.dfm=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\Main.dfm + 2017/05/01 12:26:13.000.106,C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\uChildForm.dfm=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\ChildWin.dfm + 2017/05/01 12:26:13.000.106,C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\uChildForm.pas=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\ChildWin.pas diff --git a/demos/MDIBrowser/MDIBrowser.dsk b/demos/MDIBrowser/MDIBrowser.dsk index f84400b9..0cdfb141 100644 --- a/demos/MDIBrowser/MDIBrowser.dsk +++ b/demos/MDIBrowser/MDIBrowser.dsk @@ -1,19 +1,19 @@ [Closed Files] -File_0=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFLifeSpanHandler.pas',0,1,218,90,218,0,0,, -File_1=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFChromium.pas',0,1,2259,73,2287,0,0,, -File_2=TSourceModule,'c:\program files (x86)\embarcadero\studio\19.0\SOURCE\VCL\Vcl.Forms.pas',0,1,3703,39,3731,0,0,{{1747,4} -File_3=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\FastMM4\FastMM4.pas',0,1,10238,1,10260,0,0,, -File_4=TSourceModule,'c:\program files\embarcadero\studio\17.0\SOURCE\VCL\Vcl.Forms.pas',0,1,6306,1,6308,0,0,{{1729,4} -File_5=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFApplication.pas',0,1,53,20,81,0,0,, -File_6=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MiniBrowser\uMiniBrowser.pas',0,1,1,22,38,0,0,, -File_7=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFMiscFunctions.pas',0,1,626,1,663,0,0,, -File_8=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\SimpleBrowser\uSimpleBrowser.pas',0,1,1,1,1,0,0,, -File_9=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFTypes.pas',0,1,289,21,334,0,0,, +File_0=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFRequestContext.pas',0,62,84,71,84,0,0,, +File_1=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFApplication.pas',0,1,207,34,235,0,0,, +File_2=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFMiscFunctions.pas',0,1,486,3,515,0,0,, +File_3=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFChromium.pas',0,1,892,81,927,0,0,, +File_4=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser_new\uChildForm.pas',0,1,106,1,147,0,0,, +File_5=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser_new\uMainForm.pas',0,1,55,1,1,0,0,, +File_6=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\FastMM4\FastMM4.pas',0,1,10238,70,10281,0,0,, +File_7=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFLifeSpanHandler.pas',0,1,218,90,218,0,0,, +File_8=TSourceModule,'c:\program files (x86)\embarcadero\studio\19.0\SOURCE\VCL\Vcl.Forms.pas',0,1,3703,39,3731,0,0,{{1747,4} +File_9=TSourceModule,'c:\program files\embarcadero\studio\17.0\SOURCE\VCL\Vcl.Forms.pas',0,1,6306,1,6308,0,0,{{1729,4} [Modules] Module0=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\MDIBrowser.dproj -Module1=default.htm -Module2=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\uChildForm.pas +Module1=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\uChildForm.pas +Module2=default.htm Module3=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\uMainForm.pas Count=4 EditWindowCount=1 @@ -21,12 +21,12 @@ EditWindowCount=1 [C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\MDIBrowser.dproj] ModuleType=TBaseProject -[default.htm] -ModuleType=TURLModule - [C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\uChildForm.pas] ModuleType=TSourceModule +[default.htm] +ModuleType=TURLModule + [C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\uMainForm.pas] ModuleType=TSourceModule @@ -53,18 +53,18 @@ ClientHeight=9417 DockedToMainForm=1 BorlandEditorCodeExplorer=BorlandEditorCodeExplorer@EditWindow0 TopPanelSize=0 -LeftPanelSize=1898 -LeftPanelClients=PropertyInspector,DockSite3 -LeftPanelData=00000800010100000000A219000000000000016A0700000000000001000000005D0E000009000000446F636B53697465330100000000972300001100000050726F7065727479496E73706563746F72FFFFFFFF +LeftPanelSize=0 RightPanelSize=2000 -RightPanelClients=DockSite2,DockSite4 -RightPanelData=00000800010100000000A21900000000000001D00700000000000001000000004312000009000000446F636B536974653201000000009723000009000000446F636B5369746534FFFFFFFF +RightPanelClients=DockSite2 +RightPanelData=00000800010100000000A21900000000000001D00700000000000001000000009723000009000000446F636B5369746532FFFFFFFF BottomPanelSize=0 BottomPanelClients=DockSite1,MessageView BottomPanelData=0000080001020200000009000000446F636B53697465310F0000004D65737361676556696577466F726D1234000000000000022506000000000000FFFFFFFF BottomMiddlePanelSize=0 BottomMiddlePanelClients=DockSite0,GraphDrawingModel BottomMiddelPanelData=0000080001020200000009000000446F636B536974653010000000477261706844726177696E67566965779D1D00000000000002F306000000000000FFFFFFFF +TabDockLeftClients=PropertyInspector=0,DockSite3=1 +TabDockRightClients=DockSite4=0 [View0] CustomEditViewType=TWelcomePageView @@ -73,9 +73,9 @@ WelcomePageURL=bds:/default.htm [View1] CustomEditViewType=TEditView Module=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\MDIBrowser.dpr -CursorX=1 -CursorY=43 -TopLine=37 +CursorX=41 +CursorY=59 +TopLine=25 LeftCol=1 Elisions= Bookmarks= @@ -84,9 +84,9 @@ EditViewName=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\d [View2] CustomEditViewType=TEditView Module=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\uChildForm.pas -CursorX=87 -CursorY=96 -TopLine=87 +CursorX=60 +CursorY=171 +TopLine=128 LeftCol=1 Elisions= Bookmarks= @@ -95,9 +95,9 @@ EditViewName=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\d [View3] CustomEditViewType=TEditView Module=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\MDIBrowser\uMainForm.pas -CursorX=3 -CursorY=56 -TopLine=31 +CursorX=48 +CursorY=187 +TopLine=144 LeftCol=1 Elisions= Bookmarks= @@ -168,11 +168,11 @@ State=0 Left=0 Top=0 Width=2000 -Height=4305 +Height=8935 MaxLeft=-1 MaxTop=-1 ClientWidth=2000 -ClientHeight=4305 +ClientHeight=8935 TBDockHeight=5897 LRDockWidth=2352 Dockable=1 @@ -205,12 +205,12 @@ Docked=1 State=0 Left=0 Top=0 -Width=2000 -Height=4383 +Width=1875 +Height=6738 MaxLeft=-1 MaxTop=-1 -ClientWidth=2000 -ClientHeight=4383 +ClientWidth=1875 +ClientHeight=6738 TBDockHeight=7152 LRDockWidth=2000 Dockable=1 @@ -260,8 +260,8 @@ Create=1 Visible=0 Docked=1 State=0 -Left=-121 -Top=-70 +Left=-8 +Top=-30 Width=1844 Height=3139 MaxLeft=-1 @@ -314,17 +314,17 @@ StayOnTop=0 [PropertyInspector] PercentageSizes=1 Create=1 -Visible=1 +Visible=0 Docked=1 State=0 -Left=0 -Top=357 +Left=78 +Top=386 Width=1898 -Height=5415 +Height=7164 MaxLeft=-1 MaxTop=-1 ClientWidth=1898 -ClientHeight=5415 +ClientHeight=7164 TBDockHeight=7164 LRDockWidth=1898 Dockable=1 @@ -375,8 +375,8 @@ Create=1 Visible=0 Docked=1 State=0 -Left=-1152 -Top=247 +Left=-8 +Top=287 Width=273 Height=359 MaxLeft=-1 @@ -432,6 +432,7 @@ Column0Width=145 Column1Width=100 Column2Width=115 Column3Width=250 +Column4Width=250 [LocalVarsWindow] PercentageSizes=1 @@ -627,12 +628,12 @@ Docked=1 State=0 Left=0 Top=0 -Width=1898 -Height=3554 +Width=1773 +Height=6738 MaxLeft=-1 MaxTop=-1 -ClientWidth=1898 -ClientHeight=3554 +ClientWidth=1773 +ClientHeight=6738 TBDockHeight=3677 LRDockWidth=1898 Dockable=1 @@ -738,11 +739,11 @@ State=0 Left=0 Top=18 Width=2000 -Height=4585 +Height=9215 MaxLeft=-1 MaxTop=-1 ClientWidth=2000 -ClientHeight=4585 +ClientHeight=9215 TBDockHeight=7164 LRDockWidth=2000 Dockable=1 @@ -752,21 +753,21 @@ ActiveTabID=ProjectManager TabDockClients=ProjectManager,ModelViewTool,DataExplorerContainer,frmDesignPreview,TFileExplorerForm [DockSite3] -HostDockSite=DockLeftPanel +HostDockSite=LeftDockTabSet DockSiteType=1 PercentageSizes=1 Create=1 -Visible=1 +Visible=0 Docked=1 State=0 Left=0 -Top=18 +Top=0 Width=1898 -Height=3554 +Height=7164 MaxLeft=-1 MaxTop=-1 -ClientWidth=1898 -ClientHeight=3554 +ClientWidth=1773 +ClientHeight=6738 TBDockHeight=7164 LRDockWidth=1898 Dockable=1 @@ -776,21 +777,21 @@ ActiveTabID=StructureView TabDockClients=StructureView,ClassBrowserTool [DockSite4] -HostDockSite=DockRightPanel +HostDockSite=RightTabDock DockSiteType=1 PercentageSizes=1 Create=1 -Visible=1 +Visible=0 Docked=1 State=0 Left=0 -Top=449 +Top=0 Width=2000 -Height=4383 +Height=7164 MaxLeft=-1 MaxTop=-1 -ClientWidth=2000 -ClientHeight=4383 +ClientWidth=1875 +ClientHeight=6738 TBDockHeight=7164 LRDockWidth=2000 Dockable=1 diff --git a/demos/MDIBrowser/MDIBrowser.identcache b/demos/MDIBrowser/MDIBrowser.identcache index 2966cc53..846f5577 100644 Binary files a/demos/MDIBrowser/MDIBrowser.identcache and b/demos/MDIBrowser/MDIBrowser.identcache differ diff --git a/demos/MDIBrowser/MDIBrowser.stat b/demos/MDIBrowser/MDIBrowser.stat index 66f87297..42defa6a 100644 --- a/demos/MDIBrowser/MDIBrowser.stat +++ b/demos/MDIBrowser/MDIBrowser.stat @@ -1,10 +1,10 @@ [Stats] -EditorSecs=6316 -DesignerSecs=26 -InspectorSecs=5 -CompileSecs=199870 -OtherSecs=496 +EditorSecs=7691 +DesignerSecs=91 +InspectorSecs=49 +CompileSecs=266444 +OtherSecs=393 StartTime=01/05/2017 12:55:55 RealKeys=0 EffectiveKeys=0 -DebugSecs=1340 +DebugSecs=2328 diff --git a/demos/MDIBrowser/uChildForm.pas b/demos/MDIBrowser/uChildForm.pas index d576b8ea..f07a9353 100644 --- a/demos/MDIBrowser/uChildForm.pas +++ b/demos/MDIBrowser/uChildForm.pas @@ -96,6 +96,8 @@ implementation // 2. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy CEFWindowParent1 in the main thread. // 3. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form. +uses + uCEFRequestContext; procedure TChildForm.Button1Click(Sender: TObject); begin @@ -150,8 +152,23 @@ begin end; procedure TChildForm.FormShow(Sender: TObject); +var + TempContext : ICefRequestContext; begin - Chromium1.CreateBrowser(CEFWindowParent1, ''); + // The new request context overrides several GlobalCEFApp properties like : + // cache, AcceptLanguageList, PersistSessionCookies, PersistUserPreferences, + // IgnoreCertificateErrors and EnableNetSecurityExpiration + + // If you use an empty cache path, CEF will use in-memory cache. + + if MainForm.NewContextChk.Checked then + TempContext := TCefRequestContextRef.New('', '', False, False, False, False) + else + TempContext := nil; + + // In case you used a custom cookies path in the GlobalCEFApp you can + // override it in the TChromium.CreateBrowser function + Chromium1.CreateBrowser(CEFWindowParent1, '', TempContext); end; procedure TChildForm.WMMove(var aMessage : TWMMove); diff --git a/demos/MDIBrowser/uMainForm.dfm b/demos/MDIBrowser/uMainForm.dfm index d3686189..a21fcc75 100644 --- a/demos/MDIBrowser/uMainForm.dfm +++ b/demos/MDIBrowser/uMainForm.dfm @@ -69,5 +69,13 @@ object MainForm: TMainForm NumGlyphs = 2 OnClick = ExitBtnClick end + object NewContextChk: TCheckBox + Left = 192 + Top = 8 + Width = 257 + Height = 17 + Caption = 'Create a new request context for new browsers' + TabOrder = 0 + end end end diff --git a/demos/MDIBrowser/uMainForm.pas b/demos/MDIBrowser/uMainForm.pas index cc9a7503..7610bdea 100644 --- a/demos/MDIBrowser/uMainForm.pas +++ b/demos/MDIBrowser/uMainForm.pas @@ -62,6 +62,7 @@ type ButtonPnl: TPanel; NewBtn: TSpeedButton; ExitBtn: TSpeedButton; + NewContextChk: TCheckBox; procedure FormCreate(Sender: TObject); procedure NewBtnClick(Sender: TObject); procedure ExitBtnClick(Sender: TObject); diff --git a/demos/TabbedBrowser/TabBrowser.dsk b/demos/TabbedBrowser/TabBrowser.dsk index 94150d14..718592a1 100644 --- a/demos/TabbedBrowser/TabBrowser.dsk +++ b/demos/TabbedBrowser/TabBrowser.dsk @@ -12,20 +12,20 @@ File_9=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\Com [Modules] Module0=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\TabbedBrowser\TabBrowser.dproj -Module1=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\TabbedBrowser\uMainForm.pas -Module2=default.htm +Module1=default.htm +Module2=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\TabbedBrowser\uMainForm.pas Count=3 EditWindowCount=1 [C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\TabbedBrowser\TabBrowser.dproj] ModuleType=TBaseProject -[C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\TabbedBrowser\uMainForm.pas] -ModuleType=TSourceModule - [default.htm] ModuleType=TURLModule +[C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\TabbedBrowser\uMainForm.pas] +ModuleType=TSourceModule + [EditWindow0] ViewCount=3 CurrentEditView=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\TabbedBrowser\TabBrowser.dpr @@ -48,18 +48,18 @@ ClientHeight=9417 DockedToMainForm=1 BorlandEditorCodeExplorer=BorlandEditorCodeExplorer@EditWindow0 TopPanelSize=0 -LeftPanelSize=1898 -LeftPanelClients=PropertyInspector,DockSite3 -LeftPanelData=000008000101000000001615000000000000016A0700000000000001000000005D0E000009000000446F636B53697465330100000000471D00001100000050726F7065727479496E73706563746F72FFFFFFFF +LeftPanelSize=0 RightPanelSize=2000 -RightPanelClients=DockSite2,DockSite4 -RightPanelData=00000800010100000000161500000000000001D00700000000000001000000004312000009000000446F636B53697465320100000000471D000009000000446F636B5369746534FFFFFFFF -BottomPanelSize=1551 +RightPanelClients=DockSite2 +RightPanelData=00000800010100000000A21900000000000001D00700000000000001000000009723000009000000446F636B5369746532FFFFFFFF +BottomPanelSize=0 BottomPanelClients=DockSite1,MessageView -BottomPanelData=0000080001020100000009000000446F636B53697465313B36000000000000020F0600000000000001000000003B3600000F0000004D65737361676556696577466F726DFFFFFFFF +BottomPanelData=0000080001020200000009000000446F636B53697465310F0000004D65737361676556696577466F726D1234000000000000022506000000000000FFFFFFFF BottomMiddlePanelSize=0 BottomMiddlePanelClients=DockSite0,GraphDrawingModel BottomMiddelPanelData=0000080001020200000009000000446F636B536974653010000000477261706844726177696E67566965779D1D00000000000002F306000000000000FFFFFFFF +TabDockLeftClients=PropertyInspector=0,DockSite3=1 +TabDockRightClients=DockSite4=0 [View0] CustomEditViewType=TWelcomePageView @@ -80,7 +80,7 @@ EditViewName=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\d CustomEditViewType=TEditView Module=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\TabbedBrowser\TabBrowser.dpr CursorX=55 -CursorY=66 +CursorY=77 TopLine=41 LeftCol=1 Elisions= @@ -104,18 +104,19 @@ State=0 Left=0 Top=0 Width=3820 -Height=1121 +Height=1143 MaxLeft=-1 MaxTop=-1 ClientWidth=3820 -ClientHeight=1121 +ClientHeight=1143 TBDockHeight=213 LRDockWidth=13602 Dockable=1 StayOnTop=0 [Breakpoints] -Count=0 +Count=1 +Breakpoint0='C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\demos\TabbedBrowser\TabBrowser.dpr',71,'',0,1,'',1,0,0,'',1,'','','',0,'' [EmbarcaderoWin32Debugger_AddressBreakpoints] Count=0 @@ -152,11 +153,11 @@ State=0 Left=0 Top=0 Width=2000 -Height=4305 +Height=8935 MaxLeft=-1 MaxTop=-1 ClientWidth=2000 -ClientHeight=4305 +ClientHeight=8935 TBDockHeight=5897 LRDockWidth=2352 Dockable=1 @@ -165,18 +166,18 @@ StayOnTop=0 [MessageView] PercentageSizes=1 Create=1 -Visible=1 +Visible=0 Docked=1 State=0 Left=0 -Top=18 -Width=10000 -Height=1401 +Top=0 +Width=2773 +Height=1424 MaxLeft=-1 MaxTop=-1 -ClientWidth=10000 -ClientHeight=1401 -TBDockHeight=1401 +ClientWidth=2773 +ClientHeight=1424 +TBDockHeight=1424 LRDockWidth=2773 Dockable=1 StayOnTop=0 @@ -189,12 +190,12 @@ Docked=1 State=0 Left=0 Top=0 -Width=2000 -Height=2713 +Width=1875 +Height=6794 MaxLeft=-1 MaxTop=-1 -ClientWidth=2000 -ClientHeight=2713 +ClientWidth=1875 +ClientHeight=6794 TBDockHeight=7152 LRDockWidth=2000 Dockable=1 @@ -244,8 +245,8 @@ Create=1 Visible=0 Docked=1 State=0 -Left=-121 -Top=-70 +Left=-8 +Top=-30 Width=1844 Height=3139 MaxLeft=-1 @@ -298,18 +299,18 @@ StayOnTop=0 [PropertyInspector] PercentageSizes=1 Create=1 -Visible=1 +Visible=0 Docked=1 State=0 -Left=0 -Top=357 +Left=78 +Top=386 Width=1898 -Height=3744 +Height=7220 MaxLeft=-1 MaxTop=-1 ClientWidth=1898 -ClientHeight=3744 -TBDockHeight=7164 +ClientHeight=7220 +TBDockHeight=7220 LRDockWidth=1898 Dockable=1 StayOnTop=0 @@ -359,8 +360,8 @@ Create=1 Visible=0 Docked=1 State=0 -Left=-1152 -Top=247 +Left=-8 +Top=287 Width=273 Height=359 MaxLeft=-1 @@ -384,11 +385,11 @@ State=0 Left=0 Top=0 Width=3820 -Height=1121 +Height=1143 MaxLeft=-1 MaxTop=-1 ClientWidth=3820 -ClientHeight=1121 +ClientHeight=1143 TBDockHeight=415 LRDockWidth=4953 Dockable=1 @@ -403,11 +404,11 @@ State=0 Left=0 Top=0 Width=3820 -Height=1121 +Height=1143 MaxLeft=-1 MaxTop=-1 ClientWidth=3820 -ClientHeight=1121 +ClientHeight=1143 TBDockHeight=213 LRDockWidth=7406 Dockable=1 @@ -426,11 +427,11 @@ State=0 Left=0 Top=0 Width=3820 -Height=1121 +Height=1143 MaxLeft=-1 MaxTop=-1 ClientWidth=3820 -ClientHeight=1121 +ClientHeight=1143 TBDockHeight=1536 LRDockWidth=3484 Dockable=1 @@ -445,11 +446,11 @@ State=0 Left=0 Top=0 Width=3820 -Height=1121 +Height=1143 MaxLeft=-1 MaxTop=-1 ClientWidth=3820 -ClientHeight=1121 +ClientHeight=1143 TBDockHeight=2063 LRDockWidth=3484 Dockable=1 @@ -586,11 +587,11 @@ State=0 Left=0 Top=0 Width=3820 -Height=1121 +Height=1143 MaxLeft=-1 MaxTop=-1 ClientWidth=3820 -ClientHeight=1121 +ClientHeight=1143 TBDockHeight=1547 LRDockWidth=8742 Dockable=1 @@ -611,12 +612,12 @@ Docked=1 State=0 Left=0 Top=0 -Width=1898 -Height=3554 +Width=1773 +Height=6794 MaxLeft=-1 MaxTop=-1 -ClientWidth=1898 -ClientHeight=3554 +ClientWidth=1773 +ClientHeight=6794 TBDockHeight=3677 LRDockWidth=1898 Dockable=1 @@ -698,12 +699,12 @@ State=0 Left=0 Top=18 Width=3820 -Height=1401 +Height=1424 MaxLeft=-1 MaxTop=-1 ClientWidth=3820 -ClientHeight=1401 -TBDockHeight=1401 +ClientHeight=1424 +TBDockHeight=1424 LRDockWidth=3820 Dockable=1 StayOnTop=0 @@ -722,12 +723,12 @@ State=0 Left=0 Top=18 Width=2000 -Height=4585 +Height=9215 MaxLeft=-1 MaxTop=-1 ClientWidth=2000 -ClientHeight=4585 -TBDockHeight=7164 +ClientHeight=9215 +TBDockHeight=7220 LRDockWidth=2000 Dockable=1 StayOnTop=0 @@ -736,22 +737,22 @@ ActiveTabID=ProjectManager TabDockClients=ProjectManager,ModelViewTool,DataExplorerContainer,frmDesignPreview,TFileExplorerForm [DockSite3] -HostDockSite=DockLeftPanel +HostDockSite=LeftDockTabSet DockSiteType=1 PercentageSizes=1 Create=1 -Visible=1 +Visible=0 Docked=1 State=0 Left=0 -Top=18 +Top=0 Width=1898 -Height=3554 +Height=7220 MaxLeft=-1 MaxTop=-1 -ClientWidth=1898 -ClientHeight=3554 -TBDockHeight=7164 +ClientWidth=1773 +ClientHeight=6794 +TBDockHeight=7220 LRDockWidth=1898 Dockable=1 StayOnTop=0 @@ -760,22 +761,22 @@ ActiveTabID=StructureView TabDockClients=StructureView,ClassBrowserTool [DockSite4] -HostDockSite=DockRightPanel +HostDockSite=RightTabDock DockSiteType=1 PercentageSizes=1 Create=1 -Visible=1 +Visible=0 Docked=1 State=0 Left=0 -Top=449 +Top=0 Width=2000 -Height=2713 +Height=7220 MaxLeft=-1 MaxTop=-1 -ClientWidth=2000 -ClientHeight=2713 -TBDockHeight=7164 +ClientWidth=1875 +ClientHeight=6794 +TBDockHeight=7220 LRDockWidth=2000 Dockable=1 StayOnTop=0 diff --git a/demos/TabbedBrowser/TabBrowser.stat b/demos/TabbedBrowser/TabBrowser.stat index e06a1774..f88a382f 100644 --- a/demos/TabbedBrowser/TabBrowser.stat +++ b/demos/TabbedBrowser/TabBrowser.stat @@ -1,10 +1,10 @@ [Stats] -EditorSecs=5709 +EditorSecs=5737 DesignerSecs=425 InspectorSecs=86 -CompileSecs=107989 -OtherSecs=194 +CompileSecs=114863 +OtherSecs=199 StartTime=22/09/2017 23:12:56 RealKeys=0 EffectiveKeys=0 -DebugSecs=915 +DebugSecs=2359 diff --git a/source/CEF4Delphi.dsk b/source/CEF4Delphi.dsk index 99e5761d..fc635ff9 100644 --- a/source/CEF4Delphi.dsk +++ b/source/CEF4Delphi.dsk @@ -1,14 +1,14 @@ [Closed Files] -File_0=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFChromium.pas',0,1,1741,1,1761,0,0,,{1,1730,1}{2,1675,41} -File_1=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFApplication.pas',0,1,30,39,60,0,0,, -File_2=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFInterfaces.pas',0,1,240,5,271,0,0,,{1,269,40} -File_3=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFBrowser.pas',0,1,186,62,249,0,0,, -File_4=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFX509Certificate.pas',0,1,164,73,195,0,0,, -File_5=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFTypes.pas',0,1,2490,108,2513,0,0,,{1,2513,79}{2,1011,61} -File_6=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFTask.pas',0,1,189,82,245,0,0,,{1,90,17} -File_7=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFStringVisitor.pas',0,1,42,39,78,0,0,,{1 -File_8=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFChromiumEvents.pas',0,1,1,1,1,0,0,, -File_9=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFCookieManager.pas',0,1,21,23,38,0,0,, +File_0=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFApplication.pas',0,1,730,1,737,0,0,, +File_1=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFChromium.pas',0,1,895,36,930,0,0,,{1,926,72} +File_2=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFInterfaces.pas',0,1,1475,37,1511,0,0,, +File_3=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFRequestContext.pas',0,1,35,69,58,0,0,, +File_4=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFMiscFunctions.pas',0,1,428,62,454,0,0,, +File_5=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFTypes.pas',0,1,1450,1,1480,0,0,, +File_6=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFBrowser.pas',0,1,524,13,547,0,0,, +File_7=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFX509Certificate.pas',0,1,164,73,195,0,0,, +File_8=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFTask.pas',0,1,189,82,245,0,0,,{1 +File_9=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFStringVisitor.pas',0,1,42,39,78,0,0,,{1 [Modules] Module0=default.htm @@ -38,18 +38,18 @@ ClientHeight=9417 DockedToMainForm=1 BorlandEditorCodeExplorer=BorlandEditorCodeExplorer@EditWindow0 TopPanelSize=0 -LeftPanelSize=1898 -LeftPanelClients=PropertyInspector,DockSite3 -LeftPanelData=000008000101000000001615000000000000016A0700000000000001000000005D0E000009000000446F636B53697465330100000000471D00001100000050726F7065727479496E73706563746F72FFFFFFFF +LeftPanelSize=0 RightPanelSize=2000 -RightPanelClients=DockSite2,DockSite4 -RightPanelData=00000800010100000000161500000000000001D00700000000000001000000004312000009000000446F636B53697465320100000000471D000009000000446F636B5369746534FFFFFFFF -BottomPanelSize=1551 +RightPanelClients=DockSite2 +RightPanelData=00000800010100000000A21900000000000001D00700000000000001000000009723000009000000446F636B5369746532FFFFFFFF +BottomPanelSize=0 BottomPanelClients=DockSite1,MessageView -BottomPanelData=0000080001020100000009000000446F636B53697465313B36000000000000020F0600000000000001000000003B3600000F0000004D65737361676556696577466F726DFFFFFFFF +BottomPanelData=0000080001020200000009000000446F636B53697465310F0000004D65737361676556696577466F726D1234000000000000022506000000000000FFFFFFFF BottomMiddlePanelSize=0 BottomMiddlePanelClients=DockSite0,GraphDrawingModel BottomMiddelPanelData=0000080001020200000009000000446F636B536974653010000000477261706844726177696E67566965779D1D00000000000002F306000000000000FFFFFFFF +TabDockLeftClients=PropertyInspector=0,DockSite3=1 +TabDockRightClients=DockSite4=0 [View0] CustomEditViewType=TWelcomePageView @@ -120,11 +120,11 @@ State=0 Left=0 Top=0 Width=2000 -Height=4305 +Height=8935 MaxLeft=-1 MaxTop=-1 ClientWidth=2000 -ClientHeight=4305 +ClientHeight=8935 TBDockHeight=5897 LRDockWidth=2352 Dockable=1 @@ -133,18 +133,18 @@ StayOnTop=0 [MessageView] PercentageSizes=1 Create=1 -Visible=1 +Visible=0 Docked=1 State=0 Left=0 -Top=18 -Width=10000 -Height=1401 +Top=0 +Width=2773 +Height=1424 MaxLeft=-1 MaxTop=-1 -ClientWidth=10000 -ClientHeight=1401 -TBDockHeight=1401 +ClientWidth=2773 +ClientHeight=1424 +TBDockHeight=1424 LRDockWidth=2773 Dockable=1 StayOnTop=0 @@ -157,12 +157,12 @@ Docked=1 State=0 Left=0 Top=0 -Width=2000 -Height=2713 +Width=1875 +Height=6738 MaxLeft=-1 MaxTop=-1 -ClientWidth=2000 -ClientHeight=2713 +ClientWidth=1875 +ClientHeight=6738 TBDockHeight=7152 LRDockWidth=2000 Dockable=1 @@ -212,8 +212,8 @@ Create=1 Visible=0 Docked=1 State=0 -Left=-148 -Top=-132 +Left=-8 +Top=-30 Width=1844 Height=3139 MaxLeft=-1 @@ -266,18 +266,18 @@ StayOnTop=0 [PropertyInspector] PercentageSizes=1 Create=1 -Visible=1 +Visible=0 Docked=1 State=0 -Left=0 -Top=357 +Left=78 +Top=386 Width=1898 -Height=3744 +Height=7164 MaxLeft=-1 MaxTop=-1 ClientWidth=1898 -ClientHeight=3744 -TBDockHeight=7220 +ClientHeight=7164 +TBDockHeight=7164 LRDockWidth=1898 Dockable=1 StayOnTop=0 @@ -292,11 +292,11 @@ State=0 Left=0 Top=0 Width=2000 -Height=6939 +Height=6883 MaxLeft=-1 MaxTop=-1 ClientWidth=2000 -ClientHeight=6939 +ClientHeight=6883 TBDockHeight=5964 LRDockWidth=2508 Dockable=1 @@ -308,8 +308,8 @@ Create=1 Visible=0 Docked=1 State=0 -Left=-898 -Top=-132 +Left=-946 +Top=5 Width=2844 Height=6200 MaxLeft=-1 @@ -327,8 +327,8 @@ Create=1 Visible=0 Docked=1 State=0 -Left=-1026 -Top=-132 +Left=-8 +Top=287 Width=273 Height=359 MaxLeft=-1 @@ -384,6 +384,7 @@ Column0Width=145 Column1Width=100 Column2Width=115 Column3Width=250 +Column4Width=250 [LocalVarsWindow] PercentageSizes=1 @@ -451,11 +452,11 @@ State=0 Left=0 Top=0 Width=2336 -Height=1200 +Height=964 MaxLeft=-1 MaxTop=-1 ClientWidth=2336 -ClientHeight=1200 +ClientHeight=964 TBDockHeight=2321 LRDockWidth=2820 Dockable=1 @@ -516,11 +517,11 @@ State=0 Left=0 Top=0 Width=2000 -Height=6939 +Height=6883 MaxLeft=-1 MaxTop=-1 ClientWidth=2000 -ClientHeight=6939 +ClientHeight=6883 TBDockHeight=4888 LRDockWidth=7148 Dockable=1 @@ -532,8 +533,8 @@ Create=1 Visible=0 Docked=1 State=0 -Left=0 -Top=0 +Left=249 +Top=709 Width=2859 Height=3206 MaxLeft=-1 @@ -579,12 +580,12 @@ Docked=1 State=0 Left=0 Top=0 -Width=1898 -Height=3554 +Width=1773 +Height=6738 MaxLeft=-1 MaxTop=-1 -ClientWidth=1898 -ClientHeight=3554 +ClientWidth=1773 +ClientHeight=6738 TBDockHeight=3677 LRDockWidth=1898 Dockable=1 @@ -599,11 +600,11 @@ State=0 Left=0 Top=0 Width=2000 -Height=6939 +Height=6883 MaxLeft=-1 MaxTop=-1 ClientWidth=2000 -ClientHeight=6939 +ClientHeight=6883 TBDockHeight=4888 LRDockWidth=5305 Dockable=1 @@ -664,7 +665,7 @@ Visible=0 Docked=1 State=0 Left=0 -Top=0 +Top=18 Width=3820 Height=1424 MaxLeft=-1 @@ -690,12 +691,12 @@ State=0 Left=0 Top=18 Width=2000 -Height=4585 +Height=9215 MaxLeft=-1 MaxTop=-1 ClientWidth=2000 -ClientHeight=4585 -TBDockHeight=7220 +ClientHeight=9215 +TBDockHeight=7164 LRDockWidth=2000 Dockable=1 StayOnTop=0 @@ -704,22 +705,22 @@ ActiveTabID=ProjectManager TabDockClients=ProjectManager,ModelViewTool,DataExplorerContainer,frmDesignPreview,TFileExplorerForm [DockSite3] -HostDockSite=DockLeftPanel +HostDockSite=LeftDockTabSet DockSiteType=1 PercentageSizes=1 Create=1 -Visible=1 +Visible=0 Docked=1 State=0 Left=0 -Top=18 +Top=0 Width=1898 -Height=3554 +Height=7164 MaxLeft=-1 MaxTop=-1 -ClientWidth=1898 -ClientHeight=3554 -TBDockHeight=7220 +ClientWidth=1773 +ClientHeight=6738 +TBDockHeight=7164 LRDockWidth=1898 Dockable=1 StayOnTop=0 @@ -728,22 +729,22 @@ ActiveTabID=StructureView TabDockClients=StructureView,ClassBrowserTool [DockSite4] -HostDockSite=DockRightPanel +HostDockSite=RightTabDock DockSiteType=1 PercentageSizes=1 Create=1 -Visible=1 +Visible=0 Docked=1 State=0 Left=0 -Top=449 +Top=0 Width=2000 -Height=2713 +Height=7164 MaxLeft=-1 MaxTop=-1 -ClientWidth=2000 -ClientHeight=2713 -TBDockHeight=7220 +ClientWidth=1875 +ClientHeight=6738 +TBDockHeight=7164 LRDockWidth=2000 Dockable=1 StayOnTop=0 diff --git a/source/CEF4Delphi.stat b/source/CEF4Delphi.stat index 61c837e5..7bed3246 100644 --- a/source/CEF4Delphi.stat +++ b/source/CEF4Delphi.stat @@ -1,9 +1,9 @@ [Stats] -EditorSecs=181807 +EditorSecs=184701 DesignerSecs=98 InspectorSecs=326 -CompileSecs=5685029 -OtherSecs=18957 +CompileSecs=5773145 +OtherSecs=19237 StartTime=22/01/2017 10:49:52 RealKeys=0 EffectiveKeys=0 diff --git a/source/uCEFApplication.pas b/source/uCEFApplication.pas index 31002a7c..0579d0d3 100644 --- a/source/uCEFApplication.pas +++ b/source/uCEFApplication.pas @@ -672,8 +672,13 @@ function TCefApplication.ExecuteProcess : integer; var TempArgs : TCefMainArgs; begin - TempArgs.instance := HINSTANCE; - Result := cef_execute_process(@TempArgs, FApp.Wrap, FWindowsSandboxInfo); + if (FApp <> nil) then + begin + TempArgs.instance := HINSTANCE; + Result := cef_execute_process(@TempArgs, FApp.Wrap, FWindowsSandboxInfo); + end + else + Result := 0; end; procedure TCefApplication.InitializeSettings(var aSettings : TCefSettings); @@ -719,7 +724,8 @@ begin InitializeSettings(FAppSettings); - Result := (cef_initialize(@HInstance, @FAppSettings, FApp.Wrap, FWindowsSandboxInfo) <> 0) and + Result := (FApp <> nil) and + (cef_initialize(@HInstance, @FAppSettings, FApp.Wrap, FWindowsSandboxInfo) <> 0) and InitializeCookies; except on e : exception do diff --git a/source/uCEFChromium.pas b/source/uCEFChromium.pas index 8a2f341c..7d0451de 100644 --- a/source/uCEFChromium.pas +++ b/source/uCEFChromium.pas @@ -386,8 +386,8 @@ type function CreateClientHandler(aIsOSR : boolean) : boolean; overload; function CreateClientHandler(var aClient : ICefClient) : boolean; overload; procedure CloseBrowser(aForceClose : boolean); - function CreateBrowser(const aBrowserParent : TWinControl = nil; const aWindowName : string = '') : boolean; overload; - function CreateBrowser(aParentHandle : HWND; aParentRect : TRect; const aWindowName : string = '') : boolean; overload; + function CreateBrowser(const aBrowserParent : TWinControl = nil; const aWindowName : string = ''; const aContext : ICefRequestContext = nil; const aCookiesPath : string = ''; aPersistSessionCookies : boolean = False) : boolean; overload; + function CreateBrowser(aParentHandle : HWND; aParentRect : TRect; const aWindowName : string = ''; const aContext : ICefRequestContext = nil; const aCookiesPath : string = ''; aPersistSessionCookies : boolean = False) : boolean; overload; procedure InitializeDragAndDrop(const aDropTargetCtrl : TWinControl); procedure ShutdownDragAndDrop; @@ -871,10 +871,14 @@ begin FOnCookiesDeleted := nil; end; -function TChromium.CreateBrowser(const aBrowserParent : TWinControl; const aWindowName : string) : boolean; +function TChromium.CreateBrowser(const aBrowserParent : TWinControl; + const aWindowName : string; + const aContext : ICefRequestContext; + const aCookiesPath : string; + aPersistSessionCookies : boolean) : boolean; var TempHandle : HWND; - TempRect : TRect; + TempRect : TRect; begin if (aBrowserParent <> nil) then begin @@ -887,10 +891,17 @@ begin TempRect := rect(0, 0, 0, 0); end; - Result := CreateBrowser(TempHandle, TempRect, aWindowName); + Result := CreateBrowser(TempHandle, TempRect, aWindowName, aContext, aCookiesPath, aPersistSessionCookies); end; -function TChromium.CreateBrowser(aParentHandle : HWND; aParentRect : TRect; const aWindowName : string = '') : boolean; +function TChromium.CreateBrowser(aParentHandle : HWND; + aParentRect : TRect; + const aWindowName : string; + const aContext : ICefRequestContext; + const aCookiesPath : string; + aPersistSessionCookies : boolean) : boolean; +var + TempCookieManager : ICefCookieManager; begin Result := False; @@ -910,11 +921,21 @@ begin WindowInfoAsChild(FWindowInfo, aParentHandle, aParentRect, aWindowName); + if (aContext <> nil) and (length(aCookiesPath) > 0) then + begin + TempCookieManager := aContext.GetDefaultCookieManager(nil); + + if (TempCookieManager = nil) or + not(TempCookieManager.SetStoragePath(aCookiesPath, aPersistSessionCookies, nil)) then + OutputDebugMessage('TChromium.CreateBrowser error : cookies cannot be accessed'); + end; + + if MultithreadApp then - Result := CreateBrowserHost(@FWindowInfo, FDefaultUrl, @FBrowserSettings, nil) + Result := CreateBrowserHost(@FWindowInfo, FDefaultUrl, @FBrowserSettings, aContext) else begin - FBrowser := CreateBrowserHostSync(@FWindowInfo, FDefaultUrl, @FBrowserSettings, nil); + FBrowser := CreateBrowserHostSync(@FWindowInfo, FDefaultUrl, @FBrowserSettings, aContext); if (FBrowser <> nil) then begin diff --git a/source/uCEFRequestContext.pas b/source/uCEFRequestContext.pas index 65f482bb..b8fc0177 100644 --- a/source/uCEFRequestContext.pas +++ b/source/uCEFRequestContext.pas @@ -80,7 +80,8 @@ type public class function UnWrap(data: Pointer): ICefRequestContext; class function Global: ICefRequestContext; - class function New(const settings: PCefRequestContextSettings; const handler: ICefRequestContextHandler): ICefRequestContext; + class function New(const settings: PCefRequestContextSettings; const handler: ICefRequestContextHandler = nil): ICefRequestContext; overload; + class function New(const aCache, aAcceptLanguageList : ustring; aPersistSessionCookies, aPersistUserPreferences, aIgnoreCertificateErrors, aEnableNetSecurityExpiration : boolean; const handler: ICefRequestContextHandler = nil): ICefRequestContext; overload; class function Shared(const other: ICefRequestContext; const handler: ICefRequestContextHandler): ICefRequestContext; end; @@ -146,6 +147,27 @@ begin Result := UnWrap(cef_request_context_create_context(settings, CefGetData(handler))); end; +class function TCefRequestContextRef.New(const aCache : ustring; + const aAcceptLanguageList : ustring; + aPersistSessionCookies : boolean; + aPersistUserPreferences : boolean; + aIgnoreCertificateErrors : boolean; + aEnableNetSecurityExpiration : boolean; + const handler : ICefRequestContextHandler): ICefRequestContext; +var + TempSettings : TCefRequestContextSettings; +begin + TempSettings.size := SizeOf(TCefRequestContextSettings); + TempSettings.cache_path := CefString(aCache); + TempSettings.persist_session_cookies := Ord(aPersistSessionCookies); + TempSettings.persist_user_preferences := Ord(aPersistUserPreferences); + TempSettings.ignore_certificate_errors := Ord(aIgnoreCertificateErrors); + TempSettings.enable_net_security_expiration := Ord(aEnableNetSecurityExpiration); + TempSettings.accept_language_list := CefString(aAcceptLanguageList); + + Result := UnWrap(cef_request_context_create_context(@TempSettings, CefGetData(handler))); +end; + procedure TCefRequestContextRef.PurgePluginListCache(reloadPages: Boolean); begin PCefRequestContext(FData).purge_plugin_list_cache(FData, Ord(reloadPages));