1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-06-12 22:07:39 +02:00

Geolocation demo

This commit is contained in:
Salvador Diaz Fau
2017-08-12 20:29:52 +02:00
parent a8326eb6dc
commit b349625e09
14 changed files with 2196 additions and 75 deletions

View File

@ -52,7 +52,7 @@ uses
{$ELSE}
Windows, Classes, SysUtils, Controls, ActiveX, Math,
{$ENDIF}
uCEFTypes, uCEFInterfaces, uCEFLibFunctions, uCEFResourceHandler;
uCEFTypes, uCEFInterfaces, uCEFLibFunctions, uCEFResourceHandler, uCEFGetGeolocationCallback;
const
Kernel32DLL = 'kernel32.dll';
@ -184,10 +184,13 @@ procedure LogicalToDevice(var aRect : TCEFRect; const aDeviceScaleFactor : doubl
function GetScreenDPI : integer;
function GetDeviceScaleFactor : single;
function CefGetGeolocation(const aCallbackFunction : TOnLocationUpdate) : boolean;
implementation
uses
uCEFConstants, uCEFApplication, uCEFSchemeHandlerFactory, uCEFValue, uCEFBinaryValue;
uCEFConstants, uCEFApplication, uCEFSchemeHandlerFactory, uCEFValue,
uCEFBinaryValue;
function CefColorGetA(color: TCefColor): Byte;
begin
@ -1006,6 +1009,14 @@ begin
cef_load_crlsets_file(@TempPath);
end;
function CefGetGeolocation(const aCallbackFunction : TOnLocationUpdate) : boolean;
var
TempGeoCallBack : ICefGetGeolocationCallback;
begin
TempGeoCallBack := TCefFastGetGeolocationCallback.Create(aCallbackFunction);
Result := (cef_get_geolocation(TempGeoCallBack.Wrap) <> 0);
end;
function CefIsKeyDown(aWparam : WPARAM) : boolean;
begin
Result := (GetKeyState(aWparam) < 0);