[Release] wrt_0.8.182
authorJihoon Chung <jihoon.chung@samsung.com>
Mon, 15 Apr 2013 08:13:43 +0000 (17:13 +0900)
committerJihoon Chung <jihoon.chung@samsung.com>
Mon, 15 Apr 2013 08:13:55 +0000 (17:13 +0900)
Change-Id: I1e647272082bc21fd75d987fba243fbef12ca1d0

packaging/wrt.spec
src/view/common/CMakeLists.txt
src/view/common/view_logic_uri_support.cpp

index 28f0291..fb3cf20 100644 (file)
@@ -1,7 +1,7 @@
-#git:framework/web/wrt wrt_0.8.181
+#git:framework/web/wrt wrt_0.8.182
 Name:       wrt
 Summary:    web runtime
-Version:    0.8.181
+Version:    0.8.182
 Release:    1
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
@@ -14,6 +14,7 @@ Source101:  wrt_launchpad_daemon@.service
 BuildRequires:  cmake
 BuildRequires:  gettext
 BuildRequires:  edje-tools
+BuildRequires:  pkgconfig(aul)
 BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  pkgconfig(ewebkit2)
 BuildRequires:  pkgconfig(appcore-efl)
index b8649c2..4f22676 100644 (file)
@@ -21,6 +21,7 @@ SET(TARGET_VIEW_COMMON_LIB_STATIC "wrt-view-common")
 PKG_CHECK_MODULES(SYS_VIEW_COMMON_DEP
     wrt-commons-custom-handler-dao-ro
     appsvc
+    aul
     cert-svc-vcore
     capi-appfw-app-manager
     capi-web-url-download
index 59cec63..6725e25 100644 (file)
@@ -34,6 +34,8 @@
 #include <wrt-commons/custom-handler-dao-ro/custom_handler_dao_read_only.h>
 #include <stdio.h>
 #include <pcrecpp.h>
+#include <aul.h>
+#include <iri.h>
 
 namespace ViewModule {
 namespace UriSupport {
@@ -50,25 +52,10 @@ enum ServiceDataType
 char const * const SCHEME_TYPE_APP = "app";
 #endif
 char const * const SCHEME_TYPE_FILE = "file";
+char const * const SCHEME_TYPE_HTTP = "http";
+char const * const SCHEME_TYPE_HTTPS = "https";
 char const * const SCHEME_TYPE_WIDGET = "widget";
-
-/**
- * Parses scheme from appsvc. From mailto:test@wacapps.net
- * it will return list:
- * 0: mailto
- * 1: test@wacapps.net
- */
-std::vector<std::string> parseScheme(const std::string &scheme)
-{
-    std::vector<std::string> schemeParts;
-    std::string::size_type pos = scheme.find(":");
-    if (pos != std::string::npos) {
-        schemeParts.push_back(scheme.substr(0, pos));
-        schemeParts.push_back(
-            scheme.substr(pos + 1, scheme.length() - pos - 1));
-    }
-    return schemeParts;
-}
+const char * const SCHEME_TYPE_FILE_SLASH = "file://";
 
 bool wildcardCompare(std::string wildcardString, std::string target)
 {
@@ -185,29 +172,53 @@ std::string getAppServiceUri(bundle *bundle, WidgetModel *widgetModel)
     const char* value = NULL;
     value = appsvc_get_operation(bundle);
     std::string operation = value ? value : "";
+    if (operation.empty()) {
+        return std::string("");
+    }
 
     value = appsvc_get_mime(bundle);
     std::string mime = value ? value : "";
 
     value = appsvc_get_uri(bundle);
     std::string uri = value ? value : "";
+    if (uri.empty()) {
+        LogError("Launch with no bundle data");
+        return std::string("");
+    }
 
-    std::vector<std::string> schemeParts = parseScheme(uri);
-    std::string scheme = (schemeParts.empty()) ? "" : schemeParts[0];
+    // get scheme by iri
+    std::unique_ptr<iri_t> iri(iri_parse(uri.c_str()));
+    if (!iri.get()) {
+        LogDebug("Fail to get iri");
+        return std::string("");
+    }
+    std::string scheme;
+    if (iri->scheme) {
+        if (std::string(iri->scheme) != SCHEME_TYPE_FILE) {
+            scheme = iri->scheme;
+        }
+    }
+    if (iri->path) {
+        uri = iri->path;
+    }
 
-    std::string ignoreScheme = "file";
-    if (scheme == ignoreScheme)
-    {
-        LogInfo("exception : 'file' scheme is ignored.");
-        uri = "";
-        scheme = "";
+    // get mime type by aul api in case of mime type is empty
+    if (mime.empty()) {
+        char mimetype[128] = {0,};
+        if (AUL_R_OK ==
+            aul_get_mime_from_file(uri.c_str(),
+                                   mimetype,
+                                   sizeof(mimetype)))
+        {
+            mime = mimetype;
+        }
     }
 
     LogDebug("AppService Information");
     LogDebug(" - operation : " << operation);
-    LogDebug(" - uri : " << uri);
-    LogDebug(" - scheme : " << scheme);
-    LogDebug(" - mimetype : " << mime);
+    LogDebug(" - uri       : " << uri);
+    LogDebug(" - scheme    : " << scheme);
+    LogDebug(" - mimetype  : " << mime);
 
     WidgetApplicationServiceList appServiceList = widgetModel->AppServiceList.Get();
 
@@ -235,8 +246,8 @@ std::string getAppServiceUri(bundle *bundle, WidgetModel *widgetModel)
                 {
                     LogDebug("AppService Matched with : " << appServiceIt->src);
                     LogDebug(" - operation : " << appServiceIt->operation);
-                    LogDebug(" - uri : " << appServiceIt->scheme);
-                    LogDebug(" - mimetype : " << appServiceIt->mime);
+                    LogDebug(" - scheme    : " << appServiceIt->scheme);
+                    LogDebug(" - mimetype  : " << appServiceIt->mime);
 
                     return DPL::ToUTF8String(appServiceIt->src);
                 }
@@ -245,10 +256,10 @@ std::string getAppServiceUri(bundle *bundle, WidgetModel *widgetModel)
     }
 #endif
 
-    if (schemeParts.size() > 1) {
-        LogDebug("Scheme parts: " << schemeParts[0] << ", " << schemeParts[1]);
+    if (!scheme.empty()) {
+        LogDebug("Scheme parts: " << scheme << ", " << uri);
         return getCustomHandlerProtocolUri(
-                   widgetModel, schemeParts[0], schemeParts[1]);
+                   widgetModel, scheme, uri);
     }
     if (mime != "") {
         value = appsvc_get_data(bundle, APPSVC_DATA_SELECTED);
@@ -284,7 +295,8 @@ std::string getUri(WidgetModel *widgetModel, const std::string &defaultUri)
     // insert prefix path
     std::string preFix = DPL::ToUTF8String(widgetModel->PrefixURL.Get());
 
-    if (strstr(startUri.c_str(), "http") == startUri.c_str() ||
+    if (strstr(startUri.c_str(), SCHEME_TYPE_HTTP) == startUri.c_str() ||
+        strstr(startUri.c_str(), SCHEME_TYPE_HTTPS) == startUri.c_str() ||
         strstr(startUri.c_str(), preFix.c_str()) == startUri.c_str())
     {
         uri = DPL::FromUTF8String(startUri);