Recent

Author Topic: idea for embedding a chromium browser  (Read 43509 times)

dliw

  • New Member
  • *
  • Posts: 21
Re: idea for embedding a chromium browser
« Reply #30 on: June 11, 2014, 03:02:43 pm »
that's exactly what I did in the new example  8)

zbyna

  • Jr. Member
  • **
  • Posts: 63
Re: idea for embedding a chromium browser
« Reply #31 on: June 19, 2014, 01:13:27 am »
I encountered strange behaving  :) of  Browser.Host.SendMouseClickEvent:

Code: [Select]
           event.x:=440;           
           event.y:=275;           
           event.modifiers:=[];
           aType:=MBT_LEFT;   
           mojeMouseUp:=true;
           clickCount:=1;
           Chromium.Browser.Host.SendMouseClickEvent(event, aType, mojeMouseUp,clickCount); // for MBT_RIGHT works

this code does not perform click (only choose element) for aType:=MBT_LEFT
but for MBT_RIGHT is element chosen  and clicked  :(

May be this is a feature, I am not able to judge.
Thanks for potential clarification.


 

dliw

  • New Member
  • *
  • Posts: 21
Re: idea for embedding a chromium browser
« Reply #32 on: June 19, 2014, 12:11:42 pm »
It seems that I can reproduce this - it isn't that easy to reliably find out that no click happened.

The header is ok and I couldn't find a related bug - so I have no idea.
You could try to use the debug DLL and decrease CefLogSeverity, maybe you get a hint somehow.

The best way to test, whether it is supposed to work or not, is to hack together a small CEF C(++) app - but unfortunately I'm very busy again  %)

Apart from that I would generally advise - if your code happens to be in a Cef-Callback with Browser param - to use it instead of Chromium.Browser.
This should be more reliable (e.g. makes sure you are in the "right" thread) and even faster.

zbyna

  • Jr. Member
  • **
  • Posts: 63
Re: idea for embedding a chromium browser
« Reply #33 on: June 19, 2014, 04:17:07 pm »
Thanks for response.
It seems to be CEF3 problem, I do not rule c++ to verify it.

zbyna

  • Jr. Member
  • **
  • Posts: 63
Re: idea for embedding a chromium browser
« Reply #34 on: June 19, 2014, 09:13:24 pm »
Solution is insane  :D
for the right click is enough:
Code: [Select]
event.x:=700;           
event.y:=307;         
event.modifiers:=[];
aType:=MBT_RIGHT;
mouseUp:=true;
clickCount:=1; 
Browser.Host.SendMouseClickEvent(event, aType, mouseUp, clickCount)

for the left click is a must:
Code: [Select]
aType:=MBT_LEFT;
Browser.Host.SendMouseClickEvent(event, aType, false, clickCount);
Browser.Host.SendMouseClickEvent(event, aType, true, clickCount);

 :o  :)    I have already install Visual Studio Express,but it seems that I do not begin with c++ again :D

BlueIcaro

  • Hero Member
  • *****
  • Posts: 834
    • Blog personal
Re: idea for embedding a chromium browser (@dliw)
« Reply #35 on: June 21, 2014, 08:49:31 pm »
Hi  dliw, I downloaded the lasted version of the lazarus package from https://github.com/dliw/fpCEF3.

But doesnt work with the lasted version of  Chromium Embedded Framework (CEF) Downloads (3.1750 windows 32 bits)

At the start of my test proyect show a excepcion
Quote
Invalid CEF Library version
. It's seems that there is a problem looking for a entry in the Library

But if I download the previus version (3.1650), it's works my test proyect.

/BlueIcaro

dliw

  • New Member
  • *
  • Posts: 21
Re: idea for embedding a chromium browser
« Reply #36 on: June 21, 2014, 10:05:50 pm »
Unfortunately you have to stick to CEF 1650 for now.

Of course there will be support for 1750 as soon as possible, but latest fpCEF version (which apparently doesn't work with 1750) was finished only recently - and I'm afraid I won't find time for the next update that soon.




« Last Edit: June 21, 2014, 10:11:38 pm by dliw »

zbyna

  • Jr. Member
  • **
  • Posts: 63
Re: idea for embedding a chromium browser
« Reply #37 on: August 26, 2014, 02:58:08 am »
Hi all,

I continue with playing with fpCEF3 and I met this issue:

when I try to launch this procedure (catch fileinput dialog and fill it in):

Code: [Select]
procedure TMainformCEF.ChromiumFileDialog(Sender: TObject;
  const Browser: ICefBrowser; mode: TCefFileDialogMode;const title,
  defaultFileName: ustring; acceptTypes: TStrings;
  const callback: ICefFileDialogCallback; out Result: Boolean);
 var
     fileList:TStringlist;
begin
   fileList:=TStringlist.Create;   
   fileList.Append('mojejmeno'); 
   fileList.Append('druheJmeno');
   callback.Cont(fileList);                       // trace to line 1700 in cef3ref.pas , here external sigsegv error arise
   Result:=false;
end;                       

I encountered   external sigsegv error  and debugging showed these lines in cef3ref.pas:

Code: [Select]
procedure TCefFileDialogCallbackRef.Cont(filePaths : TStrings);
Var
  list : TCefStringList;
  i    : Integer;
  item : TCefString;
begin
  list := cef_string_list_alloc;
  try
    For i := 0 to filePaths.Count - 1 do
    begin
      item := CefString(filePaths[i]);
      cef_string_list_append(list, @item);             //  this is the line which throws external sigsegv error
    end;
    PCefFileDialogCallback(FData)^.cont(FData, list);
  finally
    cef_string_list_free(list);
  end;
end;   

seems like list:Tcefstringlist does not exist (was not allocated)  :(

 Thanks for any ideas

PS: using fpCEF3.1750 , CodeTyphon 32 4.80, win7 64
 

zbyna

  • Jr. Member
  • **
  • Posts: 63
Re: idea for embedding a chromium browser
« Reply #38 on: August 29, 2014, 12:12:24 am »
Issue from previous post resolved in
https://github.com/dliw/fpCEF3

Big thanks to  dliw

z505

  • New Member
  • *
  • Posts: 38
  • think first, code after
Re: idea for embedding a chromium browser
« Reply #39 on: March 01, 2017, 07:24:21 pm »

Code: [Select]
procedure TCustomRenderProcessHandler.OnBrowserCreated(
  const browser: ICefBrowser);
begin
  mujGlobalBrowser:=browser;
  //inherited OnBrowserCreated(browser);
end;

It was tough struggle ::) but it works :)


Hi, sorry to revive an old thread, but still relevant today..

Any idea why this global variable must be used, instead of passing the Browser around as a parameter?

Seems a strange bug, that requires some kind of explanation.
think first, code after

dliw

  • New Member
  • *
  • Posts: 21
Re: idea for embedding a chromium browser
« Reply #40 on: March 01, 2017, 08:24:00 pm »
First of all: the cited code is old, dom events and listeners no longer exist.

Code: Pascal  [Select][+][-]
  1. procedure mujEventListener(const event: ICefDomEvent);
does not have a browser parameter, but the browser is needed in there.

Different example:
See DOMAccess:
Quote
// Enables access to browser in callbacks
Code: Pascal  [Select][+][-]
  1. procedure visitDOM(const document: ICefDomDocument);
again: there is no browser parameter in this callback.

But probably I don't really understand the issue...
« Last Edit: March 01, 2017, 08:30:45 pm by dliw »

z505

  • New Member
  • *
  • Posts: 38
  • think first, code after
Re: idea for embedding a chromium browser
« Reply #41 on: March 01, 2017, 08:47:08 pm »
I'm wondering why the API does not allow the browser param to be passed in...

Do they do that for a reason, to try and forbid you from accessing browser, or they just didn't think the browser param would be useful, even though it turns out it is.

Trying to avoid globals (even though, they are not always as bad as people say)
think first, code after

dliw

  • New Member
  • *
  • Posts: 21
Re: idea for embedding a chromium browser
« Reply #42 on: March 01, 2017, 08:56:16 pm »
I would think that way:
These handlers are implemented in the subprocess and the browser is global to the subprocess, so it makes little sense to have the browser as additional parameter in each callback.

Additionally any language with support for closures does not need this global variable, as the callback then can be defined inline (in fpc you could use nestedprocvars).

 

TinyPortal © 2005-2018