From: Tomasz Iwanek Date: Mon, 4 Mar 2013 10:16:11 +0000 (+0100) Subject: app uri passing by localization X-Git-Tag: submit/trunk/20130314.041840~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0bbbd1c3a41004cffa0b03bcc66c874f4ba099a6;p=platform%2Fframework%2Fweb%2Fwrt-commons.git app uri passing by localization [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 --- diff --git a/modules/localization/src/w3c_file_localization.cpp b/modules/localization/src/w3c_file_localization.cpp index 75a6bf2..4bea51f 100644 --- a/modules/localization/src/w3c_file_localization.cpp +++ b/modules/localization/src/w3c_file_localization.cpp @@ -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 GetFilePathInWidgetPackageInternal( @@ -156,6 +157,15 @@ DPL::Optional 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::Null; + } + req.erase(0, id.length()); } else { LogDebug("Unknown path format, ignoring"); return DPL::Optional::Null; @@ -163,6 +173,7 @@ DPL::Optional getFilePathInWidgetPackageFromUrl( auto widgetPath = dao->getPath(); + LogDebug("Required path: " << req); DPL::Optional found = GetFilePathInWidgetPackageInternal(widgetPath, req); diff --git a/modules/utils/src/warp_iri.cpp b/modules/utils/src/warp_iri.cpp index 9edf59f..ae30121 100644 --- a/modules/utils/src/warp_iri.cpp +++ b/modules/utils/src/warp_iri.cpp @@ -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");