[Release] livebox.web-provider-1.18
[platform/framework/web/web-provider.git] / src / Core / BoxManager.cpp
index 1b95d61..28efcca 100644 (file)
@@ -75,6 +75,9 @@ bool BoxManager::doCommand(const request_cmd_type type, const BoxInfoPtr& boxInf
     case REQUEST_CMD_CHANGE_PERIOD:
         result = requestChangePeriod(boxInfo->instanceId, boxInfo->period);
         break;
+    case REQUEST_CMD_UPDATE_BOX:
+        result = requestUpdateBox(boxInfo->instanceId);
+        break;
     default:
         LogD("not available request type");
         break;
@@ -156,14 +159,17 @@ bool BoxManager::requestPauseBox(std::string& instanceId)
         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;
@@ -173,7 +179,10 @@ bool BoxManager::requestPauseAll()
 {
     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;
@@ -214,6 +223,17 @@ bool BoxManager::requestChangePeriod(std::string& instanceId, float period)
     return box->changePeriod(period);
 }
 
+bool BoxManager::requestUpdateBox(std::string& instanceId)
+{
+    LogD("enter");
+    IBoxPtr box = searchBoxMap(instanceId);
+    if (!box) {
+        return false;
+    }
+
+    return box->update();
+}
+
 void BoxManager::insertBoxMap(std::string& instanceId, IBoxPtr box)
 {
     if (!searchBoxMap(instanceId)) {