Adding a new CEF type with strings

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

Adding a new CEF type with strings

Postby usaini » Tue Sep 28, 2010 2:54 pm

I'm trying to add a new CEF type (a cef history item) which will probably contain strings. I'm wondering what the best way to deal with this is for the C API. Should I create my own class and then for the C API, create several functions similar to cef_string.h that deal with the proper memory allocation for it? I figure this is probably necessary since I'll also want to create a std::vector<> of these items for the cpp api and I'll have to wrap the vector similarly as well. However, I'm not sure if there is a better way to do this.

I also have a problem with the translator.bat complaining that "Exception: Failed to translate type: cef_history_item"

even though this is defined in cef_types.h and the compiler works/finds it appropriately. Is there somewhere that I need to change/edit/update the script for it?
usaini
Newbie
 
Posts: 3
Joined: Tue Sep 28, 2010 2:20 pm

Re: Adding a new CEF type with strings

Postby magreenblatt » Wed Sep 29, 2010 8:20 am

Take a look at CefWindowInfo and cef_window_info_t for an example of how to pass a structure containing strings. Do a search for 'cef_window_info_t' in tools/cef_parser.py to identify the places that you'll need to change in order to support translation of your new type.

The cef_string_list_t type and related functions in cef_string_list.h are used by the C API to represent string vectors.

Regards,
Marshall
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: Adding a new CEF type with strings

Postby usaini » Mon Oct 18, 2010 8:12 pm

Thanks.

I just had another quick question regarding where should this new type really reside. It would not be specific to any os, so the cef_types_win.h and cef_win.h wouldn't be the right place.
However, I wanted to create a C++ structure, so if the C structure goes in cef_types.h, would it be fine to put the C++ type that inherits from the C style struct (a la CefWindowInfo) in cef.h? Should I create a new file?

Thanks.
usaini
Newbie
 
Posts: 3
Joined: Tue Sep 28, 2010 2:20 pm

Re: Adding a new CEF type with strings

Postby magreenblatt » Tue Oct 19, 2010 8:32 am

Putting it in cef.h should be fine for now. We can always move it somewhere else if/when appropriate.
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm


Return to CEF Discussion

Who is online

Users browsing this forum: No registered users and 27 guests