Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
CEF ChromeRuntime
CEF ChromeRuntime
Hi,
First thanks for all your hard work on this project.
I'm checking the new ChromeRuntime in TinyBrowser project on CEF 92 and I have a few question if you can enlighten me
It really runs OK, with extensions.
- Is it possible to have components in the browser window? like a navigation edit box and back, forward, refresh buttons ?
- how to send messages between CEF thread and the app( or other app) if there is no handle?
Hope you can help me!
Thanks again.
First thanks for all your hard work on this project.
I'm checking the new ChromeRuntime in TinyBrowser project on CEF 92 and I have a few question if you can enlighten me
It really runs OK, with extensions.
- Is it possible to have components in the browser window? like a navigation edit box and back, forward, refresh buttons ?
- how to send messages between CEF thread and the app( or other app) if there is no handle?
Hope you can help me!
Thanks again.
- salvadordf
- Posts: 4083
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: CEF ChromeRuntime
Hi,
This is the CEF issue where the project maintainer keeps track of all the changes :
https://bitbucket.org/chromiumembedded/cef/issues/2969/support-chrome-windows-with-cef-callbacks
As you can see, it's still not marked as "resolved" and the maintainer considers it as experimental at this moment.
I still haven't tried to add a browser in that mode inside a Delphi form but I'll probably wait until it's marked as "resolved".
Adding Delphi controls into those forms is not possible at this moment because they are created by CEF.
You can create a custom thread with a custom message loop similar to the one you can see in the TCEFBrowserThread class inside the ConsoleBrowser2 demo. Then you can send messages from CEF threads to your custom thread.
This is the CEF issue where the project maintainer keeps track of all the changes :
https://bitbucket.org/chromiumembedded/cef/issues/2969/support-chrome-windows-with-cef-callbacks
As you can see, it's still not marked as "resolved" and the maintainer considers it as experimental at this moment.
I still haven't tried to add a browser in that mode inside a Delphi form but I'll probably wait until it's marked as "resolved".
Adding Delphi controls into those forms is not possible at this moment because they are created by CEF.
You can create a custom thread with a custom message loop similar to the one you can see in the TCEFBrowserThread class inside the ConsoleBrowser2 demo. Then you can send messages from CEF threads to your custom thread.
Re: CEF ChromeRuntime
Hi,
Thanks for your reply.
Works OK, to send/receive messages.
Do you think it needs to make source changes or just some modification to the demo project?
Also another thing I've seen, It doesn't let me change the URL after is loaded, any idea why ?
Thanks again!
Thanks for your reply.
I found a workaround, I've added a FHandle to TTinyBrowser and on create:You can create a custom thread with a custom message loop similar to the one you can see in the TCEFBrowserThread class inside the ConsoleBrowser2 demo. Then you can send messages from CEF threads to your custom thread.
Code: Select all
FHandle := AllocateHwnd(WndProc);
Pity , seems it will take another few months, seems that issue is started from June 2020.I still haven't tried to add a browser in that mode inside a Delphi form but I'll probably wait until it's marked as "resolved".
Do you think it needs to make source changes or just some modification to the demo project?
Also another thing I've seen, It doesn't let me change the URL after is loaded, any idea why ?
Code: Select all
TinyBrowser.Chromium.LoadUrl('https://www.test.com');
- salvadordf
- Posts: 4083
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: CEF ChromeRuntime
I haven't checked but I wouldn't be surprised if it needs some modifications in the current components.
TChromiumCore needs to be fixed in order to work correctly in this mode.mike2k wrote: ↑Fri Sep 17, 2021 4:32 pm Also another thing I've seen, It doesn't let me change the URL after is loaded, any idea why ?Code: Select all
TinyBrowser.Chromium.LoadUrl('https://www.test.com');
Thanks for reporting this issue!
- salvadordf
- Posts: 4083
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: CEF ChromeRuntime
I just uploaded the fix for the initialization issue you described and now you can call TChromium.LoadURL
Re: CEF ChromeRuntime
Thanks, works now!salvadordf wrote: ↑Sat Sep 18, 2021 9:02 am I just uploaded the fix for the initialization issue you described and now you can call TChromium.LoadURL
I'll report back if I find any other anomaly , already filled an issue with fullscreen crash:
https://bitbucket.org/chromiumembedded/cef/issues/3182/windows-fullscreen-broken-cefclient-in
I have a few questions after testing ChromeRuntime, if you can help
- I've added OnConsoleMessage event. it gets all the messages but they also show in dev tools console. Even if I set result to true/false. Any idea why?
- how to disable developer tools?
- TCEFWindowComponent.GetAsPanel would it help to be used with TForm?
Thanks again.
- salvadordf
- Posts: 4083
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: CEF ChromeRuntime
I put a breakpoint in that event and the True (1) result is returned correctly to CEF.
I also tried several old CEF versions with the DOMVisitor demo because it uses the "console trick" to send information by calling "console.log" in JS and all of them had the same issue.
I went back to CEF 85 but we should modify cefclient and test this issue there because this could be a CEF issue.
I haven't tested this but try removing the "Inspect" context menu option and intercept the F12 key press.
Use TChromium.OnBeforeContextMenu and TChromium.OnPreKeyEvent
I'm afraid I have limited experience with the Views framework and I don't know if that could help. I would need to investigate.
Re: CEF ChromeRuntime
Unfortunately I can't help on this, I don't know much C language. But seems to be a CEF issue.I went back to CEF 85 but we should modify cefclient and test this issue there because this could be a CEF issue.
Thanks for the PreKey tip, I was already working on this.Use TChromium.OnBeforeContextMenu and TChromium.OnPreKeyEvent
I thought you know some flag to disable developer tools, but seems there isn't.
Btw, found another possible bug with CEFWindowComponent OnKeyEvent, it's not triggered at all (only if find box is in focus (CTRL+F), it triggers)
With ChromeRuntime false, it's triggered correctly.
Also, I came across another issue.
I want to prevent the user to open any new window, because they have Chromium design.
So there are 2 possible solutions, either I catch somehow all new windows and block them or open them as plain browser window.
Chromium OnBeforePopup is not triggered when user presses SHIFT or CTRL key and clicks on a link (link opens in new window)
EDIT: Just tried Chromium RenderCompMsg to catch mouse down, but it's not even triggered.
Any help is welcomed
Thanks
- salvadordf
- Posts: 4083
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: CEF ChromeRuntime
If that event is triggered sometimes then the handler is implemented correctly. It's CEF/Chromium the one who decides when it's triggered.
Chrome runtime is not fully implemented in CEF and this could be just an unfinished feature.
Use the TChromium.OnOpenUrlFromTab and TChromium.OnBeforePopup events like this :mike2k wrote: ↑Sat Sep 18, 2021 4:51 pm Also, I came across another issue.
I want to prevent the user to open any new window, because they have Chromium design.
So there are 2 possible solutions, either I catch somehow all new windows and block them or open them as plain browser window.
Chromium OnBeforePopup is not triggered when user presses SHIFT or CTRL key and clicks on a link (link opens in new window)
EDIT: Just tried Chromium RenderCompMsg to catch mouse down, but it's not even triggered.
https://github.com/salvadordf/CEF4Delphi/blob/fe3d171c5b9ce0c1c4a8a7ea4aff8ab8dc4a7a1e/demos/Delphi_VCL/SimpleBrowser2/uSimpleBrowser2.pas#L187
Re: CEF ChromeRuntime
Perfect, OpenURLFromTab does the job! Thanks!Use the TChromium.OnOpenUrlFromTab and TChromium.OnBeforePopup events like this :
https://github.com/salvadordf/CEF4Delphi/blob/fe3d171c5b9ce0c1c4a8a7ea4aff8ab8dc4a7a1e/demos/Delphi_VCL/SimpleBrowser2/uSimpleBrowser2.pas#L187
When user click on a link and ALT is pressed the page is downloaded.
I've tried OnDownloadUpdated and OnBeforeDownload, which are not triggered. Any events I can check to block this?