namespace {
const char *LIBRARY_PATH_SEPARATOR = "/";
-const char* FEATURE_WAC20_DEVICAPIS_NAME = "http://wacapps.net/api/deviceapis";
}
class PluginLogic::Impl
typedef std::map<JSContextRef, JSPageSessionPtr> PagesSessionsSet;
PagesSessionsSet m_sessions;
-
public:
Impl();
~Impl();
bool PluginLogic::Impl::s_sanityCheck = false;
#define PLUGIN_LOGIC_SANITY_CHECK \
- if(!s_sanityCheck)\
- {\
- LogError("Object is not available. Wrong flow occured");\
- return;\
+ if (!s_sanityCheck) \
+ { \
+ LogError("Object is not available. Wrong flow occured"); \
+ return; \
}
PluginLogic::Impl::Impl()
void PluginLogic::performLibrariesUnload()
{
LogError("Libraries unload TURNED OFF");
-// m_impl->performLibrariesUnload();
+ // m_impl->performLibrariesUnload();
}
bool PluginLogic::loadPluginOnDemand(
return m_impl->loadPluginOnDemand(pluginHandle, parentObject, context);
}
-void PluginLogic::loadPluginsIntoIframes(JSGlobalContextRef context)
+void PluginLogic::loadPluginsIntoIframes(JSGlobalContextRef /*context*/)
{
LogError("This function is Deprecated");
}
-void PluginLogic::setCustomProperties(double scaleFactor,
- const char* encodedBundle,
- const char* theme)
+void PluginLogic::setCustomProperties(double /*scaleFactor*/,
+ const char* /*encodedBundle*/,
+ const char* /*theme*/)
{
LogError("This function is DEPRECATED");
}
m_impl->setCustomProperties(context, scaleFactor, encodedBundle, theme);
}
-void PluginLogic::dispatchJavaScriptEvent(CustomEventType eventType)
+void PluginLogic::dispatchJavaScriptEvent(CustomEventType /*eventType*/)
{
LogError("This function is DEPRECATED");
}
}
PluginLogic::PluginLogic() : m_impl(new PluginLogic::Impl())
-{
-}
+{}
PluginLogic::~PluginLogic()
-{
-}
+{}
void PluginLogic::Impl::initSession(int widgetHandle)
{
LogDebug("Preload plugins so file");
PluginContainerSupport::PluginsList pluginList =
- m_pluginsSupport->getPluginsList();
+ m_pluginsSupport->getPluginsList();
FOREACH(it, pluginList)
{
PluginModelPtr& pluginModel = *it;
+
+ if (!pluginModel->LibraryDependencies.Get()->empty()) {
+ // Only Root Object
+ continue;
+ }
+
PluginPtr pluginLib = pluginModel->LibraryInstance.Get();
- if (!pluginLib)
- {
+ if (!pluginLib) {
std::string path = pluginModel->LibraryPath.Get() +
- std::string(LIBRARY_PATH_SEPARATOR) +
- pluginModel->LibraryName.Get();
+ std::string(LIBRARY_PATH_SEPARATOR) +
+ pluginModel->LibraryName.Get();
pluginLib = Plugin::LoadFromFile(path);
- if (!pluginLib)
- {
+ if (!pluginLib) {
LogError("Loading library failed");
- } else
- {
+ } else {
pluginModel->LibraryInstance.Set(pluginLib);
- LogDebug("pluginModel->LibraryInstance.Set() : " << pluginLib->GetFileName());
+ LogDebug(
+ "pluginModel->LibraryInstance.Set() : " <<
+ pluginLib->GetFileName());
}
- }
- else
- {
+ } else {
LogDebug("Already loaded");
}
}
{
LogInfo("Starting widget session...");
- if (!m_pluginsSupport->isInitialized())
- {
+ if (!m_pluginsSupport->isInitialized()) {
m_pluginsSupport->Initialize(widgetHandle);
}
auto sessionIt = m_sessions.find(context);
// Check if corresponding session if not already created
- if (sessionIt != m_sessions.end())
- {
+ if (sessionIt != m_sessions.end()) {
LogWarning("Session already started!");
return;
}
LogInfo("Stopping widget session...");
auto sessionIt = m_sessions.find(context);
- if (sessionIt == m_sessions.end())
- {
+ if (sessionIt == m_sessions.end()) {
LogError("Session not exist!");
return;
}
LogInfo("Load plugin on demand");
auto sessionIt = m_sessions.find(context);
- if (sessionIt == m_sessions.end())
- {
+ if (sessionIt == m_sessions.end()) {
LogWarning("Session not exist!");
return false;
}
PLUGIN_LOGIC_SANITY_CHECK
auto sessionIt = m_sessions.find(context);
- if (sessionIt == m_sessions.end())
- {
+ if (sessionIt == m_sessions.end()) {
LogWarning("Session not exist!");
return;
}
PLUGIN_LOGIC_SANITY_CHECK
auto sessionIt = m_sessions.find(context);
- if (sessionIt == m_sessions.end())
- {
+ if (sessionIt == m_sessions.end()) {
LogWarning("Session not exist!");
return;
}
sessionIt->second->unloadFrame(context);
- m_sessions.erase(sessionIt);
+
+ // I don't know why this session should be removed here.
+ // session list is removed also from stopSession().
+ //m_sessions.erase(sessionIt);
}
void PluginLogic::Impl::setCustomProperties(JSGlobalContextRef context,
const char* encodedBundle,
const char* theme)
{
- LogInfo("set properties of window object " << scaleFactor << ", "
- << encodedBundle << ", " << theme);
+ LogInfo(
+ "set properties of window object " << scaleFactor << ", "
+ << encodedBundle << ", " <<
+ theme);
PLUGIN_LOGIC_SANITY_CHECK
auto sessionIt = m_sessions.find(context);
- if (sessionIt == m_sessions.end())
- {
+ if (sessionIt == m_sessions.end()) {
LogWarning("Session not exist!");
return;
}
sessionIt->second->setCustomProperties(scaleFactor,
encodedBundle,
theme);
-
}
void PluginLogic::Impl::dispatchJavaScriptEvent(JSGlobalContextRef context,
PLUGIN_LOGIC_SANITY_CHECK
auto sessionIt = m_sessions.find(context);
- if (sessionIt == m_sessions.end())
- {
+ if (sessionIt == m_sessions.end()) {
LogWarning("Session not exist!");
return;
}
sessionIt->second->dispatchJavaScriptEvent(eventType, data);
-
-
}