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