Skip to content
Snippets Groups Projects
Commit f563ef61 authored by callum_linden's avatar callum_linden
Browse files

Add callback for when CEF asks to shutdown

parent ca847845
No related branches found
No related tags found
No related merge requests found
...@@ -62,6 +62,7 @@ class MediaPluginCEF : ...@@ -62,6 +62,7 @@ class MediaPluginCEF :
void onStatusMessageCallback(std::string value); void onStatusMessageCallback(std::string value);
void onTitleChangeCallback(std::string title); void onTitleChangeCallback(std::string title);
void onLoadStartCallback(); void onLoadStartCallback();
void onRequestExitCallback();
void onLoadEndCallback(int httpStatusCode); void onLoadEndCallback(int httpStatusCode);
void onAddressChangeCallback(std::string url); void onAddressChangeCallback(std::string url);
void onNavigateURLCallback(std::string url, std::string target); void onNavigateURLCallback(std::string url, std::string target);
...@@ -128,7 +129,6 @@ MediaPluginBase(host_send_func, host_user_data) ...@@ -128,7 +129,6 @@ MediaPluginBase(host_send_func, host_user_data)
// //
MediaPluginCEF::~MediaPluginCEF() MediaPluginCEF::~MediaPluginCEF()
{ {
mLLCEFLib->requestExit();
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
...@@ -199,6 +199,16 @@ void MediaPluginCEF::onLoadStartCallback() ...@@ -199,6 +199,16 @@ void MediaPluginCEF::onLoadStartCallback()
sendMessage(message); sendMessage(message);
} }
////////////////////////////////////////////////////////////////////////////////
//
void MediaPluginCEF::onRequestExitCallback()
{
mLLCEFLib->shutdown();
LLPluginMessage message("base", "goodbye");
sendMessage(message);
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// //
void MediaPluginCEF::onLoadEndCallback(int httpStatusCode) void MediaPluginCEF::onLoadEndCallback(int httpStatusCode)
...@@ -344,8 +354,7 @@ void MediaPluginCEF::receiveMessage(const char* message_string) ...@@ -344,8 +354,7 @@ void MediaPluginCEF::receiveMessage(const char* message_string)
} }
else if (message_name == "cleanup") else if (message_name == "cleanup")
{ {
LLPluginMessage message("base", "goodbye"); mLLCEFLib->requestExit();
sendMessage(message);
} }
else if (message_name == "shm_added") else if (message_name == "shm_added")
{ {
...@@ -401,6 +410,7 @@ void MediaPluginCEF::receiveMessage(const char* message_string) ...@@ -401,6 +410,7 @@ void MediaPluginCEF::receiveMessage(const char* message_string)
mLLCEFLib->setOnNavigateURLCallback(boost::bind(&MediaPluginCEF::onNavigateURLCallback, this, _1, _2)); mLLCEFLib->setOnNavigateURLCallback(boost::bind(&MediaPluginCEF::onNavigateURLCallback, this, _1, _2));
mLLCEFLib->setOnHTTPAuthCallback(boost::bind(&MediaPluginCEF::onHTTPAuthCallback, this, _1, _2, _3, _4)); mLLCEFLib->setOnHTTPAuthCallback(boost::bind(&MediaPluginCEF::onHTTPAuthCallback, this, _1, _2, _3, _4));
mLLCEFLib->setOnCursorChangedCallback(boost::bind(&MediaPluginCEF::onCursorChangedCallback, this, _1, _2)); mLLCEFLib->setOnCursorChangedCallback(boost::bind(&MediaPluginCEF::onCursorChangedCallback, this, _1, _2));
mLLCEFLib->setOnRequestExitCallback(boost::bind(&MediaPluginCEF::onRequestExitCallback, this));
LLCEFLib::LLCEFLibSettings settings; LLCEFLib::LLCEFLibSettings settings;
settings.initial_width = 1024; settings.initial_width = 1024;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment