From a334640b24fd08b0029d63ba643b55e4b6164f8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Salvador=20D=C3=ADaz=20Fau?= Date: Sat, 30 Dec 2017 09:54:26 +0100 Subject: [PATCH] Update to CEF 3.3239.1716.g735b746 - Added a HTTP, SOCKS4 and SOCKS5 combobox to the proxy preferences in the MiniBrowser. - Added more comments to DOMVisitor. --- demos/DOMVisitor/uDOMVisitor.pas | 18 ++++++++++- demos/MiniBrowser/uMiniBrowser.dfm | 8 +++-- demos/MiniBrowser/uMiniBrowser.pas | 51 +++++++++++++++++++++++++++--- demos/MiniBrowser/uPreferences.dfm | 30 +++++++++++++----- demos/MiniBrowser/uPreferences.pas | 1 + source/uCEFApplication.pas | 2 +- 6 files changed, 93 insertions(+), 17 deletions(-) diff --git a/demos/DOMVisitor/uDOMVisitor.pas b/demos/DOMVisitor/uDOMVisitor.pas index 85d478cc..a61d09d7 100644 --- a/demos/DOMVisitor/uDOMVisitor.pas +++ b/demos/DOMVisitor/uDOMVisitor.pas @@ -113,6 +113,22 @@ uses uCEFProcessMessage, uCEFMiscFunctions, uCEFSchemeRegistrar, uCEFRenderProcessHandler, uCEFv8Handler, uCEFDomVisitor, uCEFDomNode, uCEFTask; +// This demo sends messages from the browser process to the render process, +// and from the render process to the browser process. + +// To send a message from the browser process you must use the TChromium.SendProcessMessage +// procedure with a PID_RENDERER parameter. The render process receives those messages in +// the GlobalCEFApp.OnProcessMessageReceived event + +// To send messages from the render process you must use the browser.SendProcessMessage +// procedure with a PID_BROWSER parameter. The browser process receives those messages in +// the TChromium.OnProcessMessageReceived event. + +// message.name is used to identify different messages sent with SendProcessMessage. + +// The OnProcessMessageReceived event can recognize any number of messages identifying them +// by message.name + procedure SimpleDOMIteration(const aDocument: ICefDomDocument); var TempHead, TempChild : ICefDomNode; @@ -220,7 +236,7 @@ procedure TDOMVisitorFrm.Chromium1BeforeContextMenu(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; const model: ICefMenuModel); begin - model.AddItem(MINIBROWSER_CONTEXTMENU_VISITDOM, 'Visit DOM in CEF'); + model.AddItem(MINIBROWSER_CONTEXTMENU_VISITDOM, 'Visit DOM in CEF'); end; procedure TDOMVisitorFrm.Chromium1ContextMenuCommand(Sender: TObject; diff --git a/demos/MiniBrowser/uMiniBrowser.dfm b/demos/MiniBrowser/uMiniBrowser.dfm index 78c39e44..16cb45fe 100644 --- a/demos/MiniBrowser/uMiniBrowser.dfm +++ b/demos/MiniBrowser/uMiniBrowser.dfm @@ -165,7 +165,8 @@ object MiniBrowserFrm: TMiniBrowserFrm 'chrome://shorthang' 'chrome://gpuclean' 'chrome://gpucrash' - 'chrome://gpuhang') + 'chrome://gpuhang' + 'chrome://extensions-support') end end object ConfigPnl: TPanel @@ -232,7 +233,10 @@ object MiniBrowserFrm: TMiniBrowserFrm Height = 19 Panels = < item - Width = 50 + Width = 100 + end + item + Width = 500 end> end object Chromium1: TChromium diff --git a/demos/MiniBrowser/uMiniBrowser.pas b/demos/MiniBrowser/uMiniBrowser.pas index 3812e09b..666ca3e8 100644 --- a/demos/MiniBrowser/uMiniBrowser.pas +++ b/demos/MiniBrowser/uMiniBrowser.pas @@ -516,8 +516,19 @@ procedure TMiniBrowserFrm.Chromium1LoadingStateChange(Sender: TObject; begin BackBtn.Enabled := canGoBack; ForwardBtn.Enabled := canGoForward; - ReloadBtn.Enabled := not(isLoading); - StopBtn.Enabled := isLoading; + + if isLoading then + begin + StatusBar1.Panels[0].Text := 'Loading...'; + ReloadBtn.Enabled := False; + StopBtn.Enabled := True; + end + else + begin + StatusBar1.Panels[0].Text := 'Finished'; + ReloadBtn.Enabled := True; + StopBtn.Enabled := False; + end; end; procedure TMiniBrowserFrm.Chromium1PdfPrintFinished(Sender: TObject; aResultOK: Boolean); @@ -578,7 +589,7 @@ end; procedure TMiniBrowserFrm.ShowStatusText(const aText : string); begin - StatusBar1.Panels[0].Text := aText; + StatusBar1.Panels[1].Text := aText; end; procedure TMiniBrowserFrm.StopBtnClick(Sender: TObject); @@ -677,9 +688,34 @@ begin end; procedure TMiniBrowserFrm.Preferences1Click(Sender: TObject); +var + TempScheme, TempServer : string; + i : integer; begin + i := pos('://', Chromium1.ProxyServer); + + if (i <= 0) then + begin + PreferencesFrm.ProxySchemeCb.ItemIndex := 0; + TempServer := Chromium1.ProxyServer; + end + else + begin + TempScheme := copy(Chromium1.ProxyServer, 1, pred(i)); + TempServer := copy(Chromium1.ProxyServer, i + 3, length(Chromium1.ProxyServer)); + + if (CompareText(TempScheme, 'socks') = 0) or + (CompareText(TempScheme, 'socks5') = 0) then + PreferencesFrm.ProxySchemeCb.ItemIndex := 2 + else + if (CompareText(TempScheme, 'socks4') = 0) then + PreferencesFrm.ProxySchemeCb.ItemIndex := 1 + else + PreferencesFrm.ProxySchemeCb.ItemIndex := 0; + end; + PreferencesFrm.ProxyTypeCbx.ItemIndex := Chromium1.ProxyType; - PreferencesFrm.ProxyServerEdt.Text := Chromium1.ProxyServer; + PreferencesFrm.ProxyServerEdt.Text := TempServer; PreferencesFrm.ProxyPortEdt.Text := inttostr(Chromium1.ProxyPort); PreferencesFrm.ProxyUsernameEdt.Text := Chromium1.ProxyUsername; PreferencesFrm.ProxyPasswordEdt.Text := Chromium1.ProxyPassword; @@ -691,7 +727,6 @@ begin if (PreferencesFrm.ShowModal = mrOk) then begin Chromium1.ProxyType := PreferencesFrm.ProxyTypeCbx.ItemIndex; - Chromium1.ProxyServer := PreferencesFrm.ProxyServerEdt.Text; Chromium1.ProxyPort := strtoint(PreferencesFrm.ProxyPortEdt.Text); Chromium1.ProxyUsername := PreferencesFrm.ProxyUsernameEdt.Text; Chromium1.ProxyPassword := PreferencesFrm.ProxyPasswordEdt.Text; @@ -700,6 +735,12 @@ begin Chromium1.CustomHeaderName := PreferencesFrm.HeaderNameEdt.Text; Chromium1.CustomHeaderValue := PreferencesFrm.HeaderValueEdt.Text; + case PreferencesFrm.ProxySchemeCb.ItemIndex of + 1 : Chromium1.ProxyServer := 'socks4://' + PreferencesFrm.ProxyServerEdt.Text; + 2 : Chromium1.ProxyServer := 'socks5://' + PreferencesFrm.ProxyServerEdt.Text; + else Chromium1.ProxyServer := PreferencesFrm.ProxyServerEdt.Text; + end; + Chromium1.UpdatePreferences; end; end; diff --git a/demos/MiniBrowser/uPreferences.dfm b/demos/MiniBrowser/uPreferences.dfm index db0bad72..812404b0 100644 --- a/demos/MiniBrowser/uPreferences.dfm +++ b/demos/MiniBrowser/uPreferences.dfm @@ -108,11 +108,11 @@ object PreferencesFrm: TPreferencesFrm 'PAC script') end object ProxyServerEdt: TEdit - Left = 108 + Left = 176 Top = 53 - Width = 292 + Width = 224 Height = 21 - TabOrder = 1 + TabOrder = 2 end object ProxyPortEdt: TEdit Left = 108 @@ -121,7 +121,7 @@ object PreferencesFrm: TPreferencesFrm Height = 21 MaxLength = 5 NumbersOnly = True - TabOrder = 2 + TabOrder = 3 Text = '80' end object ProxyUsernameEdt: TEdit @@ -129,7 +129,7 @@ object PreferencesFrm: TPreferencesFrm Top = 107 Width = 292 Height = 21 - TabOrder = 3 + TabOrder = 4 end object ProxyPasswordEdt: TEdit Left = 108 @@ -137,21 +137,35 @@ object PreferencesFrm: TPreferencesFrm Width = 292 Height = 21 PasswordChar = '*' - TabOrder = 4 + TabOrder = 5 end object ProxyScriptURLEdt: TEdit Left = 108 Top = 161 Width = 292 Height = 21 - TabOrder = 5 + TabOrder = 6 end object ProxyByPassListEdt: TEdit Left = 108 Top = 188 Width = 292 Height = 21 - TabOrder = 6 + TabOrder = 7 + end + object ProxySchemeCb: TComboBox + Left = 108 + Top = 53 + Width = 62 + Height = 21 + Style = csDropDownList + ItemIndex = 0 + TabOrder = 1 + Text = 'HTTP' + Items.Strings = ( + 'HTTP' + 'SOCKS4' + 'SOCKS5') end end object GroupBox2: TGroupBox diff --git a/demos/MiniBrowser/uPreferences.pas b/demos/MiniBrowser/uPreferences.pas index 4d99dcf5..c6a63904 100644 --- a/demos/MiniBrowser/uPreferences.pas +++ b/demos/MiniBrowser/uPreferences.pas @@ -74,6 +74,7 @@ type HeaderNameLbl: TLabel; HeaderValueEdt: TEdit; HeaderValueLbl: TLabel; + ProxySchemeCb: TComboBox; private { Private declarations } public diff --git a/source/uCEFApplication.pas b/source/uCEFApplication.pas index 74f887ec..07a35c21 100644 --- a/source/uCEFApplication.pas +++ b/source/uCEFApplication.pas @@ -57,7 +57,7 @@ uses const CEF_SUPPORTED_VERSION_MAJOR = 3; CEF_SUPPORTED_VERSION_MINOR = 3239; - CEF_SUPPORTED_VERSION_RELEASE = 1710; + CEF_SUPPORTED_VERSION_RELEASE = 1716; CEF_SUPPORTED_VERSION_BUILD = 0; CEF_CHROMEELF_VERSION_MAJOR = 63;