Fix the bug regarding checking id on recieving request of update
authorYunchan Cho <yunchan.cho@samsung.com>
Fri, 24 May 2013 09:14:19 +0000 (18:14 +0900)
committerYunchan Cho <yunchan.cho@samsung.com>
Fri, 24 May 2013 10:14:45 +0000 (19:14 +0900)
[Issue#] DCM-1440
[Problem] When the native application request a dynamic box to be updated, the request is ignored
[Cause] In case of update request from external app, web-provider receives only box id, not instance id.
        But web-provider tries to search boxes using NULL id in its maps, so that always these requests are ignored.
[Solution] During handling update request, web-provider search instances using box id that is sent from external app

Change-Id: I3377c48bae6e813c8134b791c9ec83a85dfa293c

src/Core/BoxManager.cpp

index 28efcca..c0ac7d8 100644 (file)
@@ -17,6 +17,7 @@
  * @file    BoxManager.cpp
  * @author  Yunchan Cho (yunchan.cho@samsung.com)
  */
+#include <string>
 #include <map>
 #include <ewk_context.h>
 #include <Plugin/IBoxPluginFactory.h>
@@ -76,7 +77,7 @@ bool BoxManager::doCommand(const request_cmd_type type, const BoxInfoPtr& boxInf
         result = requestChangePeriod(boxInfo->instanceId, boxInfo->period);
         break;
     case REQUEST_CMD_UPDATE_BOX:
-        result = requestUpdateBox(boxInfo->instanceId);
+        result = requestUpdateBox(boxInfo->boxId);
         break;
     default:
         LogD("not available request type");
@@ -223,15 +224,21 @@ bool BoxManager::requestChangePeriod(std::string& instanceId, float period)
     return box->changePeriod(period);
 }
 
-bool BoxManager::requestUpdateBox(std::string& instanceId)
+bool BoxManager::requestUpdateBox(std::string& boxId)
 {
     LogD("enter");
-    IBoxPtr box = searchBoxMap(instanceId);
-    if (!box) {
-        return false;
+
+    IBoxPtr box;
+    box.reset();
+    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();
     }
 
-    return box->update();
+    return true;
 }
 
 void BoxManager::insertBoxMap(std::string& instanceId, IBoxPtr box)