app uri passing by localization
authorTomasz Iwanek <t.iwanek@samsung.com>
Mon, 4 Mar 2013 10:16:11 +0000 (11:16 +0100)
committerGerrit Code Review <gerrit2@kim11>
Thu, 14 Mar 2013 02:22:32 +0000 (11:22 +0900)
[Issue#]       LINUXWRT-149
[Feature]      app uri handling in localization
[Cause]        N/A
[Solution]     N/A
[Verification] No regression in working. No logical difference. Check widgets from w3c which uses locales dir (run them) or just check any widget (up to you)

Change-Id: I8d149c0c57fac6aa780191d503739ede4b685817

modules/localization/src/w3c_file_localization.cpp
modules/utils/src/warp_iri.cpp

index 75a6bf2..4bea51f 100644 (file)
@@ -41,6 +41,7 @@ using namespace WrtDB;
 namespace {
 const DPL::String FILE_URI_BEGIN = L"file://";
 const DPL::String WIDGET_URI_BEGIN = L"widget://";
+const DPL::String APP_URI_BEGIN = L"app://";
 const DPL::String LOCALE_PREFIX = L"locales/";
 
 DPL::Optional<std::string> GetFilePathInWidgetPackageInternal(
@@ -156,6 +157,15 @@ DPL::Optional<DPL::String> getFilePathInWidgetPackageFromUrl(
                 req.erase(0, position + 1);
             }
         }
+    } else if(req.find(APP_URI_BEGIN) == 0) {
+        req.erase(0, APP_URI_BEGIN.length());
+        DPL::String id = *dao->getTizenAppId();
+        if(req.substr(0, id.size()) != id)
+        {
+            LogError("Tizen id does not match, ignoring");
+            return DPL::Optional<DPL::String>::Null;
+        }
+        req.erase(0, id.length());
     } else {
         LogDebug("Unknown path format, ignoring");
         return DPL::Optional<DPL::String>::Null;
@@ -163,6 +173,7 @@ DPL::Optional<DPL::String> getFilePathInWidgetPackageFromUrl(
 
     auto widgetPath = dao->getPath();
 
+    LogDebug("Required path: " << req);
     DPL::Optional<DPL::String> found =
         GetFilePathInWidgetPackageInternal(widgetPath, req);
 
index 9edf59f..ae30121 100644 (file)
@@ -40,8 +40,9 @@ namespace {
 // Unfortunatly all widgets are using file protocol to load its data from
 // hard drive. What's why we cannot check any iri with file schema.
 
-const char *IRI_IGNORED_SCHEME[] = { "file://", "widget://", "tel:", "sms:",
-                                     "mmsto:", "mailto:", "data:", "blob:", 0 };
+const char *IRI_IGNORED_SCHEME[] = { "file://", "widget://", "app://", "tel:",
+                                     "sms:", "mmsto:", "mailto:", "data:", "blob:",
+                                     0 };
 
 const DPL::String SCHEMA_HTTP = DPL::FromUTF8String("http");
 const DPL::String SCHEMA_HTTPS = DPL::FromUTF8String("https");