1
0

CEF Changes

This commit is contained in:
Scott E. Graves
2017-03-18 14:07:45 -05:00
parent 2d1c098d92
commit 7bed11a276
10 changed files with 390 additions and 8 deletions

View File

@@ -2,10 +2,29 @@
#define _SIADRIVEAPP_H
#include <siacommon.h>
#include <include/cef_app.h>
class CSiaDriveApp
NS_BEGIN(Sia)
class CSiaDriveApp :
public CefApp,
public CefBrowserProcessHandler
{
public:
CSiaDriveApp();
// CefApp methods:
virtual CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() OVERRIDE
{
return this;
}
// CefBrowserProcessHandler methods:
virtual void OnContextInitialized() OVERRIDE;
private:
// Include the default reference counting implementation.
IMPLEMENT_REFCOUNTING(CSiaDriveApp);
};
NS_END(1)
#endif //_SIADRIVEAPP_H

View File

@@ -0,0 +1,75 @@
#ifndef _SIADRIVEHANDLER_H
#define _SIADRIVEHANDLER_H
#include <siacommon.h>
#include <include/cef_client.h>
#include <include/cef_load_handler.h>
#include <include/cef_life_span_handler.h>
#include <include/cef_display_handler.h>
NS_BEGIN(Sia)
class CSiaDriveHandler :
public CefClient,
public CefDisplayHandler,
public CefLifeSpanHandler,
public CefLoadHandler
{
public:
explicit CSiaDriveHandler(const bool& useViews);
~CSiaDriveHandler();
// Provide access to the single global instance of this object.
static CSiaDriveHandler* GetInstance();
// CefClient methods:
virtual CefRefPtr<CefDisplayHandler> GetDisplayHandler() OVERRIDE
{
return this;
}
virtual CefRefPtr<CefLifeSpanHandler> GetLifeSpanHandler() OVERRIDE
{
return this;
}
virtual CefRefPtr<CefLoadHandler> GetLoadHandler() OVERRIDE
{
return this;
}
// CefDisplayHandler methods:
virtual void OnTitleChange(CefRefPtr<CefBrowser> browser, const CefString& title) OVERRIDE;
// CefLifeSpanHandler methods:
virtual void OnAfterCreated(CefRefPtr<CefBrowser> browser) OVERRIDE;
virtual bool DoClose(CefRefPtr<CefBrowser> browser) OVERRIDE;
virtual void OnBeforeClose(CefRefPtr<CefBrowser> browser) OVERRIDE;
// CefLoadHandler methods:
virtual void OnLoadError(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, ErrorCode errorCode, const CefString& errorText, const CefString& failedUrl) OVERRIDE;
// Request that all existing browser windows close.
void CloseAllBrowsers(bool forceClose);
bool IsClosing() const { return _isClosing; }
private:
// Platform-specific implementation.
void PlatformTitleChange(CefRefPtr<CefBrowser> browser, const CefString& title);
// True if the application is using the Views framework.
const bool _useViews;
// List of existing browser windows. Only accessed on the CEF UI thread.
typedef std::list<CefRefPtr<CefBrowser> > BrowserList;
BrowserList _browserList;
bool _isClosing;
// Include the default reference counting implementation.
IMPLEMENT_REFCOUNTING(CSiaDriveHandler);
};
NS_END(1)
#endif //_SIADRIVEHANDLER_H