#git:framework/web/web-provider
Name: livebox.web-provider
Summary: web framework for livebox
-Version: 1.43
+Version: 1.46
Release: 1
Group: main/app
License: Flora License, Version 1.1
RenderInfoPtr renderInfo = makeRenderInfo(renderTypeCreate, URL_TYPE_BOX);
m_boxBuffer->stopCanvasUpdate();
m_view->showBox(renderInfo);
- ecore_idler_add(startUpdateRenderBufferIdlerCallback, m_boxBuffer.get());
} catch (...) {
return false;
}
RenderInfoPtr renderInfo = makeRenderInfo(renderTypeUpdate, URL_TYPE_BOX);
m_boxBuffer->stopCanvasUpdate();
m_view->showBox(renderInfo);
- ecore_idler_add(startUpdateRenderBufferIdlerCallback, m_boxBuffer.get());
}
void Box::setState(IBoxStatePtr state)
}
// In the future, new content info can be set by caller
- box->update(time(NULL), box->m_boxInfo->contentInfo);
+ box->updateInternal();
return true;
}
callbacks.set_period = BoxDaemonImpl::boxPeriodChangeCallback;
}
-const char* BoxDaemonImpl::getBoxType(const char* boxId)
+std::string BoxDaemonImpl::getBoxType(const char* boxId)
{
LogD("enter");
if (!boxId) {
- return NULL;
+ return std::string();
}
const char* type = web_provider_livebox_get_box_type(boxId);
- std::string boxType;
if (!type) {
- std::string serviceBoxId(boxId);
- boxType = m_pluginConnector->getBoxType(serviceBoxId);
+ std::string boxType = m_pluginConnector->getBoxType(boxId);
if (boxType.empty()) {
LogD("unrecognized box id");
- return NULL;
+ } else {
+ LogD("box id: %s, type: %s", boxId, boxType.c_str());
}
- type = strdup(boxType.c_str());
+ return boxType;
}
LogD("box id: %s, type: %s", boxId, type);
- return type;
+ std::string result{type};
+ free(const_cast<char*>(type));
+ return result;
}
BoxInfoPtr BoxDaemonImpl::initializeBoxInfo(ProviderEventArgPtr arg)
return BoxInfoPtr();
}
- const char* type = getBoxType(arg->pkgname);
- if (!type) {
+ std::string type = getBoxType(arg->pkgname);
+ if (type.empty()) {
return BoxInfoPtr();
}
BoxInfoPtr infoPtr = BoxInfoPtr(new BoxInfo(type, arg->pkgname, arg->id));
- delete[] type;
return infoPtr;
}
// common private functions
void setProviderCallbacks(ProviderCallbacks& callbacks);
- const char* getBoxType(const char* boxId);
+ std::string getBoxType(const char* boxId);
BoxInfoPtr initializeBoxInfo(ProviderEventArgPtr arg);
// functions for handling appcontrol per operation
* @file AppBoxManager.cpp
* @author Yunchan Cho (yunchan.cho@samsung.com)
*/
+#include <map>
#include <core_module.h>
#include <Plugin/IBoxPluginFactory.h>
#include <Core/BoxData.h>
#include <Core/BoxManager.h>
#include <Core/IBox.h>
+#include <Core/Util/Log.h>
+#include <API/web_provider_livebox_info.h>
#include "AppBoxObserver.h"
#include "AppBoxManager.h"
if (!ret) {
throw; // throw exeception
}
- m_defaultEwkContext.reset(
- ewk_context_new_with_injected_bundle_path(bundlePath.c_str()));
AppBoxObserver::Instance()->initialize();
}
bool AppBoxManager::requestAddBox(BoxInfoPtr boxInfo, EwkContextPtr ewkContext)
{
- ewkContext = getAvailableEwkContext();
+
+ const char* appId =
+ web_provider_livebox_get_app_id(boxInfo->boxId.c_str());
+
+ if (!appId) {
+ LogD("no appid of %s", boxInfo->boxId.c_str());
+ return false;
+ }
+
+ std::string appIdStr(appId);
+ delete appId;
+
+ auto it = m_ewkContextMap.find(appIdStr);
+ if (it == m_ewkContextMap.end()) {
+ ewkContext = getAvailableEwkContext();
+ insertContextMap(appIdStr, ewkContext);
+ } else {
+ ewkContext = it->second;
+ }
+
if (!BoxManager::requestAddBox(boxInfo, ewkContext)) {
return false;
}
- insertContextMap(ewkContext, boxInfo->instanceId);
return true;
}
return false;
}
- eraseContextMap(instanceId);
return true;
}
EwkContextPtr AppBoxManager::getAvailableEwkContext()
{
- // TODO make proper Ewk_Context instance, and update context map
- // std::shared_ptr<Ewk_Context> context(
- // ewk_context_new(),
- // BoxManager::deleteDefaultEwkContext);
-
- return m_defaultEwkContext;
+ return EwkContextPtr(
+ ewk_context_new_with_injected_bundle_path(bundlePath.c_str()),
+ BoxManager::EwkContextDeleter());
}
-void AppBoxManager::insertContextMap(EwkContextPtr ewkContext, std::string& instanceId)
+void AppBoxManager::insertContextMap(std::string& appId, EwkContextPtr ewkContext)
{
- // not implemented
+ m_ewkContextMap.insert(EwkContextMapPair(appId, ewkContext));
}
-void AppBoxManager::eraseContextMap(std::string& instanceId)
+void AppBoxManager::eraseContextMap(std::string& appId)
{
- // not implemented
+ m_ewkContextMap.erase(appId);
}
bool requestRemoveBox(std::string& instanceId);
EwkContextPtr getAvailableEwkContext();
- void insertContextMap(EwkContextPtr context, std::string& instanceId);
- void eraseContextMap(std::string& instanceId);
+ void insertContextMap(std::string& appId, EwkContextPtr ewkContext);
+ void eraseContextMap(std::string& appId);
explicit AppBoxManager(IBoxPluginFactoryPtr factory);
// members
- typedef std::map<EwkContextPtr, IBoxPtr> EwkContextMap;
- EwkContextMap m_contextMap;
- EwkContextPtr m_defaultEwkContext;
+ typedef std::map<std::string, EwkContextPtr> EwkContextMap;
+ typedef std::pair<std::string, EwkContextPtr> EwkContextMapPair;
+ EwkContextMap m_ewkContextMap;
};
}
m_boxRenderBuffer = AppBoxObserver::Instance()->getRenderBuffer(m_instanceId);
- m_pdFastOpen = web_provider_livebox_get_pd_fast_open(m_boxId.c_str()) ? true : false;
+
+ // use fastopen to default
+ // m_pdFastOpen = web_provider_livebox_get_pd_fast_open(m_boxId.c_str()) ? true : false;
+ m_pdFastOpen = false;
AppBoxObserver::Instance()->registerRenderView(m_instanceId, this);
}
return true;
}
-std::string BoxPluginConnector::getBoxType(std::string& serviceBoxId)
+std::string BoxPluginConnector::getBoxType(const std::string& serviceBoxId)
{
LogD("enter");
virtual bool shutdown();
virtual bool requestCommand(
const request_cmd_type type, const BoxInfoPtr& boxInfo);
- virtual std::string getBoxType(std::string& serviceBoxId);
+ virtual std::string getBoxType(const std::string& serviceBoxId);
virtual ~BoxPluginConnector();
private:
virtual bool shutdown() = 0;
virtual bool requestCommand(
const request_cmd_type type, const BoxInfoPtr& boxInfo) = 0;
- virtual std::string getBoxType(std::string& serviceBoxId) = 0;
+ virtual std::string getBoxType(const std::string& serviceBoxId) = 0;
virtual ~IBoxPluginConnector() {};
};