show progress bar

Do not post support requests, bug reports or feature requests. Discuss CEF here. Non-CEF related discussion goes in General Discussion!

show progress bar

Postby punamg » Mon Jan 13, 2014 1:27 am

Hi Marshal,

I want to show a progress bar while the page is loading in CEF browser. Currently in the cefclient , progress bar isnt displayed.

I have gone through the wiki and have come across the CefUrlRequest class. Do we need to use this class for showing the progress bar?
If anyone has worked on it or you have any sample code, kindly share.


Regards
Punam
punamg
Techie
 
Posts: 43
Joined: Thu Dec 05, 2013 6:00 am

Re: show progress bar

Postby magreenblatt » Mon Jan 13, 2014 9:25 am

There's no way to accurately predetermine how long page load will take, so the usefulness of a progress bar is limited. You can use the OnLoadingStateChange notification to know when loading has started and stopped.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: show progress bar

Postby punamg » Fri Jan 17, 2014 12:52 am

Hi Marshal,

Thank you for the info. "OnLoadingStateChange " is in CefLoadHandler and i tried writing this function in CefClientHandler.cpp
However, when i launch the Cef browser, this function is not getting hit for me.
Can you tell me what am I doing wrong here or missing here.
punamg
Techie
 
Posts: 43
Joined: Thu Dec 05, 2013 6:00 am

Re: show progress bar

Postby magreenblatt » Fri Jan 17, 2014 8:48 am

Did you implement CefClient::GetLoadHandler?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: show progress bar

Postby punamg » Mon Jan 20, 2014 12:32 am

Hi Marsha,

Thanx a lot. After adding GetLoadHandler, its hitting the function now :) So a big thanks.

I have a query. Currently using "OnLoadingStateChange " i just get to know if the page is still loading or done loading. However, if i want to show a progress bar that is gradually loading, i need to know how much progress is happening based on which i can show a gradually increasing bar. Is there anything like that available in CEF which tells me how much progress is done?

Currently my application uses IE which I am trying to replace with CEF. IE provides the progress value using which they can show the gradual progress.
Kindly help me if similar thing is available in CEF or you have any idea how we can implement same thing in CEF.

Thanks in advance
punamg
Techie
 
Posts: 43
Joined: Thu Dec 05, 2013 6:00 am

Re: show progress bar

Postby fengtianba » Mon May 19, 2014 7:45 am

punamg wrote:Hi Marsha,

Thanx a lot. After adding GetLoadHandler, its hitting the function now :) So a big thanks.

I have a query. Currently using "OnLoadingStateChange " i just get to know if the page is still loading or done loading. However, if i want to show a progress bar that is gradually loading, i need to know how much progress is happening based on which i can show a gradually increasing bar. Is there anything like that available in CEF which tells me how much progress is done?

Currently my application uses IE which I am trying to replace with CEF. IE provides the progress value using which they can show the gradual progress.
Kindly help me if similar thing is available in CEF or you have any idea how we can implement same thing in CEF.

Thanks in advance


I also want to know the loading percentage while loading a page,bug it seems to be difficult, but I got some usefull infomation, for chromium code ,in src/content/renderer/render_view_impl.cc file function didChangeLoadProgress(WebFrame* frame, double load_progress); the load_progress can represent the browser loading parts of the resources, I think this is useful to you,if you print the load_progress you can see percentage while loading a page. When loading successfully, the load_progress does not change.
fengtianba
Techie
 
Posts: 30
Joined: Mon Apr 28, 2014 10:53 am

Re: show progress bar

Postby alervd » Mon Feb 02, 2015 8:56 am

We need this functionality too...
Yes, Internet Explorer provides the progress of loading a web page. It would be fine if CEF could do the same thing.

Marshal, I agree with that you said, but it's not required (for us at least) for the progress to be totally accurate.

It could be determined using this algorithm:
1. If we know sizes of all the web page resources we downloading: progress = (total_downloaded) / (total_size) * 100 %.
2. If we do not: progress = (total_resource_count_downloaded) / (total_web_page_resource_count) * 100 %.
3. If the total number of resources on web page is changed by somehow, we recalculate the progress using the above method (so it can become smaller).

What do you think? Any chances for it to be implemented in some of next releases?
alervd
Newbie
 
Posts: 6
Joined: Mon Sep 30, 2013 5:42 pm

Re: show progress bar

Postby magreenblatt » Mon Feb 02, 2015 11:02 am

alervd wrote:We need this functionality too...
Yes, Internet Explorer provides the progress of loading a web page. It would be fine if CEF could do the same thing.

Marshal, I agree with that you said, but it's not required (for us at least) for the progress to be totally accurate.

It could be determined using this algorithm:
1. If we know sizes of all the web page resources we downloading: progress = (total_downloaded) / (total_size) * 100 %.
2. If we do not: progress = (total_resource_count_downloaded) / (total_web_page_resource_count) * 100 %.
3. If the total number of resources on web page is changed by somehow, we recalculate the progress using the above method (so it can become smaller).

What do you think? Any chances for it to be implemented in some of next releases?

Feel free to file a bug. I don't know that we have this information but something may be possible. We can discuss in the issue tracker.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm


Return to CEF Discussion

Who is online

Users browsing this forum: No registered users and 66 guests