mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2026-06-13 16:05:40 +02:00
Update to CEF 135.0.17
Fixed issue #548 Removed custom JS dialogs code from SimpleOSRBrowser.
This commit is contained in:
@@ -120,7 +120,6 @@ object Form1: TForm1
|
||||
OnCanFocus = chrmosrCanFocus
|
||||
OnTooltip = chrmosrTooltip
|
||||
OnCursorChange = chrmosrCursorChange
|
||||
OnJsdialog = chrmosrJsdialog
|
||||
OnBeforePopup = chrmosrBeforePopup
|
||||
OnAfterCreated = chrmosrAfterCreated
|
||||
OnBeforeClose = chrmosrBeforeClose
|
||||
|
||||
@@ -77,7 +77,6 @@ type
|
||||
procedure chrmosrBeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure chrmosrIMECompositionRangeChanged(Sender: TObject; const browser: ICefBrowser; const selected_range: PCefRange; character_boundsCount: NativeUInt; const character_bounds: PCefRect);
|
||||
procedure chrmosrCanFocus(Sender: TObject);
|
||||
procedure chrmosrJsdialog(Sender: TObject; const browser: ICefBrowser; const originUrl: ustring; dialogType: TCefJsDialogType; const messageText, defaultPromptText: ustring; const callback: ICefJsDialogCallback; out suppressMessage, Result: Boolean);
|
||||
|
||||
procedure SnapshotBtnClick(Sender: TObject);
|
||||
procedure SnapshotBtnEnter(Sender: TObject);
|
||||
@@ -104,14 +103,6 @@ type
|
||||
FLastClickPoint : TPoint;
|
||||
FLastClickButton : TMouseButton;
|
||||
|
||||
FJSDialogInfoCS : TCriticalSection;
|
||||
FOriginUrl : ustring;
|
||||
FMessageText : ustring;
|
||||
FDefaultPromptText : ustring;
|
||||
FPendingDlg : boolean;
|
||||
FDialogType : TCefJsDialogType;
|
||||
FCallback : ICefJsDialogCallback;
|
||||
|
||||
function getModifiers(Shift: TShiftState): TCefEventFlags;
|
||||
function GetButton(Button: TMouseButton): TCefMouseButtonType;
|
||||
procedure DoResize;
|
||||
@@ -134,7 +125,6 @@ type
|
||||
procedure PendingResizeMsg(var aMessage : TMessage); message CEF_PENDINGRESIZE;
|
||||
procedure RangeChangedMsg(var aMessage : TMessage); message CEF_IMERANGECHANGED;
|
||||
procedure FocusEnabledMsg(var aMessage : TMessage); message CEF_FOCUSENABLED;
|
||||
procedure ShowJSDialogMsg(var aMessage: TMessage); message CEFBROWSER_SHOWJSDIALOG;
|
||||
|
||||
public
|
||||
{ Public declarations }
|
||||
@@ -736,14 +726,6 @@ procedure TForm1.FormCreate(Sender: TObject);
|
||||
var
|
||||
TempMajorVer, TempMinorVer : DWORD;
|
||||
begin
|
||||
FJSDialogInfoCS := TCriticalSection.Create;
|
||||
FOriginUrl := '';
|
||||
FMessageText := '';
|
||||
FDefaultPromptText := '';
|
||||
FPendingDlg := False;
|
||||
FDialogType := JSDIALOGTYPE_ALERT;
|
||||
FCallback := nil;
|
||||
|
||||
FPopUpBitmap := nil;
|
||||
FPopUpRect := rect(0, 0, 0, 0);
|
||||
FShowPopUp := False;
|
||||
@@ -772,14 +754,11 @@ end;
|
||||
|
||||
procedure TForm1.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
FCallback := nil;
|
||||
|
||||
chrmosr.ShutdownDragAndDrop;
|
||||
|
||||
if (FPopUpBitmap <> nil) then FreeAndNil(FPopUpBitmap);
|
||||
if (FResizeCS <> nil) then FreeAndNil(FResizeCS);
|
||||
if (FIMECS <> nil) then FreeAndNil(FIMECS);
|
||||
if (FJSDialogInfoCS <> nil) then FreeAndNil(FJSDialogInfoCS);
|
||||
|
||||
if (FDeviceBounds <> nil) then
|
||||
begin
|
||||
@@ -1194,36 +1173,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.ShowJSDialogMsg(var aMessage : TMessage);
|
||||
var
|
||||
TempCaption : string;
|
||||
begin
|
||||
// Here we show the dialog and reset the information.
|
||||
// showmessage, MessageDlg and InputBox should be replaced by nicer custom forms with the same functionality.
|
||||
|
||||
FJSDialogInfoCS.Acquire;
|
||||
|
||||
if FPendingDlg then
|
||||
begin
|
||||
TempCaption := 'JavaScript message from : ' + FOriginUrl;
|
||||
|
||||
case FDialogType of
|
||||
JSDIALOGTYPE_ALERT : showmessage(TempCaption + CRLF + CRLF + FMessageText);
|
||||
JSDIALOGTYPE_CONFIRM : FCallback.cont((MessageDlg(TempCaption + CRLF + CRLF + FMessageText, mtConfirmation, [mbYes, mbNo], 0, mbYes) = mrYes), '');
|
||||
JSDIALOGTYPE_PROMPT : FCallback.cont(True, InputBox(TempCaption, FMessageText, FDefaultPromptText));
|
||||
end;
|
||||
end;
|
||||
|
||||
FOriginUrl := '';
|
||||
FMessageText := '';
|
||||
FDefaultPromptText := '';
|
||||
FPendingDlg := False;
|
||||
FDialogType := JSDIALOGTYPE_ALERT;
|
||||
FCallback := nil;
|
||||
|
||||
FJSDialogInfoCS.Release;
|
||||
end;
|
||||
|
||||
procedure TForm1.FocusEnabledMsg(var aMessage : TMessage);
|
||||
begin
|
||||
if Panel1.Focused then
|
||||
@@ -1363,36 +1312,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.chrmosrJsdialog(Sender: TObject; const browser: ICefBrowser;
|
||||
const originUrl: ustring; dialogType: TCefJsDialogType; const messageText,
|
||||
defaultPromptText: ustring; const callback: ICefJsDialogCallback;
|
||||
out suppressMessage, Result: Boolean);
|
||||
begin
|
||||
// In this event we must store the dialog information and post a message to the main form to show the dialog
|
||||
FJSDialogInfoCS.Acquire;
|
||||
|
||||
if FPendingDlg then
|
||||
begin
|
||||
Result := False;
|
||||
suppressMessage := True;
|
||||
end
|
||||
else
|
||||
begin
|
||||
FOriginUrl := originUrl;
|
||||
FMessageText := messageText;
|
||||
FDefaultPromptText := defaultPromptText;
|
||||
FDialogType := dialogType;
|
||||
FCallback := callback;
|
||||
FPendingDlg := True;
|
||||
Result := True;
|
||||
suppressMessage := False;
|
||||
|
||||
PostMessage(Handle, CEFBROWSER_SHOWJSDIALOG, 0, 0);
|
||||
end;
|
||||
|
||||
FJSDialogInfoCS.Release;
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1IMECancelComposition(Sender: TObject);
|
||||
begin
|
||||
chrmosr.IMECancelComposition;
|
||||
|
||||
Reference in New Issue
Block a user