From 5392eb462d3d6ea4e64c85e874e1a03eb9493695 Mon Sep 17 00:00:00 2001 From: "d.l.i.w" Date: Sun, 24 Aug 2014 00:52:29 +0200 Subject: [PATCH] update to CEF 3.1750 various fixes & cleanup --- Component/cef3lcl.pas | 17 ++-- Component/cef3osr.pas | 20 ++-- Examples/GT2Minimal/minimal.lpr | 4 +- Examples/JavaScript/handler.pas | 5 +- Examples/JavaScript/main.pas | 2 +- Examples/SubProcess/subprocess.lpr | 4 +- cef3api.pas | 147 ++++++++++++++++------------- cef3gui.pas | 2 - cef3intf.pas | 18 ++-- cef3lib.pas | 72 ++++++-------- cef3own.pas | 15 ++- cef3ref.pas | 51 +++++++--- cef3types.pas | 96 ++++++++++--------- 13 files changed, 251 insertions(+), 202 deletions(-) diff --git a/Component/cef3lcl.pas b/Component/cef3lcl.pas index 1ab26cf..6d2b5dd 100644 --- a/Component/cef3lcl.pas +++ b/Component/cef3lcl.pas @@ -143,9 +143,9 @@ TCustomChromium = class(TWinControl, IChromiumEvents) FOptions: TChromiumOptions; - FUserStyleSheetLocation: ustring; FDefaultEncoding: ustring; FFontOptions: TChromiumFontOptions; + FBackgroundColor: TCefColor; procedure GetSettings(var settings: TCefBrowserSettings); procedure CreateBrowser; @@ -323,8 +323,8 @@ TCustomChromium = class(TWinControl, IChromiumEvents) property DefaultUrl: ustring read FDefaultUrl write FDefaultUrl; property Options: TChromiumOptions read FOptions write FOptions; property FontOptions: TChromiumFontOptions read FFontOptions; + property BackgroundColor: TCefColor read FBackgroundColor write FBackgroundColor; property DefaultEncoding: ustring read FDefaultEncoding write FDefaultEncoding; - property UserStyleSheetLocation: ustring read FUserStyleSheetLocation write FUserStyleSheetLocation; property BrowserId: Integer read FBrowserId; property Browser: ICefBrowser read FBrowser; property Handler: ICefClient read FHandler; @@ -410,7 +410,7 @@ TChromium = class(TCustomChromium) property Options; property FontOptions; property DefaultEncoding; - property UserStyleSheetLocation; + property BackgroundColor; end; procedure Register; @@ -450,9 +450,9 @@ procedure Register; RegisterComponents('Chromium', [TChromium]); end; -{$IFNDEF CEF_MULTI_THREADED_MESSAGE_LOOP} class procedure TLCLClientHandler.OnTimer(Sender : TObject); begin + {$IFNDEF CEF_MULTI_THREADED_MESSAGE_LOOP} If Looping then Exit; If CefInstances > 0 then begin @@ -463,8 +463,8 @@ class procedure TLCLClientHandler.OnTimer(Sender : TObject); Looping := False; end; end; + {$ENDIF} end; -{$ENDIF} constructor TLCLClientHandler.Create(const crm : IChromiumEvents); begin @@ -518,9 +518,11 @@ procedure TLCLClientHandler.Cleanup; procedure TLCLClientHandler.StartTimer; begin + {$IFNDEF CEF_MULTI_THREADED_MESSAGE_LOOP} If not Assigned(Timer) then Exit; Timer.Enabled := true; + {$ENDIF} end; { TCustomChromium } @@ -540,7 +542,6 @@ procedure TCustomChromium.GetSettings(var settings : TCefBrowserSettings); settings.minimum_logical_font_size := FFontOptions.MinimumLogicalFontSize; settings.remote_fonts := FFontOptions.RemoteFonts; settings.default_encoding := CefString(FDefaultEncoding); - settings.user_style_sheet_location := CefString(FUserStyleSheetLocation); settings.javascript := FOptions.Javascript; settings.javascript_open_windows := FOptions.JavascriptOpenWindows; @@ -557,12 +558,12 @@ procedure TCustomChromium.GetSettings(var settings : TCefBrowserSettings); settings.image_shrink_standalone_to_fit := FOptions.ImageShrinkStandaloneToFit; settings.text_area_resize := FOptions.TextAreaResize; settings.tab_to_links := FOptions.TabToLinks; - settings.author_and_user_styles := FOptions.AuthorAndUserStyles; settings.local_storage := FOptions.LocalStorage; settings.databases := FOptions.Databases; settings.application_cache := FOptions.ApplicationCache; settings.webgl := FOptions.Webgl; settings.accelerated_compositing := FOptions.AcceleratedCompositing; + settings.background_color := FBackgroundColor; end; procedure TCustomChromium.CreateWnd; @@ -711,8 +712,8 @@ constructor TCustomChromium.Create(TheOwner : TComponent); FOptions := TChromiumOptions.Create; FFontOptions := TChromiumFontOptions.Create; + FBackgroundColor := CefColorSetARGB(255, 255, 255, 255); - FUserStyleSheetLocation := ''; FDefaultEncoding := ''; FBrowserId := 0; FBrowser := nil; diff --git a/Component/cef3osr.pas b/Component/cef3osr.pas index 304d3a6..51afb1f 100644 --- a/Component/cef3osr.pas +++ b/Component/cef3osr.pas @@ -23,6 +23,7 @@ Uses Classes, SysUtils, fpTimer, + {$IFDEF DEBUG}LCLProc,{$ENDIF} cef3types, cef3lib, cef3intf, cef3gui; Type @@ -115,9 +116,9 @@ TCustomChromiumOSR = class(TComponent, IChromiumEvents) FOnRenderProcessTerminated: TOnRenderProcessTerminated; FOptions: TChromiumOptions; - FUserStyleSheetLocation: ustring; FDefaultEncoding: ustring; FFontOptions: TChromiumFontOptions; + FBackgroundColor: TCefColor; procedure GetSettings(var settings: TCefBrowserSettings); procedure CreateBrowser; @@ -325,7 +326,7 @@ TCustomChromiumOSR = class(TComponent, IChromiumEvents) property Options: TChromiumOptions read FOptions write FOptions; property FontOptions: TChromiumFontOptions read FFontOptions; property DefaultEncoding: ustring read FDefaultEncoding write FDefaultEncoding; - property UserStyleSheetLocation: ustring read FUserStyleSheetLocation write FUserStyleSheetLocation; + property BackgroundColor: TCefColor read FBackgroundColor write FBackgroundColor; property BrowserId: Integer read FBrowserId; property Browser: ICefBrowser read FBrowser; public @@ -411,7 +412,7 @@ TChromiumOSR = class(TCustomChromiumOSR) property Options; property FontOptions; property DefaultEncoding; - property UserStyleSheetLocation; + property BackgroundColor; end; procedure Register; @@ -446,6 +447,7 @@ procedure Register; class procedure TOSRClientHandler.OnTimer(Sender : TObject); begin + {$IFNDEF CEF_MULTI_THREADED_MESSAGE_LOOP} If Looping then Exit; If CefInstances > 0 then begin @@ -456,6 +458,7 @@ class procedure TOSRClientHandler.OnTimer(Sender : TObject); Looping := False; end; end; + {$ENDIF} end; constructor TOSRClientHandler.Create(const crm : IChromiumEvents); @@ -510,9 +513,11 @@ procedure TOSRClientHandler.Cleanup; procedure TOSRClientHandler.StartTimer; begin + {$IFNDEF CEF_MULTI_THREADED_MESSAGE_LOOP} If not Assigned(Timer) then Exit; Timer.Enabled := True; + {$ENDIF} end; { TCustomChromiumOSR } @@ -532,7 +537,6 @@ procedure TCustomChromiumOSR.GetSettings(var settings : TCefBrowserSettings); settings.minimum_logical_font_size := FFontOptions.MinimumLogicalFontSize; settings.remote_fonts := FFontOptions.RemoteFonts; settings.default_encoding := CefString(FDefaultEncoding); - settings.user_style_sheet_location := CefString(FUserStyleSheetLocation); settings.javascript := FOptions.Javascript; settings.javascript_open_windows := FOptions.JavascriptOpenWindows; @@ -549,12 +553,12 @@ procedure TCustomChromiumOSR.GetSettings(var settings : TCefBrowserSettings); settings.image_shrink_standalone_to_fit := FOptions.ImageShrinkStandaloneToFit; settings.text_area_resize := FOptions.TextAreaResize; settings.tab_to_links := FOptions.TabToLinks; - settings.author_and_user_styles := FOptions.AuthorAndUserStyles; settings.local_storage := FOptions.LocalStorage; settings.databases := FOptions.Databases; settings.application_cache := FOptions.ApplicationCache; settings.webgl := FOptions.Webgl; settings.accelerated_compositing := FOptions.AcceleratedCompositing; + settings.background_color := FBackgroundColor; end; procedure TCustomChromiumOSR.CreateBrowser; @@ -565,8 +569,8 @@ procedure TCustomChromiumOSR.CreateBrowser; If not (csDesigning in ComponentState) then begin FillChar(info, SizeOf(info), 0); - info.window_rendering_disabled := True; - // info.transparent_painting := ???; + info.window_rendering_disabled := Ord(True); + info.transparent_painting := Ord(True); FillChar(settings, SizeOf(TCefBrowserSettings), 0); settings.size := SizeOf(TCefBrowserSettings); @@ -973,7 +977,7 @@ constructor TCustomChromiumOSR.Create(AOwner : TComponent); FOptions := TChromiumOptions.Create; FFontOptions := TChromiumFontOptions.Create; - FUserStyleSheetLocation := ''; + FBackgroundColor := CefColorSetARGB(255, 255, 255, 255); FDefaultEncoding := ''; FBrowserId := 0; FBrowser := nil; diff --git a/Examples/GT2Minimal/minimal.lpr b/Examples/GT2Minimal/minimal.lpr index 667933c..c3c802a 100644 --- a/Examples/GT2Minimal/minimal.lpr +++ b/Examples/GT2Minimal/minimal.lpr @@ -63,7 +63,7 @@ procedure bclicked(widget : PGtkWidget; data : gpointer); cdecl; CefLoadLibrary; - ExitCode := cef_execute_process(@MainArgs, nil); + ExitCode := cef_execute_process(@MainArgs, nil, nil); If ExitCode >= 0 then Halt(ExitCode); Settings.multi_threaded_message_loop := False; @@ -73,7 +73,7 @@ procedure bclicked(widget : PGtkWidget; data : gpointer); cdecl; Settings.uncaught_exception_stack_size := 20; Settings.release_dcheck_enabled := TRUE; - cef_initialize(@MainArgs, @Settings, nil); + cef_initialize(@MainArgs, @Settings, nil, nil); gtk_init(nil, nil); diff --git a/Examples/JavaScript/handler.pas b/Examples/JavaScript/handler.pas index ce3b223..8043d65 100644 --- a/Examples/JavaScript/handler.pas +++ b/Examples/JavaScript/handler.pas @@ -41,9 +41,10 @@ function TMyHandler.Execute(const name : ustring; const obj : ICefv8Value; const arguments : TCefv8ValueArray; var retval : ICefv8Value; var exception : ustring) : Boolean; begin - Result := False; + // return a value + retval := TCefv8ValueRef.NewString('TMyHandler'); - Writeln('Execute'); + Result := True; end; { TCustomRenderProcessHandler } diff --git a/Examples/JavaScript/main.pas b/Examples/JavaScript/main.pas index f2386af..52c0efc 100644 --- a/Examples/JavaScript/main.pas +++ b/Examples/JavaScript/main.pas @@ -64,7 +64,7 @@ procedure TMainform.Button2Click(Sender : TObject); // JavaScript executes TMyHandler.Execute procedure TMainform.Button3Click(Sender : TObject); begin - Chromium.Browser.MainFrame.ExecuteJavaScript('cef.test.test_object().GetMessage();', 'about:blank', 0); + Chromium.Browser.MainFrame.ExecuteJavaScript('alert(cef.test.test_param);', 'about:blank', 0); end; procedure TMainform.ChromiumTitleChange(Sender : TObject; const Browser : ICefBrowser; const title : ustring); diff --git a/Examples/SubProcess/subprocess.lpr b/Examples/SubProcess/subprocess.lpr index 3328738..7897c44 100644 --- a/Examples/SubProcess/subprocess.lpr +++ b/Examples/SubProcess/subprocess.lpr @@ -17,12 +17,12 @@ {$IFDEF WINDOWS} Args.instance := HINSTANCE(); - Halt(cef_execute_process(@Args, nil)); + Halt(cef_execute_process(@Args, nil, nil)); {$ELSE} Args.argc := argc; Args.argv := argv; - Halt(cef_execute_process(@Args, nil)); + Halt(cef_execute_process(@Args, nil, nil)); {$ENDIF} end. diff --git a/cef3api.pas b/cef3api.pas index 2256602..950d7c7 100644 --- a/cef3api.pas +++ b/cef3api.pas @@ -31,7 +31,7 @@ Uses {$IFDEF WINDOWS}Windows,{$ENDIF} {$IFDEF LINUX}Dynlibs,{$ENDIF} - sysutils, LCLProc, ctypes, + sysutils, ctypes, {$IFDEF DEBUG}LCLProc,{$ENDIF} cef3types; Type @@ -140,7 +140,7 @@ PCefTask = ^TCefTask; PCefTaskRunner = ^TCefTaskRunner; - PCefTraceClient = ^TCefTraceClient; + PCefEndTracingCallback = ^TCefEndTracingCallback; PCefUrlRequest = ^TCefUrlRequest; @@ -361,9 +361,12 @@ TCefBrowserHost = record // information. close_browser: procedure(self: PCefBrowserHost; force_close: Integer); cconv; - // Set focus for the browser window. If |enable| is true (1) focus will be set - // to the window. Otherwise, focus will be removed. - set_focus: procedure(self : PCefBrowserHost; enable : Integer); cconv; + // Set whether the browser is focused. + set_focus: procedure(self: PCefBrowserHost; focus: Integer); cconv; + + // Set whether the window containing the browser is visible + // (minimized/unminimized, app hidden/unhidden, etc). Only used on Mac OS X. + set_window_visibility: procedure(self: PCefBrowserHost; visible: Integer); cconv; // Retrieve the window handle for this browser. get_window_handle: function(self: PCefBrowserHost): TCefWindowHandle; cconv; @@ -379,16 +382,6 @@ TCefBrowserHost = record // Returns the request context for this browser. get_request_context: function(self: PCefBrowserHost): PCefRequestContext; cconv; - // Returns the DevTools URL for this browser. If |http_scheme| is true (1) the - // returned URL will use the http scheme instead of the chrome-devtools - // scheme. Remote debugging can be enabled by specifying the "remote- - // debugging-port" command-line flag or by setting the - // CefSettings.remote_debugging_port value. If remote debugging is not enabled - // this function will return an NULL string. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - get_dev_tools_url: function(self: PCefBrowserHost; http_scheme: Integer): PCefStringUserFree; cconv; - // Get the current zoom level. The default zoom level is 0.0. This function // can only be called on the UI thread. get_zoom_level: function(self: PCefBrowserHost): Double; cconv; @@ -429,6 +422,14 @@ TCefBrowserHost = record // Cancel all searches that are currently going on. stop_finding: procedure(self: PCefBrowserHost; clearSelection: Integer); cconv; + // Open developer tools in its own window. + show_dev_tools: procedure(self: PCefBrowserHost; const windowInfo: PCefWindowInfo; client: PCefClient; + const settings: PCefBrowserSettings); cconv; + + // Explicitly close the developer tools window if one exists for this browser + // instance. + close_dev_tools: procedure(self: PCefBrowserHost); cconv; + // Set whether mouse cursor change is disabled. set_mouse_cursor_change_disabled: procedure(self: PCefBrowserHost; disabled: Integer); cconv; @@ -2673,6 +2674,11 @@ TCefReadHandler = record // Return non-zero if at end of file. eof: function(self: PCefReadHandler): Integer; cconv; + + // Return true (1) if this handler performs work like accessing the file + // system which may block. Used as a hint for determining the thread to access + // the handler from. + may_block: function(self: PCefReadHandler): Integer; cconv; end; @@ -2694,6 +2700,11 @@ TCefStreamReader = record // Return non-zero if at end of file. eof: function(self: PCefStreamReader): Integer; cconv; + + // Returns true (1) if this reader performs work like accessing the file + // system which may block. Used as a hint for determining the thread to access + // the reader from. + may_block: function(self: PCefStreamReader): Integer; cconv; end; @@ -2715,6 +2726,11 @@ TCefWriteHandler = record // Flush the stream. flush: function(self: PCefWriteHandler): Integer; cconv; + + // Return true (1) if this handler performs work like accessing the file + // system which may block. Used as a hint for determining the thread to access + // the handler from. + may_block: function(self: PCefWriteHandler): Integer; cconv; end; @@ -2736,6 +2752,11 @@ TCefStreamWriter = record // Flush the stream. flush: function(self: PCefStreamWriter): Integer; cconv; + + // Returns true (1) if this writer performs work like accessing the file + // system which may block. Used as a hint for determining the thread to access + // the writer from. + may_block: function(self: PCefStreamWriter): Integer; cconv; end; @@ -2800,23 +2821,17 @@ TCefTaskRunner = record { *** cef_trace_capi.h *** } - // Implement this structure to receive trace notifications. The functions of - // this structure will be called on the browser process UI thread. - TCefTraceClient = record + // Implement this structure to receive notification when tracing has completed. + // The functions of this structure will be called on the browser process UI + // thread. + TCefEndTracingCallback = record // Base structure. base: TCefBase; - // Called 0 or more times between CefBeginTracing and OnEndTracingComplete - // with a UTF8 JSON |fragment| of the specified |fragment_size|. Do not keep a - // reference to |fragment|. - on_trace_data_collected: procedure(self: PCefTraceClient; const fragment: PAnsiChar; - fragment_size: csize_t); cconv; - - // Called in response to CefGetTraceBufferPercentFullAsync. - on_trace_buffer_percent_full_reply: procedure(self: PCefTraceClient; percent_full: Single); cconv; - - // Called after all processes have sent their trace data. - on_end_tracing_complete: procedure(self: PCefTraceClient); cconv; + // Called after all processes have sent their trace data. |tracing_file| is + // the path at which tracing data was written. The client is responsible for + // deleting |tracing_file|. + on_end_tracing_complete: procedure(self: PCefEndTracingCallback; const tracing_file: PCefString); cconv; end; @@ -3849,14 +3864,18 @@ TCefZipReader = record // called for the browser process (identified by no "type" command-line value) // it will return immediately with a value of -1. If called for a recognized // secondary process it will block until the process should exit and then return - // the process exit code. The |application| parameter may be NULL. - cef_execute_process: function(const args: PCefMainArgs; application: PCefApp): Integer; cdecl; + // the process exit code. The |application| parameter may be NULL. The + // |windows_sandbox_info| parameter is only used on Windows and may be NULL (see + // cef_sandbox_win.h for details). + cef_execute_process: function(const args: PCefMainArgs; application: PCefApp; windows_sandbox_info: Pointer): Integer; cdecl; // This function should be called on the main application thread to initialize // the CEF browser process. The |application| parameter may be NULL. A return // value of true (1) indicates that it succeeded and false (0) indicates that it - // failed. - cef_initialize: function(const args: PCefMainArgs; const settings: PCefSettings; application: PCefApp): Integer; cdecl; + // failed. The |windows_sandbox_info| parameter is only used on Windows and may + // be NULL (see cef_sandbox_win.h for details). + cef_initialize: function(const args: PCefMainArgs; const settings: PCefSettings; application: PCefApp; + windows_sandbox_info: Pointer): Integer; cdecl; // This function should be called on the main application thread to shut down // the CEF browser process before the application exits. @@ -4112,21 +4131,7 @@ TCefZipReader = record // "-excluded_category1,-excluded_category2" // // This function must be called on the browser process UI thread. - cef_begin_tracing: function(client: PCefTraceClient; const categories: PCefString): Integer; cdecl; - - - // Get the maximum trace buffer percent full state across all processes. - // - // cef_trace_client_t::OnTraceBufferPercentFullReply will be called - // asynchronously after the value is determined. When any child process reaches - // 100% full tracing will end automatically and - // cef_trace_client_t::OnEndTracingComplete will be called. This function fails - // and returns false (0) if trace is ending or disabled, no cef_trace_client_t - // was passed to CefBeginTracing, or if a previous call to - // CefGetTraceBufferPercentFullAsync is pending. - // - // This function must be called on the browser process UI thread. - cef_get_trace_buffer_percent_full_async: function: Integer; cdecl; + cef_begin_tracing: function(const categories: PCefString): Integer; cdecl; // Stop tracing events on all processes. @@ -4134,8 +4139,13 @@ TCefZipReader = record // This function will fail and return false (0) if a previous call to // CefEndTracingAsync is already pending or if CefBeginTracing was not called. // + // |tracing_file| is the path at which tracing data will be written and + // |callback| is the callback that will be executed once all processes have sent + // their trace data. If |tracing_file| is NULL a new temporary file path will be + // used. If |callback| is NULL no trace data will be written. + // // This function must be called on the browser process UI thread. - cef_end_tracing_async: function: Integer; cdecl; + cef_end_tracing_async: function(const tracing_file: PCefString; callback: PCefEndTracingCallback): Integer; cdecl; // Returns the current system trace time or, if none is defined, the current @@ -4155,6 +4165,12 @@ TCefZipReader = record // if |parts| isn't initialized as described. cef_create_url: function(const parts: PCefUrlParts; url: PCefString): Integer; cdecl; + // Returns the mime type for the specified file extension or an NULL string if + // unknown. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_get_mime_type: function(const extension: PCefString): PCefStringUserFree; cdecl; + { *** cef_urlrequest_capi.h *** } // Create a new URL request. Only GET, POST, HEAD, DELETE and PUT request @@ -4567,7 +4583,7 @@ TCefZipReader = record cef_api_hash: function(entry: Integer): PChar; cdecl; -procedure CefLoadLibrary; +function CefLoadLibrary: Boolean; procedure CefCloseLibrary; Implementation @@ -4604,7 +4620,7 @@ function cef_string_copy(const src: PCefChar; src_len: csize_t; output: PCefStri end; { *** *** } -procedure CefLoadLibrary; +function CefLoadLibrary: Boolean; begin {$IFDEF DEBUG} Debugln('CefLoadLibrary'); @@ -4716,6 +4732,7 @@ procedure CefLoadLibrary; Pointer(cef_post_delayed_task) := GetProcAddress(LibHandle, 'cef_post_delayed_task'); Pointer(cef_parse_url) := GetProcAddress(LibHandle, 'cef_parse_url'); Pointer(cef_create_url) := GetProcAddress(LibHandle, 'cef_create_url'); + Pointer(cef_get_mime_type) := GetProcAddress(LibHandle, 'cef_get_mime_type'); Pointer(cef_browser_host_create_browser) := GetProcAddress(LibHandle, 'cef_browser_host_create_browser'); Pointer(cef_browser_host_create_browser_sync) := GetProcAddress(LibHandle, 'cef_browser_host_create_browser_sync'); Pointer(cef_request_create) := GetProcAddress(LibHandle, 'cef_request_create'); @@ -4796,7 +4813,6 @@ procedure CefLoadLibrary; Pointer(cef_task_runner_get_for_thread) := GetProcAddress(LibHandle, 'cef_task_runner_get_for_thread'); Pointer(cef_begin_tracing) := GetProcAddress(LibHandle, 'cef_begin_tracing'); - Pointer(cef_get_trace_buffer_percent_full_async) := GetProcAddress(LibHandle, 'cef_get_trace_buffer_percent_full_async'); Pointer(cef_end_tracing_async) := GetProcAddress(LibHandle, 'cef_end_tracing_async'); If not ( @@ -4856,6 +4872,7 @@ procedure CefLoadLibrary; Assigned(cef_post_delayed_task) and Assigned(cef_parse_url) and Assigned(cef_create_url) and + Assigned(cef_get_mime_type) and Assigned(cef_browser_host_create_browser) and Assigned(cef_browser_host_create_browser_sync) and Assigned(cef_request_create) and @@ -4920,19 +4937,23 @@ procedure CefLoadLibrary; Assigned(cef_task_runner_get_for_current_thread) and Assigned(cef_task_runner_get_for_thread) and Assigned(cef_begin_tracing) and - Assigned(cef_get_trace_buffer_percent_full_async) and Assigned(cef_end_tracing_async) - ) then raise Exception.Create('Invalid CEF Library version'); - //) then raise ECefException.Create('Invalid CEF Library version'); + ) then raise Exception.Create('Unsupported CEF library version'); {$IFDEF DEBUG} - Debugln(' : Loaded'); + Debugln('-> loaded'); {$ENDIF} + + Result := True; end - {$IFDEF DEBUG} - Else Debugln(' : already loaded') - {$ENDIF} - ; + Else + begin + {$IFDEF DEBUG} + Debugln('-> already loaded'); + {$ENDIF} + + Result := False; + end; end; procedure CefCloseLibrary; @@ -4943,17 +4964,15 @@ procedure CefCloseLibrary; If LibHandle <> 0 then begin {$IFDEF DEBUG} - Debugln(' : Freed'); + Debugln('-> Freed'); {$ENDIF} FreeLibrary(LibHandle); LibHandle := 0; end - Else {$IFDEF DEBUG} - Debugln(' : already freed.') + Else Debugln('-> not loaded.'); {$ENDIF} - ; end; Finalization diff --git a/cef3gui.pas b/cef3gui.pas index 61924ca..f91fdac 100644 --- a/cef3gui.pas +++ b/cef3gui.pas @@ -173,7 +173,6 @@ TChromiumOptions = class(TPersistent) FImageShrinkStandaloneToFit: TCefState; FTextAreaResize: TCefState; FTabToLinks: TCefState; - FAuthorAndUserStyles: TCefState; FLocalStorage: TCefState; FDatabases: TCefState; FApplicationCache: TCefState; @@ -195,7 +194,6 @@ TChromiumOptions = class(TPersistent) 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 AuthorAndUserStyles: TCefState read FAuthorAndUserStyles write FAuthorAndUserStyles 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; diff --git a/cef3intf.pas b/cef3intf.pas index d44c849..29d5fc1 100644 --- a/cef3intf.pas +++ b/cef3intf.pas @@ -93,7 +93,7 @@ ICefStringVisitor = interface; ICefTask = interface; ICefTaskRunner = interface; - ICefTraceClient = interface; + ICefEndTracingCallback = interface; ICefUrlRequest = interface; ICefUrlRequestClient = interface; ICefV8Context = interface; @@ -187,12 +187,12 @@ function GetBrowser: ICefBrowser; procedure ParentWindowWillClose; procedure CloseBrowser(aForceClose: Boolean); - procedure SetFocus(enable: Boolean); + procedure SetFocus(focus: Boolean); + procedure SetWindowVisibility(visible: Boolean); function GetWindowHandle: TCefWindowHandle; function GetOpenerWindowHandle: TCefWindowHandle; function GetClient: ICefClient; function GetRequestContext: ICefRequestContext; - function GetDevToolsUrl(httpScheme: Boolean): ustring; function GetZoomLevel: Double; procedure SetZoomLevel(zoomLevel: Double); procedure RunFileDialog(mode: TCefFileDialogMode; const title, defaultFileName: ustring; @@ -201,6 +201,8 @@ procedure Print; procedure Find(identifier: Integer; const searchText: ustring; forward_, matchCase, findNext: Boolean); procedure StopFinding(clearSelection: Boolean); + procedure ShowDevTools(var windowInfo: TCefWindowInfo; client: ICefClient; var settings: TCefBrowserSettings); + procedure CloseDevTools; procedure SetMouseCursorChangeDisabled(disabled: Boolean); function GetIsMouseCursorChangeDisabled: Boolean; function GetIsWindowRenderingDisabled: Boolean; @@ -617,7 +619,7 @@ ICefLifeSpanHandler = interface(ICefBase) ['{0A3EB782-A319-4C35-9B46-09B2834D7169}'] function OnBeforePopup(const parentBrowser: ICefBrowser; const frame: ICefFrame; var target_url: ustring; const targetFrameName: ustring; - var popupFeatures: TCefPopupFeatures; var windowInfo:TCefWindowInfo; var client: ICefClient; + var popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var no_javascript_access: Boolean): Boolean; procedure OnAfterCreated(const browser: ICefBrowser); function RunModal(const browser: ICefBrowser): Boolean; @@ -867,6 +869,7 @@ function Seek(offset: Int64; whence: Integer): Integer; function Tell: Int64; function Eof: Boolean; + function MayBlock: Boolean; end; {$NOTE ICefReadHandler, ICefStreamWriter} @@ -875,6 +878,7 @@ function Seek(offset: Int64; whence: Integer): Integer; function Tell: Int64; function Eof: Boolean; + function MayBlock: Boolean; end; ICefStringVisitor = interface(ICefBase) ['{63ED4D6C-2FC8-4537-964B-B84C008F6158}'] @@ -893,10 +897,8 @@ function PostDelayedTask(task: ICefTask; delayMs: Int64): Integer; end; - ICefTraceClient = interface(ICefBase) ['{B6995953-A56A-46AC-B3D1-D644AEC480A5}'] - procedure OnTraceDataCollected(const fragment: PAnsiChar; fragmentSize: TSize); - procedure OnTraceBufferPercentFullReply(percentFull: Single); - procedure OnEndTracingComplete; + ICefEndTracingCallback = interface(ICefBase) ['{B6995953-A56A-46AC-B3D1-D644AEC480A5}'] + procedure OnEndTracingComplete(const tracingFile: ustring); end; ICefUrlRequest = interface(ICefBase) ['{59226AC1-A0FA-4D59-9DF4-A65C42391A67}'] diff --git a/cef3lib.pas b/cef3lib.pas index a3afaef..f641f04 100644 --- a/cef3lib.pas +++ b/cef3lib.pas @@ -41,8 +41,8 @@ function CefInitialize(const Cache: ustring = ''; const UserAgent: ustring = ''; const BrowserSubprocessPath: ustring = ''; LogSeverity: TCefLogSeverity = LOGSEVERITY_DISABLE; JavaScriptFlags: ustring = ''; ResourcesDirPath: ustring = ''; LocalesDirPath: ustring = ''; - SingleProcess: Boolean = False; CommandLineArgsDisabled: Boolean = False; PackLoadingDisabled: Boolean = False; - RemoteDebuggingPort: Integer = 0; ReleaseDCheck: Boolean = False; + SingleProcess: Boolean = False; NoSandbox: Boolean = False; CommandLineArgsDisabled: Boolean = False; + PackLoadingDisabled: Boolean = False; RemoteDebuggingPort: Integer = 0; ReleaseDCheck: Boolean = False; UncaughtExceptionStackSize: Integer = 0; ContextSafetyImplementation: Integer = 0): Boolean; procedure CefShutDown; @@ -113,9 +113,8 @@ function CefRequestCreate: ICefRequest; function CefPostDataCreate: ICefPostData; function CefPostDataElementCreate: ICefPostDataElement; -function CefBeginTracing(const client: ICefTraceClient; const categories: ustring): Boolean; -function CefGetTraceBufferPercentFullAsync: Integer; -function CefEndTracingAsync: Boolean; +function CefBeginTracing(const categories: ustring): Boolean; +function CefEndTracingAsync(const tracingFile: ustring; callback: ICefEndTracingCallback): Boolean; function CefGetGeolocation(const callback: ICefGetGeolocationCallback): Boolean; @@ -142,6 +141,7 @@ procedure CefStringSet(const str: PCefString; const value: ustring); CefLocalesDirPath: ustring = ''; CefPackLoadingDisabled: Boolean = False; CefSingleProcess: Boolean = False; + CefNoSandbox: Boolean = True; CefBrowserSubprocessPath: ustring = ''; CefCommandLineArgsDisabled: Boolean = False; CefRemoteDebuggingPort: Integer = 0; @@ -193,14 +193,14 @@ function CefInitDefault: Boolean; Result := CefInitialize(CefCache, CefUserAgent, CefProductVersion, CefLocale, CefLogFile, CefBrowserSubprocessPath, CefLogSeverity, - CefJavaScriptFlags, CefResourcesDirPath, CefLocalesDirPath, CefSingleProcess, + CefJavaScriptFlags, CefResourcesDirPath, CefLocalesDirPath, CefSingleProcess, CefNoSandbox, CefCommandLineArgsDisabled, CefPackLoadingDisabled, CefRemoteDebuggingPort, CefReleaseDCheck, CefUncaughtExceptionStackSize, CefContextSafetyImplementation); end; function CefInitialize(const Cache, UserAgent, ProductVersion, Locale, LogFile, BrowserSubprocessPath: ustring; LogSeverity: TCefLogSeverity; JavaScriptFlags, ResourcesDirPath, LocalesDirPath: ustring; - SingleProcess, CommandLineArgsDisabled, PackLoadingDisabled: Boolean; RemoteDebuggingPort: Integer; + SingleProcess, NoSandbox, CommandLineArgsDisabled, PackLoadingDisabled: Boolean; RemoteDebuggingPort: Integer; ReleaseDCheck: Boolean; UncaughtExceptionStackSize: Integer; ContextSafetyImplementation: Integer): Boolean; Var Settings: TCefSettings; @@ -213,28 +213,24 @@ function CefInitialize(const Cache, UserAgent, ProductVersion, Locale, LogFile, Debugln('CefInitialize'); {$ENDIF} - If CefIsMainProcess then + If not CefLoadLibrary then begin - {$IFDEF DEBUG} - Debugln('Already loaded.'); - {$ENDIF} - - Result := true; + Result := True; Exit; end; - CefLoadLibrary; FillChar(settings, SizeOf(settings), 0); settings.size := SizeOf(settings); - settings.single_process := SingleProcess; + settings.single_process := Ord(SingleProcess); + settings.no_sandbox := Ord(NoSandbox); settings.browser_subprocess_path := CefString(BrowserSubprocessPath); {$IFDEF CEF_MULTI_THREADED_MESSAGE_LOOP} - settings.multi_threaded_message_loop := True; + settings.multi_threaded_message_loop := Ord(True); {$ELSE} - settings.multi_threaded_message_loop := False; + settings.multi_threaded_message_loop := Ord(False); {$ENDIF} - settings.command_line_args_disabled := CommandLineArgsDisabled; + settings.command_line_args_disabled := Ord(CommandLineArgsDisabled); settings.cache_path := CefString(Cache); //settings.persist_session_cookies := ; settings.user_agent := CefString(UserAgent); @@ -242,11 +238,11 @@ function CefInitialize(const Cache, UserAgent, ProductVersion, Locale, LogFile, settings.locale := CefString(Locale); settings.log_file := CefString(LogFile); settings.log_severity := LogSeverity; - settings.release_dcheck_enabled := ReleaseDCheck; + settings.release_dcheck_enabled := Ord(ReleaseDCheck); settings.javascript_flags := CefString(JavaScriptFlags); settings.resources_dir_path := CefString(ResourcesDirPath); settings.locales_dir_path := CefString(LocalesDirPath); - settings.pack_loading_disabled := PackLoadingDisabled; + settings.pack_loading_disabled := Ord(PackLoadingDisabled); settings.remote_debugging_port := RemoteDebuggingPort; settings.uncaught_exception_stack_size := UncaughtExceptionStackSize; settings.context_safety_implementation := ContextSafetyImplementation; @@ -257,21 +253,17 @@ function CefInitialize(const Cache, UserAgent, ProductVersion, Locale, LogFile, {$IFDEF WINDOWS} Args.instance := HINSTANCE(); - ErrCode := cef_execute_process(@Args, CefGetData(app)); + ErrCode := cef_execute_process(@Args, CefGetData(app), nil); {$ELSE} Args.argc := argc; Args.argv := argv; - ErrCode := cef_execute_process(@Args, CefGetData(app)); + ErrCode := cef_execute_process(@Args, CefGetData(app), nil); {$ENDIF} - If ErrCode >= 0 then - begin - Result := False; - Exit; - end; + If ErrCode >= 0 then Halt(ErrCode); - ErrCode := cef_initialize(@Args, @settings, CefGetData(app)); + ErrCode := cef_initialize(@Args, @settings, CefGetData(app), nil); If ErrCode <> 1 then begin Result := False; @@ -393,10 +385,7 @@ function CefRegisterSchemeHandlerFactory(const SchemeName, HostName: ustring; s := CefString(SchemeName); h := CefString(HostName); Result := cef_register_scheme_handler_factory( - @s, - @h, - CefGetData(TCefSchemeHandlerFactoryOwn.Create(handler, SyncMainThread) as ICefBase) - ) <> 0; + @s, @h, CefGetData(TCefSchemeHandlerFactoryOwn.Create(handler, SyncMainThread) as ICefBase)) <> 0; end; function CefClearSchemeHandlerFactories: Boolean; @@ -444,8 +433,7 @@ function CefRegisterExtension(const name, code: ustring; const Handler: ICefv8Ha Var n, c: TCefString; begin - { TODO : Hier wird doppelt initialisiert? } - //CefInitDefault; + CefInitDefault; n := CefString(name); c := CefString(code); Result := cef_register_extension(@n, @c, CefGetData(handler)) <> 0; @@ -651,22 +639,20 @@ function CefPostDataElementCreate: ICefPostDataElement; Result := TCefPostDataElementRef.UnWrap(cef_post_data_element_create()); end; -function CefBeginTracing(const client: ICefTraceClient; const categories: ustring): Boolean; +function CefBeginTracing(const categories: ustring): Boolean; Var c: TCefString; begin c := CefString(categories); - Result := cef_begin_tracing(CefGetData(client), @c) <> 0; + Result := cef_begin_tracing(@c) <> 0; end; -function CefGetTraceBufferPercentFullAsync: Integer; -begin - Result := cef_get_trace_buffer_percent_full_async(); -end; - -function CefEndTracingAsync: Boolean; +function CefEndTracingAsync(const tracingFile: ustring; callback: ICefEndTracingCallback): Boolean; +Var + t: TCefString; begin - Result := cef_end_tracing_async() <> 0; + t := CefString(tracingFile); + Result := cef_end_tracing_async(@t, CefGetData(callback)) <> 0; end; function CefGetGeolocation(const callback: ICefGetGeolocationCallback): Boolean; diff --git a/cef3own.pas b/cef3own.pas index dd13f08..b939a11 100644 --- a/cef3own.pas +++ b/cef3own.pas @@ -29,7 +29,8 @@ Interface Uses - Classes, SysUtils, Math, LCLProc, + Classes, SysUtils, Math, + {$IFDEF DEBUG}LCLProc,{$ENDIF} cef3api, cef3types, cef3intf; Type @@ -430,6 +431,7 @@ TCefCustomStreamReader = class(TCefBaseOwn, ICefCustomStreamReader) function Seek(offset: Int64; whence: Integer): Integer; virtual; function Tell: Int64; virtual; function Eof: Boolean; virtual; + function MayBlock: Boolean; virtual; public constructor Create(Stream: TStream; Owned: Boolean); overload; virtual; constructor Create(const filename: string); overload; virtual; @@ -672,7 +674,7 @@ constructor TCefBaseOwn.CreateData(size : TSize; owned : Boolean); destructor TCefBaseOwn.Destroy; begin {$IFDEF DEBUG} - DebugLn(Self.ClassName, '.Destroy; RefCount: ', Self.RefCount); + DebugLn(Self.ClassName + '.Destroy; RefCount: ' + IntToStr(Self.RefCount)); {$ENDIF} Dec(FData, SizeOf(Pointer)); @@ -1080,11 +1082,11 @@ function cef_cookie_visitor_visit(self : PCefCookieVisitor; const cookie : PCefC exp : TDateTime; begin delete := False; - If cookie^.has_expires then exp := CefTimeToDateTime(cookie^.expires) + If (cookie^.has_expires <> 0) then exp := CefTimeToDateTime(cookie^.expires) Else exp := 0; Result := Ord(TCefCookieVisitorOwn(CefGetObject(self)).visit(CefString(@cookie^.name), CefString(@cookie^.value), CefString(@cookie^.domain), CefString(@cookie^.path), - cookie^.secure, cookie^.httponly, cookie^.has_expires, CefTimeToDateTime(cookie^.creation), + cookie^.secure <> 0, cookie^.httponly <> 0, cookie^.has_expires <> 0, CefTimeToDateTime(cookie^.creation), CefTimeToDateTime(cookie^.last_access), exp, count, total, delete)); deleteCookie^ := Ord(delete); end; @@ -2604,6 +2606,11 @@ function TCefCustomStreamReader.Eof : Boolean; Result := FStream.Position = FStream.Size; end; +function TCefCustomStreamReader.MayBlock : Boolean; +begin + Result := True; +end; + constructor TCefCustomStreamReader.Create(Stream : TStream; Owned : Boolean); begin inherited CreateData(SizeOf(TCefReadHandler)); diff --git a/cef3ref.pas b/cef3ref.pas index 0867e80..c4872a5 100644 --- a/cef3ref.pas +++ b/cef3ref.pas @@ -29,7 +29,8 @@ Interface Uses - Classes, SysUtils, LCLProc, + Classes, SysUtils, + {$IFDEF DEBUG}LCLProc,{$ENDIF} cef3api, cef3types, cef3intf, cef3own; Type @@ -78,18 +79,20 @@ TCefBrowserHostRef = class(TCefBaseRef, ICefBrowserHost) function GetBrowser: ICefBrowser; procedure ParentWindowWillClose; procedure CloseBrowser(aForceClose: Boolean); - procedure SetFocus(enable: Boolean); + procedure SetFocus(focus: Boolean); + procedure SetWindowVisibility(visible: Boolean); function GetWindowHandle: TCefWindowHandle; function GetOpenerWindowHandle: TCefWindowHandle; function GetClient: ICefClient; function GetRequestContext: ICefRequestContext; - function GetDevToolsUrl(httpScheme: Boolean): ustring; function GetZoomLevel: Double; procedure SetZoomLevel(zoomLevel: Double); procedure StartDownload(const url: ustring); procedure Print; procedure Find(identifier: Integer; const searchText: ustring; forward_, matchCase, findNext: Boolean); procedure StopFinding(clearSelection: Boolean); + procedure ShowDevTools(var windowInfo: TCefWindowInfo; client: ICefClient; var settings: TCefBrowserSettings); + procedure CloseDevTools; procedure SetMouseCursorChangeDisabled(disabled: Boolean); function GetIsMouseCursorChangeDisabled: Boolean; function GetIsWindowRenderingDisabled: Boolean; @@ -565,6 +568,7 @@ TCefStreamReaderRef = class(TCefBaseRef, ICefStreamReader) function Seek(offset: Int64; whence: Integer): Integer; function Tell: Int64; function Eof: Boolean; + function MayBlock: Boolean; public class function UnWrap(data: Pointer): ICefStreamReader; class function CreateForFile(const filename: ustring): ICefStreamReader; @@ -1097,9 +1101,14 @@ procedure TCefBrowserHostRef.CloseBrowser(aForceClose : Boolean); PCefBrowserHost(FData)^.close_browser(FData, Ord(aForceClose)); end; -procedure TCefBrowserHostRef.SetFocus(enable : Boolean); +procedure TCefBrowserHostRef.SetFocus(focus: Boolean); begin - PCefBrowserHost(FData)^.set_focus(FData, Ord(enable)); + PCefBrowserHost(FData)^.set_focus(FData, Ord(focus)); +end; + +procedure TCefBrowserHostRef.SetWindowVisibility(visible : Boolean); +begin + PCefBrowserHost(FData)^.set_window_visibility(FData, Ord(visible)); end; function TCefBrowserHostRef.GetWindowHandle : TCefWindowHandle; @@ -1127,11 +1136,6 @@ function TCefBrowserHostRef.GetRequestContext : ICefRequestContext; Result:=TCefRequestContextRef.UnWrap(PCefBrowserHost(FData)^.get_request_context(PCefBrowserHost(FData))); end; -function TCefBrowserHostRef.GetDevToolsUrl(httpScheme : Boolean) : ustring; -begin - Result := CefStringFreeAndGet(PCefBrowserHost(FData)^.get_dev_tools_url(FData, Ord(httpScheme))); -end; - function TCefBrowserHostRef.GetZoomLevel : Double; begin Result := PCefBrowserHost(FData)^.get_zoom_level(FData); @@ -1170,6 +1174,17 @@ procedure TCefBrowserHostRef.StopFinding(clearSelection : Boolean); PCefBrowserHost(FData)^.stop_finding(PCefBrowserHost(FData),Ord(clearSelection)); end; +procedure TCefBrowserHostRef.ShowDevTools(var windowInfo : TCefWindowInfo; client : ICefClient; + var settings : TCefBrowserSettings); +begin + PCefBrowserHost(FData)^.show_dev_tools(FData, @windowInfo, CefGetData(client), @settings); +end; + +procedure TCefBrowserHostRef.CloseDevTools; +begin + PCefBrowserHost(FData)^.close_dev_tools(FData); +end; + procedure TCefBrowserHostRef.SetMouseCursorChangeDisabled(disabled : Boolean); begin PCefBrowserHost(FData)^.set_mouse_cursor_change_disabled(FData, Ord(disabled)); @@ -1216,13 +1231,14 @@ procedure TCefBrowserHostRef.SendMouseClickEvent(const event : TCefMouseEvent; PCefBrowserHost(FData)^.send_mouse_click_event(FData, @event, aType, Ord(mouseUp), clickCount); end; -procedure TCefBrowserHostRef.SendMouseMoveEvent(event : TCefMouseEvent; mouseLeave : Boolean); +procedure TCefBrowserHostRef.SendMouseMoveEvent(event : TCefMouseEvent; + mouseLeave : boolean); begin PCefBrowserHost(FData)^.send_mouse_move_event(FData, @event, Ord(mouseLeave)); end; procedure TCefBrowserHostRef.SendMouseWheelEvent(const event : TCefMouseEvent; - deltaX : integer; deltaY : integer); + deltaX, deltaY : Integer); begin PCefBrowserHost(FData)^.send_mouse_wheel_event(FData, @event, deltaX, deltaY); end; @@ -1614,11 +1630,11 @@ function TCefCookieManagerRef.SetCookie(const url : ustring; c.value := CefString(value); c.domain := CefString(domain); c.path := CefString(path); - c.secure := secure; - c.httponly := httponly; + c.secure := Ord(secure); + c.httponly := Ord(httponly); c.creation := DateTimeToCefTime(creation); c.last_access := DateTimeToCefTime(lastAccess); - c.has_expires := hasExpires; + c.has_expires := Ord(hasExpires); If hasExpires then c.expires := DateTimeToCefTime(expires) Else FillChar(c.expires, SizeOf(TCefTime), 0); @@ -3136,6 +3152,11 @@ function TCefStreamReaderRef.Eof : Boolean; Result := PCefStreamReader(FData)^.eof(FData) <> 0; end; +function TCefStreamReaderRef.MayBlock : Boolean; +begin + Result := True; +end; + class function TCefStreamReaderRef.UnWrap(data : Pointer) : ICefStreamReader; begin If data <> nil then Result := Create(data) as ICefStreamReader diff --git a/cef3types.pas b/cef3types.pas index 59a4d0a..249b20f 100644 --- a/cef3types.pas +++ b/cef3types.pas @@ -182,13 +182,13 @@ TCefWindowInfo = record // |parent_window| to be used for identifying monitor info // (MonitorFromWindow). If |parent_window| is not provided the main screen // monitor will be used. - window_rendering_disabled : BOOL; + window_rendering_disabled : Integer; // Set to true to enable transparent painting. // If window rendering is disabled and |transparent_painting| is set to true // WebKit rendering will draw on a transparent background (RGBA=0x00000000). // When this value is false the background will be white and opaque. - transparent_painting : BOOL; + transparent_painting : Integer; // Handle for the new browser window. window : TCefWindowHandle; @@ -200,10 +200,10 @@ TCefWindowInfo = record // If window rendering is disabled no browser window will be created. Set // |parent_widget| to the window that will act as the parent for popup menus, // dialog boxes, etc. - window_rendering_disabled : Boolean; + window_rendering_disabled : Integer; // Set to true to enable transparent painting. - transparent_painting : Boolean; + transparent_painting : Integer; // Pointer for the new browser widget. widget : TCefWindowHandle; @@ -218,10 +218,10 @@ TCefWindowInfo = record // If window rendering is disabled no browser window will be created. Set // |parent_view| to the window that will act as the parent for popup menus, // dialog boxes, etc. - window_rendering_disabled : Boolean; + window_rendering_disabled : Integer; // Set to true to enable transparent painting. - transparent_painting : Boolean; + transparent_painting : Integer; // NSView pointer for the new browser view. view : TCefWindowHandle; @@ -299,7 +299,12 @@ TCefSettings = record // run mode is not officially supported by Chromium and is less stable than // the multi-process default. Also configurable using the "single-process" // command-line switch. - single_process: Boolean; + single_process: Integer; + + // Set to true (1) to disable the sandbox for sub-processes. See + // cef_sandbox_win.h for requirements to enable the sandbox on Windows. Also + // configurable using the "no-sandbox" command-line switch. + no_sandbox: Integer; // The path to a separate executable that will be launched for sub-processes. // By default the browser process executable is used. See the comments on @@ -310,13 +315,13 @@ TCefSettings = record // Set to true (1) to have the browser process message loop run in a separate // thread. If false (0) than the CefDoMessageLoopWork() function must be // called from your application message loop. - multi_threaded_message_loop: Boolean; + multi_threaded_message_loop: Integer; // Set to true (1) to disable configuration of browser process features using // standard CEF and Chromium command-line arguments. Configuration can still // be specified using CEF data structures or via the // CefApp::OnBeforeCommandLineProcessing() method. - command_line_args_disabled: Boolean; + command_line_args_disabled: Integer; // The location where cache data will be stored on disk. If empty an in-memory // cache will be used for some features and a temporary disk cache for others. @@ -330,7 +335,7 @@ TCefSettings = record // browsers do not persist them. A |cache_path| value must also be specified to // enable this feature. Also configurable using the "persist-session-cookies" // command-line switch. - persist_session_cookies: Boolean; + persist_session_cookies: Integer; // Value that will be returned as the User-Agent HTTP header. If empty the // default User-Agent string will be used. Also configurable using the @@ -362,7 +367,7 @@ TCefSettings = record // Enable DCHECK in release mode to ease debugging. Also configurable using the // "enable-release-dcheck" command-line switch. - release_dcheck_enabled: Boolean; + release_dcheck_enabled: Integer; // Custom flags that will be used when initializing the V8 JavaScript engine. // The consequences of using custom flags may not be well tested. Also @@ -388,7 +393,7 @@ TCefSettings = record // processes via CefApp::GetResourceBundleHandler() if loading of pack files // is disabled. Also configurable using the "disable-pack-loading" command- // line switch. - pack_loading_disabled: Boolean; + pack_loading_disabled: Integer; // Set to a value between 1024 and 65535 to enable remote debugging on the // specified port. For example, if 8080 is specified the remote debugging URL @@ -429,10 +434,12 @@ TCefSettings = record // "man in the middle" attacks. Applications that load content from the // internet should not enable this setting. Also configurable using the // "ignore-certificate-errors" command-line switch. - ignore_certificate_error: Boolean; + ignore_certificate_error: Integer; - // Used on Mac OS X to specify the background color for hardware accelerated - // content. + // Opaque background color used for accelerated content. By default the + // background color will be white. Only the RGB compontents of the specified + // value will be used. The alpha component must greater than 0 to enable use + // of the background color but will be otherwise ignored. background_color: TCefColor; end; @@ -463,12 +470,6 @@ TCefBrowserSettings = record // configurable using the "default-encoding" command-line switch. default_encoding: TCefString; - // Location of the user style sheet that will be used for all pages. This must - // be a data URL of the form "data:text/css;charset=utf-8;base64,csscontent" - // where "csscontent" is the base64 encoded contents of the CSS file. Also - // configurable using the "user-style-sheet-location" command-line switch. - user_style_sheet_location: TCefString; - // Controls the loading of fonts from remote sources. Also configurable using // the "disable-remote-fonts" command-line switch. remote_fonts: TCefState; @@ -542,10 +543,6 @@ TCefBrowserSettings = record // using the "disable-tab-to-links" command-line switch. tab_to_links: TCefState; - // Controls whether style sheets can be used. Also configurable using the - // "disable-author-and-user-styles" command-line switch. - author_and_user_styles: TCefState; - // Controls whether local storage can be used. Also configurable using the // "disable-local-storage" command-line switch. local_storage: TCefState; @@ -568,6 +565,13 @@ TCefBrowserSettings = record // not work on all systems even when enabled. Also configurable using the // "disable-accelerated-compositing" command-line switch. accelerated_compositing: TCefState; + + // Opaque background color used for the browser before a document is loaded + // and when no document color is specified. By default the background color + // will be the same as CefSettings.background_color. Only the RGB compontents + // of the specified value will be used. The alpha component must greater than + // 0 to enable use of the background color but will be otherwise ignored. + background_color: TCefColor; end; // URL component parts. @@ -592,6 +596,12 @@ TCefUrlParts = record // Port number component. port: TCefString; + // Origin contains just the scheme, host, and port from a URL. Equivalent to + // clearing any username and password, replacing the path with a slash, and + // clearing everything after that. This value will be empty for non-standard + // URLs. + origin: TCefString; + // Path component including the first slash following the host. path: TCefString; @@ -618,10 +628,10 @@ TCefCookie = record path: TCefString; // If |secure| is true the cookie will only be sent for HTTPS requests. - secure: Boolean; + secure: Integer; // If |httponly| is true the cookie will only be sent for HTTP requests. - httponly: Boolean; + httponly: Integer; // The cookie creation date. This is automatically populated by the system on // cookie creation. @@ -632,7 +642,7 @@ TCefCookie = record last_access: TCefTime; // The cookie expiration date is only valid if |has_expires| is true. - has_expires: Boolean; + has_expires: Integer; expires: TCefTime; end; @@ -1014,7 +1024,7 @@ TCefScreenInfo = record depth_per_component: Integer; // This can be true for black and white printers. - is_monochrome: Boolean; + is_monochrome: Integer; // This is set from the rcMonitor member of MONITORINFOEX, to whit: // "A RECT structure that specifies the display monitor rectangle, @@ -1223,7 +1233,7 @@ TCefKeyEvent = record // Indicates whether the event is considered a "system key" event (see // http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx for details). // This value will always be false on non-Windows platforms. - is_system_key: Boolean; + is_system_key: Integer; // The character generated by the keystroke. character: Char16; @@ -1234,7 +1244,7 @@ TCefKeyEvent = record // True if the focus is currently on an editable field on the page. This is // useful for determining if standard key events should be intercepted. - focus_on_editable_field: Boolean; + focus_on_editable_field: Integer; end; // Focus sources. @@ -1286,23 +1296,23 @@ TCefKeyEvent = record PCefPopupFeatures = ^TCefPopupFeatures; TCefPopupFeatures = record x: Integer; - xSet: Boolean; + xSet: Integer; y: Integer; - ySet: Boolean; + ySet: Integer; width: Integer; - widthSet: Boolean; + widthSet: Integer; height: Integer; - heightSet: Boolean; + heightSet: Integer; - menuBarVisible: Boolean; - statusBarVisible: Boolean; - toolBarVisible: Boolean; - locationBarVisible: Boolean; - scrollbarsVisible: Boolean; - resizable: Boolean; + menuBarVisible: Integer; + statusBarVisible: Integer; + toolBarVisible: Integer; + locationBarVisible: Integer; + scrollbarsVisible: Integer; + resizable: Integer; - fullscreen: Boolean; - dialog: Boolean; + fullscreen: Integer; + dialog: Integer; additionalFeatures: TCefStringList; end;