/*
* Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
*
- * Licensed under the Flora License, Version 1.0 (the "License");
+ * Licensed under the Flora License, Version 1.1 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* @file BoxManager.cpp
* @author Yunchan Cho (yunchan.cho@samsung.com)
*/
+#include <string>
#include <map>
+#include <ctime>
#include <ewk_context.h>
#include <Plugin/IBoxPluginFactory.h>
#include <Plugin/box_plugin_interface.h>
case REQUEST_CMD_CHANGE_PERIOD:
result = requestChangePeriod(boxInfo->instanceId, boxInfo->period);
break;
+ case REQUEST_CMD_UPDATE_BOX:
+ result = requestUpdateBox(boxInfo->boxId, boxInfo->contentInfo);
+ break;
default:
LogD("not available request type");
break;
return false;
}
- return box->pause();
+ // paused by switching other page
+ return box->pause(false);
}
bool BoxManager::requestResumeAll()
{
LogD("enter");
for (auto it = m_boxMap.begin(); it != m_boxMap.end(); it++) {
- it->second->resume();
+ if (it->second->isCurrentTab()) {
+ it->second->resume();
+ }
}
return true;
{
LogD("enter");
for (auto it = m_boxMap.begin(); it != m_boxMap.end(); it++) {
- it->second->pause();
+ if (it->second->isCurrentTab()) {
+ // paused by entering background
+ it->second->pause(true);
+ }
}
return true;
return box->changePeriod(period);
}
+bool BoxManager::requestUpdateBox(std::string& boxId, std::string& contentInfo)
+{
+ LogD("enter");
+
+ IBoxPtr box;
+ box.reset();
+
+ time_t requestTime = time(NULL);
+
+ for (auto it = m_boxMap.begin(); it != m_boxMap.end(); ++it) {
+ if (it->first.find(boxId) == std::string::npos) {
+ continue;
+ }
+ box = it->second;
+ box->update(requestTime, contentInfo);
+ }
+
+ return true;
+}
+
void BoxManager::insertBoxMap(std::string& instanceId, IBoxPtr box)
{
if (!searchBoxMap(instanceId)) {