PluginManager change to support tizen privilege policy.
authorTaejeong Lee <taejeong.lee@samsung.com>
Wed, 23 Jan 2013 02:12:43 +0000 (11:12 +0900)
committerTaejeong Lee <taejeong.lee@samsung.com>
Wed, 23 Jan 2013 05:59:51 +0000 (14:59 +0900)
 * For tizen app type, all plugin object loading is allowed.
 * Security check is performed on ace.

[Issue#] N/A
[Problem] Plugin support policy.
[Cause] N/A
[Solution] For tizen app type, all plugin object loading is allowed.

Change-Id: I9761c2d7011a20682234d30f14c67796a437b8c1

src/modules/tizen/PluginManager/PluginManager.cpp

index d7c6080..8f71524 100644 (file)
@@ -188,40 +188,75 @@ Api::IPluginManager::PropertyList PluginManager::getProperties() const
 
     m_propertyCache = PropertyList();
 
-    WrtDB::DbWidgetFeatureSet features;
-    Try
+    WrtDB::WidgetDAOReadOnly dao(m_widgetHandle);
+    string localUri = m_objectUri + SEPARATOR;
+
+    if (dao.getWidgetType() == WrtDB::APP_TYPE_TIZENWEBAPP)
     {
-        WrtDB::WidgetDAOReadOnly dao(m_widgetHandle);
-        features = dao.getFeaturesList();
+        WrtDB::PluginHandleList pluginHandleList =
+            WrtDB::PluginDAOReadOnly::getPluginHandleList();
+
+        FOREACH(it_pluginHandle, pluginHandleList)
+        {
+            WrtDB::ImplementedObjectsList implObjectList =
+                WrtDB::PluginDAOReadOnly::getImplementedObjectsForPluginHandle(
+                    *it_pluginHandle);
+
+            FOREACH(it_implObject, implObjectList)
+            {
+                //check if implemented object stats with localUri
+                if (it_implObject->find(localUri) == 0) {
+                    string property = *it_implObject;
+                    //remove local uri that predicts property name.
+                    property.erase(0, localUri.size());
+                    //check if property has its own properties.
+                    size_t pos = property.find(SEPARATOR);
+                    if (pos != string::npos) {
+                        //if so then remove them.
+                        property.erase(pos);
+                    }
+                    m_propertyCache->push_back(property);
+                }
+            }
+        }
     }
-    Catch(WrtDB::WidgetDAOReadOnly::Exception::Base)
+    else
     {
-        LogError("Cannot get feature list");
-        ReThrow(Commons::PlatformException);
-    }
+        WrtDB::DbWidgetFeatureSet features;
 
-    string localUri = m_objectUri + SEPARATOR;
-    WrtDB::DbWidgetFeatureSet::const_iterator feature = features.begin();
-    for (; feature != features.end(); ++feature) {
-        WrtDB::ImplementedObjectsList implObjs =
-            WrtDB::PluginDAOReadOnly::getImplementedObjectsForPluginHandle(
-                feature->pluginId);
-        FOREACH(it, implObjs) {
-            //check if implemented object stats with localUri
-            if (it->find(localUri) == 0) {
-                string property = *it;
-                //remove local uri that predicts property name.
-                property.erase(0, localUri.size());
-                //check if property has its own properties.
-                size_t pos = property.find(SEPARATOR);
-                if (pos != string::npos) {
-                    //if so then remove them.
-                    property.erase(pos);
+        Try
+        {
+            features = dao.getFeaturesList();
+        }
+        Catch(WrtDB::WidgetDAOReadOnly::Exception::Base)
+        {
+            LogError("Cannot get feature list");
+            ReThrow(Commons::PlatformException);
+        }
+
+        WrtDB::DbWidgetFeatureSet::const_iterator feature = features.begin();
+        for (; feature != features.end(); ++feature) {
+            WrtDB::ImplementedObjectsList implObjs =
+                WrtDB::PluginDAOReadOnly::getImplementedObjectsForPluginHandle(
+                    feature->pluginId);
+            FOREACH(it, implObjs) {
+                //check if implemented object stats with localUri
+                if (it->find(localUri) == 0) {
+                    string property = *it;
+                    //remove local uri that predicts property name.
+                    property.erase(0, localUri.size());
+                    //check if property has its own properties.
+                    size_t pos = property.find(SEPARATOR);
+                    if (pos != string::npos) {
+                        //if so then remove them.
+                        property.erase(pos);
+                    }
+                    m_propertyCache->push_back(property);
                 }
-                m_propertyCache->push_back(property);
             }
         }
     }
+
     return *m_propertyCache;
 }