Upstream version 11.39.250.0
[platform/framework/web/crosswalk.git] / src / xwalk / application / common / manifest_handler.cc
index 7f9a630..f01af20 100644 (file)
@@ -8,12 +8,14 @@
 
 #include "base/stl_util.h"
 #include "xwalk/application/common/manifest_handlers/csp_handler.h"
-#include "xwalk/application/common/manifest_handlers/main_document_handler.h"
 #if defined(OS_TIZEN)
-#include "xwalk/application/common/manifest_handlers/navigation_handler.h"
+#include "xwalk/application/common/manifest_handlers/tizen_app_control_handler.h"
 #include "xwalk/application/common/manifest_handlers/tizen_application_handler.h"
+#include "xwalk/application/common/manifest_handlers/tizen_appwidget_handler.h"
 #include "xwalk/application/common/manifest_handlers/tizen_metadata_handler.h"
+#include "xwalk/application/common/manifest_handlers/tizen_navigation_handler.h"
 #include "xwalk/application/common/manifest_handlers/tizen_setting_handler.h"
+#include "xwalk/application/common/manifest_handlers/tizen_splash_screen_handler.h"
 #endif
 #include "xwalk/application/common/manifest_handlers/permissions_handler.h"
 #include "xwalk/application/common/manifest_handlers/warp_handler.h"
@@ -26,8 +28,7 @@ ManifestHandler::~ManifestHandler() {
 }
 
 bool ManifestHandler::Validate(scoped_refptr<const ApplicationData> application,
-                               std::string* error,
-                               std::vector<InstallWarning>* warnings) const {
+                               std::string* error) const {
   return true;
 }
 
@@ -60,8 +61,8 @@ ManifestHandlerRegistry::~ManifestHandlerRegistry() {
 }
 
 ManifestHandlerRegistry*
-ManifestHandlerRegistry::GetInstance(Manifest::PackageType package_type) {
-  if (package_type == Manifest::TYPE_WGT)
+ManifestHandlerRegistry::GetInstance(Manifest::Type type) {
+  if (type == Manifest::TYPE_WIDGET)
     return GetInstanceForWGT();
   return GetInstanceForXPK();
 }
@@ -76,11 +77,14 @@ ManifestHandlerRegistry::GetInstanceForWGT() {
   handlers.push_back(new WidgetHandler);
   handlers.push_back(new WARPHandler);
 #if defined(OS_TIZEN)
-  handlers.push_back(new CSPHandler(Manifest::TYPE_WGT));
-  handlers.push_back(new NavigationHandler);
+  handlers.push_back(new CSPHandler(Manifest::TYPE_WIDGET));
+  handlers.push_back(new TizenAppControlHandler);
   handlers.push_back(new TizenApplicationHandler);
-  handlers.push_back(new TizenSettingHandler);
+  handlers.push_back(new TizenAppWidgetHandler);
   handlers.push_back(new TizenMetaDataHandler);
+  handlers.push_back(new TizenNavigationHandler);
+  handlers.push_back(new TizenSettingHandler);
+  handlers.push_back(new TizenSplashScreenHandler);
 #endif
   widget_registry_ = new ManifestHandlerRegistry(handlers);
   return widget_registry_;
@@ -94,8 +98,7 @@ ManifestHandlerRegistry::GetInstanceForXPK() {
   std::vector<ManifestHandler*> handlers;
   // FIXME: Add manifest handlers here like this:
   // handlers.push_back(new xxxHandler);
-  handlers.push_back(new CSPHandler(Manifest::TYPE_XPK));
-  handlers.push_back(new MainDocumentHandler);
+  handlers.push_back(new CSPHandler(Manifest::TYPE_MANIFEST));
   handlers.push_back(new PermissionsHandler);
   xpk_registry_ = new ManifestHandlerRegistry(handlers);
   return xpk_registry_;
@@ -115,7 +118,7 @@ bool ManifestHandlerRegistry::ParseAppManifest(
        iter != handlers_.end(); ++iter) {
     ManifestHandler* handler = iter->second;
     if (application->GetManifest()->HasPath(iter->first) ||
-        handler->AlwaysParseForType(application->GetType())) {
+        handler->AlwaysParseForType(application->manifest_type())) {
       handlers_by_order[order_map_[handler]] = handler;
     }
   }
@@ -130,14 +133,13 @@ bool ManifestHandlerRegistry::ParseAppManifest(
 
 bool ManifestHandlerRegistry::ValidateAppManifest(
     scoped_refptr<const ApplicationData> application,
-    std::string* error,
-    std::vector<InstallWarning>* warnings) {
+    std::string* error) {
   for (ManifestHandlerMap::iterator iter = handlers_.begin();
        iter != handlers_.end(); ++iter) {
     ManifestHandler* handler = iter->second;
     if ((application->GetManifest()->HasPath(iter->first) ||
-         handler->AlwaysValidateForType(application->GetType())) &&
-        !handler->Validate(application, error, warnings))
+         handler->AlwaysValidateForType(application->manifest_type())) &&
+        !handler->Validate(application, error))
       return false;
   }
   return true;
@@ -145,8 +147,8 @@ bool ManifestHandlerRegistry::ValidateAppManifest(
 
 // static
 void ManifestHandlerRegistry::SetInstanceForTesting(
-    ManifestHandlerRegistry* registry, Manifest::PackageType package_type) {
-  if (package_type == Manifest::TYPE_WGT) {
+    ManifestHandlerRegistry* registry, Manifest::Type type) {
+  if (type == Manifest::TYPE_WIDGET) {
     widget_registry_ = registry;
     return;
   }