What is the purpose of Delegates in the cefclient example

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

What is the purpose of Delegates in the cefclient example

Postby palaver » Wed Nov 25, 2015 12:41 pm

Pretty much what is in the title. What is the role of the Delegate classes in the cefclient example (I'm looking at the Windows example, if it makes a difference).
palaver
Techie
 
Posts: 36
Joined: Wed Nov 25, 2015 9:51 am

Re: What is the purpose of Delegates in the cefclient exampl

Postby magreenblatt » Wed Nov 25, 2015 1:01 pm

They provide an abstraction for platform-specific implementations and functional layering. For example, the platform-specific window classes (BrowserWindowOsrWin, BrowserWindowStdWin, etc.) implement BrowserWindow. Whatever owns the browser window (in this case RootWindow) then implements BrowserWindow::Delegate to be notified of important events. The alternative would be passing a RootWindow pointer to BrowserWindow which might then lead to the creation of accidental dependency loops or incorrect access to RootWindow members from the BrowserWindow implementation.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 94 guests