mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-01-03 10:15:38 +02:00
Added TChromium.ProxyScheme property
This commit is contained in:
parent
2bcd2b1da0
commit
227dafc55c
@ -688,34 +688,15 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMiniBrowserFrm.Preferences1Click(Sender: TObject);
|
procedure TMiniBrowserFrm.Preferences1Click(Sender: TObject);
|
||||||
var
|
|
||||||
TempScheme, TempServer : string;
|
|
||||||
i : integer;
|
|
||||||
begin
|
begin
|
||||||
i := pos('://', Chromium1.ProxyServer);
|
case Chromium1.ProxyScheme of
|
||||||
|
psSOCKS4 : PreferencesFrm.ProxySchemeCb.ItemIndex := 1;
|
||||||
if (i <= 0) then
|
psSOCKS5 : PreferencesFrm.ProxySchemeCb.ItemIndex := 2;
|
||||||
begin
|
else PreferencesFrm.ProxySchemeCb.ItemIndex := 0;
|
||||||
PreferencesFrm.ProxySchemeCb.ItemIndex := 0;
|
end;
|
||||||
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.ProxyTypeCbx.ItemIndex := Chromium1.ProxyType;
|
||||||
PreferencesFrm.ProxyServerEdt.Text := TempServer;
|
PreferencesFrm.ProxyServerEdt.Text := Chromium1.ProxyServer;
|
||||||
PreferencesFrm.ProxyPortEdt.Text := inttostr(Chromium1.ProxyPort);
|
PreferencesFrm.ProxyPortEdt.Text := inttostr(Chromium1.ProxyPort);
|
||||||
PreferencesFrm.ProxyUsernameEdt.Text := Chromium1.ProxyUsername;
|
PreferencesFrm.ProxyUsernameEdt.Text := Chromium1.ProxyUsername;
|
||||||
PreferencesFrm.ProxyPasswordEdt.Text := Chromium1.ProxyPassword;
|
PreferencesFrm.ProxyPasswordEdt.Text := Chromium1.ProxyPassword;
|
||||||
@ -727,6 +708,7 @@ begin
|
|||||||
if (PreferencesFrm.ShowModal = mrOk) then
|
if (PreferencesFrm.ShowModal = mrOk) then
|
||||||
begin
|
begin
|
||||||
Chromium1.ProxyType := PreferencesFrm.ProxyTypeCbx.ItemIndex;
|
Chromium1.ProxyType := PreferencesFrm.ProxyTypeCbx.ItemIndex;
|
||||||
|
Chromium1.ProxyServer := PreferencesFrm.ProxyServerEdt.Text;
|
||||||
Chromium1.ProxyPort := strtoint(PreferencesFrm.ProxyPortEdt.Text);
|
Chromium1.ProxyPort := strtoint(PreferencesFrm.ProxyPortEdt.Text);
|
||||||
Chromium1.ProxyUsername := PreferencesFrm.ProxyUsernameEdt.Text;
|
Chromium1.ProxyUsername := PreferencesFrm.ProxyUsernameEdt.Text;
|
||||||
Chromium1.ProxyPassword := PreferencesFrm.ProxyPasswordEdt.Text;
|
Chromium1.ProxyPassword := PreferencesFrm.ProxyPasswordEdt.Text;
|
||||||
@ -736,9 +718,9 @@ begin
|
|||||||
Chromium1.CustomHeaderValue := PreferencesFrm.HeaderValueEdt.Text;
|
Chromium1.CustomHeaderValue := PreferencesFrm.HeaderValueEdt.Text;
|
||||||
|
|
||||||
case PreferencesFrm.ProxySchemeCb.ItemIndex of
|
case PreferencesFrm.ProxySchemeCb.ItemIndex of
|
||||||
1 : Chromium1.ProxyServer := 'socks4://' + PreferencesFrm.ProxyServerEdt.Text;
|
1 : Chromium1.ProxyScheme := psSOCKS4;
|
||||||
2 : Chromium1.ProxyServer := 'socks5://' + PreferencesFrm.ProxyServerEdt.Text;
|
2 : Chromium1.ProxyScheme := psSOCKS5;
|
||||||
else Chromium1.ProxyServer := PreferencesFrm.ProxyServerEdt.Text;
|
else Chromium1.ProxyScheme := psHTTP;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Chromium1.UpdatePreferences;
|
Chromium1.UpdatePreferences;
|
||||||
|
@ -108,9 +108,9 @@ object PreferencesFrm: TPreferencesFrm
|
|||||||
'PAC script')
|
'PAC script')
|
||||||
end
|
end
|
||||||
object ProxyServerEdt: TEdit
|
object ProxyServerEdt: TEdit
|
||||||
Left = 176
|
Left = 184
|
||||||
Top = 53
|
Top = 53
|
||||||
Width = 224
|
Width = 216
|
||||||
Height = 21
|
Height = 21
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
end
|
end
|
||||||
@ -156,7 +156,7 @@ object PreferencesFrm: TPreferencesFrm
|
|||||||
object ProxySchemeCb: TComboBox
|
object ProxySchemeCb: TComboBox
|
||||||
Left = 108
|
Left = 108
|
||||||
Top = 53
|
Top = 53
|
||||||
Width = 62
|
Width = 70
|
||||||
Height = 21
|
Height = 21
|
||||||
Style = csDropDownList
|
Style = csDropDownList
|
||||||
ItemIndex = 0
|
ItemIndex = 0
|
||||||
|
@ -75,6 +75,7 @@ type
|
|||||||
FPDFPrintOptions : TPDFPrintOptions;
|
FPDFPrintOptions : TPDFPrintOptions;
|
||||||
FDefaultEncoding : ustring;
|
FDefaultEncoding : ustring;
|
||||||
FProxyType : integer;
|
FProxyType : integer;
|
||||||
|
FProxyScheme : TCefProxyScheme;
|
||||||
FProxyServer : string;
|
FProxyServer : string;
|
||||||
FProxyPort : integer;
|
FProxyPort : integer;
|
||||||
FProxyUsername : string;
|
FProxyUsername : string;
|
||||||
@ -244,6 +245,7 @@ type
|
|||||||
procedure SetCookiePrefs(aValue : integer);
|
procedure SetCookiePrefs(aValue : integer);
|
||||||
procedure SetImagesPrefs(aValue : integer);
|
procedure SetImagesPrefs(aValue : integer);
|
||||||
procedure SetProxyType(aValue : integer);
|
procedure SetProxyType(aValue : integer);
|
||||||
|
procedure SetProxyScheme(aValue : TCefProxyScheme);
|
||||||
procedure SetProxyServer(const aValue : string);
|
procedure SetProxyServer(const aValue : string);
|
||||||
procedure SetProxyPort(aValue : integer);
|
procedure SetProxyPort(aValue : integer);
|
||||||
procedure SetProxyUsername(const aValue : string);
|
procedure SetProxyUsername(const aValue : string);
|
||||||
@ -570,6 +572,7 @@ type
|
|||||||
property WebRTCNonproxiedUDP : TCefState read FWebRTCNonProxiedUDP write SetWebRTCNonProxiedUDP;
|
property WebRTCNonproxiedUDP : TCefState read FWebRTCNonProxiedUDP write SetWebRTCNonProxiedUDP;
|
||||||
|
|
||||||
property ProxyType : integer read FProxyType write SetProxyType;
|
property ProxyType : integer read FProxyType write SetProxyType;
|
||||||
|
property ProxyScheme : TCefProxyScheme read FProxyScheme write SetProxyScheme;
|
||||||
property ProxyServer : string read FProxyServer write SetProxyServer;
|
property ProxyServer : string read FProxyServer write SetProxyServer;
|
||||||
property ProxyPort : integer read FProxyPort write SetProxyPort;
|
property ProxyPort : integer read FProxyPort write SetProxyPort;
|
||||||
property ProxyUsername : string read FProxyUsername write SetProxyUsername;
|
property ProxyUsername : string read FProxyUsername write SetProxyUsername;
|
||||||
@ -736,6 +739,7 @@ begin
|
|||||||
FWebRTCNonProxiedUDP := STATE_DEFAULT;
|
FWebRTCNonProxiedUDP := STATE_DEFAULT;
|
||||||
|
|
||||||
FProxyType := CEF_PROXYTYPE_DIRECT;
|
FProxyType := CEF_PROXYTYPE_DIRECT;
|
||||||
|
FProxyScheme := psHTTP;
|
||||||
FProxyServer := '';
|
FProxyServer := '';
|
||||||
FProxyPort := 80;
|
FProxyPort := 80;
|
||||||
FProxyUsername := '';
|
FProxyUsername := '';
|
||||||
@ -1810,6 +1814,15 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TChromium.SetProxyScheme(aValue : TCefProxyScheme);
|
||||||
|
begin
|
||||||
|
if (FProxyScheme <> aValue) then
|
||||||
|
begin
|
||||||
|
FProxyScheme := aValue;
|
||||||
|
FUpdatePreferences := True;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TChromium.SetProxyServer(const aValue : string);
|
procedure TChromium.SetProxyServer(const aValue : string);
|
||||||
begin
|
begin
|
||||||
if (FProxyServer <> aValue) then
|
if (FProxyServer <> aValue) then
|
||||||
@ -2227,7 +2240,13 @@ begin
|
|||||||
begin
|
begin
|
||||||
TempValue.SetString('fixed_servers');
|
TempValue.SetString('fixed_servers');
|
||||||
TempDict.SetValue('mode', TempValue);
|
TempDict.SetValue('mode', TempValue);
|
||||||
TempDict.SetString('server', FProxyServer + ':' + inttostr(FProxyPort));
|
|
||||||
|
case FProxyScheme of
|
||||||
|
psSOCKS4 : TempDict.SetString('server', 'socks4://' + FProxyServer + ':' + inttostr(FProxyPort));
|
||||||
|
psSOCKS5 : TempDict.SetString('server', 'socks5://' + FProxyServer + ':' + inttostr(FProxyPort));
|
||||||
|
else TempDict.SetString('server', FProxyServer + ':' + inttostr(FProxyPort));
|
||||||
|
end;
|
||||||
|
|
||||||
if (length(FProxyByPassList) > 0) then TempDict.SetString('bypass_list', FProxyByPassList);
|
if (length(FProxyByPassList) > 0) then TempDict.SetString('bypass_list', FProxyByPassList);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -299,6 +299,8 @@ type
|
|||||||
asErrorInitializingLibrary,
|
asErrorInitializingLibrary,
|
||||||
asErrorExecutingProcess);
|
asErrorExecutingProcess);
|
||||||
|
|
||||||
|
TCefProxyScheme = (psHTTP, psSOCKS4, psSOCKS5);
|
||||||
|
|
||||||
TCefWebRTCHandlingPolicy = (
|
TCefWebRTCHandlingPolicy = (
|
||||||
hpDefault,
|
hpDefault,
|
||||||
hpDefaultPublicAndPrivateInterfaces,
|
hpDefaultPublicAndPrivateInterfaces,
|
||||||
|
Loading…
Reference in New Issue
Block a user