mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-04-17 06:57:13 +02:00
Add files via upload
This commit is contained in:
parent
b0b39f2e9d
commit
993d07c00f
82
uCEFCallback.pas
Normal file
82
uCEFCallback.pas
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** CEF4Delphi *******************************
|
||||||
|
// ************************************************************************
|
||||||
|
//
|
||||||
|
// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based
|
||||||
|
// browser in Delphi applications.
|
||||||
|
//
|
||||||
|
// The original license of DCEF3 still applies to CEF4Delphi.
|
||||||
|
//
|
||||||
|
// For more information about CEF4Delphi visit :
|
||||||
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||||
|
//
|
||||||
|
// Copyright © 2017 Salvador Díaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
unit uCEFCallback;
|
||||||
|
|
||||||
|
{$IFNDEF CPUX64}
|
||||||
|
{$ALIGN ON}
|
||||||
|
{$MINENUMSIZE 4}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
uCEFBase, uCEFInterfaces, uCEFTypes;
|
||||||
|
|
||||||
|
type
|
||||||
|
TCefCallbackRef = class(TCefBaseRef, ICefCallback)
|
||||||
|
protected
|
||||||
|
procedure Cont;
|
||||||
|
procedure Cancel;
|
||||||
|
|
||||||
|
public
|
||||||
|
class function UnWrap(data: Pointer): ICefCallback;
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
uCEFMiscFunctions, uCEFLibFunctions;
|
||||||
|
|
||||||
|
procedure TCefCallbackRef.Cancel;
|
||||||
|
begin
|
||||||
|
PCefCallback(FData)^.cancel(PCefCallback(FData));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCefCallbackRef.Cont;
|
||||||
|
begin
|
||||||
|
PCefCallback(FData)^.cont(PCefCallback(FData));
|
||||||
|
end;
|
||||||
|
|
||||||
|
class function TCefCallbackRef.UnWrap(data: Pointer): ICefCallback;
|
||||||
|
begin
|
||||||
|
if data <> nil then
|
||||||
|
Result := Create(data) as ICefCallback else
|
||||||
|
Result := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
2852
uCEFChromium.pas
Normal file
2852
uCEFChromium.pas
Normal file
File diff suppressed because it is too large
Load Diff
124
uCEFChromiumEvents.pas
Normal file
124
uCEFChromiumEvents.pas
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** CEF4Delphi *******************************
|
||||||
|
// ************************************************************************
|
||||||
|
//
|
||||||
|
// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based
|
||||||
|
// browser in Delphi applications.
|
||||||
|
//
|
||||||
|
// The original license of DCEF3 still applies to CEF4Delphi.
|
||||||
|
//
|
||||||
|
// For more information about CEF4Delphi visit :
|
||||||
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||||
|
//
|
||||||
|
// Copyright © 2017 Salvador Díaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
unit uCEFChromiumEvents;
|
||||||
|
|
||||||
|
{$IFNDEF CPUX64}
|
||||||
|
{$ALIGN ON}
|
||||||
|
{$MINENUMSIZE 4}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
System.Classes,
|
||||||
|
uCEFTypes, uCEFInterfaces;
|
||||||
|
|
||||||
|
type
|
||||||
|
TOnTextResultAvailableEvent = procedure(Sender: TObject; const aText : string) of object;
|
||||||
|
TOnPdfPrintFinishedEvent = procedure(Sender: TObject; aResultOK : boolean) of object;
|
||||||
|
TOnCookiesDeletedEvent = procedure(Sender: TObject; numDeleted : integer) of object;
|
||||||
|
TOnDocumentAvailableEvent = procedure(Sender: TObject; const aDocument : ICefDomDocument) of object;
|
||||||
|
TOnProcessMessageReceived = procedure(Sender: TObject; const browser: ICefBrowser; sourceProcess: TCefProcessId; const message: ICefProcessMessage; out Result: Boolean) of object;
|
||||||
|
TOnLoadingStateChange = procedure(Sender: TObject; const browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean) of object;
|
||||||
|
TOnLoadStart = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; transitionType: TCefTransitionType) of object;
|
||||||
|
TOnLoadEnd = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer) of object;
|
||||||
|
TOnLoadError = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; errorCode: Integer; const errorText, failedUrl: ustring) of object;
|
||||||
|
TOnTakeFocus = procedure(Sender: TObject; const browser: ICefBrowser; next: Boolean) of object;
|
||||||
|
TOnSetFocus = procedure(Sender: TObject; const browser: ICefBrowser; source: TCefFocusSource; out Result: Boolean) of object;
|
||||||
|
TOnGotFocus = procedure(Sender: TObject; const browser: ICefBrowser) of object;
|
||||||
|
TOnBeforeContextMenu = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; const model: ICefMenuModel) of object;
|
||||||
|
TOnContextMenuCommand = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; commandId: Integer; eventFlags: TCefEventFlags; out Result: Boolean) of object;
|
||||||
|
TOnContextMenuDismissed = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame) of object;
|
||||||
|
TOnPreKeyEvent = procedure(Sender: TObject; const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle; out isKeyboardShortcut: Boolean; out Result: Boolean) of object;
|
||||||
|
TOnKeyEvent = procedure(Sender: TObject; const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle; out Result: Boolean) of object;
|
||||||
|
TOnAddressChange = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const url: ustring) of object;
|
||||||
|
TOnTitleChange = procedure(Sender: TObject; const browser: ICefBrowser; const title: ustring) of object;
|
||||||
|
TOnFavIconUrlChange = procedure(Sender: TObject; const browser: ICefBrowser; const iconUrls: TStrings) of object;
|
||||||
|
TOnFullScreenModeChange = procedure(Sender: TObject; const browser: ICefBrowser; fullscreen: Boolean) of object;
|
||||||
|
TOnTooltip = procedure(Sender: TObject; const browser: ICefBrowser; var text: ustring; out Result: Boolean) of object;
|
||||||
|
TOnStatusMessage = procedure(Sender: TObject; const browser: ICefBrowser; const value: ustring) of object;
|
||||||
|
TOnConsoleMessage = procedure(Sender: TObject; const browser: ICefBrowser; const message, source: ustring; line: Integer; out Result: Boolean) of object;
|
||||||
|
TOnBeforeDownload = procedure(Sender: TObject; const browser: ICefBrowser; const downloadItem: ICefDownloadItem; const suggestedName: ustring; const callback: ICefBeforeDownloadCallback) of object;
|
||||||
|
TOnDownloadUpdated = procedure(Sender: TObject; const browser: ICefBrowser; const downloadItem: ICefDownloadItem; const callback: ICefDownloadItemCallback) of object;
|
||||||
|
TOnRequestGeolocationPermission = procedure(Sender: TObject; const browser: ICefBrowser; const requestingUrl: ustring; requestId: Integer; const callback: ICefGeolocationCallback; out Result: Boolean) of object;
|
||||||
|
TOnCancelGeolocationPermission = procedure(Sender: TObject; const browser: ICefBrowser; requestId: Integer) of object;
|
||||||
|
TOnJsdialog = procedure(Sender: TObject; const browser: ICefBrowser; const originUrl: ustring; dialogType: TCefJsDialogType; const messageText, defaultPromptText: ustring; const callback: ICefJsDialogCallback; out suppressMessage: Boolean; out Result: Boolean) of object;
|
||||||
|
TOnBeforeUnloadDialog = procedure(Sender: TObject; const browser: ICefBrowser; const messageText: ustring; isReload: Boolean; const callback: ICefJsDialogCallback; out Result: Boolean) of object;
|
||||||
|
TOnResetDialogState = procedure(Sender: TObject; const browser: ICefBrowser) of object;
|
||||||
|
TOnDialogClosed = procedure(Sender: TObject; const browser: ICefBrowser) of object;
|
||||||
|
TOnBeforePopup = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; var popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var noJavascriptAccess: Boolean; out Result: Boolean) of object;
|
||||||
|
TOnAfterCreated = procedure(Sender: TObject; const browser: ICefBrowser) of object;
|
||||||
|
TOnBeforeClose = procedure(Sender: TObject; const browser: ICefBrowser) of object;
|
||||||
|
TOnClose = procedure(Sender: TObject; const browser: ICefBrowser; out Result: Boolean) of object;
|
||||||
|
TOnBeforeBrowse = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; isRedirect: Boolean; out Result: Boolean) of object;
|
||||||
|
TOnOpenUrlFromTab = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; out Result: Boolean) of Object;
|
||||||
|
TOnBeforeResourceLoad = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; const callback: ICefRequestCallback; out Result: TCefReturnValue) of object;
|
||||||
|
TOnGetResourceHandler = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; out Result: ICefResourceHandler) of object;
|
||||||
|
TOnResourceRedirect = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; const response: ICefResponse; var newUrl: ustring) of object;
|
||||||
|
TOnResourceResponse = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; const response: ICefResponse; out Result: Boolean) of Object;
|
||||||
|
TOnGetResourceResponseFilter = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; const response: ICefResponse; out Result: ICefResponseFilter) of object;
|
||||||
|
TOnResourceLoadComplete = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; const response: ICefResponse; status: TCefUrlRequestStatus; receivedContentLength: Int64) of object;
|
||||||
|
TOnGetAuthCredentials = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; isProxy: Boolean; const host: ustring; port: Integer; const realm, scheme: ustring; const callback: ICefAuthCallback; out Result: Boolean) of object;
|
||||||
|
TOnQuotaRequest = procedure(Sender: TObject; const browser: ICefBrowser; const originUrl: ustring; newSize: Int64; const callback: ICefRequestCallback; out Result: Boolean) of object;
|
||||||
|
TOnProtocolExecution = procedure(Sender: TObject; const browser: ICefBrowser; const url: ustring; out allowOsExecution: Boolean) of object;
|
||||||
|
TOnCertificateError = procedure(Sender: TObject; const browser: ICefBrowser; certError: TCefErrorcode; const requestUrl: ustring; const sslInfo: ICefSslInfo; const callback: ICefRequestCallback; out Result: Boolean) of Object;
|
||||||
|
TOnSelectClientCertificate = procedure(Sender: TObject; const browser: ICefBrowser; isProxy: boolean; const host: ustring; port: integer; certificatesCount: NativeUInt; const certificates: TCefX509CertificateArray; const callback: ICefSelectClientCertificateCallback; var aResult : boolean) of object;
|
||||||
|
TOnPluginCrashed = procedure(Sender: TObject; const browser: ICefBrowser; const pluginPath: ustring) of object;
|
||||||
|
TOnRenderViewReady = procedure(Sender: Tobject; const browser: ICefBrowser) of Object;
|
||||||
|
TOnRenderProcessTerminated = procedure(Sender: TObject; const browser: ICefBrowser; status: TCefTerminationStatus) of object;
|
||||||
|
TOnFileDialog = procedure(Sender: TObject; const browser: ICefBrowser; mode: TCefFileDialogMode; const title, defaultFilePath: ustring; acceptFilters: TStrings; selectedAcceptFilter: Integer; const callback: ICefFileDialogCallback; out Result: Boolean) of Object;
|
||||||
|
TOnGetRootScreenRect = procedure(Sender: TObject; const browser: ICefBrowser; rect: PCefRect; out Result: Boolean) of Object;
|
||||||
|
TOnGetViewRect = procedure(Sender: TObject; const browser: ICefBrowser; rect: PCefRect; out Result: Boolean) of Object;
|
||||||
|
TOnGetScreenPoint = procedure(Sender: TObject; const browser: ICefBrowser; viewX, viewY: Integer; screenX, screenY: PInteger; out Result: Boolean) of Object;
|
||||||
|
TOnGetScreenInfo = procedure(Sender: TObject; const browser: ICefBrowser; screenInfo: PCefScreenInfo; Result: Boolean) of Object;
|
||||||
|
TOnPopupShow = procedure(Sender: TObject; const browser: ICefBrowser; show: Boolean) of Object;
|
||||||
|
TOnPopupSize = procedure(Sender: TObject; const browser: ICefBrowser; const rect: PCefRect) of Object;
|
||||||
|
TOnPaint = procedure(Sender: TObject; const browser: ICefBrowser; kind: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; const buffer: Pointer; width, height: Integer) of Object;
|
||||||
|
TOnCursorChange = procedure(Sender: TObject; const browser: ICefBrowser; cursor: TCefCursorHandle; cursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo) of Object;
|
||||||
|
TOnStartDragging = procedure(Sender: TObject; const browser: ICefBrowser; const dragData: ICefDragData; allowedOps: TCefDragOperations; x, y: Integer; out Result: Boolean) of Object;
|
||||||
|
TOnUpdateDragCursor = procedure(Sender: TObject; const browser: ICefBrowser; operation: TCefDragOperation) of Object;
|
||||||
|
TOnScrollOffsetChanged = procedure(Sender: TObject; const browser: ICefBrowser; x, y: Double) of Object;
|
||||||
|
TOnIMECompositionRangeChanged = procedure(Sender: TObject; const browser: ICefBrowser; const selected_range: PCefRange; character_boundsCount: NativeUInt; const character_bounds: PCefRect) of Object;
|
||||||
|
TOnDragEnter = procedure(Sender: TObject; const browser: ICefBrowser; const dragData: ICefDragData; mask: TCefDragOperations; out Result: Boolean) of Object;
|
||||||
|
TOnDraggableRegionsChanged = procedure(Sender: TObject; const browser: ICefBrowser; regionsCount: NativeUInt; regions: PCefDraggableRegionArray)of Object;
|
||||||
|
TOnFindResult = procedure(Sender: TObject; const browser: ICefBrowser; identifier, count: Integer; const selectionRect: PCefRect; activeMatchOrdinal: Integer; finalUpdate: Boolean) of Object;
|
||||||
|
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
end.
|
100
uCEFChromiumFontOptions.pas
Normal file
100
uCEFChromiumFontOptions.pas
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** CEF4Delphi *******************************
|
||||||
|
// ************************************************************************
|
||||||
|
//
|
||||||
|
// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based
|
||||||
|
// browser in Delphi applications.
|
||||||
|
//
|
||||||
|
// The original license of DCEF3 still applies to CEF4Delphi.
|
||||||
|
//
|
||||||
|
// For more information about CEF4Delphi visit :
|
||||||
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||||
|
//
|
||||||
|
// Copyright © 2017 Salvador Díaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
unit uCEFChromiumFontOptions;
|
||||||
|
|
||||||
|
{$IFNDEF CPUX64}
|
||||||
|
{$ALIGN ON}
|
||||||
|
{$MINENUMSIZE 4}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
System.Classes,
|
||||||
|
uCEFTypes;
|
||||||
|
|
||||||
|
type
|
||||||
|
TChromiumFontOptions = class(TPersistent)
|
||||||
|
protected
|
||||||
|
FStandardFontFamily : ustring;
|
||||||
|
FCursiveFontFamily : ustring;
|
||||||
|
FSansSerifFontFamily : ustring;
|
||||||
|
FMinimumLogicalFontSize : Integer;
|
||||||
|
FFantasyFontFamily : ustring;
|
||||||
|
FSerifFontFamily : ustring;
|
||||||
|
FDefaultFixedFontSize : Integer;
|
||||||
|
FDefaultFontSize : Integer;
|
||||||
|
FRemoteFontsDisabled : TCefState;
|
||||||
|
FFixedFontFamily : ustring;
|
||||||
|
FMinimumFontSize : Integer;
|
||||||
|
|
||||||
|
public
|
||||||
|
constructor Create; virtual;
|
||||||
|
|
||||||
|
published
|
||||||
|
property StandardFontFamily : ustring read FStandardFontFamily write FStandardFontFamily;
|
||||||
|
property FixedFontFamily : ustring read FFixedFontFamily write FFixedFontFamily;
|
||||||
|
property SerifFontFamily : ustring read FSerifFontFamily write FSerifFontFamily;
|
||||||
|
property SansSerifFontFamily : ustring read FSansSerifFontFamily write FSansSerifFontFamily;
|
||||||
|
property CursiveFontFamily : ustring read FCursiveFontFamily write FCursiveFontFamily;
|
||||||
|
property FantasyFontFamily : ustring read FFantasyFontFamily write FFantasyFontFamily;
|
||||||
|
property DefaultFontSize : Integer read FDefaultFontSize write FDefaultFontSize default 0;
|
||||||
|
property DefaultFixedFontSize : Integer read FDefaultFixedFontSize write FDefaultFixedFontSize default 0;
|
||||||
|
property MinimumFontSize : Integer read FMinimumFontSize write FMinimumFontSize default 0;
|
||||||
|
property MinimumLogicalFontSize : Integer read FMinimumLogicalFontSize write FMinimumLogicalFontSize default 0;
|
||||||
|
property RemoteFonts : TCefState read FRemoteFontsDisabled write FRemoteFontsDisabled default STATE_DEFAULT;
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
constructor TChromiumFontOptions.Create;
|
||||||
|
begin
|
||||||
|
FStandardFontFamily := '';
|
||||||
|
FCursiveFontFamily := '';
|
||||||
|
FSansSerifFontFamily := '';
|
||||||
|
FMinimumLogicalFontSize := 0;
|
||||||
|
FFantasyFontFamily := '';
|
||||||
|
FSerifFontFamily := '';
|
||||||
|
FDefaultFixedFontSize := 0;
|
||||||
|
FDefaultFontSize := 0;
|
||||||
|
FRemoteFontsDisabled := STATE_DEFAULT;
|
||||||
|
FFixedFontFamily := '';
|
||||||
|
FMinimumFontSize := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
129
uCEFChromiumOptions.pas
Normal file
129
uCEFChromiumOptions.pas
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** CEF4Delphi *******************************
|
||||||
|
// ************************************************************************
|
||||||
|
//
|
||||||
|
// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based
|
||||||
|
// browser in Delphi applications.
|
||||||
|
//
|
||||||
|
// The original license of DCEF3 still applies to CEF4Delphi.
|
||||||
|
//
|
||||||
|
// For more information about CEF4Delphi visit :
|
||||||
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||||
|
//
|
||||||
|
// Copyright © 2017 Salvador Díaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
unit uCEFChromiumOptions;
|
||||||
|
|
||||||
|
{$IFNDEF CPUX64}
|
||||||
|
{$ALIGN ON}
|
||||||
|
{$MINENUMSIZE 4}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
System.Classes,
|
||||||
|
uCEFTypes;
|
||||||
|
|
||||||
|
type
|
||||||
|
TChromiumOptions = class(TPersistent)
|
||||||
|
protected
|
||||||
|
FWindowlessFrameRate : Integer;
|
||||||
|
FJavascript : TCefState;
|
||||||
|
FJavascriptOpenWindows : TCefState;
|
||||||
|
FJavascriptCloseWindows : TCefState;
|
||||||
|
FJavascriptAccessClipboard : TCefState;
|
||||||
|
FJavascriptDomPaste : TCefState;
|
||||||
|
FCaretBrowsing : TCefState;
|
||||||
|
FPlugins : TCefState;
|
||||||
|
FUniversalAccessFromFileUrls : TCefState;
|
||||||
|
FFileAccessFromFileUrls : TCefState;
|
||||||
|
FWebSecurity : TCefState;
|
||||||
|
FImageLoading : TCefState;
|
||||||
|
FImageShrinkStandaloneToFit : TCefState;
|
||||||
|
FTextAreaResize : TCefState;
|
||||||
|
FTabToLinks : TCefState;
|
||||||
|
FLocalStorage : TCefState;
|
||||||
|
FDatabases : TCefState;
|
||||||
|
FApplicationCache : TCefState;
|
||||||
|
FWebgl : TCefState;
|
||||||
|
FBackgroundColor : TCefColor;
|
||||||
|
FAcceptLanguageList : ustring;
|
||||||
|
|
||||||
|
public
|
||||||
|
constructor Create; virtual;
|
||||||
|
|
||||||
|
published
|
||||||
|
property Javascript : TCefState read FJavascript write FJavascript default STATE_DEFAULT;
|
||||||
|
property JavascriptOpenWindows : TCefState read FJavascriptOpenWindows write FJavascriptOpenWindows default STATE_DEFAULT;
|
||||||
|
property JavascriptCloseWindows : TCefState read FJavascriptCloseWindows write FJavascriptCloseWindows default STATE_DEFAULT;
|
||||||
|
property JavascriptAccessClipboard : TCefState read FJavascriptAccessClipboard write FJavascriptAccessClipboard default STATE_DEFAULT;
|
||||||
|
property JavascriptDomPaste : TCefState read FJavascriptDomPaste write FJavascriptDomPaste default STATE_DEFAULT;
|
||||||
|
property CaretBrowsing : TCefState read FCaretBrowsing write FCaretBrowsing default STATE_DEFAULT;
|
||||||
|
property Plugins : TCefState read FPlugins write FPlugins default STATE_DEFAULT;
|
||||||
|
property UniversalAccessFromFileUrls : TCefState read FUniversalAccessFromFileUrls write FUniversalAccessFromFileUrls default STATE_DEFAULT;
|
||||||
|
property FileAccessFromFileUrls : TCefState read FFileAccessFromFileUrls write FFileAccessFromFileUrls default STATE_DEFAULT;
|
||||||
|
property WebSecurity : TCefState read FWebSecurity write FWebSecurity default STATE_DEFAULT;
|
||||||
|
property ImageLoading : TCefState read FImageLoading write FImageLoading default STATE_DEFAULT;
|
||||||
|
property ImageShrinkStandaloneToFit : TCefState read FImageShrinkStandaloneToFit write FImageShrinkStandaloneToFit default STATE_DEFAULT;
|
||||||
|
property TextAreaResize : TCefState read FTextAreaResize write FTextAreaResize default STATE_DEFAULT;
|
||||||
|
property TabToLinks : TCefState read FTabToLinks write FTabToLinks default STATE_DEFAULT;
|
||||||
|
property LocalStorage : TCefState read FLocalStorage write FLocalStorage default STATE_DEFAULT;
|
||||||
|
property Databases : TCefState read FDatabases write FDatabases default STATE_DEFAULT;
|
||||||
|
property ApplicationCache : TCefState read FApplicationCache write FApplicationCache default STATE_DEFAULT;
|
||||||
|
property Webgl : TCefState read FWebgl write FWebgl default STATE_DEFAULT;
|
||||||
|
property BackgroundColor : TCefColor read FBackgroundColor write FBackgroundColor default 0;
|
||||||
|
property AcceptLanguageList : ustring read FAcceptLanguageList write FAcceptLanguageList;
|
||||||
|
property WindowlessFrameRate : Integer read FWindowlessFrameRate write FWindowlessFrameRate default 30;
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
constructor TChromiumOptions.Create;
|
||||||
|
begin
|
||||||
|
FWindowlessFrameRate := 30;
|
||||||
|
FJavascript := STATE_DEFAULT;
|
||||||
|
FJavascriptOpenWindows := STATE_DEFAULT;
|
||||||
|
FJavascriptCloseWindows := STATE_DEFAULT;
|
||||||
|
FJavascriptAccessClipboard := STATE_DEFAULT;
|
||||||
|
FJavascriptDomPaste := STATE_DEFAULT;
|
||||||
|
FCaretBrowsing := STATE_DEFAULT;
|
||||||
|
FPlugins := STATE_DEFAULT;
|
||||||
|
FUniversalAccessFromFileUrls := STATE_DEFAULT;
|
||||||
|
FFileAccessFromFileUrls := STATE_DEFAULT;
|
||||||
|
FWebSecurity := STATE_DEFAULT;
|
||||||
|
FImageLoading := STATE_DEFAULT;
|
||||||
|
FImageShrinkStandaloneToFit := STATE_DEFAULT;
|
||||||
|
FTextAreaResize := STATE_DEFAULT;
|
||||||
|
FTabToLinks := STATE_DEFAULT;
|
||||||
|
FLocalStorage := STATE_DEFAULT;
|
||||||
|
FDatabases := STATE_DEFAULT;
|
||||||
|
FApplicationCache := STATE_DEFAULT;
|
||||||
|
FWebgl := STATE_DEFAULT;
|
||||||
|
FBackgroundColor := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
136
uCEFChromiumWindow.pas
Normal file
136
uCEFChromiumWindow.pas
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** CEF4Delphi *******************************
|
||||||
|
// ************************************************************************
|
||||||
|
//
|
||||||
|
// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based
|
||||||
|
// browser in Delphi applications.
|
||||||
|
//
|
||||||
|
// The original license of DCEF3 still applies to CEF4Delphi.
|
||||||
|
//
|
||||||
|
// For more information about CEF4Delphi visit :
|
||||||
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||||
|
//
|
||||||
|
// Copyright © 2017 Salvador Díaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
unit uCEFChromiumWindow;
|
||||||
|
|
||||||
|
{$IFNDEF CPUX64}
|
||||||
|
{$ALIGN ON}
|
||||||
|
{$MINENUMSIZE 4}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
WinApi.Windows, System.Classes, WinApi.Messages,
|
||||||
|
uCEFWindowParent, uCEFChromium, uCEFInterfaces, uCEFConstants;
|
||||||
|
|
||||||
|
type
|
||||||
|
TChromiumWindow = class(TCEFWindowParent)
|
||||||
|
protected
|
||||||
|
FChromium : TChromium;
|
||||||
|
FOnClose : TNotifyEvent;
|
||||||
|
|
||||||
|
function GetChildWindowHandle : THandle; override;
|
||||||
|
|
||||||
|
procedure OnCloseMsg(var aMessage : TMessage); message CEF_DOONCLOSE;
|
||||||
|
|
||||||
|
procedure WebBrowser_OnClose(Sender: TObject; const browser: ICefBrowser; out Result: Boolean);
|
||||||
|
|
||||||
|
public
|
||||||
|
constructor Create(AOwner: TComponent); override;
|
||||||
|
procedure AfterConstruction; override;
|
||||||
|
procedure CreateBrowser;
|
||||||
|
procedure CloseBrowser(aForceClose : boolean);
|
||||||
|
procedure LoadURL(const aURL : string);
|
||||||
|
|
||||||
|
property ChromiumBrowser : TChromium read FChromium;
|
||||||
|
|
||||||
|
published
|
||||||
|
property OnClose : TNotifyEvent read FOnClose write FOnClose;
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
System.SysUtils;
|
||||||
|
|
||||||
|
constructor TChromiumWindow.Create(AOwner: TComponent);
|
||||||
|
begin
|
||||||
|
inherited Create(AOwner);
|
||||||
|
|
||||||
|
FChromium := nil;
|
||||||
|
FOnClose := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TChromiumWindow.AfterConstruction;
|
||||||
|
begin
|
||||||
|
inherited AfterConstruction;
|
||||||
|
|
||||||
|
if not(csDesigning in ComponentState) then
|
||||||
|
begin
|
||||||
|
FChromium := TChromium.Create(self);
|
||||||
|
FChromium.OnClose := WebBrowser_OnClose;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TChromiumWindow.GetChildWindowHandle : THandle;
|
||||||
|
begin
|
||||||
|
if (FChromium <> nil) then
|
||||||
|
Result := FChromium.WindowHandle
|
||||||
|
else
|
||||||
|
Result := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TChromiumWindow.WebBrowser_OnClose(Sender: TObject; const browser: ICefBrowser; out Result: Boolean);
|
||||||
|
begin
|
||||||
|
PostMessage(self.Handle, CEF_DOONCLOSE, 0, 0);
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TChromiumWindow.OnCloseMsg(var aMessage : TMessage);
|
||||||
|
begin
|
||||||
|
if assigned(FOnClose) then FOnClose(self);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TChromiumWindow.CreateBrowser;
|
||||||
|
begin
|
||||||
|
if not(csDesigning in ComponentState) and (FChromium <> nil) then
|
||||||
|
FChromium.CreateBrowser(self, '');
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TChromiumWindow.CloseBrowser(aForceClose : boolean);
|
||||||
|
begin
|
||||||
|
if (FChromium <> nil) then FChromium.CloseBrowser(aForceClose);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TChromiumWindow.LoadURL(const aURL : string);
|
||||||
|
begin
|
||||||
|
if not(csDesigning in ComponentState) and (FChromium <> nil) then
|
||||||
|
FChromium.LoadURL(aURL);
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
Loading…
x
Reference in New Issue
Block a user