Moved key contstants from application_manifest_constants to appropriate impl files 61/50161/6
authorArkadiusz Szulakiewicz <a.szulakiewi@partner.samsung.com>
Tue, 20 Oct 2015 10:30:32 +0000 (12:30 +0200)
committerPawel Sikorski <p.sikorski@samsung.com>
Wed, 4 Nov 2015 12:50:40 +0000 (04:50 -0800)
Change-Id: Ia536e26c8c6e7081009d2a52bdde565efef22865

22 files changed:
src/manifest_handlers/account_handler.cc
src/manifest_handlers/app_control_handler.cc
src/manifest_handlers/application_icons_handler.cc
src/manifest_handlers/application_manifest_constants.cc
src/manifest_handlers/application_manifest_constants.h
src/manifest_handlers/appwidget_handler.cc
src/manifest_handlers/category_handler.cc
src/manifest_handlers/content_handler.cc
src/manifest_handlers/csp_handler.cc
src/manifest_handlers/ime_handler.cc
src/manifest_handlers/metadata_handler.cc
src/manifest_handlers/navigation_handler.cc
src/manifest_handlers/permissions_handler.cc
src/manifest_handlers/service_handler.cc
src/manifest_handlers/setting_handler.cc
src/manifest_handlers/splash_screen_handler.cc
src/manifest_handlers/tizen_application_handler.cc
src/manifest_handlers/warp_handler.cc
src/manifest_handlers/widget_handler.cc
src/tpk_manifest_handlers/author_handler.cc
src/unit_tests/content_handler_unittest.cc
src/unit_tests/service_handler_unittest.cc

index d6d70b72d85dee75a4e761f5ce482f8862acf086..53e7854f5f0d0603d4267f26d4d983c7e4b5dbbb 100644 (file)
@@ -13,6 +13,13 @@ const char kSectionIconAccount[] = "Account";
 const char kSectionIconAccountSmall[] = "AccountSmall";
 const char kTrueValueString[] = "true";
 const char kFalseValueString[] = "false";
+const char kAccountMASKey[] = "@multiple-account-support";
+const char kAccountSectionKey[] = "@section";
+const char kAccountTextKey[] = "#text";
+const char kAccountNameKey[] = "display-name";
+const char kAccountLangKey[] = "@lang";
+const char kAccountIconKey[] = "icon";
+const char kAccountCapabilityKey[] = "capability";
 }
 
 namespace wgt {
@@ -52,7 +59,7 @@ bool AccountHandler::ParseSingleAccountElement(
     std::string* error) {
   std::string multiple_apps_support;
   SingleAccountInfo single_account;
-  if (!item_dict->GetString(keys::kAccountMASKey, &multiple_apps_support)) {
+  if (!item_dict->GetString(kAccountMASKey, &multiple_apps_support)) {
     *error = "Error while parsing multiple apps support in account";
     return false;
   }
@@ -88,7 +95,7 @@ bool AccountHandler::ParseAccountIcons(
   const parser::Value* val = nullptr;
   const parser::DictionaryValue* dict = nullptr;
   const parser::ListValue* list = nullptr;
-  if (item_dict->Get(keys::kAccountIconKey, &val)) {
+  if (item_dict->Get(kAccountIconKey, &val)) {
     if (val->GetAsDictionary(&dict)) {
       if (!ParseSingleAccountIcon(dict, info))
         return false;
@@ -107,12 +114,12 @@ bool AccountHandler::ParseSingleAccountIcon(
     const parser::DictionaryValue* item_dict,
     SingleAccountInfo* info) {
   std::string section;
-  item_dict->GetString(keys::kAccountSectionKey, &section);
+  item_dict->GetString(kAccountSectionKey, &section);
   if (section.compare(kSectionIconAccount) != 0 &&
       section.compare(kSectionIconAccountSmall) != 0)
     return false;
   std::string icon_path;
-  item_dict->GetString(keys::kAccountTextKey, &icon_path);
+  item_dict->GetString(kAccountTextKey, &icon_path);
   info->icon_paths.push_back(std::make_pair(section, icon_path));
   return true;
 }
@@ -123,7 +130,7 @@ bool AccountHandler::ParseAccountNames(
   const parser::Value* val = nullptr;
   const parser::DictionaryValue* dict = nullptr;
   const parser::ListValue* list = nullptr;
-  if (item_dict->Get(keys::kAccountNameKey, &val)) {
+  if (item_dict->Get(kAccountNameKey, &val)) {
     if (val->GetAsDictionary(&dict)) {
       if (!ParseSingleAccountName(dict, info))
         return false;
@@ -142,12 +149,12 @@ bool AccountHandler::ParseSingleAccountName(
     const parser::DictionaryValue* item_dict,
     SingleAccountInfo* info) {
   std::string lang;
-  if (item_dict->GetString(keys::kAccountLangKey, &lang) &&
+  if (item_dict->GetString(kAccountLangKey, &lang) &&
       !utils::w3c_languages::ValidateLanguageTag(lang)) {
     return false;
   }
   std::string name;
-  item_dict->GetString(keys::kAccountTextKey, &name);
+  item_dict->GetString(kAccountTextKey, &name);
   info->names.push_back(std::make_pair(name, lang));
   return true;
 }
@@ -160,15 +167,15 @@ bool AccountHandler::ParseCapabilities(
   const parser::DictionaryValue* dict = nullptr;
   const parser::ListValue* list = nullptr;
   std::string string_value;
-  if (item_dict->Get(keys::kAccountCapabilityKey, &val)) {
+  if (item_dict->Get(kAccountCapabilityKey, &val)) {
     std::string capability;
     if (val->GetAsDictionary(&dict)) {
-      dict->GetString(keys::kAccountTextKey, &capability);
+      dict->GetString(kAccountTextKey, &capability);
       info->capabilities.push_back(capability);
     } else if (val->GetAsList(&list)) {
       for (auto& item : *list)
         if (item->GetAsDictionary(&dict)) {
-          dict->GetString(keys::kAccountTextKey, &capability);
+          dict->GetString(kAccountTextKey, &capability);
           info->capabilities.push_back(capability);
         }
     }
index cb570cd55c1a138de8bc7f7999318f9be2a9b44a..f74141f64cc3d66e75c5b4e822665fe373f3c30e 100644 (file)
 namespace {
 const char kEnabledValue[] = "enable";
 const char kDisabledValue[] = "disable";
+
 const utils::VersionNumber kReloadRequiredVersion("2.4");
+const char kTizenApplicationAppControlSrcKey[] = "src";
+const char kTizenApplicationAppControlOperationKey[] = "operation";
+const char kTizenApplicationAppControlUriKey[] = "uri";
+const char kTizenApplicationAppControlMimeKey[] = "mime";
+const char kTizenApplicationAppControlReloadKey[] = "@reload";
+const char kTizenApplicationAppControlChildNameAttrKey[] = "@name";
 }  // namespace
 
 namespace wgt {
@@ -30,36 +37,36 @@ void ParseAppControlEntryAndStore(
   std::string src;
   std::string reload;
   const parser::DictionaryValue* src_dict;
-  if (control_dict.GetDictionary(keys::kTizenApplicationAppControlSrcKey,
+  if (control_dict.GetDictionary(kTizenApplicationAppControlSrcKey,
       &src_dict)) {
     src_dict->GetString(
-        keys::kTizenApplicationAppControlChildNameAttrKey, &src);
-    src_dict->GetString(keys::kTizenApplicationAppControlReloadKey, &reload);
+        kTizenApplicationAppControlChildNameAttrKey, &src);
+    src_dict->GetString(kTizenApplicationAppControlReloadKey, &reload);
   }
 
   std::string operation;
   const parser::DictionaryValue* operation_dict;
   if (control_dict.GetDictionary(
-      keys::kTizenApplicationAppControlOperationKey,
+      kTizenApplicationAppControlOperationKey,
       &operation_dict)) {
     operation_dict->GetString(
-        keys::kTizenApplicationAppControlChildNameAttrKey, &operation);
+        kTizenApplicationAppControlChildNameAttrKey, &operation);
   }
 
   std::string uri;
   const parser::DictionaryValue* uri_dict;
-  if (control_dict.GetDictionary(keys::kTizenApplicationAppControlUriKey,
+  if (control_dict.GetDictionary(kTizenApplicationAppControlUriKey,
       &uri_dict)) {
     uri_dict->GetString(
-        keys::kTizenApplicationAppControlChildNameAttrKey, &uri);
+        kTizenApplicationAppControlChildNameAttrKey, &uri);
   }
 
   std::string mime;
   const parser::DictionaryValue* mime_dict;
-  if (control_dict.GetDictionary(keys::kTizenApplicationAppControlMimeKey,
+  if (control_dict.GetDictionary(kTizenApplicationAppControlMimeKey,
       &mime_dict)) {
     mime_dict->GetString(
-        keys::kTizenApplicationAppControlChildNameAttrKey, &mime);
+        kTizenApplicationAppControlChildNameAttrKey, &mime);
   }
 
   aplist->controls.emplace_back(src, operation, uri, mime, reload);
index c3b0e32e950a0e08b85fc081af4fcd785b41555f..4f05e1e34ae67cccc5d4211c23ebb8ac51818572 100644 (file)
 namespace keys = wgt::application_widget_keys;
 
 namespace {
+const char kWidgetIconKey[] = "widget.icon";
+const char kWidgetIconSrcKey[] = "@src";
+const char kWidgetIconWidthKey[] = "@width";
+const char kWidgetIconHeightKey[] = "@height";
 
 bool ExtractIconSrc(const parser::Value& dict, std::string* value,
                     std::string* /*error*/) {
@@ -21,7 +25,7 @@ bool ExtractIconSrc(const parser::Value& dict, std::string* value,
     return true;
   }
   std::string src;
-  if (!inner_dict->GetString(keys::kWidgetIconSrcKey, &src)) {
+  if (!inner_dict->GetString(kWidgetIconSrcKey, &src)) {
     LOG(INFO) << "Cannot find mandatory key. Key name: .@src";
     return true;
   }
@@ -47,7 +51,7 @@ void ExtractIconDimensions(const parser::Value& dict, int* height, int* width) {
   }
 
   std::string width_str;
-  if (inner_dict->GetString(keys::kWidgetIconWidthKey, &width_str)) {
+  if (inner_dict->GetString(kWidgetIconWidthKey, &width_str)) {
     try {
       *width = std::stoi(width_str);
     } catch (const std::logic_error&) {
@@ -56,7 +60,7 @@ void ExtractIconDimensions(const parser::Value& dict, int* height, int* width) {
   }
 
   std::string height_str;
-  if (inner_dict->GetString(keys::kWidgetIconHeightKey, &height_str)) {
+  if (inner_dict->GetString(kWidgetIconHeightKey, &height_str)) {
     try {
       *height = std::stoi(height_str);
     } catch (const std::logic_error&) {
@@ -133,7 +137,7 @@ bool ApplicationIconsHandler::Parse(
   std::shared_ptr<ApplicationIconsInfo> app_icons_info =
       std::make_shared<ApplicationIconsInfo>();
   parser::Value* key_value;
-  if (!manifest.Get(keys::kWidgetIconKey, &key_value)) {
+  if (!manifest.Get(kWidgetIconKey, &key_value)) {
     *output = std::static_pointer_cast<parser::ManifestData>(app_icons_info);
     return true;
   }
index ebec3285426294aef5f619ac2df3f6f2fd2b0bac..c88473e778874104709b87e526bf2ba29918ae5b 100644 (file)
@@ -18,158 +18,57 @@ const char kIconsKey[] = "icons";
 // manifest keys for widget applications.
 namespace application_widget_keys {
 
+const char kCSPKey[] = "widget.content-security-policy";
+const char kCSPReportOnlyKey[] = "widget.content-security-policy-report-only";
 const char kIconsKey[] = "icons";
 const char kAccountKey[] = "widget.account";
-const char kAccountMASKey[] = "@multiple-account-support";
-const char kAccountIconKey[] = "icon";
-const char kAccountNameKey[] = "display-name";
-const char kAccountSectionKey[] = "@section";
-const char kAccountTextKey[] = "#text";
-const char kAccountCapabilityKey[] = "capability";
-const char kAccountLangKey[] = "@lang";
-const char kNamespaceKey[] = "@namespace";
-const char kXmlLangKey[] = "@lang";
-const char kXmlHrefKey[] = "@href";
 const char kDefaultLocaleKey[] = "widget.@defaultlocale";
-const char kNameKey[] = "widget.name";
-const char kVersionKey[] = "widget.@version";
 const char kViewModesKey[] = "widget.@viewmodes";
 const char kWidgetKey[] = "widget";
-const char kWebURLsKey[] = "widget.@id";
 const char kAuthorKey[] = "widget.author";
 const char kDescriptionKey[] = "widget.description";
-const char kShortNameKey[] = "widget.name.@short";
 const char kShortKey[] = "@short";
 const char kIDKey[] = "widget.@id";
-const char kAuthorEmailKey[] = "@email";
-const char kAuthorHrefKey[] = "@href";
 const char kHeightKey[] = "widget.@height";
 const char kWidthKey[] = "widget.@width";
 const char kPreferencesKey[] = "widget.preference";
-const char kCSPKey[] = "widget.content-security-policy";
-const char kCSPReportOnlyKey[] = "widget.content-security-policy-report-only";
 const char kAccessKey[] = "widget.access";
 const char kLicenseKey[] = "widget.license";
 
+const char kTizenWidgetKey[] = "widget";
 // Child keys inside 'kPreferencesKey'.
 const char kPreferencesNameKey[] = "@name";
-const char kPreferencesValueKey[] = "@value";
-const char kPreferencesReadonlyKey[] = "@readonly";
 
 const char kWidgetLangKey[] = "widget.@lang";
-const char kWidgetNamespaceKey[] = "widget.@namespace";
-const char kWidgetNamespacePrefix[] = "http://www.w3.org/ns/widgets";
-
-// Child keys inside 'kAccessKey'.
-const char kAccessOriginKey[] = "@origin";
-const char kAccessSubdomainsKey[] = "@subdomains";
-
-const char kTizenWidgetKey[] = "widget";
-
-// W3C icon
-const char kWidgetIconKey[] = "widget.icon";
-const char kWidgetIconSrcKey[] = "@src";
-const char kWidgetIconWidthKey[] = "@width";
-const char kWidgetIconHeightKey[] = "@height";
 
 const char kTizenApplicationKey[] = "widget.application";
+const char kTizenAppWidgetFullKey[] = "widget.app-widget";
 // Child keys inside 'kTizenApplicationKey'
-const char kTizenApplicationIdKey[] = "@id";
+
 const char kTizenApplicationLaunchModeKey[] = "@launch_mode";
 const char kTizenApplicationPackageKey[] = "@package";
-const char kTizenApplicationRequiredVersionKey[] = "@required_version";
 
-const char kTizenAppIdKey[] = "widget.application.@package";
 const char kAllowNavigationKey[] = "widget.allow-navigation";
 const char kTizenSettingKey[] = "widget.setting";
-const char kTizenBackgroundSupportKey[] = "@background-support";
-const char kTizenContextMenuKey[] = "@context-menu";
-const char kTizenHardwareKey[] = "@hwkey-event";
-const char kTizenEncryptionKey[] = "@encryption";
 const char kTizenInstallLocationKey[] = "@install-location";
-const char kTizenNoDisplayKey[] = "@nodisplay";
-const char kTizenIndicatorPresenceKey[] = "@indicator-presence";
-const char kTizenBackbuttonPresenceKey[] =
-    "@backbutton-presence";
 const char kTizenUserAgentKey[] = "@user-agent";
 const char kTizenSoundModeKey[] = "@sound-mode";
-const char kTizenBackgroundVibrationKey[] =
-    "@background-vibration";
+const char kTizenBackgroundVibrationKey[] = "@background-vibration";
 const char kTizenMetaDataKey[] = "widget.metadata";
+const char kTizenSplashScreenKey[] = "widget.splash-screen";
 // Child keys inside 'kTizenMetaDataKey'
-const char kTizenMetaDataNameKey[] = "@key";
-const char kTizenMetaDataValueKey[] = "@value";
 const char kTizenPermissionsKey[] = "widget.privilege";
-const char kTizenPermissionsNameKey[] = "@name";
-const char kTizenSplashScreenKey[] = "widget.splash-screen";
-const char kTizenSplashScreenSrcKey[] = "@src";
-const char kContentNamespace[] = "widget.content.@namespace";
-const char kTizenScreenOrientationKey[] = "@screen-orientation";
-const char kTizenAppWidgetFullKey[] = "widget.app-widget";
-const char kTizenAppWidgetKey[] = "app-widget";
-const char kTizenAppWidgetIdKey[] = "@id";
-const char kTizenAppWidgetPrimaryKey[] = "@primary";
-const char kTizenAppWidgetUpdatePeriodKey[] = "@update-period";
-const char kTizenAppWidgetAutoLaunchKey[] = "@auto-launch";
-const char kTizenAppWidgetBoxLabelKey[] = "box-label";
-const char kTizenAppWidgetBoxLabelLangKey[] = "@lang";
-const char kTizenAppWidgetBoxLabelTextKey[] = "#text";
-const char kTizenAppWidgetBoxIconKey[] = "box-icon";
-const char kTizenAppWidgetBoxIconSrcKey[] = "@src";
-const char kTizenAppWidgetBoxContentKey[] = "box-content";
-const char kTizenAppWidgetBoxContentSrcKey[] = "@src";
-const char kTizenAppWidgetBoxContentMouseEventKey[] = "@mouse-event";
-const char kTizenAppWidgetBoxContentTouchEffectKey[] = "@touch-effect";
-const char kTizenAppWidgetBoxContentSizeKey[] = "box-size";
-const char kTizenAppWidgetBoxContentSizeTextKey[] = "#text";
-const char kTizenAppWidgetBoxContentSizePreviewKey[] = "@preview";
-const char kTizenAppWidgetBoxContentSizeUseDecorationKey[] = "@use-decoration";
-const char kTizenAppWidgetBoxContentDropViewKey[] = "pd";
-const char kTizenAppWidgetBoxContentDropViewSrcKey[] = "@src";
-const char kTizenAppWidgetBoxContentDropViewWidthKey[] = "@width";
-const char kTizenAppWidgetBoxContentDropViewHeightKey[] = "@height";
+
 // App control
 const char kTizenApplicationAppControlsKey[] = "widget.app-control";
-const char kTizenApplicationAppControlSrcKey[] = "src";
-const char kTizenApplicationAppControlOperationKey[] = "operation";
-const char kTizenApplicationAppControlUriKey[] = "uri";
-const char kTizenApplicationAppControlMimeKey[] = "mime";
-const char kTizenApplicationAppControlReloadKey[] = "@reload";
-const char kTizenApplicationAppControlChildNameAttrKey[] = "@name";
 // IME
 const char kTizenImeKey[] = "widget.ime";
-const char kTizenImeUuidKey[] = "uuid";
-const char kTizenImeUuidTextKey[] = "#text";
-const char kTizenImeLanguagesKey[] = "languages";
-const char kTizenImeLanguageKey[] = "language";
-const char kTizenImeLanguageTextKey[] = "#text";
 // Content
 const char kTizenContentKey[] = "widget.content";
-const char kTizenContentSrcKey[] = "@src";
-const char kTizenContentEncodingKey[] = "@encoding";
-const char kTizenContentTypeKey[] = "@type";
 // Category
 const char kTizenCategoryKey[] = "widget.category";
-const char kTizenCategoryNameKey[] = "@name";
-const char kTizenNamespacePrefix[] = "http://tizen.org/ns/widgets";
 // Service
 const char kTizenServiceKey[] = "widget.service";
-const char kTizenServiceIdKey[] = "@id";
-const char kTizenServiceAutoRestartKey[] = "@auto-restart";
-const char kTizenServiceOnBootKey[] = "@on-boot";
-const char kTizenServiceNameKey[] = "name";
-const char kTizenServiceCategoryKey[] = "category";
-const char kTizenServiceCategoryNameKey[] = "@name";
-const char kTizenServiceContentKey[] = "content";
-const char kTizenServiceContentSrcKey[] = "@src";
-const char kTizenServiceIconKey[] = "icon";
-const char kTizenServiceIconSrcKey[] = "@src";
-const char kTizenServiceDescriptionKey[] = "description";
-const char kTizenServiceMetadataKey[] = "metadata";
-const char kTizenServiceMetadataKeyKey[] = "@key";
-const char kTizenServiceMetadataValueKey[] = "@value";
-
-const char kXmlTextKey[] = "#text";
 
 }  // namespace application_widget_keys
 
index a9cfc0799f681e1df65889d1c8dc2069112afa17..1f688c42e14a4fb3e91c90eee685c3584c19e39b 100644 (file)
@@ -19,139 +19,30 @@ extern const char kIconsKey[];
 }  // namespace application_manifest_keys
 
 namespace application_widget_keys {
-extern const char kIconsKey[];
-extern const char kAccountKey[];
-extern const char kAccountMASKey[];
-extern const char kAccountIconKey[];
-extern const char kAccountNameKey[];
-extern const char kAccountSectionKey[];
-extern const char kAccountTextKey[];
-extern const char kAccountCapabilityKey[];
-extern const char kAccountLangKey[];
-extern const char kNamespaceKey[];
-extern const char kXmlLangKey[];
-extern const char kXmlHrefKey[];
-extern const char kDefaultLocaleKey[];
-extern const char kNameKey[];
-extern const char kWebURLsKey[];
-extern const char kWidgetKey[];
-extern const char kVersionKey[];
-extern const char kViewModesKey[];
+
 extern const char kAccessKey[];
-extern const char kLicenseKey[];
-extern const char kAccessOriginKey[];
-extern const char kAccessSubdomainsKey[];
+extern const char kAccountKey[];
+extern const char kAllowNavigationKey[];
+extern const char kAuthorKey[];
 extern const char kCSPKey[];
 extern const char kCSPReportOnlyKey[];
-extern const char kAuthorKey[];
 extern const char kDescriptionKey[];
-extern const char kShortNameKey[];
-extern const char kShortKey[];
-extern const char kIDKey[];
-extern const char kAuthorEmailKey[];
-extern const char kAuthorHrefKey[];
-extern const char kHeightKey[];
-extern const char kWidthKey[];
-extern const char kPreferencesKey[];
-extern const char kPreferencesNameKey[];
-extern const char kPreferencesValueKey[];
-extern const char kPreferencesReadonlyKey[];
-extern const char kWidgetLangKey[];
-extern const char kWidgetNamespaceKey[];
-extern const char kWidgetNamespacePrefix[];
-extern const char kTizenWidgetKey[];
+extern const char kIconsKey[];
+extern const char kTizenApplicationAppControlsKey[];
 extern const char kTizenApplicationKey[];
-extern const char kTizenApplicationIdKey[];
-extern const char kTizenApplicationLaunchModeKey[];
-extern const char kTizenApplicationPackageKey[];
-extern const char kTizenApplicationRequiredVersionKey[];
-extern const char kTizenAppIdKey[];
-extern const char kWidgetIconKey[];
-extern const char kWidgetIconSrcKey[];
-extern const char kWidgetIconWidthKey[];
-extern const char kWidgetIconHeightKey[];
-extern const char kAllowNavigationKey[];
-extern const char kCSPReportOnlyKey[];
-extern const char kTizenSettingKey[];
-extern const char kTizenBackgroundSupportKey[];
-extern const char kTizenContextMenuKey[];
-extern const char kTizenHardwareKey[];
-extern const char kTizenEncryptionKey[];
-extern const char kTizenInstallLocationKey[];
-extern const char kTizenNoDisplayKey[];
-extern const char kTizenIndicatorPresenceKey[];
-extern const char kTizenBackbuttonPresenceKey[];
-extern const char kTizenUserAgentKey[];
-extern const char kTizenSoundModeKey[];
-extern const char kTizenBackgroundVibrationKey[];
-extern const char kTizenMetaDataKey[];
-extern const char kTizenMetaDataNameKey[];
-extern const char kTizenMetaDataValueKey[];
-extern const char kTizenPermissionsKey[];
-extern const char kTizenPermissionsNameKey[];
-extern const char kTizenSplashScreenKey[];
-extern const char kTizenSplashScreenSrcKey[];
-extern const char kContentNamespace[];
-extern const char kTizenScreenOrientationKey[];
 extern const char kTizenAppWidgetFullKey[];
-extern const char kTizenAppWidgetKey[];
-extern const char kTizenAppWidgetIdKey[];
-extern const char kTizenAppWidgetPrimaryKey[];
-extern const char kTizenAppWidgetUpdatePeriodKey[];
-extern const char kTizenAppWidgetAutoLaunchKey[];
-extern const char kTizenAppWidgetBoxLabelKey[];
-extern const char kTizenAppWidgetBoxLabelLangKey[];
-extern const char kTizenAppWidgetBoxLabelTextKey[];
-extern const char kTizenAppWidgetBoxIconKey[];
-extern const char kTizenAppWidgetBoxIconSrcKey[];
-extern const char kTizenAppWidgetBoxContentKey[];
-extern const char kTizenAppWidgetBoxContentSrcKey[];
-extern const char kTizenAppWidgetBoxContentMouseEventKey[];
-extern const char kTizenAppWidgetBoxContentTouchEffectKey[];
-extern const char kTizenAppWidgetBoxContentSizeKey[];
-extern const char kTizenAppWidgetBoxContentSizeTextKey[];
-extern const char kTizenAppWidgetBoxContentSizePreviewKey[];
-extern const char kTizenAppWidgetBoxContentSizeUseDecorationKey[];
-extern const char kTizenAppWidgetBoxContentDropViewKey[];
-extern const char kTizenAppWidgetBoxContentDropViewSrcKey[];
-extern const char kTizenAppWidgetBoxContentDropViewWidthKey[];
-extern const char kTizenAppWidgetBoxContentDropViewHeightKey[];
-extern const char kTizenApplicationAppControlsKey[];
-extern const char kTizenApplicationAppControlSrcKey[];
-extern const char kTizenApplicationAppControlOperationKey[];
-extern const char kTizenApplicationAppControlUriKey[];
-extern const char kTizenApplicationAppControlMimeKey[];
-extern const char kTizenApplicationAppControlReloadKey[];
-extern const char kTizenApplicationAppControlChildNameAttrKey[];
-extern const char kTizenImeKey[];
-extern const char kTizenImeUuidKey[];
-extern const char kTizenImeUuidTextKey[];
-extern const char kTizenImeLanguagesKey[];
-extern const char kTizenImeLanguageKey[];
-extern const char kTizenImeLanguageTextKey[];
-extern const char kTizenContentKey[];
-extern const char kTizenContentSrcKey[];
-extern const char kTizenContentEncodingKey[];
-extern const char kTizenContentTypeKey[];
 extern const char kTizenCategoryKey[];
-extern const char kTizenCategoryNameKey[];
-extern const char kTizenNamespacePrefix[];
+extern const char kTizenContentKey[];
+extern const char kTizenImeKey[];
+extern const char kTizenMetaDataKey[];
+extern const char kTizenPermissionsKey[];
 extern const char kTizenServiceKey[];
-extern const char kTizenServiceIdKey[];
-extern const char kTizenServiceAutoRestartKey[];
-extern const char kTizenServiceOnBootKey[];
-extern const char kTizenServiceNameKey[];
-extern const char kTizenServiceCategoryKey[];
-extern const char kTizenServiceCategoryNameKey[];
-extern const char kTizenServiceContentKey[];
-extern const char kTizenServiceContentSrcKey[];
-extern const char kTizenServiceIconKey[];
-extern const char kTizenServiceIconSrcKey[];
-extern const char kTizenServiceDescriptionKey[];
-extern const char kTizenServiceMetadataKey[];
-extern const char kTizenServiceMetadataKeyKey[];
-extern const char kTizenServiceMetadataValueKey[];
-extern const char kXmlTextKey[];
+extern const char kTizenSettingKey[];
+extern const char kTizenSplashScreenKey[];
+extern const char kTizenWidgetKey[];
+extern const char kVersionKey[];
+extern const char kWidgetKey[];
+
 }  // namespace application_widget_keys
 
 }  // namespace wgt
index 52b6ce38fd3443d130b5b139af4f516e2e79d3fd..9e143731b53d45e5a36d1869f7b5a32c2cdae2fa 100644 (file)
@@ -21,17 +21,38 @@ namespace parse {
 namespace keys = wgt::application_widget_keys;
 
 namespace {
+const char kTizenNamespacePrefix[] = "http://tizen.org/ns/widgets";
+const char kWidgetNamespacePrefix[] = "http://www.w3.org/ns/widgets";
+const char kNamespaceKey[] = "@namespace";
+const char kTizenAppWidgetKey[] = "app-widget";
+const char kTizenAppWidgetBoxLabelLangKey[] = "@lang";
+const char kTizenAppWidgetBoxIconSrcKey[] = "@src";
+const char kTizenAppWidgetBoxContentSizePreviewKey[] = "@preview";
+const char kTizenAppWidgetBoxContentSizeUseDecorationKey[] = "@use-decoration";
+const char kTizenAppWidgetBoxContentDropViewSrcKey[] = "@src";
+const char kTizenAppWidgetBoxContentDropViewWidthKey[] = "@width";
+const char kTizenAppWidgetBoxContentDropViewHeightKey[] = "@height";
+const char kTizenAppWidgetBoxContentSrcKey[] = "@src";
+const char kTizenAppWidgetBoxContentMouseEventKey[] = "@mouse-event";
+const char kTizenAppWidgetBoxContentTouchEffectKey[] = "@touch-effect";
+const char kTizenAppWidgetBoxContentSizeKey[] = "box-size";
+const char kTizenAppWidgetBoxContentDropViewKey[] = "pd";
+const char kTizenAppWidgetAutoLaunchKey[] = "@auto-launch";
+const char kTizenAppWidgetBoxLabelKey[] = "box-label";
+const char kTizenAppWidgetBoxIconKey[] = "box-icon";
+const char kTizenAppWidgetBoxContentKey[] = "box-content";
+const char kTizenAppWidgetIdKey[] = "@id";
+const char kTizenAppWidgetPrimaryKey[] = "@primary";
+const char kTizenAppWidgetUpdatePeriodKey[] = "@update-period";
+const char kTizenAppWidgetBoxLabelTextKey[] = "#text";
+const char kTizenAppWidgetBoxContentSizeTextKey[] = "#text";
 
 const char kErrMsgInvalidDictionary[] =
     "Cannot get key value as a dictionary. Key name: ";
-const char kErrMsgInvalidList[] =
-    "Cannot get key value as a list. Key name: ";
-const char kErrMsgNoMandatoryKey[] =
-    "Cannot find mandatory key. Key name: ";
-const char kErrMsgInvalidKeyValue[] =
-    "Invalid key value. Key name: ";
-const char kErrMsgMultipleKeys[] =
-    "Too many keys found. Key name: ";
+const char kErrMsgInvalidList[] = "Cannot get key value as a list. Key name: ";
+const char kErrMsgNoMandatoryKey[] = "Cannot find mandatory key. Key name: ";
+const char kErrMsgInvalidKeyValue[] = "Invalid key value. Key name: ";
+const char kErrMsgMultipleKeys[] = "Too many keys found. Key name: ";
 const char kErrMsgNoNamespace[] =
     "Element pointed by key has no namespace specified. Key name: ";
 const char kErrMsgInvalidNamespace[] =
@@ -39,8 +60,7 @@ const char kErrMsgInvalidNamespace[] =
 const char kErrMsgUpdatePeriodOutOfDomain[] =
     "Value of an update-period attribute in app-widget element out of domain."
     " The value: ";
-const char kErrMsgNoLabel[] =
-    "No box-label element in app-widget element.";
+const char kErrMsgNoLabel[] = "No box-label element in app-widget element.";
 const char kErrMsgInvalidIconSrc[] =
     "Invalid path in a src attribute of box-icon element. The value: ";
 const char kErrMsgInvalidContentSrc[] =
@@ -60,26 +80,24 @@ const std::regex kStringRegex("[.][0-9a-zA-Z]+");
 
 // If the error parameter is specified, it is filled with the given message
 // otherwise it does nothing.
-void SetError(const std::string& message,
-    std::string* error) {
-  if (error)
-    *error = message;
+void SetError(const std::string& message, std::string* error) {
+  if (error) *error = message;
 }
 
 // If the error parameter is specified, it is filled with concatenation
 // of message and arg parameters otherwise it does nothing.
-void SetError(const std::string& message,
-    const std::string& arg, std::string* error) {
-  if (error)
-    *error = message + arg;
+void SetError(const std::string& message, const std::string& arg,
+              std::string* error) {
+  if (error) *error = message + arg;
 }
 
 // Retrieves a mandatory dictionary from specified manifest and specified key.
 // Returns true, if the ditionary is found or false otherwise. If the error
 // parameter is specified, it is also filled with proper message.
 bool GetMandatoryDictionary(const parser::Manifest& manifest,
-    const std::string& key, const parser::DictionaryValue** dict,
-    std::string* error) {
+                            const std::string& key,
+                            const parser::DictionaryValue** dict,
+                            std::string* error) {
   assert(dict);
   if (!manifest.HasPath(key)) {
     SetError(kErrMsgNoMandatoryKey, key, error);
@@ -96,8 +114,9 @@ bool GetMandatoryDictionary(const parser::Manifest& manifest,
 // if convertion is successful or false otherwise.
 template <typename ValueType>
 bool ConvertValue(const std::string& /*str_value*/, ValueType* /*value*/) {
-  assert(false && "Use one of already defined template specializations"
-                  " or define a new one.");
+  assert(false &&
+         "Use one of already defined template specializations"
+         " or define a new one.");
   return false;
 }
 
@@ -151,7 +170,8 @@ bool ConvertValue(const std::string& str_value, double* value) {
 // parameter is specified, it is also filled with proper message.
 template <typename ValueType>
 bool GetMandatoryValue(const parser::DictionaryValue& dict,
-    const std::string& key, ValueType* value, std::string* error) {
+                       const std::string& key, ValueType* value,
+                       std::string* error) {
   assert(value);
   std::string tmp;
   if (!dict.GetString(key, &tmp)) {
@@ -159,8 +179,7 @@ bool GetMandatoryValue(const parser::DictionaryValue& dict,
     return false;
   }
   bool result = ConvertValue(tmp, value);
-  if (!result)
-    SetError(kErrMsgInvalidKeyValue, key, error);
+  if (!result) SetError(kErrMsgInvalidKeyValue, key, error);
   return result;
 }
 
@@ -171,8 +190,8 @@ bool GetMandatoryValue(const parser::DictionaryValue& dict,
 // and fills error parameter if it is set.
 template <typename ValueType>
 bool GetOptionalValue(const parser::DictionaryValue& dict,
-    const std::string& key, ValueType default_value, ValueType* value,
-    std::string* error) {
+                      const std::string& key, ValueType default_value,
+                      ValueType* value, std::string* error) {
   assert(value);
   std::string tmp;
   if (!dict.GetString(key, &tmp)) {
@@ -180,24 +199,22 @@ bool GetOptionalValue(const parser::DictionaryValue& dict,
     return true;
   }
   bool result = ConvertValue(tmp, value);
-  if (!result)
-    SetError(kErrMsgInvalidKeyValue, key, error);
+  if (!result) SetError(kErrMsgInvalidKeyValue, key, error);
   return result;
 }
 
 // Helper function for ParseEach. Do not use directly.
 template <typename ParseSingleType, typename DataContainerType>
-bool ParseEachInternal(const parser::Value& value,
-    const std::string& key, ParseSingleType parse_single,
-    DataContainerType* data_container, std::string* error) {
+bool ParseEachInternal(const parser::Value& value, const std::string& key,
+                       ParseSingleType parse_single,
+                       DataContainerType* data_container, std::string* error) {
   assert(data_container);
   const parser::DictionaryValue* inner_dict;
   if (!value.GetAsDictionary(&inner_dict)) {
     SetError(kErrMsgInvalidDictionary, key, error);
     return false;
   }
-  if (!parse_single(*inner_dict, key, data_container, error))
-    return false;
+  if (!parse_single(*inner_dict, key, data_container, error)) return false;
   return true;
 }
 
@@ -209,10 +226,9 @@ bool ParseEachInternal(const parser::Value& value,
 //    std::string* error);
 //  - a DataContainerType object where the above function stores data
 template <typename ParseSingleType, typename DataContainerType>
-bool ParseEach(const parser::DictionaryValue& dict,
-               const std::string& key, bool mandatory,
-               ParseSingleType parse_single, DataContainerType* data_container,
-               std::string* error) {
+bool ParseEach(const parser::DictionaryValue& dict, const std::string& key,
+               bool mandatory, ParseSingleType parse_single,
+               DataContainerType* data_container, std::string* error) {
   assert(data_container);
 
   const parser::Value* value = nullptr;
@@ -246,11 +262,11 @@ bool ParseEach(const parser::DictionaryValue& dict,
 // one or false otherwise. If the error parameter is specified, it is also
 // filled with proper message.
 bool VerifyElementNamespace(const parser::DictionaryValue& dict,
-    const std::string& key, const std::string& desired_namespace_value,
-    std::string* error) {
+                            const std::string& key,
+                            const std::string& desired_namespace_value,
+                            std::string* error) {
   std::string namespace_value;
-  if (!GetMandatoryValue(dict, keys::kNamespaceKey,
-      &namespace_value, nullptr)) {
+  if (!GetMandatoryValue(dict, kNamespaceKey, &namespace_value, nullptr)) {
     SetError(kErrMsgNoNamespace, key, error);
     return false;
   }
@@ -262,21 +278,20 @@ bool VerifyElementNamespace(const parser::DictionaryValue& dict,
 }
 
 // Parses box-label part
-bool ParseLabel(const parser::DictionaryValue& dict,
-    const std::string& key, AppWidget* app_widget, std::string* error) {
+bool ParseLabel(const parser::DictionaryValue& dict, const std::string& key,
+                AppWidget* app_widget, std::string* error) {
   assert(app_widget);
 
-  if (!VerifyElementNamespace(dict, key, keys::kTizenNamespacePrefix, error))
+  if (!VerifyElementNamespace(dict, key, kTizenNamespacePrefix, error))
     return false;
 
   std::string lang;
-  if (!GetOptionalValue(dict, keys::kTizenAppWidgetBoxLabelLangKey,
-      std::string(), &lang, error))
+  if (!GetOptionalValue(dict, kTizenAppWidgetBoxLabelLangKey, std::string(),
+                        &lang, error))
     return false;
 
   std::string text;
-  if (!GetMandatoryValue(dict, keys::kTizenAppWidgetBoxLabelTextKey,
-      &text, error))
+  if (!GetMandatoryValue(dict, kTizenAppWidgetBoxLabelTextKey, &text, error))
     return false;
 
   if (lang.empty()) {
@@ -293,19 +308,19 @@ bool ParseLabel(const parser::DictionaryValue& dict,
 }
 
 // Parses box-icon part
-bool ParseIcon(const parser::DictionaryValue& dict,
-    const std::string& key, AppWidget* app_widget, std::string* error) {
+bool ParseIcon(const parser::DictionaryValue& dict, const std::string& key,
+               AppWidget* app_widget, std::string* error) {
   assert(app_widget);
 
-  if (!VerifyElementNamespace(dict, key, keys::kTizenNamespacePrefix, error))
+  if (!VerifyElementNamespace(dict, key, kTizenNamespacePrefix, error))
     return false;
 
   if (!app_widget->icon_src.empty()) {
     SetError(kErrMsgMultipleKeys, key, error);
     return false;
   }
-  if (!GetMandatoryValue(dict, keys::kTizenAppWidgetBoxIconSrcKey,
-      &app_widget->icon_src, error))
+  if (!GetMandatoryValue(dict, kTizenAppWidgetBoxIconSrcKey,
+                         &app_widget->icon_src, error))
     return false;
 
   return true;
@@ -313,7 +328,7 @@ bool ParseIcon(const parser::DictionaryValue& dict,
 
 // Converts size type from text to enum representation
 bool StringToSizeType(const std::string& str_type,
-    AppWidgetSizeType* enum_type) {
+                      AppWidgetSizeType* enum_type) {
   assert(enum_type);
   if (str_type == "1x1") {
     *enum_type = AppWidgetSizeType::k1x1;
@@ -332,34 +347,34 @@ bool StringToSizeType(const std::string& str_type,
 
 // Parses box-size part
 bool ParseContentSizes(const parser::DictionaryValue& dict,
-    const std::string& key, AppWidget* app_widget, std::string* error) {
+                       const std::string& key, AppWidget* app_widget,
+                       std::string* error) {
   assert(app_widget);
 
-  if (!VerifyElementNamespace(dict, key, keys::kTizenNamespacePrefix, error))
+  if (!VerifyElementNamespace(dict, key, kTizenNamespacePrefix, error))
     return false;
 
   AppWidgetSize size;
 
   std::string str_type;
-  if (!GetMandatoryValue(dict, keys::kTizenAppWidgetBoxContentSizeTextKey,
-      &str_type, error))
+  if (!GetMandatoryValue(dict, kTizenAppWidgetBoxContentSizeTextKey, &str_type,
+                         error))
     return false;
 
   AppWidgetSizeType type;
   if (!StringToSizeType(str_type, &type)) {
-    SetError(kErrMsgInvalidKeyValue,
-        keys::kTizenAppWidgetBoxContentSizeTextKey, error);
+    SetError(kErrMsgInvalidKeyValue, kTizenAppWidgetBoxContentSizeTextKey,
+             error);
     return false;
   }
   size.type = type;
 
-  if (!GetOptionalValue(dict, keys::kTizenAppWidgetBoxContentSizePreviewKey,
-      std::string(), &size.preview, error))
+  if (!GetOptionalValue(dict, kTizenAppWidgetBoxContentSizePreviewKey,
+                        std::string(), &size.preview, error))
     return false;
 
-  if (!GetOptionalValue(dict,
-      keys::kTizenAppWidgetBoxContentSizeUseDecorationKey,
-      true, &size.use_decoration, error))
+  if (!GetOptionalValue(dict, kTizenAppWidgetBoxContentSizeUseDecorationKey,
+                        true, &size.use_decoration, error))
     return false;
 
   app_widget->content_size.push_back(size);
@@ -369,10 +384,11 @@ bool ParseContentSizes(const parser::DictionaryValue& dict,
 
 // Parses pd part
 bool ParseContentDropView(const parser::DictionaryValue& dict,
-    const std::string& key, AppWidget* app_widget, std::string* error) {
+                          const std::string& key, AppWidget* app_widget,
+                          std::string* error) {
   assert(app_widget);
 
-  if (!VerifyElementNamespace(dict, key, keys::kTizenNamespacePrefix, error))
+  if (!VerifyElementNamespace(dict, key, kTizenNamespacePrefix, error))
     return false;
 
   if (!app_widget->content_drop_view.empty()) {
@@ -382,18 +398,16 @@ bool ParseContentDropView(const parser::DictionaryValue& dict,
 
   AppWidgetDropView drop_view;
 
-  if (!GetMandatoryValue(dict, keys::kTizenAppWidgetBoxContentDropViewSrcKey,
-      &drop_view.src, error))
+  if (!GetMandatoryValue(dict, kTizenAppWidgetBoxContentDropViewSrcKey,
+                         &drop_view.src, error))
     return false;
 
-  if (!GetMandatoryValue(dict,
-      keys::kTizenAppWidgetBoxContentDropViewWidthKey,
-      &drop_view.width, error))
+  if (!GetMandatoryValue(dict, kTizenAppWidgetBoxContentDropViewWidthKey,
+                         &drop_view.width, error))
     return false;
 
-  if (!GetMandatoryValue(dict,
-      keys::kTizenAppWidgetBoxContentDropViewHeightKey,
-      &drop_view.height, error))
+  if (!GetMandatoryValue(dict, kTizenAppWidgetBoxContentDropViewHeightKey,
+                         &drop_view.height, error))
     return false;
 
   app_widget->content_drop_view.push_back(drop_view);
@@ -402,81 +416,79 @@ bool ParseContentDropView(const parser::DictionaryValue& dict,
 }
 
 // Parses box-content part
-bool ParseContent(const parser::DictionaryValue& dict,
-    const std::string& key, AppWidget* app_widget, std::string* error) {
+bool ParseContent(const parser::DictionaryValue& dict, const std::string& key,
+                  AppWidget* app_widget, std::string* error) {
   assert(app_widget);
 
-  if (!VerifyElementNamespace(dict, key, keys::kTizenNamespacePrefix, error))
+  if (!VerifyElementNamespace(dict, key, kTizenNamespacePrefix, error))
     return false;
 
   if (!app_widget->content_src.empty()) {
     SetError(kErrMsgMultipleKeys, key, error);
     return false;
   }
-  if (!GetMandatoryValue(dict, keys::kTizenAppWidgetBoxContentSrcKey,
-      &app_widget->content_src, error))
+  if (!GetMandatoryValue(dict, kTizenAppWidgetBoxContentSrcKey,
+                         &app_widget->content_src, error))
     return false;
 
-  if (!GetOptionalValue(dict, keys::kTizenAppWidgetBoxContentMouseEventKey,
-      false, &app_widget->content_mouse_event, error))
+  if (!GetOptionalValue(dict, kTizenAppWidgetBoxContentMouseEventKey, false,
+                        &app_widget->content_mouse_event, error))
     return false;
 
-  if (!GetOptionalValue(dict, keys::kTizenAppWidgetBoxContentTouchEffectKey,
-      true, &app_widget->content_touch_effect, error))
+  if (!GetOptionalValue(dict, kTizenAppWidgetBoxContentTouchEffectKey, true,
+                        &app_widget->content_touch_effect, error))
     return false;
 
-  if (!ParseEach(dict, keys::kTizenAppWidgetBoxContentSizeKey,
-      true, ParseContentSizes, app_widget, error))
+  if (!ParseEach(dict, kTizenAppWidgetBoxContentSizeKey, true,
+                 ParseContentSizes, app_widget, error))
     return false;
 
-  if (!ParseEach(dict, keys::kTizenAppWidgetBoxContentDropViewKey,
-      false, ParseContentDropView, app_widget, error))
+  if (!ParseEach(dict, kTizenAppWidgetBoxContentDropViewKey, false,
+                 ParseContentDropView, app_widget, error))
     return false;
 
   return true;
 }
 
 // Parses app-widget part
-bool ParseAppWidget(const parser::DictionaryValue& dict,
-    const std::string& key, AppWidgetVector* app_widgets,
-    std::string* error) {
+bool ParseAppWidget(const parser::DictionaryValue& dict, const std::string& key,
+                    AppWidgetVector* app_widgets, std::string* error) {
   assert(app_widgets);
 
-  if (!VerifyElementNamespace(dict, key, keys::kTizenNamespacePrefix, error))
+  if (!VerifyElementNamespace(dict, key, kTizenNamespacePrefix, error))
     return false;
 
   AppWidget app_widget;
 
-  if (!GetMandatoryValue(dict, keys::kTizenAppWidgetIdKey,
-      &app_widget.id, error))
+  if (!GetMandatoryValue(dict, kTizenAppWidgetIdKey, &app_widget.id, error))
     return false;
 
-  if (!GetMandatoryValue(dict, keys::kTizenAppWidgetPrimaryKey,
-      &app_widget.primary, error))
+  if (!GetMandatoryValue(dict, kTizenAppWidgetPrimaryKey, &app_widget.primary,
+                         error))
     return false;
 
   double update_period;
   double no_update_period = std::numeric_limits<double>::min();
-  if (!GetOptionalValue(dict, keys::kTizenAppWidgetUpdatePeriodKey,
-      no_update_period, &update_period, error))
+  if (!GetOptionalValue(dict, kTizenAppWidgetUpdatePeriodKey, no_update_period,
+                        &update_period, error))
     return false;
   if (update_period != no_update_period)
     app_widget.update_period.push_back(update_period);
 
-  if (!GetOptionalValue(dict, keys::kTizenAppWidgetAutoLaunchKey,
-      false, &app_widget.auto_launch, error))
+  if (!GetOptionalValue(dict, kTizenAppWidgetAutoLaunchKey, false,
+                        &app_widget.auto_launch, error))
     return false;
 
-  if (!ParseEach(dict, keys::kTizenAppWidgetBoxLabelKey,
-      true, ParseLabel, &app_widget, error))
+  if (!ParseEach(dict, kTizenAppWidgetBoxLabelKey, true, ParseLabel,
+                 &app_widget, error))
     return false;
 
-  if (!ParseEach(dict, keys::kTizenAppWidgetBoxIconKey,
-      false, ParseIcon, &app_widget, error))
+  if (!ParseEach(dict, kTizenAppWidgetBoxIconKey, false, ParseIcon, &app_widget,
+                 error))
     return false;
 
-  if (!ParseEach(dict, keys::kTizenAppWidgetBoxContentKey,
-      true, ParseContent, &app_widget, error))
+  if (!ParseEach(dict, kTizenAppWidgetBoxContentKey, true, ParseContent,
+                 &app_widget, error))
     return false;
 
   app_widgets->push_back(app_widget);
@@ -503,7 +515,7 @@ bool IsValidPathOrUrl(const std::string& value) {
 
 // Validates all content sizes in an app-widget
 bool ValidateContentSize(const AppWidgetSizeVector& content_size,
-    std::string* error) {
+                         std::string* error) {
   bool mandatory_1x1_found = false;
 
   for (const AppWidgetSize& size : content_size) {
@@ -526,31 +538,25 @@ bool ValidateContentSize(const AppWidgetSizeVector& content_size,
 }  // namespace
 
 AppWidgetInfo::AppWidgetInfo(const AppWidgetVector& app_widgets)
-    : app_widgets_(app_widgets) {
-}
+    : app_widgets_(app_widgets) {}
 
-AppWidgetInfo::~AppWidgetInfo() {
-}
+AppWidgetInfo::~AppWidgetInfo() {}
 
-AppWidgetHandler::AppWidgetHandler() {
-}
+AppWidgetHandler::AppWidgetHandler() {}
 
-AppWidgetHandler::~AppWidgetHandler() {
-}
+AppWidgetHandler::~AppWidgetHandler() {}
 
-bool AppWidgetHandler::Parse(
-    const parser::Manifest& manifest,
-    std::shared_ptr<parser::ManifestData>* output,
-    std::string* error) {
+bool AppWidgetHandler::Parse(const parser::Manifest& manifest,
+                             std::shared_ptr<parser::ManifestData>* output,
+                             std::string* error) {
   const parser::DictionaryValue* dict = nullptr;
-  if (!GetMandatoryDictionary(manifest, keys::kTizenWidgetKey,
-                              &dict, error))
+  if (!GetMandatoryDictionary(manifest, keys::kTizenWidgetKey, &dict, error))
     return false;
 
   AppWidgetVector app_widgets;
 
-  if (!ParseEach(*dict, keys::kTizenAppWidgetKey,
-      false, ParseAppWidget, &app_widgets, error))
+  if (!ParseEach(*dict, kTizenAppWidgetKey, false, ParseAppWidget, &app_widgets,
+                 error))
     return false;
 
   *output = std::static_pointer_cast<parser::ManifestData>(
@@ -567,21 +573,21 @@ bool AppWidgetHandler::Validate(
   const AppWidgetVector& app_widgets = app_widget_info.app_widgets();
 
   for (const AppWidget& app_widget : app_widgets) {
-    if (!app_widget.update_period.empty()
-        && app_widget.update_period.front() < 1800) {
+    if (!app_widget.update_period.empty() &&
+        app_widget.update_period.front() < 1800) {
       SetError(kErrMsgUpdatePeriodOutOfDomain,
-          std::to_string(app_widget.update_period.front()), error);
+               std::to_string(app_widget.update_period.front()), error);
       return false;
     }
 
-    if (app_widget.label.default_value.empty()
-        && app_widget.label.lang_value_map.empty()) {
+    if (app_widget.label.default_value.empty() &&
+        app_widget.label.lang_value_map.empty()) {
       SetError(kErrMsgNoLabel, error);
       return false;
     }
 
-    if (!app_widget.icon_src.empty()
-        && !IsValidPathOrUrl(app_widget.icon_src)) {
+    if (!app_widget.icon_src.empty() &&
+        !IsValidPathOrUrl(app_widget.icon_src)) {
       SetError(kErrMsgInvalidIconSrc, app_widget.icon_src, error);
       return false;
     }
@@ -591,12 +597,10 @@ bool AppWidgetHandler::Validate(
       return false;
     }
 
-    if (!ValidateContentSize(app_widget.content_size, error))
-      return false;
+    if (!ValidateContentSize(app_widget.content_size, error)) return false;
 
     if (!app_widget.content_drop_view.empty()) {
-      const AppWidgetDropView& drop_view
-          = app_widget.content_drop_view.front();
+      const AppWidgetDropView& drop_view = app_widget.content_drop_view.front();
 
       if (!IsValidPathOrUrl(drop_view.src)) {
         SetError(kErrMsgInvalidContentDropViewSrc, drop_view.src, error);
@@ -605,7 +609,7 @@ bool AppWidgetHandler::Validate(
 
       if (drop_view.height < 1 || drop_view.height > 380) {
         SetError(kErrMsgContentDropViewHeightOutOfDomain,
-            std::to_string(drop_view.height), error);
+                 std::to_string(drop_view.height), error);
         return false;
       }
     }
index 1a8b429fc5fab307ee1258e121213e560ddaf15a..78bc7a0e3c46c4ae063159908181cb9cb65c5c9a 100644 (file)
@@ -15,38 +15,33 @@ namespace parse {
 namespace keys = wgt::application_widget_keys;
 
 namespace {
-
-const char kErrMsgCategory[] =
-    "Parsing category element failed";
+const char kTizenNamespacePrefix[] = "http://tizen.org/ns/widgets";
+const char kWidgetNamespacePrefix[] = "http://www.w3.org/ns/widgets";
+const char kTizenCategoryNameKey[] = "@name";
+const char kErrMsgCategory[] = "Parsing category element failed";
 const char kErrMsgCategoryName[] =
     "The name element inside category element is obligatory";
 
-bool ParseCategoryEntryAndStore(
-    const parser::DictionaryValue& control_dict,
-    CategoryInfoList* aplist) {
+bool ParseCategoryEntryAndStore(const parser::DictionaryValue& control_dict,
+                                CategoryInfoList* aplist) {
   std::string name;
-  if (!control_dict.GetString(keys::kTizenCategoryNameKey, &name))
-    return false;
+  if (!control_dict.GetString(kTizenCategoryNameKey, &name)) return false;
   aplist->categories.push_back(name);
   return true;
 }
 
 }  // namespace
 
-CategoryHandler::CategoryHandler() {
-}
+CategoryHandler::CategoryHandler() {}
 
-CategoryHandler::~CategoryHandler() {
-}
+CategoryHandler::~CategoryHandler() {}
 
-bool CategoryHandler::Parse(
-    const parser::Manifest& manifest,
-    std::shared_ptr<parser::ManifestData>* output,
-    std::string* error) {
+bool CategoryHandler::Parse(const parser::Manifest& manifest,
+                            std::shared_ptr<parser::ManifestData>* output,
+                            std::string* error) {
   std::shared_ptr<CategoryInfoList> aplist(new CategoryInfoList());
   parser::Value* value = nullptr;
-  if (!manifest.Get(keys::kTizenCategoryKey, &value))
-    return true;
+  if (!manifest.Get(keys::kTizenCategoryKey, &value)) return true;
 
   if (value->GetType() == parser::Value::TYPE_LIST) {
     // multiple entries
@@ -54,10 +49,8 @@ bool CategoryHandler::Parse(
     value->GetAsList(&list);
     for (const auto& item : *list) {
       const parser::DictionaryValue* control_dict;
-      if (!item->GetAsDictionary(&control_dict))
-        continue;
-      if (!parser::VerifyElementNamespace(
-          *control_dict, keys::kTizenNamespacePrefix))
+      if (!item->GetAsDictionary(&control_dict)) continue;
+      if (!parser::VerifyElementNamespace(*control_dict, kTizenNamespacePrefix))
         continue;
       if (!ParseCategoryEntryAndStore(*control_dict, aplist.get())) {
         *error = kErrMsgCategory;
@@ -68,10 +61,9 @@ bool CategoryHandler::Parse(
     // single entry
     const parser::DictionaryValue* dict;
     value->GetAsDictionary(&dict);
-    if (!parser::VerifyElementNamespace(*dict, keys::kTizenNamespacePrefix))
-      return nullptr;
-    if (!ParseCategoryEntryAndStore(*dict, aplist.get()))
+    if (!parser::VerifyElementNamespace(*dict, kTizenNamespacePrefix))
       return nullptr;
+    if (!ParseCategoryEntryAndStore(*dict, aplist.get())) return nullptr;
   } else {
     LOG(INFO) << "Category element is not defined.";
     return true;
@@ -96,9 +88,7 @@ bool CategoryHandler::Validate(
   return true;
 }
 
-std::string CategoryHandler::Key() const {
-  return keys::kTizenCategoryKey;
-}
+std::string CategoryHandler::Key() const { return keys::kTizenCategoryKey; }
 
 }  // namespace parse
 }  // namespace wgt
index 83ac4a4de6565c2f97922ae8f9dda2c197f74f9f..93940c2916c6d4f0621ce9c43fe5dcff9b791140 100644 (file)
@@ -21,16 +21,19 @@ namespace keys = wgt::application_widget_keys;
 
 namespace {
 
+const char kNamespaceKey[] = "@namespace";
+const char kTizenNamespacePrefix[] = "http://tizen.org/ns/widgets";
+const char kWidgetNamespacePrefix[] = "http://www.w3.org/ns/widgets";
+const char kTizenContentEncodingKey[] = "@encoding";
+const char kTizenContentTypeKey[] = "@type";
 const char kMimeMainComponent[] = "";
 const char kMimeCharsetComponent[] = "charset";
 const char kDefaultMimeType[] = "text/html";
 const char kDefaultEncoding[] = "UTF-8";
+const char kTizenContentSrcKey[] = "@src";
 
 const std::set<std::string> ValidMimeTypeStartFile = {
-  "text/html",
-  "application/xhtml+xml",
-  "image/svg+xml"
-};
+    "text/html", "application/xhtml+xml", "image/svg+xml"};
 
 std::map<std::string, std::string> ParseMimeComponents(
     const std::string& type) {
@@ -57,9 +60,8 @@ std::map<std::string, std::string> ParseMimeComponents(
 }
 
 bool ValidateMimeTypeStartFile(const std::string& type) {
-  return ValidMimeTypeStartFile.find(
-        parser::utils::CollapseWhitespaceUTF8(type)) !=
-      ValidMimeTypeStartFile.end();
+  return ValidMimeTypeStartFile.find(parser::utils::CollapseWhitespaceUTF8(
+             type)) != ValidMimeTypeStartFile.end();
 }
 
 }  // namespace
@@ -68,12 +70,9 @@ namespace wgt {
 namespace parse {
 
 ContentHandler::ContentHandler()
-    : w3c_content_found_(false),
-      tizen_content_found_(false) {
-}
+    : w3c_content_found_(false), tizen_content_found_(false) {}
 
-ContentHandler::~ContentHandler() {
-}
+ContentHandler::~ContentHandler() {}
 
 /**
  * @brief ParseAndSetContentValue
@@ -88,12 +87,11 @@ ContentHandler::~ContentHandler() {
  */
 ContentHandler::ParseResult ContentHandler::ParseAndSetContentValue(
     const parser::DictionaryValue& dict,
-    std::shared_ptr<wgt::parse::ContentInfo>* content,
-    std::string* error) {
+    std::shared_ptr<wgt::parse::ContentInfo>* content, std::string* error) {
   std::string element_namespace;
-  dict.GetString(keys::kNamespaceKey, &element_namespace);
+  dict.GetString(kNamespaceKey, &element_namespace);
 
-  if (element_namespace == keys::kTizenNamespacePrefix) {
+  if (element_namespace == kTizenNamespacePrefix) {
     if (tizen_content_found_) {
       // tizen:content already found
       return ParseResult::IGNORE;
@@ -108,7 +106,7 @@ ContentHandler::ParseResult ContentHandler::ParseAndSetContentValue(
   }
 
   std::string src;
-  if (!dict.GetString(keys::kTizenContentSrcKey, &src)) {
+  if (!dict.GetString(kTizenContentSrcKey, &src)) {
     return ParseResult::IGNORE;
   }
 
@@ -119,7 +117,7 @@ ContentHandler::ParseResult ContentHandler::ParseAndSetContentValue(
   }
 
   std::string type = kDefaultMimeType;
-  dict.GetString(keys::kTizenContentTypeKey, &type);
+  dict.GetString(kTizenContentTypeKey, &type);
   // TODO(t.iwanek): this will fail for "quoted-string"
   //                 use/implement proper mime parsing...
   std::map<std::string, std::string> mime_components =
@@ -128,13 +126,13 @@ ContentHandler::ParseResult ContentHandler::ParseAndSetContentValue(
   auto mime_iter = mime_components.find(kMimeMainComponent);
   if (mime_iter != mime_components.end()) {
     if (!ValidateMimeTypeStartFile(mime_iter->second)) {
-        *error = "Not proper type of starting file";
-        return ParseResult::IGNORE;
+      *error = "Not proper type of starting file";
+      return ParseResult::IGNORE;
     }
   }
 
   std::string encoding = kDefaultEncoding;
-  if (!dict.GetString(keys::kTizenContentEncodingKey, &encoding)) {
+  if (!dict.GetString(kTizenContentEncodingKey, &encoding)) {
     auto charset_iter = mime_components.find(kMimeCharsetComponent);
     if (charset_iter != mime_components.end()) {
       encoding = charset_iter->second;
@@ -151,15 +149,13 @@ ContentHandler::ParseResult ContentHandler::ParseAndSetContentValue(
   (*content)->set_src(src);
   (*content)->set_type(type);
   (*content)->set_encoding(encoding);
-  (*content)->set_is_tizen_content(
-      element_namespace == keys::kTizenNamespacePrefix);
+  (*content)->set_is_tizen_content(element_namespace == kTizenNamespacePrefix);
   return ParseResult::OK;
 }
 
-bool ContentHandler::Parse(
-    const parser::Manifest& manifest,
-    std::shared_ptr<parser::ManifestData>* output,
-    std::string* error) {
+bool ContentHandler::Parse(const parser::Manifest& manifest,
+                           std::shared_ptr<parser::ManifestData>* output,
+                           std::string* error) {
   std::shared_ptr<ContentInfo> content_info;
   parser::Value* value = nullptr;
   manifest.Get(keys::kTizenContentKey, &value);
@@ -169,8 +165,8 @@ bool ContentHandler::Parse(
   if (value->GetType() == parser::Value::TYPE_DICTIONARY) {
     const parser::DictionaryValue* dict = nullptr;
     value->GetAsDictionary(&dict);
-    if (ParseAndSetContentValue(*dict, &content_info, error)
-        == ParseResult::ERROR) {
+    if (ParseAndSetContentValue(*dict, &content_info, error) ==
+        ParseResult::ERROR) {
       return false;
     }
   } else if (value->GetType() == parser::Value::TYPE_LIST) {
@@ -180,8 +176,8 @@ bool ContentHandler::Parse(
     for (auto& item : *list) {
       const parser::DictionaryValue* dict = nullptr;
       if (item->GetAsDictionary(&dict)) {
-        if (ParseAndSetContentValue(*dict, &content_info, error)
-            == ParseResult::ERROR) {
+        if (ParseAndSetContentValue(*dict, &content_info, error) ==
+            ParseResult::ERROR) {
           return false;
         }
       }
@@ -195,9 +191,7 @@ bool ContentHandler::Parse(
   return true;
 }
 
-std::string ContentHandler::Key() const {
-  return keys::kTizenContentKey;
-}
+std::string ContentHandler::Key() const { return keys::kTizenContentKey; }
 
 }  // namespace parse
 }  // namespace wgt
index bf20aa915a4bf931b3671b62ded2cd6f2d200d9e..b4ab88c5a068a94afaaab2e17e976198a0a54e50 100644 (file)
 
 #include "manifest_handlers/application_manifest_constants.h"
 
+namespace {
+const char kTizenNamespacePrefix[] = "http://tizen.org/ns/widgets";
+const char kWidgetNamespacePrefix[] = "http://www.w3.org/ns/widgets";
+const char kXmlTextKey[] = "#text";
+}
+
 namespace wgt {
 namespace parse {
 
 namespace keys = wgt::application_widget_keys;
 
-bool CSPHandler::Parse(
-    const parser::Manifest& manifest,
-    std::shared_ptr<parser::ManifestData>* output,
-    std::string* /*error*/) {
-  std::string security_policy = (security_type_ == SecurityType::CSP) ?
-      keys::kCSPKey : keys::kCSPReportOnlyKey;
+bool CSPHandler::Parse(const parser::Manifest& manifest,
+                       std::shared_ptr<parser::ManifestData>* output,
+                       std::string* /*error*/) {
+  std::string security_policy = (security_type_ == SecurityType::CSP)
+                                    ? keys::kCSPKey
+                                    : keys::kCSPReportOnlyKey;
   const parser::Value* value = nullptr;
-  if (!manifest.Get(security_policy, &value))
-    return true;
+  if (!manifest.Get(security_policy, &value)) return true;
   const parser::DictionaryValue* dict = nullptr;
   if (!value->GetAsDictionary(&dict)) {
     const parser::ListValue* list = nullptr;
@@ -32,22 +37,20 @@ bool CSPHandler::Parse(
       const parser::DictionaryValue* candidate = nullptr;
       for (auto& item : *list) {
         if (item->GetAsDictionary(&candidate) &&
-            parser::VerifyElementNamespace(
-              *candidate, keys::kTizenNamespacePrefix)) {
+            parser::VerifyElementNamespace(*candidate, kTizenNamespacePrefix)) {
           dict = candidate;
           break;
         }
       }
     }
   }
-  if (!dict)
-    return true;
-  if (!parser::VerifyElementNamespace(*dict, keys::kTizenNamespacePrefix))
+  if (!dict) return true;
+  if (!parser::VerifyElementNamespace(*dict, kTizenNamespacePrefix))
     return true;
 
   std::shared_ptr<CSPInfo> info(new CSPInfo);
   std::string security_rules;
-  if (dict->GetString(keys::kXmlTextKey, &security_rules)) {
+  if (dict->GetString(kXmlTextKey, &security_rules)) {
     info->set_security_rules(security_rules);
     *output = std::static_pointer_cast<parser::ManifestData>(info);
   }
@@ -55,8 +58,8 @@ bool CSPHandler::Parse(
 }
 
 std::string CSPHandler::Key() const {
-  return security_type_ == SecurityType::CSP ?
-        keys::kCSPKey : keys::kCSPReportOnlyKey;
+  return security_type_ == SecurityType::CSP ? keys::kCSPKey
+                                             : keys::kCSPReportOnlyKey;
 }
 
 }  // namespace parse
index b9398fb56f168ed3cbd6b82faaec07bff2589739..24859f30558047513b730ba104e77ccc3d1ba08d 100644 (file)
@@ -20,18 +20,22 @@ namespace keys = wgt::application_widget_keys;
 
 namespace {
 
+const char kTizenNamespacePrefix[] = "http://tizen.org/ns/widgets";
+const char kWidgetNamespacePrefix[] = "http://www.w3.org/ns/widgets";
+const char kTizenImeUuidKey[] = "uuid";
+const char kTizenImeUuidTextKey[] = "#text";
+const char kTizenImeLanguagesKey[] = "languages";
+const char kTizenImeLanguageKey[] = "language";
+const char kTizenImeLanguageTextKey[] = "#text";
+
 const char kErrMsgLanguages[] =
     "At least and only ONE tizen:languages tag should be specified";
-const char kErrMsgEmptyLanguage[] =
-    "Language cannot be empty";
-const char kErrMsgParsingIme[] =
-    "Only one ime tag should be specified";
-const char kErrMsgParsingUuid[] =
-    "Only one uuid tag should be specified";
+const char kErrMsgEmptyLanguage[] = "Language cannot be empty";
+const char kErrMsgParsingIme[] = "Only one ime tag should be specified";
+const char kErrMsgParsingUuid[] = "Only one uuid tag should be specified";
 const char kErrMsgValidatingUuidEmpty[] =
     "The UUID of ime element is obligatory";
-const char kErrMsgUuidFormat[] =
-    "Uuid should be in proper format (8-4-4-4-12)";
+const char kErrMsgUuidFormat[] = "Uuid should be in proper format (8-4-4-4-12)";
 const char kErrMsgNoLanguages[] =
     "At least one language of ime element should be specified";
 
@@ -39,11 +43,11 @@ const std::regex kUuidRegex(
     "^[0-9a-zA-Z]{8}([-][0-9a-zA-Z]{4}){3}[-][0-9a-zA-Z]{12}$");
 
 bool GetLanguage(const parser::Value* item, ImeInfo* ime_info,
-    std::string* error) {
+                 std::string* error) {
   const parser::DictionaryValue* language_dict;
   if (item->GetAsDictionary(&language_dict)) {
     std::string language;
-    if (!language_dict->GetString(keys::kTizenImeLanguageTextKey, &language) ||
+    if (!language_dict->GetString(kTizenImeLanguageTextKey, &language) ||
         language.empty()) {
       *error = kErrMsgEmptyLanguage;
       return false;
@@ -54,13 +58,12 @@ bool GetLanguage(const parser::Value* item, ImeInfo* ime_info,
 }
 
 bool ParseImeEntryAndStore(const parser::DictionaryValue& control_dict,
-    ImeInfo* ime_info, std::string* error) {
-
+                           ImeInfo* ime_info, std::string* error) {
   // parsing uuid element
   const parser::DictionaryValue* uuid_dict;
   std::string uuid;
-  if (control_dict.GetDictionary(keys::kTizenImeUuidKey, &uuid_dict) &&
-      uuid_dict->GetString(keys::kTizenImeUuidTextKey, &uuid)) {
+  if (control_dict.GetDictionary(kTizenImeUuidKey, &uuid_dict) &&
+      uuid_dict->GetString(kTizenImeUuidTextKey, &uuid)) {
     ime_info->set_uuid(uuid);
   } else {
     *error = kErrMsgParsingUuid;
@@ -68,14 +71,13 @@ bool ParseImeEntryAndStore(const parser::DictionaryValue& control_dict,
   }
 
   const parser::DictionaryValue* languages_dict;
-  if (!control_dict.GetDictionary(
-      keys::kTizenImeLanguagesKey, &languages_dict)) {
+  if (!control_dict.GetDictionary(kTizenImeLanguagesKey, &languages_dict)) {
     *error = kErrMsgLanguages;
     return false;
   }
 
   const parser::Value* languages;
-  if (!languages_dict->Get(keys::kTizenImeLanguageKey, &languages)) {
+  if (!languages_dict->Get(kTizenImeLanguageKey, &languages)) {
     *error = kErrMsgNoLanguages;
     return false;
   }
@@ -85,12 +87,10 @@ bool ParseImeEntryAndStore(const parser::DictionaryValue& control_dict,
     const parser::ListValue* list;
     languages->GetAsList(&list);
     for (const auto& item : *list) {
-      if (!GetLanguage(item, ime_info, error))
-        return false;
+      if (!GetLanguage(item, ime_info, error)) return false;
     }
   } else if (languages->GetType() == parser::Value::TYPE_DICTIONARY) {
-    if (!GetLanguage(languages, ime_info, error))
-      return false;
+    if (!GetLanguage(languages, ime_info, error)) return false;
   }
 
   return true;
@@ -103,30 +103,24 @@ bool IsValidUuid(const std::string& uuid) {
 
 }  // namespace
 
-ImeInfo::ImeInfo() {
-}
+ImeInfo::ImeInfo() {}
 
-ImeInfo::~ImeInfo() {
-}
+ImeInfo::~ImeInfo() {}
 
-ImeHandler::ImeHandler() {
-}
+ImeHandler::ImeHandler() {}
 
-ImeHandler::~ImeHandler() {
-}
+ImeHandler::~ImeHandler() {}
 
 void ImeInfo::AddLanguage(const std::string& language) {
   languages_.push_back(language);
 }
 
-bool ImeHandler::Parse(
-    const parser::Manifest& manifest,
-    std::shared_ptr<parser::ManifestData>* output,
-    std::string* error) {
+bool ImeHandler::Parse(const parser::Manifest& manifest,
+                       std::shared_ptr<parser::ManifestData>* output,
+                       std::string* error) {
   std::shared_ptr<ImeInfo> ime_info(new ImeInfo);
   parser::Value* value = nullptr;
-  if (!manifest.Get(keys::kTizenImeKey, &value))
-    return true;
+  if (!manifest.Get(keys::kTizenImeKey, &value)) return true;
 
   bool result = true;
 
@@ -134,7 +128,7 @@ bool ImeHandler::Parse(
     // single entry
     const parser::DictionaryValue* dict;
     value->GetAsDictionary(&dict);
-    if (!parser::VerifyElementNamespace(*dict, keys::kTizenNamespacePrefix))
+    if (!parser::VerifyElementNamespace(*dict, kTizenNamespacePrefix))
       return nullptr;
     result = ParseImeEntryAndStore(*dict, ime_info.get(), error);
   } else if (value->GetType() == parser::Value::TYPE_LIST) {
@@ -149,15 +143,12 @@ bool ImeHandler::Parse(
   return true;
 }
 
-bool ImeHandler::Validate(
-    const parser::ManifestData& data,
-    const parser::ManifestDataMap& /*handlers_output*/,
-    std::string* error) const {
-
+bool ImeHandler::Validate(const parser::ManifestData& data,
+                          const parser::ManifestDataMap& /*handlers_output*/,
+                          std::string* error) const {
   const ImeInfo& ime_info = static_cast<const ImeInfo&>(data);
 
-  if (!ime_info.exists())
-    return true;
+  if (!ime_info.exists()) return true;
 
   if (ime_info.uuid().empty()) {
     *error = kErrMsgValidatingUuidEmpty;
@@ -177,9 +168,7 @@ bool ImeHandler::Validate(
   return true;
 }
 
-std::string ImeHandler::Key() const {
-  return keys::kTizenImeKey;
-}
+std::string ImeHandler::Key() const { return keys::kTizenImeKey; }
 
 }  // namespace parse
 }  // namespace wgt
index 644c9558d8497fa66ab5e6d0eb6a3720144dc758..94c3d5b98f7b6308779263a5739c1d4f0d1d2052 100755 (executable)
@@ -23,15 +23,18 @@ typedef std::map<std::string, std::string> MetaDataMap;
 typedef std::map<std::string, std::string>::const_iterator MetaDataIter;
 
 namespace {
-
+const char kTizenNamespacePrefix[] = "http://tizen.org/ns/widgets";
+const char kWidgetNamespacePrefix[] = "http://www.w3.org/ns/widgets";
+const char kTizenMetaDataNameKey[] = "@key";
+const char kTizenMetaDataValueKey[] = "@value";
 MetaDataPair ParseMetaDataItem(const parser::DictionaryValue* dict,
                                std::string* error) {
   assert(dict && dict->IsType(parser::Value::TYPE_DICTIONARY));
   MetaDataPair result;
-  if (!dict->GetString(keys::kTizenMetaDataNameKey, &result.first)) {
+  if (!dict->GetString(kTizenMetaDataNameKey, &result.first)) {
     *error = "Invalid key of tizen metaData.";
   } else {
-    if (!dict->GetString(keys::kTizenMetaDataValueKey, &result.second)) {
+    if (!dict->GetString(kTizenMetaDataValueKey, &result.second)) {
       result.second = "";
     }
   }
@@ -51,13 +54,11 @@ bool MetaDataInfo::HasKey(const std::string& key) const {
 
 std::string MetaDataInfo::GetValue(const std::string& key) const {
   MetaDataIter it = metadata_.find(key);
-  if (it != metadata_.end())
-    return it->second;
+  if (it != metadata_.end()) return it->second;
   return std::string("");
 }
 
-void MetaDataInfo::SetValue(const std::string& key,
-                                 const std::string& value) {
+void MetaDataInfo::SetValue(const std::string& key, const std::string& value) {
   metadata_.insert(MetaDataPair(key, value));
 }
 
@@ -65,10 +66,9 @@ MetaDataHandler::MetaDataHandler() {}
 
 MetaDataHandler::~MetaDataHandler() {}
 
-bool MetaDataHandler::Parse(
-    const parser::Manifest& manifest,
-    std::shared_ptr<parser::ManifestData>* output,
-    std::string* error) {
+bool MetaDataHandler::Parse(const parser::Manifest& manifest,
+                            std::shared_ptr<parser::ManifestData>* output,
+                            std::string* error) {
   std::shared_ptr<MetaDataInfo> metadata_info(new MetaDataInfo);
   parser::Value* metadata_value = nullptr;
 
@@ -78,31 +78,32 @@ bool MetaDataHandler::Parse(
   }
 
   MetaDataPair metadata_item;
-  if (metadata_value && metadata_value->IsType(
-          parser::Value::TYPE_DICTIONARY)) {
+  if (metadata_value &&
+      metadata_value->IsType(parser::Value::TYPE_DICTIONARY)) {
     parser::DictionaryValue* dict;
     metadata_value->GetAsDictionary(&dict);
-    if (parser::VerifyElementNamespace(*dict, keys::kTizenNamespacePrefix)) {
+    if (parser::VerifyElementNamespace(*dict, kTizenNamespacePrefix)) {
       metadata_item = ParseMetaDataItem(dict, error);
       metadata_info->SetValue(metadata_item.first, metadata_item.second);
     }
   } else if (metadata_value &&
-        metadata_value->IsType(parser::Value::TYPE_LIST)) {
+             metadata_value->IsType(parser::Value::TYPE_LIST)) {
     parser::ListValue* list;
     metadata_value->GetAsList(&list);
 
-    for (parser::ListValue::iterator it = list->begin();
-         it != list->end(); ++it) {
+    for (parser::ListValue::iterator it = list->begin(); it != list->end();
+         ++it) {
       parser::DictionaryValue* dict;
       (*it)->GetAsDictionary(&dict);
-      if (!parser::VerifyElementNamespace(*dict, keys::kTizenNamespacePrefix))
+      if (!parser::VerifyElementNamespace(*dict, kTizenNamespacePrefix))
         continue;
       metadata_item = ParseMetaDataItem(dict, error);
       metadata_info->SetValue(metadata_item.first, metadata_item.second);
     }
   } else {
-    *error = "tizen metaData element exists and its type is neither "
-             "TYPE_LIST nor TYPE_DICTIONARY.";
+    *error =
+        "tizen metaData element exists and its type is neither "
+        "TYPE_LIST nor TYPE_DICTIONARY.";
     return false;
   }
 
@@ -117,13 +118,11 @@ bool MetaDataHandler::Validate(
   const MetaDataInfo& mdata_info = static_cast<const MetaDataInfo&>(data);
   // TODO(j.izydorczyk):
   // Here should be performed *info class members validity check
-  (void) mdata_info;
+  (void)mdata_info;
   return true;
 }
 
-std::string MetaDataHandler::Key() const {
-  return keys::kTizenMetaDataKey;
-}
+std::string MetaDataHandler::Key() const { return keys::kTizenMetaDataKey; }
 
 }  // namespace parse
 }  // namespace wgt
index e2acdab484cf9ff0e658b366f781ed1e695f0268..6bf7bb465f2055881eb5a6654cb7cb924b4466a1 100644 (file)
@@ -15,37 +15,33 @@ namespace parse {
 namespace keys = wgt::application_widget_keys;
 
 namespace {
-
+const char kTizenNamespacePrefix[] = "http://tizen.org/ns/widgets";
+const char kWidgetNamespacePrefix[] = "http://www.w3.org/ns/widgets";
+const char kXmlTextKey[] = "#text";
 const boost::char_separator<char> navigation_separator(" ");
 
 }  // namespace
 
-AllowedNavigationInfo::AllowedNavigationInfo(const std::string&
-                                             allowed_domains) {
-  boost::tokenizer<boost::char_separator<char>> tokens(
-      allowed_domains, navigation_separator);
+AllowedNavigationInfo::AllowedNavigationInfo(
+    const std::string& allowed_domains) {
+  boost::tokenizer<boost::char_separator<char>> tokens(allowed_domains,
+                                                       navigation_separator);
   for (auto& item : tokens) {
     allowed_domains_.push_back(item);
   }
 }
 
-AllowedNavigationInfo::~AllowedNavigationInfo() {
-}
+AllowedNavigationInfo::~AllowedNavigationInfo() {}
 
-NavigationHandler::NavigationHandler() {
-}
-
-NavigationHandler::~NavigationHandler() {
-}
+NavigationHandler::NavigationHandler() {}
 
-bool NavigationHandler::Parse(
-    const parser::Manifest& manifest,
-    std::shared_ptr<parser::ManifestData>* output,
-    std::string* error) {
+NavigationHandler::~NavigationHandler() {}
 
+bool NavigationHandler::Parse(const parser::Manifest& manifest,
+                              std::shared_ptr<parser::ManifestData>* output,
+                              std::string* error) {
   const parser::Value* value = nullptr;
-  if (!manifest.Get(keys::kAllowNavigationKey, &value))
-    return true;
+  if (!manifest.Get(keys::kAllowNavigationKey, &value)) return true;
   const parser::DictionaryValue* dict = nullptr;
   if (!value->GetAsDictionary(&dict)) {
     const parser::ListValue* list = nullptr;
@@ -53,21 +49,18 @@ bool NavigationHandler::Parse(
       for (auto& item : *list) {
         const parser::DictionaryValue* candidate = nullptr;
         if (item->GetAsDictionary(&candidate) &&
-            parser::VerifyElementNamespace(
-              *candidate, keys::kTizenNamespacePrefix)) {
+            parser::VerifyElementNamespace(*candidate, kTizenNamespacePrefix)) {
           dict = candidate;
           break;
         }
       }
     }
   }
-  if (!dict)
-    return true;
-  if (!VerifyElementNamespace(*dict, keys::kTizenNamespacePrefix))
-    return true;
+  if (!dict) return true;
+  if (!VerifyElementNamespace(*dict, kTizenNamespacePrefix)) return true;
 
   std::string allowed_domains;
-  if (!dict->GetString(keys::kXmlTextKey, &allowed_domains)) {
+  if (!dict->GetString(kXmlTextKey, &allowed_domains)) {
     return true;
   }
 
@@ -83,13 +76,11 @@ bool NavigationHandler::Validate(
   const AllowedNavigationInfo& navi_info =
       static_cast<const AllowedNavigationInfo&>(data);
   // TODO(j.izydorczyk): There should be done 'navi_info' validity check.
-  (void) navi_info;
+  (void)navi_info;
   return true;
 }
 
-std::string NavigationHandler::Key() const {
-  return keys::kAllowNavigationKey;
-}
+std::string NavigationHandler::Key() const { return keys::kAllowNavigationKey; }
 
 }  // namespace parse
 }  // namespace wgt
index 5986b3a142ee6c5958f1c4f522b404b5c5574eba..2b5a43e1b84f040859881f8ddd0a4ecd1080e565 100644 (file)
@@ -14,22 +14,23 @@ namespace parse {
 
 namespace keys = wgt::application_widget_keys;
 
-PermissionsInfo::PermissionsInfo() {
+namespace {
+const char kTizenNamespacePrefix[] = "http://tizen.org/ns/widgets";
+const char kTizenPermissionsNameKey[] = "@name";
+const char kWidgetNamespacePrefix[] = "http://www.w3.org/ns/widgets";
 }
 
-PermissionsInfo::~PermissionsInfo() {
-}
+PermissionsInfo::PermissionsInfo() {}
 
-PermissionsHandler::PermissionsHandler() {
-}
+PermissionsInfo::~PermissionsInfo() {}
 
-PermissionsHandler::~PermissionsHandler() {
-}
+PermissionsHandler::PermissionsHandler() {}
 
-bool PermissionsHandler::Parse(
-    const parser::Manifest& manifest,
-    std::shared_ptr<parser::ManifestData>* output,
-    std::string* error) {
+PermissionsHandler::~PermissionsHandler() {}
+
+bool PermissionsHandler::Parse(const parser::Manifest& manifest,
+                               std::shared_ptr<parser::ManifestData>* output,
+                               std::string* error) {
   std::shared_ptr<PermissionsInfo> permissions_info(new PermissionsInfo);
   if (!manifest.HasPath(keys::kTizenPermissionsKey)) {
     return true;
@@ -48,8 +49,7 @@ bool PermissionsHandler::Parse(
   } else {
     parser::ListValue* list = nullptr;
     value->GetAsList(&list);
-    if (list)
-      permission_list.reset(list->DeepCopy());
+    if (list) permission_list.reset(list->DeepCopy());
   }
 
   if (!permission_list) {
@@ -61,14 +61,12 @@ bool PermissionsHandler::Parse(
        it != permission_list->end(); ++it) {
     parser::DictionaryValue* dictionary_value = nullptr;
     (*it)->GetAsDictionary(&dictionary_value);
-    if (!dictionary_value)
-      continue;
+    if (!dictionary_value) continue;
     if (!parser::VerifyElementNamespace(*dictionary_value,
-                                        keys::kTizenNamespacePrefix))
+                                        kTizenNamespacePrefix))
       continue;
     std::string permission;
-    if (!dictionary_value->GetString(
-            keys::kTizenPermissionsNameKey, &permission) ||
+    if (!dictionary_value->GetString(kTizenPermissionsNameKey, &permission) ||
         permission.empty())
       continue;
 
@@ -90,7 +88,7 @@ bool PermissionsHandler::Validate(
     std::string* /*error*/) const {
   const PermissionsInfo& perm_info = static_cast<const PermissionsInfo&>(data);
   // TODO(j.izydorczyk): there should be done 'perm_info' members validation
-  (void) perm_info;
+  (void)perm_info;
   return true;
 }
 
index 81152435da13cfa9d1f788799fa3167e4c555c7b..d245408e0ee91faebff33265b23913fc220d1b7b 100644 (file)
 namespace keys = wgt::application_widget_keys;
 
 namespace {
+const char kTizenServiceIdKey[] = "@id";
+const char kTizenServiceAutoRestartKey[] = "@auto-restart";
+const char kTizenServiceOnBootKey[] = "@on-boot";
+const char kTizenServiceCategoryKey[] = "category";
+const char kTizenServiceCategoryNameKey[] = "@name";
+const char kTizenServiceContentKey[] = "content";
+const char kTizenNamespacePrefix[] = "http://tizen.org/ns/widgets";
+const char kWidgetNamespacePrefix[] = "http://www.w3.org/ns/widgets";
+const char kTizenServiceNameKey[] = "name";
+const char kTizenServiceContentSrcKey[] = "@src";
+const char kTizenServiceIconKey[] = "icon";
+const char kTizenServiceIconSrcKey[] = "@src";
+const char kTizenServiceDescriptionKey[] = "description";
+const char kTizenServiceMetadataKey[] = "metadata";
+const char kTizenServiceMetadataKeyKey[] = "@key";
+const char kTizenServiceMetadataValueKey[] = "@value";
+const char kXmlLangKey[] = "@lang";
+const char kXmlTextKey[] = "#text";
 
 bool ParseServiceContent(const parser::DictionaryValue* dict,
                          wgt::parse::ServiceInfo* service_info,
                          std::string* error) {
   std::string content;
   bool found = false;
-  for (auto& item : parser::GetOneOrMany(dict, keys::kTizenServiceContentKey,
-                                         keys::kTizenNamespacePrefix)) {
+  for (auto& item : parser::GetOneOrMany(dict, kTizenServiceContentKey,
+                                         kTizenNamespacePrefix)) {
     if (found) {
       *error = "tizen:content element of tizen:service "
                "should be declared only once";
       return false;
     }
     found = true;
-    if (!item->GetString(keys::kTizenServiceContentSrcKey, &content)) {
+    if (!item->GetString(kTizenServiceContentSrcKey, &content)) {
       *error =
           "Missing 'src' attribute in tizen:content tag in tizen:service";
       return false;
@@ -49,15 +67,15 @@ bool ParseServiceIcon(const parser::DictionaryValue* dict,
                       wgt::parse::ServiceInfo* service_info,
                       std::string* error) {
   std::string icon;
-  const auto& items = parser::GetOneOrMany(dict, keys::kTizenServiceIconKey,
-                                           keys::kTizenNamespacePrefix);
+  const auto& items = parser::GetOneOrMany(dict, kTizenServiceIconKey,
+                                           kTizenNamespacePrefix);
   if (!items.empty()) {
     if (items.size() > 1) {
       *error = "tizen:icon element of tizen:service "
                "should be declared only once";
       return false;
     }
-    if (!items[0]->GetString(keys::kTizenServiceIconSrcKey, &icon)) {
+    if (!items[0]->GetString(kTizenServiceIconSrcKey, &icon)) {
       *error = "Missing 'src' attribute in tizen:icon tag in tizen:service";
       return false;
     }
@@ -70,19 +88,19 @@ bool ParseServiceDescription(const parser::DictionaryValue* dict,
                              wgt::parse::ServiceInfo* service_info,
                              std::string* error) {
   const parser::Value* value = nullptr;
-  if (!dict->Get(keys::kTizenServiceDescriptionKey, &value))
-    return true;
+  if (!dict->Get(kTizenServiceDescriptionKey, &value)) return true;
   std::string description;
+
   const auto& items = parser::GetOneOrMany(dict,
-                                           keys::kTizenServiceDescriptionKey,
-                                           keys::kTizenNamespacePrefix);
+                                           kTizenServiceDescriptionKey,
+                                           kTizenNamespacePrefix);
   if (!items.empty()) {
     if (items.size() > 1) {
       *error = "tizen:description element of tizen:service "
                "should be declared only once";
       return false;
     }
-    items[0]->GetString(keys::kXmlTextKey, &description);
+    items[0]->GetString(kXmlTextKey, &description);
     service_info->set_description(description);
   }
   return true;
@@ -92,10 +110,10 @@ bool ParseServiceCategory(const parser::DictionaryValue* dict,
                           wgt::parse::ServiceInfo* service_info,
                           std::string* error) {
   std::vector<std::string> categories;
-  for (auto& item : parser::GetOneOrMany(dict, keys::kTizenServiceCategoryKey,
-                                         keys::kTizenNamespacePrefix)) {
+  for (auto& item : parser::GetOneOrMany(dict, kTizenServiceCategoryKey,
+                                         kTizenNamespacePrefix)) {
     std::string category;
-    if (!item->GetString(keys::kTizenServiceCategoryNameKey, &category)) {
+    if (!item->GetString(kTizenServiceCategoryNameKey, &category)) {
       *error =
           "Missing 'name' attribute of tizen:category tag in tizen:service";
       return false;
@@ -110,12 +128,12 @@ bool ParseServiceName(const parser::DictionaryValue* dict,
                       wgt::parse::ServiceInfo* service_info,
                       std::string* error) {
   wgt::parse::LangNameVector names;
-  for (auto& item : parser::GetOneOrMany(dict, keys::kTizenServiceNameKey,
-                                         keys::kTizenNamespacePrefix)) {
+  for (auto& item : parser::GetOneOrMany(dict, kTizenServiceNameKey,
+                                         kTizenNamespacePrefix)) {
     std::string lang;
     std::string name;
-    item->GetString(keys::kXmlLangKey, &lang);
-    item->GetString(keys::kXmlTextKey, &name);
+    item->GetString(kXmlLangKey, &lang);
+    item->GetString(kXmlTextKey, &name);
     names.emplace_back(lang, name);
   }
   if (names.empty()) {
@@ -131,15 +149,15 @@ bool ParseServiceMetadata(const parser::DictionaryValue* dict,
                           wgt::parse::ServiceInfo* service_info,
                           std::string* error) {
   wgt::parse::KeyValueVector metadata_set;
-  for (auto& item : parser::GetOneOrMany(dict, keys::kTizenServiceMetadataKey,
-                                         keys::kTizenNamespacePrefix)) {
+  for (auto& item : parser::GetOneOrMany(dict, kTizenServiceMetadataKey,
+                                         kTizenNamespacePrefix)) {
     std::string key;
     std::string value;
-    if (!item->GetString(keys::kTizenServiceMetadataKeyKey, &key)) {
+    if (!item->GetString(kTizenServiceMetadataKeyKey, &key)) {
       *error = "'key' attribute of metadata is obligatory";
       return false;
     }
-    item->GetString(keys::kTizenServiceMetadataValueKey, &value);
+    item->GetString(kTizenServiceMetadataValueKey, &value);
     metadata_set.emplace_back(key, value);
   }
   service_info->set_metadata_set(metadata_set);
@@ -149,7 +167,7 @@ bool ParseServiceMetadata(const parser::DictionaryValue* dict,
 std::unique_ptr<wgt::parse::ServiceInfo> ParseService(
     const parser::DictionaryValue* dict, std::string* error) {
   std::string id;
-  if (!dict->GetString(keys::kTizenServiceIdKey, &id)) {
+  if (!dict->GetString(kTizenServiceIdKey, &id)) {
     *error = "Cannot get appid for tizen:service";
     return nullptr;
   }
@@ -158,30 +176,24 @@ std::unique_ptr<wgt::parse::ServiceInfo> ParseService(
       new wgt::parse::ServiceInfo(id));
 
   std::string auto_restart = "false";
-  if (dict->GetString(keys::kTizenServiceAutoRestartKey, &auto_restart))
+  if (dict->GetString(kTizenServiceAutoRestartKey, &auto_restart))
     service->set_auto_restart(auto_restart == "true");
 
   std::string on_boot = "false";
-  if (dict->GetString(keys::kTizenServiceOnBootKey, &on_boot))
+  if (dict->GetString(kTizenServiceOnBootKey, &on_boot))
     service->set_on_boot(on_boot == "true");
 
-  if (!ParseServiceContent(dict, service.get(), error))
-    return nullptr;
+  if (!ParseServiceContent(dict, service.get(), error)) return nullptr;
 
-  if (!ParseServiceIcon(dict, service.get(), error))
-    return nullptr;
+  if (!ParseServiceIcon(dict, service.get(), error)) return nullptr;
 
-  if (!ParseServiceDescription(dict, service.get(), error))
-    return nullptr;
+  if (!ParseServiceDescription(dict, service.get(), error)) return nullptr;
 
-  if (!ParseServiceCategory(dict, service.get(), error))
-    return nullptr;
+  if (!ParseServiceCategory(dict, service.get(), error)) return nullptr;
 
-  if (!ParseServiceName(dict, service.get(), error))
-    return nullptr;
+  if (!ParseServiceName(dict, service.get(), error)) return nullptr;
 
-  if (!ParseServiceMetadata(dict, service.get(), error))
-    return nullptr;
+  if (!ParseServiceMetadata(dict, service.get(), error)) return nullptr;
 
   return service;
 }
@@ -193,8 +205,7 @@ namespace wgt {
 namespace parse {
 
 ServiceInfo::ServiceInfo(const std::string& id, bool auto_restart, bool on_boot)
-    : id_(id), auto_restart_(auto_restart), on_boot_(on_boot) {
-}
+    : id_(id), auto_restart_(auto_restart), on_boot_(on_boot) {}
 
 ServiceInfo::~ServiceInfo() {}
 
@@ -202,6 +213,7 @@ ServiceHandler::ServiceHandler() {}
 
 ServiceHandler::~ServiceHandler() {}
 
+
 bool ServiceHandler::Parse(
     const parser::Manifest& manifest,
     std::shared_ptr<parser::ManifestData>* output,
@@ -210,8 +222,9 @@ bool ServiceHandler::Parse(
     return true;
   }
   std::shared_ptr<ServiceList> services_data(new ServiceList());
+
   for (auto& item : parser::GetOneOrMany(manifest.value(),
-      keys::kTizenServiceKey, keys::kTizenNamespacePrefix)) {
+      keys::kTizenServiceKey, kTizenNamespacePrefix)) {
     auto service = ParseService(item, error);
     if (!service)
       return false;
@@ -229,8 +242,9 @@ bool ServiceHandler::Validate(
 
   for (auto& service : services.services) {
     if (!parser::ValidateTizenApplicationId(service.id())) {
-      *error = "The id property of application element "
-               "does not match the format\n";
+      *error =
+          "The id property of application element "
+          "does not match the format\n";
       return false;
     }
   }
@@ -238,9 +252,7 @@ bool ServiceHandler::Validate(
   return true;
 }
 
-std::string ServiceHandler::Key() const {
-  return keys::kTizenServiceKey;
-}
+std::string ServiceHandler::Key() const { return keys::kTizenServiceKey; }
 
 }  // namespace parse
 }  // namespace wgt
index c5988fc3d1057ca0e834ee3e88d6c51d470ca426..89c31235618e5c93d629a67bc5b0578ecf6af5d7 100644 (file)
@@ -20,26 +20,37 @@ namespace {
 
 const char kTrueValue[] = "true";
 const char kFalseValue[] = "false";
+const char kTizenHardwareKey[] = "@hwkey-event";
+const char kTizenScreenOrientationKey[] = "@screen-orientation";
+const char kTizenEncryptionKey[] = "@encryption";
+const char kTizenContextMenuKey[] = "@context-menu";
+const char kTizenBackgroundSupportKey[] = "@background-support";
+const char kTizenNoDisplayKey[] = "@nodisplay";
+const char kTizenIndicatorPresenceKey[] = "@indicator-presence";
+const char kTizenBackbuttonPresenceKey[] = "@backbutton-presence";
+const char kTizenInstallLocationKey[] = "@install-location";
+const char kTizenUserAgentKey[] = "@user-agent";
+const char kTizenSoundModeKey[] = "@sound-mode";
+const char kTizenBackgroundVibrationKey[] = "@background-vibration";
+const char kTizenNamespacePrefix[] = "http://tizen.org/ns/widgets";
 
 bool ForAllFindKey(const parser::Value* value, const std::string& key,
                    std::string* result) {
   if (value->GetType() == parser::Value::TYPE_DICTIONARY) {
     const parser::DictionaryValue* dict = nullptr;
     value->GetAsDictionary(&dict);
-    if (!parser::VerifyElementNamespace(*dict, keys::kTizenNamespacePrefix))
+    if (!parser::VerifyElementNamespace(*dict, kTizenNamespacePrefix))
       return false;
-    if (dict->GetString(key, result))
-      return true;
+    if (dict->GetString(key, result)) return true;
   } else if (value->GetType() == parser::Value::TYPE_LIST) {
     const parser::ListValue* list = nullptr;
     value->GetAsList(&list);
     for (auto& item : *list) {
       const parser::DictionaryValue* dict = nullptr;
       if (item->GetAsDictionary(&dict)) {
-        if (!parser::VerifyElementNamespace(*dict, keys::kTizenNamespacePrefix))
+        if (!parser::VerifyElementNamespace(*dict, kTizenNamespacePrefix))
           continue;
-        if (dict->GetString(key, result))
-          return true;
+        if (dict->GetString(key, result)) return true;
       }
     }
   }
@@ -70,20 +81,19 @@ SettingHandler::SettingHandler() {}
 
 SettingHandler::~SettingHandler() {}
 
-bool SettingHandler::Parse(
-    const parser::Manifest& manifest,
-    std::shared_ptr<parser::ManifestData>* output,
-    std::string* /*error*/) {
+bool SettingHandler::Parse(const parser::Manifest& manifest,
+                           std::shared_ptr<parser::ManifestData>* output,
+                           std::string* /*error*/) {
   const parser::Value* value = nullptr;
   manifest.Get(keys::kTizenSettingKey, &value);
 
   std::shared_ptr<SettingInfo> app_info(new SettingInfo);
   std::string hwkey;
-  ForAllFindKey(value, keys::kTizenHardwareKey, &hwkey);
+  ForAllFindKey(value, kTizenHardwareKey, &hwkey);
   app_info->set_hwkey_enabled(hwkey != "disable");
 
   std::string screen_orientation;
-  ForAllFindKey(value, keys::kTizenScreenOrientationKey, &screen_orientation);
+  ForAllFindKey(value, kTizenScreenOrientationKey, &screen_orientation);
   if (strcasecmp("portrait", screen_orientation.c_str()) == 0)
     app_info->set_screen_orientation(SettingInfo::ScreenOrientation::PORTRAIT);
   else if (strcasecmp("landscape", screen_orientation.c_str()) == 0)
@@ -92,31 +102,30 @@ bool SettingHandler::Parse(
     app_info->set_screen_orientation(SettingInfo::ScreenOrientation::AUTO);
 
   std::string encryption;
-  ForAllFindKey(value, keys::kTizenEncryptionKey, &encryption);
+  ForAllFindKey(value, kTizenEncryptionKey, &encryption);
   app_info->set_encryption_enabled(encryption == "enable");
 
   std::string context_menu;
-  ForAllFindKey(value, keys::kTizenContextMenuKey, &context_menu);
+  ForAllFindKey(value, kTizenContextMenuKey, &context_menu);
   app_info->set_context_menu_enabled(context_menu != "disable");
 
   std::string background_support;
-  ForAllFindKey(value, keys::kTizenBackgroundSupportKey, &background_support);
+  ForAllFindKey(value, kTizenBackgroundSupportKey, &background_support);
   app_info->set_background_support_enabled(background_support == "enable");
 
   std::string install_location;
-  ForAllFindKey(value, keys::kTizenInstallLocationKey, &install_location);
+  ForAllFindKey(value, kTizenInstallLocationKey, &install_location);
   if (strcasecmp("internal-only", install_location.c_str()) == 0)
     app_info->set_install_location(SettingInfo::InstallLocation::INTERNAL);
   else if (strcasecmp("prefer-external", install_location.c_str()) == 0)
     app_info->set_install_location(SettingInfo::InstallLocation::EXTERNAL);
 
   std::string no_display;
-  ForAllFindKey(value, keys::kTizenNoDisplayKey, &no_display);
+  ForAllFindKey(value, kTizenNoDisplayKey, &no_display);
   app_info->set_no_display(boost::iequals(no_display, kTrueValue));
 
   std::string indicator_presence;
-  if (ForAllFindKey(value, keys::kTizenIndicatorPresenceKey,
-                    &indicator_presence)) {
+  if (ForAllFindKey(value, kTizenIndicatorPresenceKey, &indicator_presence)) {
     if (boost::iequals(indicator_presence, kTrueValue)) {
       app_info->set_indicator_presence(true);
     } else if (boost::iequals(indicator_presence, kFalseValue)) {
@@ -125,8 +134,7 @@ bool SettingHandler::Parse(
   }
 
   std::string backbutton_presence;
-  if (ForAllFindKey(value, keys::kTizenBackbuttonPresenceKey,
-                    &backbutton_presence)) {
+  if (ForAllFindKey(value, kTizenBackbuttonPresenceKey, &backbutton_presence)) {
     if (boost::iequals(backbutton_presence, kTrueValue)) {
       app_info->set_backbutton_presence(true);
     } else if (boost::iequals(backbutton_presence, kFalseValue)) {
@@ -135,16 +143,15 @@ bool SettingHandler::Parse(
   }
 
   std::string user_agent;
-  ForAllFindKey(value, keys::kTizenUserAgentKey, &user_agent);
+  ForAllFindKey(value, kTizenUserAgentKey, &user_agent);
   app_info->set_user_agent(user_agent);
 
   std::string background_vibration;
-  ForAllFindKey(value, keys::kTizenBackgroundVibrationKey,
-                &background_vibration);
+  ForAllFindKey(value, kTizenBackgroundVibrationKey, &background_vibration);
   app_info->set_background_vibration(background_vibration == "enable");
 
   std::string sound_mode;
-  ForAllFindKey(value, keys::kTizenSoundModeKey, &sound_mode);
+  ForAllFindKey(value, kTizenSoundModeKey, &sound_mode);
   if (strcasecmp("exclusive", sound_mode.c_str()) == 0)
     app_info->set_sound_mode(SettingInfo::SoundMode::EXCLUSIVE);
 
@@ -156,8 +163,7 @@ bool SettingHandler::Validate(
     const parser::ManifestData& data,
     const parser::ManifestDataMap& /*handlers_output*/,
     std::string* error) const {
-  const SettingInfo& setting_info =
-      static_cast<const SettingInfo&>(data);
+  const SettingInfo& setting_info = static_cast<const SettingInfo&>(data);
   if (setting_info.screen_orientation() !=
           SettingInfo::ScreenOrientation::AUTO &&
       setting_info.screen_orientation() !=
@@ -168,8 +174,7 @@ bool SettingHandler::Validate(
     return false;
   }
 
-  if (setting_info.install_location() !=
-          SettingInfo::InstallLocation::AUTO &&
+  if (setting_info.install_location() != SettingInfo::InstallLocation::AUTO &&
       setting_info.install_location() !=
           SettingInfo::InstallLocation::INTERNAL &&
       setting_info.install_location() !=
@@ -178,10 +183,8 @@ bool SettingHandler::Validate(
     return false;
   }
 
-  if (setting_info.sound_mode() !=
-          SettingInfo::SoundMode::SHARED &&
-      setting_info.sound_mode() !=
-          SettingInfo::SoundMode::EXCLUSIVE) {
+  if (setting_info.sound_mode() != SettingInfo::SoundMode::SHARED &&
+      setting_info.sound_mode() != SettingInfo::SoundMode::EXCLUSIVE) {
     *error = "Wrong value of screen sound mode";
     return false;
   }
@@ -189,9 +192,7 @@ bool SettingHandler::Validate(
   return true;
 }
 
-std::string SettingHandler::Key() const {
-  return keys::kTizenSettingKey;
-}
+std::string SettingHandler::Key() const { return keys::kTizenSettingKey; }
 
 }  // namespace parse
 }  // namespace wgt
index 1e64f76d119858586c74aef2b1f9d0895bb14906..3c54463b839083d63aaf8a481634a4bfa35738fb 100644 (file)
@@ -21,6 +21,10 @@ namespace parse {
 
 namespace keys = wgt::application_widget_keys;
 
+namespace {
+const char kTizenSplashScreenSrcKey[] = "@src";
+}
+
 SplashScreenInfo::SplashScreenInfo() {}
 SplashScreenInfo::~SplashScreenInfo() {}
 
@@ -28,22 +32,20 @@ SplashScreenHandler::SplashScreenHandler() {}
 
 SplashScreenHandler::~SplashScreenHandler() {}
 
-bool SplashScreenHandler::Parse(
-    const parser::Manifest& manifest,
-    std::shared_ptr<parser::ManifestData>* output,
-    std::string* error) {
+bool SplashScreenHandler::Parse(const parser::Manifest& manifest,
+                                std::shared_ptr<parser::ManifestData>* output,
+                                std::string* error) {
   std::shared_ptr<SplashScreenInfo> ss_info(new SplashScreenInfo);
   parser::Value* splash_screen = nullptr;
   manifest.Get(keys::kTizenSplashScreenKey, &splash_screen);
-  if (splash_screen && splash_screen->IsType(
-          parser::Value::TYPE_DICTIONARY)) {
+  if (splash_screen && splash_screen->IsType(parser::Value::TYPE_DICTIONARY)) {
     parser::DictionaryValue* ss_dict = nullptr;
     splash_screen->GetAsDictionary(&ss_dict);
     std::string src;
-    ss_dict->GetString(keys::kTizenSplashScreenSrcKey, &src);
+    ss_dict->GetString(kTizenSplashScreenSrcKey, &src);
     ss_info->set_src(src);
-  } else if (splash_screen && !splash_screen->IsType(
-                 parser::Value::TYPE_DICTIONARY)) {
+  } else if (splash_screen &&
+             !splash_screen->IsType(parser::Value::TYPE_DICTIONARY)) {
     *error = "splash-screen elements type is not TYPE_DICTIONARY";
     return false;
   } else {
@@ -58,7 +60,7 @@ bool SplashScreenHandler::Validate(
     const parser::ManifestDataMap& /*handlers_output*/,
     std::string* error) const {
   const SplashScreenInfo& splash_data =
-       static_cast<const SplashScreenInfo&>(data);
+      static_cast<const SplashScreenInfo&>(data);
   std::string src = splash_data.src();
   // According to w3c specification splash screen image should be of one of
   // below types.
index 5b7b398d0a5bf1db1e1a9da72d2e7c6df6741667..f0c39b2f7556f1e6b9d10403bbbc0ac2d0951b3e 100644 (file)
@@ -21,6 +21,12 @@ namespace parse {
 namespace {
 const utils::VersionNumber kMinimumAPIVersion("2.2.1");
 const utils::VersionNumber kLaunchModeRequiredVersion("2.4");
+const char kTizenNamespacePrefix[] = "http://tizen.org/ns/widgets";
+const char kNamespaceKey[] = "@namespace";
+const char kTizenApplicationIdKey[] = "@id";
+const char kTizenApplicationPackageKey[] = "@package";
+const char kTizenApplicationLaunchModeKey[] = "@launch_mode";
+const char kTizenApplicationRequiredVersionKey[] = "@required_version";
 }  // namespace
 
 namespace keys = wgt::application_widget_keys;
@@ -35,8 +41,7 @@ TizenApplicationHandler::~TizenApplicationHandler() {}
 
 bool TizenApplicationHandler::Parse(
     const parser::Manifest& manifest,
-    std::shared_ptr<parser::ManifestData>* output,
-    std::string* error) {
+    std::shared_ptr<parser::ManifestData>* output, std::string* error) {
   std::shared_ptr<TizenApplicationInfo> app_info(new TizenApplicationInfo);
   parser::Value* app_value = nullptr;
   manifest.Get(keys::kTizenApplicationKey, &app_value);
@@ -46,16 +51,16 @@ bool TizenApplicationHandler::Parse(
   bool found = false;
   if (app_value && app_value->IsType(parser::Value::TYPE_DICTIONARY)) {
     app_value->GetAsDictionary(&app_dict);
-    found = app_dict->GetString(keys::kNamespaceKey, &value);
-    found = found && (value == keys::kTizenNamespacePrefix);
+    found = app_dict->GetString(kNamespaceKey, &value);
+    found = found && (value == kTizenNamespacePrefix);
   } else if (app_value && app_value->IsType(parser::Value::TYPE_LIST)) {
     parser::ListValue* list;
     app_value->GetAsList(&list);
-    for (parser::ListValue::iterator it = list->begin();
-         it != list->end(); ++it) {
+    for (parser::ListValue::iterator it = list->begin(); it != list->end();
+         ++it) {
       (*it)->GetAsDictionary(&app_dict);
-      app_dict->GetString(keys::kNamespaceKey, &value);
-      bool is_tizen = (value == keys::kTizenNamespacePrefix);
+      app_dict->GetString(kNamespaceKey, &value);
+      bool is_tizen = (value == kTizenNamespacePrefix);
       if (is_tizen) {
         if (found) {
           *error = "There should be no more than one tizen:application element";
@@ -67,15 +72,17 @@ bool TizenApplicationHandler::Parse(
   }
 
   if (!found) {
-    *error = "Cannot find application element with tizen namespace "
-             "or the tizen namespace prefix is incorrect.\n";
+    *error =
+        "Cannot find application element with tizen namespace "
+        "or the tizen namespace prefix is incorrect.\n";
     return false;
   }
-  if (app_dict->GetString(keys::kTizenApplicationIdKey, &value))
+  if (app_dict->GetString(kTizenApplicationIdKey, &value))
     app_info->set_id(value);
-  if (app_dict->GetString(keys::kTizenApplicationPackageKey, &value))
+  if (app_dict->GetString(kTizenApplicationPackageKey, &value)) {
     app_info->set_package(value);
-  if (app_dict->GetString(keys::kTizenApplicationRequiredVersionKey, &value)) {
+  }
+  if (app_dict->GetString(kTizenApplicationRequiredVersionKey, &value)) {
     if (!value.empty()) {
       // TODO(wy80.choi): should consider minimum API version for each profile.
       utils::VersionNumber req_version(value);
@@ -86,8 +93,9 @@ bool TizenApplicationHandler::Parse(
       }
     }
   }
+
   std::string launch_mode;
-  app_dict->GetString(keys::kTizenApplicationLaunchModeKey, &launch_mode);
+  app_dict->GetString(kTizenApplicationLaunchModeKey, &launch_mode);
   app_info->set_launch_mode(launch_mode);
 
   *output = std::static_pointer_cast<parser::ManifestData>(app_info);
@@ -102,25 +110,29 @@ bool TizenApplicationHandler::Validate(
       static_cast<const TizenApplicationInfo&>(data);
 
   if (!parser::ValidateTizenApplicationId(app_info.id())) {
-    *error = "The id property of application element "
-             "does not match the format\n";
+    *error =
+        "The id property of application element "
+        "does not match the format\n";
     return false;
   }
 
   if (!parser::ValidateTizenPackageId(app_info.package())) {
-    *error = "The package property of application element "
-             "does not match the format\n";
+    *error =
+        "The package property of application element "
+        "does not match the format\n";
     return false;
   }
 
   if (app_info.id().find(app_info.package()) != 0) {
-    *error = "The application element property id "
-             "does not start with package.\n";
+    *error =
+        "The application element property id "
+        "does not start with package.\n";
     return false;
   }
   if (app_info.required_version().empty()) {
-    *error = "The required_version property of application "
-             "element does not exist.\n";
+    *error =
+        "The required_version property of application "
+        "element does not exist.\n";
     return false;
   }
   utils::VersionNumber supported_version = parser::GetCurrentPlatformVersion();
@@ -134,8 +146,9 @@ bool TizenApplicationHandler::Validate(
     return false;
   }
   if (supported_version < required_version) {
-    *error = "The required_version of Tizen Web API "
-             "is not supported.\n";
+    *error =
+        "The required_version of Tizen Web API "
+        "is not supported.\n";
     return false;
   }
   if (required_version >= kLaunchModeRequiredVersion) {
@@ -161,9 +174,7 @@ std::string TizenApplicationHandler::Key() const {
   return keys::kTizenApplicationKey;
 }
 
-bool TizenApplicationHandler::AlwaysParseForKey() const {
-  return true;
-}
+bool TizenApplicationHandler::AlwaysParseForKey() const { return true; }
 
 }  // namespace parse
 }  // namespace wgt
index 115a16f622806001bf1995f52c296df754d4763e..4ba7f72e8be695120a7008c6af8bf279c937ef16 100644 (file)
@@ -16,6 +16,12 @@ namespace parse {
 
 namespace keys = wgt::application_widget_keys;
 
+namespace {
+const char kWidgetNamespacePrefix[] = "http://www.w3.org/ns/widgets";
+const char kAccessSubdomainsKey[] = "@subdomains";
+const char kAccessOriginKey[] = "@origin";
+}
+
 void WarpHandler::ParseSingleAccessElement(
     const parser::DictionaryValue& item_dict,
     std::shared_ptr<WarpInfo> info) {
@@ -23,13 +29,13 @@ void WarpHandler::ParseSingleAccessElement(
   std::string subdomains_str;
   bool subdomains = false;
 
-  if (item_dict.HasKey(keys::kAccessSubdomainsKey)) {
-    item_dict.GetString(keys::kAccessSubdomainsKey, &subdomains_str);
+  if (item_dict.HasKey(kAccessSubdomainsKey)) {
+    item_dict.GetString(kAccessSubdomainsKey, &subdomains_str);
     if (subdomains_str == "true")
       subdomains = true;
   }
   // TODO(w.kosowicz): address validation
-  item_dict.GetString(keys::kAccessOriginKey, &domain_name);
+  item_dict.GetString(kAccessOriginKey, &domain_name);
   if (domain_name == "*")
     subdomains = true;
   info->set_access_element(std::make_pair(domain_name, subdomains));
@@ -46,13 +52,13 @@ void WarpHandler::ParseAccessElements(
   const parser::ListValue* list = nullptr;
   if (manifest.Get(keys::kAccessKey, &val)) {
     if (val->GetAsDictionary(&dict)) {
-      if (parser::VerifyElementNamespace(*dict, keys::kWidgetNamespacePrefix))
+      if (parser::VerifyElementNamespace(*dict, kWidgetNamespacePrefix))
         ParseSingleAccessElement(*dict, info);
     } else if (val->GetAsList(&list)) {
       for (auto& item : *list) {
         if (item->GetAsDictionary(&dict)) {
           if (!parser::VerifyElementNamespace(*dict,
-                                              keys::kWidgetNamespacePrefix))
+                                              kWidgetNamespacePrefix))
             continue;
           ParseSingleAccessElement(*dict, info);
         }
index c767931cffd76ea693bc342217762ebdb8622ce0..8d0aa43460d5b627a0c11ae48aff04972e03857f 100644 (file)
@@ -26,8 +26,29 @@ namespace keys = wgt::application_widget_keys;
 
 namespace {
 
-bool ParserPreferenceItem(const parser::Value* val,
-                          Preference** output,
+const char kWidgetNamespacePrefix[] = "http://www.w3.org/ns/widgets";
+const char kWidgetNamespaceKey[] = "widget.@namespace";
+const char kAuthorHrefKey[] = "@href";
+const char kAuthorEmailKey[] = "@email";
+const char kVersionKey[] = "widget.@version";
+const char kNameKey[] = "widget.name";
+const char kPreferencesNameKey[] = "@name";
+const char kPreferencesValueKey[] = "@value";
+const char kPreferencesReadonlyKey[] = "@readonly";
+const char kXmlLangKey[] = "@lang";
+const char kXmlHrefKey[] = "@href";
+const char kLicenseKey[] = "widget.license";
+const char kShortKey[] = "@short";
+const char kWidgetLangKey[] = "widget.@lang";
+const char kIDKey[] = "widget.@id";
+const char kHeightKey[] = "widget.@height";
+const char kWidthKey[] = "widget.@width";
+const char kDefaultLocaleKey[] = "widget.@defaultlocale";
+const char kViewModesKey[] = "widget.@viewmodes";
+const char kPreferencesKey[] = "widget.preference";
+const char kXmlTextKey[] = "#text";
+
+bool ParserPreferenceItem(const parser::Value* val, Preference** output,
                           std::string* error) {
   const parser::DictionaryValue* pref_dict;
   if (!val->GetAsDictionary(&pref_dict)) {
@@ -37,9 +58,9 @@ bool ParserPreferenceItem(const parser::Value* val,
   std::string name;
   std::string value;
   std::string readonly = "false";
-  pref_dict->GetString(keys::kPreferencesNameKey, &name);
-  pref_dict->GetString(keys::kPreferencesValueKey, &value);
-  pref_dict->GetString(keys::kPreferencesReadonlyKey, &readonly);
+  pref_dict->GetString(kPreferencesNameKey, &name);
+  pref_dict->GetString(kPreferencesValueKey, &value);
+  pref_dict->GetString(kPreferencesReadonlyKey, &readonly);
   *output = new Preference(name, value, readonly == "true");
   return true;
 }
@@ -54,18 +75,18 @@ void WidgetHandler::ParseSingleLocalizedLicenseElement(
   std::string text;
   std::string href;
 
-  if (item_dict->HasKey(keys::kXmlLangKey)) {
+  if (item_dict->HasKey(kXmlLangKey)) {
     lang_overwriten = true;
-    item_dict->GetString(keys::kXmlLangKey, &lang);
+    item_dict->GetString(kXmlLangKey, &lang);
     if (!utils::w3c_languages::ValidateLanguageTag(lang)) {
       LOG(ERROR) << "Tag " << lang << " is invalid";
       return;
     }
   }
-  if (item_dict->HasKey(keys::kXmlHrefKey)) {
-    item_dict->GetString(keys::kXmlHrefKey, &href);
+  if (item_dict->HasKey(kXmlHrefKey)) {
+    item_dict->GetString(kXmlHrefKey, &href);
   }
-  item_dict->GetString(keys::kXmlTextKey, &text);
+  item_dict->GetString(kXmlTextKey, &text);
   // TODO(w.kosowicz) check where href should be put...
   if (lang_overwriten) {
     info->license_set_.insert(std::make_pair(lang, text + href));
@@ -75,25 +96,22 @@ void WidgetHandler::ParseSingleLocalizedLicenseElement(
 }
 
 void WidgetHandler::ParseLocalizedLicenseElements(
-    const parser::Manifest& manifest,
-    const std::string& parent_lang,
+    const parser::Manifest& manifest, const std::string& parent_lang,
     std::shared_ptr<WidgetInfo> info) {
-  if (!manifest.HasPath(keys::kLicenseKey))
-    return;
+  if (!manifest.HasPath(kLicenseKey)) return;
 
   const parser::Value* val = nullptr;
   const parser::DictionaryValue* dict = nullptr;
   const parser::ListValue* list = nullptr;
-  if (manifest.Get(keys::kLicenseKey, &val)) {
+  if (manifest.Get(kLicenseKey, &val)) {
     if (val->GetAsDictionary(&dict)) {
-      if (parser::VerifyElementNamespace(*dict, keys::kWidgetNamespacePrefix))
+      if (parser::VerifyElementNamespace(*dict, kWidgetNamespacePrefix))
         ParseSingleLocalizedLicenseElement(dict, parent_lang, info);
     } else if (val->GetAsList(&list)) {
-      for_each(list->begin(), list->end(), [list, &dict,
-               parent_lang, info, this](parser::Value* item) {
+      for_each(list->begin(), list->end(),
+               [list, &dict, parent_lang, info, this](parser::Value* item) {
         if (item->GetAsDictionary(&dict))
-          if (parser::VerifyElementNamespace(*dict,
-                                             keys::kWidgetNamespacePrefix))
+          if (parser::VerifyElementNamespace(*dict, kWidgetNamespacePrefix))
             ParseSingleLocalizedLicenseElement(dict, parent_lang, info);
       });
     }
@@ -107,15 +125,15 @@ void WidgetHandler::ParseSingleLocalizedDescriptionElement(
   std::string lang;
   std::string text;
 
-  if (item_dict->HasKey(keys::kXmlLangKey)) {
+  if (item_dict->HasKey(kXmlLangKey)) {
     lang_overwriten = true;
-    item_dict->GetString(keys::kXmlLangKey, &lang);
+    item_dict->GetString(kXmlLangKey, &lang);
     if (!utils::w3c_languages::ValidateLanguageTag(lang)) {
       LOG(ERROR) << "Tag " << lang << " is invalid";
       return;
     }
   }
-  item_dict->GetString(keys::kXmlTextKey, &text);
+  item_dict->GetString(kXmlTextKey, &text);
   if (lang_overwriten) {
     info->description_set_.insert(std::make_pair(lang, text));
   } else {
@@ -124,24 +142,21 @@ void WidgetHandler::ParseSingleLocalizedDescriptionElement(
 }
 
 void WidgetHandler::ParseLocalizedDescriptionElements(
-    const parser::Manifest& manifest,
-    const std::string& parent_lang,
+    const parser::Manifest& manifest, const std::string& parent_lang,
     std::shared_ptr<WidgetInfo> info) {
-  if (!manifest.HasPath(keys::kDescriptionKey))
-    return;
+  if (!manifest.HasPath(keys::kDescriptionKey)) return;
 
   const parser::Value* val = nullptr;
   const parser::DictionaryValue* dict = nullptr;
   const parser::ListValue* list = nullptr;
   if (manifest.Get(keys::kDescriptionKey, &val)) {
     if (val->GetAsDictionary(&dict)) {
-      if (parser::VerifyElementNamespace(*dict, keys::kWidgetNamespacePrefix))
+      if (parser::VerifyElementNamespace(*dict, kWidgetNamespacePrefix))
         ParseSingleLocalizedDescriptionElement(dict, parent_lang, info);
     } else if (val->GetAsList(&list)) {
       for (auto& item : *list)
         if (item->GetAsDictionary(&dict))
-          if (parser::VerifyElementNamespace(*dict,
-                                             keys::kWidgetNamespacePrefix))
+          if (parser::VerifyElementNamespace(*dict, kWidgetNamespacePrefix))
             ParseSingleLocalizedDescriptionElement(dict, parent_lang, info);
     }
   }
@@ -155,22 +170,21 @@ void WidgetHandler::ParseSingleLocalizedNameElement(
   std::string name;
   std::string short_name;
 
-  if (item_dict->HasKey(keys::kXmlLangKey)) {
+  if (item_dict->HasKey(kXmlLangKey)) {
     lang_overwriten = true;
-    item_dict->GetString(keys::kXmlLangKey, &lang);
+    item_dict->GetString(kXmlLangKey, &lang);
     if (!utils::w3c_languages::ValidateLanguageTag(lang)) {
       LOG(ERROR) << "Tag " << lang << " is invalid";
       return;
     }
   }
-  if (item_dict->HasKey(keys::kShortKey)) {
-    item_dict->GetString(keys::kShortKey, &short_name);
+  if (item_dict->HasKey(kShortKey)) {
+    item_dict->GetString(kShortKey, &short_name);
   }
-  item_dict->GetString(keys::kXmlTextKey, &name);
+  item_dict->GetString(kXmlTextKey, &name);
 
   // ignore if given language already spotted
-  if (info->name_set_.find(lang) != info->name_set_.end())
-    return;
+  if (info->name_set_.find(lang) != info->name_set_.end()) return;
 
   if (lang_overwriten) {
     info->name_set_.insert(std::make_pair(lang, name));
@@ -183,23 +197,22 @@ void WidgetHandler::ParseSingleLocalizedNameElement(
   }
 }
 
-void WidgetHandler::ParseLocalizedNameElements(const parser::Manifest& manifest,
-    const std::string& parent_lang, std::shared_ptr<WidgetInfo> info) {
-  if (!manifest.HasPath(keys::kNameKey))
-    return;
+void WidgetHandler::ParseLocalizedNameElements(
+    const parser::Manifest& manifest, const std::string& parent_lang,
+    std::shared_ptr<WidgetInfo> info) {
+  if (!manifest.HasPath(kNameKey)) return;
 
   const parser::Value* val = nullptr;
   const parser::DictionaryValue* dict = nullptr;
   const parser::ListValue* list = nullptr;
-  if (manifest.Get(keys::kNameKey, &val)) {
+  if (manifest.Get(kNameKey, &val)) {
     if (val->GetAsDictionary(&dict)) {
-      if (parser::VerifyElementNamespace(*dict, keys::kWidgetNamespacePrefix))
+      if (parser::VerifyElementNamespace(*dict, kWidgetNamespacePrefix))
         ParseSingleLocalizedNameElement(dict, parent_lang, info);
     } else if (val->GetAsList(&list)) {
       for (auto& item : *list)
         if (item->GetAsDictionary(&dict))
-          if (parser::VerifyElementNamespace(*dict,
-                                             keys::kWidgetNamespacePrefix))
+          if (parser::VerifyElementNamespace(*dict, kWidgetNamespacePrefix))
             ParseSingleLocalizedNameElement(dict, parent_lang, info);
     }
   }
@@ -208,43 +221,40 @@ void WidgetHandler::ParseLocalizedNameElements(const parser::Manifest& manifest,
 void WidgetHandler::ParseSingleAuthorElement(
     const parser::DictionaryValue* author_dict,
     std::shared_ptr<WidgetInfo> info) {
-  author_dict->GetString(keys::kXmlTextKey, &info->author_);
-  author_dict->GetString(keys::kAuthorEmailKey, &info->author_email_);
+  author_dict->GetString(kXmlTextKey, &info->author_);
+  author_dict->GetString(kAuthorEmailKey, &info->author_email_);
   std::string author_href;
-  author_dict->GetString(keys::kAuthorHrefKey, &author_href);
+  author_dict->GetString(kAuthorHrefKey, &author_href);
   if (!author_href.empty() && parser::utils::IsValidIRI(author_href))
     info->author_href_ = author_href;
 }
 
-void WidgetHandler::ParseAuthorElements(
-    const parser::Manifest& manifest,
-    std::shared_ptr<WidgetInfo> info) {
+void WidgetHandler::ParseAuthorElements(const parser::Manifest& manifest,
+                                        std::shared_ptr<WidgetInfo> info) {
   if (manifest.HasPath(keys::kAuthorKey)) {
     const parser::Value* author_value = nullptr;
     manifest.Get(keys::kAuthorKey, &author_value);
+
     auto& authors = parser::GetOneOrMany(manifest.value(), keys::kAuthorKey,
-                                         keys::kWidgetNamespacePrefix);
+                                         kWidgetNamespacePrefix);
     if (!authors.empty())
       ParseSingleAuthorElement(authors[0], info);
   }
 }
 
-bool WidgetHandler::Parse(
-    const parser::Manifest& manifest,
-    std::shared_ptr<parser::ManifestData>* output,
-    std::string* error) {
+bool WidgetHandler::Parse(const parser::Manifest& manifest,
+                          std::shared_ptr<parser::ManifestData>* output,
+                          std::string* error) {
   std::shared_ptr<WidgetInfo> widget_info(new WidgetInfo());
   widget_info->preferences_ = std::vector<Preference*>();
 
   std::string parent_lang;
-  if (manifest.HasPath(keys::kWidgetNamespaceKey)) {
-    manifest.GetString(keys::kWidgetNamespaceKey,
-                       &widget_info->widget_namespace_);
-    manifest.GetString(keys::kWidgetLangKey,
-                       &parent_lang);
+  if (manifest.HasPath(kWidgetNamespaceKey)) {
+    manifest.GetString(kWidgetNamespaceKey, &widget_info->widget_namespace_);
+    manifest.GetString(kWidgetLangKey, &parent_lang);
   }
 
-  if (widget_info->widget_namespace_ != keys::kWidgetNamespacePrefix) {
+  if (widget_info->widget_namespace_ != kWidgetNamespacePrefix) {
     *error = "Wrong namespace of <widget> element. Config.xml is invalid";
     return false;
   }
@@ -255,32 +265,31 @@ bool WidgetHandler::Parse(
   ParseLocalizedNameElements(manifest, parent_lang, widget_info);
   ParseLocalizedLicenseElements(manifest, parent_lang, widget_info);
 
-  if (manifest.HasPath(keys::kVersionKey))
-    manifest.GetString(keys::kVersionKey, &widget_info->version_);
-  if (manifest.HasPath(keys::kIDKey)) {
+  if (manifest.HasPath(kVersionKey))
+    manifest.GetString(kVersionKey, &widget_info->version_);
+  if (manifest.HasPath(kIDKey)) {
     std::string id;
-    manifest.GetString(keys::kIDKey, &id);
-    if (!id.empty() && parser::utils::IsValidIRI(id))
-      widget_info->id_ = id;
+    manifest.GetString(kIDKey, &id);
+    if (!id.empty() && parser::utils::IsValidIRI(id)) widget_info->id_ = id;
   }
-  if (manifest.HasPath(keys::kHeightKey)) {
+  if (manifest.HasPath(kHeightKey)) {
     int h;
-    manifest.GetInteger(keys::kHeightKey, &h);
+    manifest.GetInteger(kHeightKey, &h);
     widget_info->height_ = static_cast<unsigned int>(h);
   }
-  if (manifest.HasPath(keys::kWidthKey)) {
+  if (manifest.HasPath(kWidthKey)) {
     int w;
-    manifest.GetInteger(keys::kWidthKey, &w);
+    manifest.GetInteger(kWidthKey, &w);
     widget_info->width_ = static_cast<unsigned int>(w);
   }
-  if (manifest.HasPath(keys::kDefaultLocaleKey))
-    manifest.GetString(keys::kDefaultLocaleKey, &widget_info->default_locale_);
-  if (manifest.HasPath(keys::kViewModesKey))
-    manifest.GetString(keys::kViewModesKey, &widget_info->viewmodes_);
+  if (manifest.HasPath(kDefaultLocaleKey))
+    manifest.GetString(kDefaultLocaleKey, &widget_info->default_locale_);
+  if (manifest.HasPath(kViewModesKey))
+    manifest.GetString(kViewModesKey, &widget_info->viewmodes_);
 
   for (auto& pref_dict : parser::GetOneOrMany(manifest.value(),
-                                              keys::kPreferencesKey,
-                                              keys::kWidgetNamespacePrefix)) {
+                                              kPreferencesKey,
+                                              kWidgetNamespacePrefix)) {
     Preference* preference = nullptr;
     if (!ParserPreferenceItem(pref_dict, &preference, error))
       return false;
@@ -291,21 +300,18 @@ bool WidgetHandler::Parse(
   return true;
 }
 
-bool WidgetHandler::Validate(
-    const parser::ManifestData& data,
-    const parser::ManifestDataMap& /*handlers_output*/,
-    std::string* error) const {
+bool WidgetHandler::Validate(const parser::ManifestData& data,
+                             const parser::ManifestDataMap& /*handlers_output*/,
+                             std::string* error) const {
   const WidgetInfo& widget_info = static_cast<const WidgetInfo&>(data);
-  if (widget_info.widget_namespace() != keys::kWidgetNamespacePrefix) {
+  if (widget_info.widget_namespace() != kWidgetNamespacePrefix) {
     *error = "The widget namespace is invalid.";
     return false;
   }
   return true;
 }
 
-std::string WidgetHandler::Key() const {
-  return keys::kTizenWidgetKey;
-}
+std::string WidgetHandler::Key() const { return keys::kTizenWidgetKey; }
 
 }  // namespace parse
 }  // namespace wgt
index ecd5384c353312627753f19413b2c11b9d8f19ab..d2999677dced292555f294cd11bf908836c4a790 100644 (file)
@@ -20,6 +20,7 @@ namespace parse {
 namespace keys = tpk::application_keys;
 
 namespace {
+
 const char kAuthorKeyText[] = "#text";
 const char kAuthorEmailKey[] = "email";
 const char kAuthorEmailChildKey[] = "@email";
index f3292d713a958d9900f826de8dc002d0038a26e0..818fffa1d3eab80576e56e56d2ef482723bc0288 100644 (file)
@@ -18,7 +18,9 @@
 namespace bf = boost::filesystem;
 
 namespace {
-
+const char kTizenNamespacePrefix[] = "http://tizen.org/ns/widgets";
+const char kTizenContentSrcKey[] = "@src";
+const char kNamespaceKey[] = "@namespace";
 const char kTizenContentTagKey[] = "content";
 
 std::unique_ptr<parser::ManifestHandlerRegistry> GetRegistryForTest() {
@@ -46,9 +48,7 @@ class ContentHandlerTest : public testing::Test {
   void SetUp() override {
     parser_.reset(new ManifestParserImpl((GetRegistryForTest())));
   }
-  void TearDown() override {
-    parser_.reset();
-  }
+  void TearDown() override { parser_.reset(); }
   void SetManifest(std::shared_ptr<Manifest> manifest) {
     parser_->manifest_ = manifest;
   }
@@ -84,7 +84,7 @@ TEST_F(ContentHandlerTest, SingleContentEntry) {
   std::unique_ptr<DictionaryValue> value(new DictionaryValue());
   std::unique_ptr<DictionaryValue> widget(new DictionaryValue());
   std::unique_ptr<DictionaryValue> content(new DictionaryValue());
-  content->SetString(keys::kTizenContentSrcKey, "my_index.html");
+  content->SetString(kTizenContentSrcKey, "my_index.html");
   widget->Set(kTizenContentTagKey, content.release());
   value->Set(keys::kWidgetKey, widget.release());
   std::shared_ptr<Manifest> manifest(new Manifest(std::move(value)));
@@ -105,8 +105,8 @@ TEST_F(ContentHandlerTest, SingleContentEntrySrcEmpty) {
   std::unique_ptr<DictionaryValue> value(new DictionaryValue());
   std::unique_ptr<DictionaryValue> widget(new DictionaryValue());
   std::unique_ptr<DictionaryValue> content(new DictionaryValue());
-  content->SetString(keys::kTizenContentSrcKey, "");
-  content->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  content->SetString(kTizenContentSrcKey, "");
+  content->SetString(kNamespaceKey, kTizenNamespacePrefix);
   widget->Set(kTizenContentTagKey, content.release());
   value->Set(keys::kWidgetKey, widget.release());
   std::shared_ptr<Manifest> manifest(new Manifest(std::move(value)));
@@ -125,9 +125,8 @@ TEST_F(ContentHandlerTest, SingleTizenContentEntry) {
   std::unique_ptr<DictionaryValue> value(new DictionaryValue());
   std::unique_ptr<DictionaryValue> widget(new DictionaryValue());
   std::unique_ptr<DictionaryValue> content(new DictionaryValue());
-  content->SetString(keys::kTizenContentSrcKey,
-      "http://www.tizen.app/my_index.html");
-  content->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  content->SetString(kTizenContentSrcKey, "http://www.tizen.app/my_index.html");
+  content->SetString(kNamespaceKey, kTizenNamespacePrefix);
   widget->Set(kTizenContentTagKey, content.release());
   value->Set(keys::kWidgetKey, widget.release());
   std::shared_ptr<Manifest> manifest(new Manifest(std::move(value)));
@@ -148,8 +147,8 @@ TEST_F(ContentHandlerTest, SingleTizenContentEntryNotURL) {
   std::unique_ptr<DictionaryValue> value(new DictionaryValue());
   std::unique_ptr<DictionaryValue> widget(new DictionaryValue());
   std::unique_ptr<DictionaryValue> content(new DictionaryValue());
-  content->SetString(keys::kTizenContentSrcKey, "relative_NOT_url");
-  content->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  content->SetString(kTizenContentSrcKey, "relative_NOT_url");
+  content->SetString(kNamespaceKey, kTizenNamespacePrefix);
   widget->Set(kTizenContentTagKey, content.release());
   value->Set(keys::kWidgetKey, widget.release());
   std::shared_ptr<Manifest> manifest(new Manifest(std::move(value)));
@@ -170,12 +169,10 @@ TEST_F(ContentHandlerTest, MultipleContentEntryW3CTakeFirst) {
   std::unique_ptr<DictionaryValue> value(new DictionaryValue());
   std::unique_ptr<DictionaryValue> widget(new DictionaryValue());
   std::unique_ptr<ListValue> list(new ListValue());
-  std::unique_ptr<DictionaryValue> content1(
-      new DictionaryValue());
-  std::unique_ptr<DictionaryValue> content2(
-      new DictionaryValue());
-  content1->SetString(keys::kTizenContentSrcKey, "w3c_1_index.html");
-  content2->SetString(keys::kTizenContentSrcKey, "w3c_2_index.html");
+  std::unique_ptr<DictionaryValue> content1(new DictionaryValue());
+  std::unique_ptr<DictionaryValue> content2(new DictionaryValue());
+  content1->SetString(kTizenContentSrcKey, "w3c_1_index.html");
+  content2->SetString(kTizenContentSrcKey, "w3c_2_index.html");
   list->Append(content1.release());
   list->Append(content2.release());
   widget->Set(kTizenContentTagKey, list.release());
@@ -198,16 +195,14 @@ TEST_F(ContentHandlerTest, MultipleContentEntryTizenTakeFirst) {
   std::unique_ptr<DictionaryValue> value(new DictionaryValue());
   std::unique_ptr<DictionaryValue> widget(new DictionaryValue());
   std::unique_ptr<ListValue> list(new ListValue());
-  std::unique_ptr<DictionaryValue> content1(
-      new DictionaryValue());
-  std::unique_ptr<DictionaryValue> content2(
-      new DictionaryValue());
-  content1->SetString(keys::kTizenContentSrcKey,
-      "http://www.tizen.app/tizen_1_index.html");
-  content1->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  content2->SetString(keys::kTizenContentSrcKey,
-      "http://www.tizen.app/tizen_2_index.html");
-  content2->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  std::unique_ptr<DictionaryValue> content1(new DictionaryValue());
+  std::unique_ptr<DictionaryValue> content2(new DictionaryValue());
+  content1->SetString(kTizenContentSrcKey,
+                      "http://www.tizen.app/tizen_1_index.html");
+  content1->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  content2->SetString(kTizenContentSrcKey,
+                      "http://www.tizen.app/tizen_2_index.html");
+  content2->SetString(kNamespaceKey, kTizenNamespacePrefix);
   list->Append(content1.release());
   list->Append(content2.release());
   widget->Set(kTizenContentTagKey, list.release());
@@ -230,14 +225,12 @@ TEST_F(ContentHandlerTest, MultipleContentEntryTizenPrioritizedAsFirst) {
   std::unique_ptr<DictionaryValue> value(new DictionaryValue());
   std::unique_ptr<DictionaryValue> widget(new DictionaryValue());
   std::unique_ptr<ListValue> list(new ListValue());
-  std::unique_ptr<DictionaryValue> content1(
-      new DictionaryValue());
-  std::unique_ptr<DictionaryValue> content2(
-      new DictionaryValue());
-  content1->SetString(keys::kTizenContentSrcKey,
-      "http://www.tizen.app/tizen_index.html");
-  content1->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  content2->SetString(keys::kTizenContentSrcKey, "my_index.html");
+  std::unique_ptr<DictionaryValue> content1(new DictionaryValue());
+  std::unique_ptr<DictionaryValue> content2(new DictionaryValue());
+  content1->SetString(kTizenContentSrcKey,
+                      "http://www.tizen.app/tizen_index.html");
+  content1->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  content2->SetString(kTizenContentSrcKey, "my_index.html");
   list->Append(content1.release());
   list->Append(content2.release());
   widget->Set(kTizenContentTagKey, list.release());
@@ -260,14 +253,12 @@ TEST_F(ContentHandlerTest, MultipleContentEntryTizenPrioritizedAsSecond) {
   std::unique_ptr<DictionaryValue> value(new DictionaryValue());
   std::unique_ptr<DictionaryValue> widget(new DictionaryValue());
   std::unique_ptr<ListValue> list(new ListValue());
-  std::unique_ptr<DictionaryValue> content1(
-      new DictionaryValue());
-  std::unique_ptr<DictionaryValue> content2(
-      new DictionaryValue());
-  content1->SetString(keys::kTizenContentSrcKey, "my_index.html");
-  content2->SetString(keys::kTizenContentSrcKey,
-      "http://www.tizen.app/tizen_index.html");
-  content2->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  std::unique_ptr<DictionaryValue> content1(new DictionaryValue());
+  std::unique_ptr<DictionaryValue> content2(new DictionaryValue());
+  content1->SetString(kTizenContentSrcKey, "my_index.html");
+  content2->SetString(kTizenContentSrcKey,
+                      "http://www.tizen.app/tizen_index.html");
+  content2->SetString(kNamespaceKey, kTizenNamespacePrefix);
   list->Append(content1.release());
   list->Append(content2.release());
   widget->Set(kTizenContentTagKey, list.release());
@@ -290,11 +281,9 @@ TEST_F(ContentHandlerTest, MultipleContentEntryW3CIgnoreIfNotFirst) {
   std::unique_ptr<DictionaryValue> value(new DictionaryValue());
   std::unique_ptr<DictionaryValue> widget(new DictionaryValue());
   std::unique_ptr<ListValue> list(new ListValue());
-  std::unique_ptr<DictionaryValue> content1(
-      new DictionaryValue());
-  std::unique_ptr<DictionaryValue> content2(
-      new DictionaryValue());
-  content2->SetString(keys::kTizenContentSrcKey, "w3c_2_index.html");
+  std::unique_ptr<DictionaryValue> content1(new DictionaryValue());
+  std::unique_ptr<DictionaryValue> content2(new DictionaryValue());
+  content2->SetString(kTizenContentSrcKey, "w3c_2_index.html");
   list->Append(content1.release());
   list->Append(content2.release());
   widget->Set(kTizenContentTagKey, list.release());
@@ -315,12 +304,10 @@ TEST_F(ContentHandlerTest, MultipleContentEntryW3CIgnoreIfFirstEmpty) {
   std::unique_ptr<DictionaryValue> value(new DictionaryValue());
   std::unique_ptr<DictionaryValue> widget(new DictionaryValue());
   std::unique_ptr<ListValue> list(new ListValue());
-  std::unique_ptr<DictionaryValue> content1(
-      new DictionaryValue());
-  std::unique_ptr<DictionaryValue> content2(
-      new DictionaryValue());
-  content1->SetString(keys::kTizenContentSrcKey, "");
-  content2->SetString(keys::kTizenContentSrcKey, "w3c_2_index.html");
+  std::unique_ptr<DictionaryValue> content1(new DictionaryValue());
+  std::unique_ptr<DictionaryValue> content2(new DictionaryValue());
+  content1->SetString(kTizenContentSrcKey, "");
+  content2->SetString(kTizenContentSrcKey, "w3c_2_index.html");
   list->Append(content1.release());
   list->Append(content2.release());
   widget->Set(kTizenContentTagKey, list.release());
@@ -341,12 +328,10 @@ TEST_F(ContentHandlerTest, MultipleContentBackToW3CWhenTizenEntryBroken) {
   std::unique_ptr<DictionaryValue> value(new DictionaryValue());
   std::unique_ptr<DictionaryValue> widget(new DictionaryValue());
   std::unique_ptr<ListValue> list(new ListValue());
-  std::unique_ptr<DictionaryValue> content1(
-      new DictionaryValue());
-  std::unique_ptr<DictionaryValue> content2(
-      new DictionaryValue());
-  content1->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  content2->SetString(keys::kTizenContentSrcKey, "w3c_1_index.html");
+  std::unique_ptr<DictionaryValue> content1(new DictionaryValue());
+  std::unique_ptr<DictionaryValue> content2(new DictionaryValue());
+  content1->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  content2->SetString(kTizenContentSrcKey, "w3c_1_index.html");
   list->Append(content1.release());
   list->Append(content2.release());
   widget->Set(kTizenContentTagKey, list.release());
@@ -373,15 +358,14 @@ TEST_F(ContentHandlerTest, MultipleMoreContentEntry) {
   std::unique_ptr<DictionaryValue> content2(new DictionaryValue());
   std::unique_ptr<DictionaryValue> content3(new DictionaryValue());
   std::unique_ptr<DictionaryValue> content4(new DictionaryValue());
-  content1->SetString(keys::kTizenContentSrcKey, "w3c_1_index.html");
-  content2->SetString(keys::kTizenContentSrcKey,
-      "w3c_2_index.html");
-  content3->SetString(keys::kTizenContentSrcKey,
-      "http://www.tizen.app/tizen_3_index.html");
-  content3->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  content4->SetString(keys::kTizenContentSrcKey,
-      "http://www.tizen.app/tizen_4_index.html");
-  content4->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  content1->SetString(kTizenContentSrcKey, "w3c_1_index.html");
+  content2->SetString(kTizenContentSrcKey, "w3c_2_index.html");
+  content3->SetString(kTizenContentSrcKey,
+                      "http://www.tizen.app/tizen_3_index.html");
+  content3->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  content4->SetString(kTizenContentSrcKey,
+                      "http://www.tizen.app/tizen_4_index.html");
+  content4->SetString(kNamespaceKey, kTizenNamespacePrefix);
   list->Append(content1.release());
   list->Append(content2.release());
   list->Append(content3.release());
@@ -402,4 +386,3 @@ TEST_F(ContentHandlerTest, MultipleMoreContentEntry) {
 }
 
 }  // namespace parser
-
index 4a6481666ca0410c14dd6ac24d12a9e2c1e7dbc8..fbf26b1beeb8fc68a6837587ffb106c036171de3 100644 (file)
 namespace bf = boost::filesystem;
 
 namespace {
-
+const char kTizenServiceContentKey[] = "content";
+const char kTizenServiceContentSrcKey[] = "@src";
+const char kTizenServiceIdKey[] = "@id";
+const char kTizenNamespacePrefix[] = "http://tizen.org/ns/widgets";
+const char kTizenServiceOnBootKey[] = "@on-boot";
+const char kTizenServiceNameKey[] = "name";
+const char kTizenServiceCategoryNameKey[] = "@name";
+const char kTizenServiceCategoryKey[] = "category";
+const char kTizenServiceIconKey[] = "icon";
 const char kNamespaceKey[] = "@namespace";
 const char kServiceKey[] = "service";
-
+const char kTizenServiceAutoRestartKey[] = "@auto-restart";
+const char kTizenServiceIconSrcKey[] = "@src";
+const char kTizenServiceDescriptionKey[] = "description";
+const char kTizenServiceMetadataKeyKey[] = "@key";
+const char kTizenServiceMetadataValueKey[] = "@value";
+const char kTizenServiceMetadataKey[] = "metadata";
+const char kXmlLangKey[] = "@lang";
+const char kXmlTextKey[] = "#text";
 std::unique_ptr<parser::ManifestHandlerRegistry> GetRegistryForTest() {
   std::unique_ptr<parser::ManifestHandlerRegistry> registry;
   registry.reset(new parser::ManifestHandlerRegistry());
@@ -41,9 +56,7 @@ class ServiceHandlerTest : public testing::Test {
   void SetUp() override {
     parser_.reset(new ManifestParserImpl((GetRegistryForTest())));
   }
-  void TearDown() override {
-    parser_.reset();
-  }
+  void TearDown() override { parser_.reset(); }
   void SetManifest(std::shared_ptr<Manifest> manifest) {
     parser_->manifest_ = manifest;
   }
@@ -80,14 +93,14 @@ TEST_F(ServiceHandlerTest, SingleServiceEntryDefault) {
   std::unique_ptr<DictionaryValue> service(new DictionaryValue());
   std::unique_ptr<DictionaryValue> content(new DictionaryValue());
   std::unique_ptr<DictionaryValue> name(new DictionaryValue());
-  content->SetString(keys::kTizenServiceContentSrcKey, "service.js");
-  content->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kXmlTextKey, "name");
-  service->Set(keys::kTizenServiceContentKey, content.release());
-  service->Set(keys::kTizenServiceNameKey, name.release());
-  service->SetString(keys::kTizenServiceIdKey, "correct001.appId");
-  service->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  content->SetString(kTizenServiceContentSrcKey, "service.js");
+  content->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kXmlTextKey, "name");
+  service->Set(kTizenServiceContentKey, content.release());
+  service->Set(kTizenServiceNameKey, name.release());
+  service->SetString(kTizenServiceIdKey, "correct001.appId");
+  service->SetString(kNamespaceKey, kTizenNamespacePrefix);
   widget->Set(kServiceKey, service.release());
   value->Set(keys::kWidgetKey, widget.release());
   std::shared_ptr<Manifest> manifest(new Manifest(std::move(value)));
@@ -118,15 +131,15 @@ TEST_F(ServiceHandlerTest, SingleServiceEntryOnBootOn) {
   std::unique_ptr<DictionaryValue> service(new DictionaryValue());
   std::unique_ptr<DictionaryValue> content(new DictionaryValue());
   std::unique_ptr<DictionaryValue> name(new DictionaryValue());
-  content->SetString(keys::kTizenServiceContentSrcKey, "service.js");
-  content->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kXmlTextKey, "name");
-  service->Set(keys::kTizenServiceContentKey, content.release());
-  service->Set(keys::kTizenServiceNameKey, name.release());
-  service->SetString(keys::kTizenServiceIdKey, "correct002.appId");
-  service->SetString(keys::kTizenServiceOnBootKey, "true");
-  service->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  content->SetString(kTizenServiceContentSrcKey, "service.js");
+  content->SetString(::kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kXmlTextKey, "name");
+  service->Set(kTizenServiceContentKey, content.release());
+  service->Set(kTizenServiceNameKey, name.release());
+  service->SetString(kTizenServiceIdKey, "correct002.appId");
+  service->SetString(kTizenServiceOnBootKey, "true");
+  service->SetString(kNamespaceKey, kTizenNamespacePrefix);
   widget->Set(kServiceKey, service.release());
   value->Set(keys::kWidgetKey, widget.release());
   std::shared_ptr<Manifest> manifest(new Manifest(std::move(value)));
@@ -155,16 +168,16 @@ TEST_F(ServiceHandlerTest, SingleServiceEntryAutoRestartOn) {
   std::unique_ptr<DictionaryValue> service(new DictionaryValue());
   std::unique_ptr<DictionaryValue> content(new DictionaryValue());
   std::unique_ptr<DictionaryValue> name(new DictionaryValue());
-  content->SetString(keys::kTizenServiceContentSrcKey, "service.js");
-  content->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kXmlTextKey, "name");
-  service->Set(keys::kTizenServiceContentKey, content.release());
-  service->Set(keys::kTizenServiceNameKey, name.release());
-  service->SetString(keys::kTizenServiceIdKey, "correct003.appId");
-  service->SetString(keys::kTizenServiceOnBootKey, "false");
-  service->SetString(keys::kTizenServiceAutoRestartKey, "true");
-  service->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  content->SetString(kTizenServiceContentSrcKey, "service.js");
+  content->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kXmlTextKey, "name");
+  service->Set(kTizenServiceContentKey, content.release());
+  service->Set(kTizenServiceNameKey, name.release());
+  service->SetString(kTizenServiceIdKey, "correct003.appId");
+  service->SetString(kTizenServiceOnBootKey, "false");
+  service->SetString(kTizenServiceAutoRestartKey, "true");
+  service->SetString(kNamespaceKey, kTizenNamespacePrefix);
   widget->Set(kServiceKey, service.release());
   value->Set(keys::kWidgetKey, widget.release());
   std::shared_ptr<Manifest> manifest(new Manifest(std::move(value)));
@@ -193,14 +206,14 @@ TEST_F(ServiceHandlerTest, SingleServiceEntryWrongId) {
   std::unique_ptr<DictionaryValue> service(new DictionaryValue());
   std::unique_ptr<DictionaryValue> content(new DictionaryValue());
   std::unique_ptr<DictionaryValue> name(new DictionaryValue());
-  content->SetString(keys::kTizenServiceContentSrcKey, "service.js");
-  content->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kXmlTextKey, "name");
-  service->Set(keys::kTizenServiceContentKey, content.release());
-  service->Set(keys::kTizenServiceNameKey, name.release());
-  service->SetString(keys::kTizenServiceIdKey, "wrongid.appId");
-  service->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  content->SetString(kTizenServiceContentSrcKey, "service.js");
+  content->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kXmlTextKey, "name");
+  service->Set(kTizenServiceContentKey, content.release());
+  service->Set(kTizenServiceNameKey, name.release());
+  service->SetString(kTizenServiceIdKey, "wrongid.appId");
+  service->SetString(kNamespaceKey, kTizenNamespacePrefix);
   widget->Set(kServiceKey, service.release());
   value->Set(keys::kWidgetKey, widget.release());
   std::shared_ptr<Manifest> manifest(new Manifest(std::move(value)));
@@ -217,14 +230,14 @@ TEST_F(ServiceHandlerTest, SingleServiceEntryIdTypeMismatch) {
   std::unique_ptr<DictionaryValue> service(new DictionaryValue());
   std::unique_ptr<DictionaryValue> content(new DictionaryValue());
   std::unique_ptr<DictionaryValue> name(new DictionaryValue());
-  content->SetString(keys::kTizenServiceContentSrcKey, "service.js");
-  content->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kXmlTextKey, "name");
-  service->Set(keys::kTizenServiceContentKey, content.release());
-  service->Set(keys::kTizenServiceNameKey, name.release());
-  service->SetInteger(keys::kTizenServiceIdKey, 1410);
-  service->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  content->SetString(kTizenServiceContentSrcKey, "service.js");
+  content->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kXmlTextKey, "name");
+  service->Set(kTizenServiceContentKey, content.release());
+  service->Set(kTizenServiceNameKey, name.release());
+  service->SetInteger(kTizenServiceIdKey, 1410);
+  service->SetString(kNamespaceKey, kTizenNamespacePrefix);
   widget->Set(kServiceKey, service.release());
   value->Set(keys::kWidgetKey, widget.release());
   std::shared_ptr<Manifest> manifest(new Manifest(std::move(value)));
@@ -239,11 +252,11 @@ TEST_F(ServiceHandlerTest, SingleServiceEntryNameMissing) {
   std::unique_ptr<DictionaryValue> widget(new DictionaryValue());
   std::unique_ptr<DictionaryValue> service(new DictionaryValue());
   std::unique_ptr<DictionaryValue> content(new DictionaryValue());
-  content->SetString(keys::kTizenServiceContentSrcKey, "service.js");
-  content->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  service->Set(keys::kTizenServiceContentKey, content.release());
-  service->SetInteger(keys::kTizenServiceIdKey, 1410);
-  service->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  content->SetString(kTizenServiceContentSrcKey, "service.js");
+  content->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  service->Set(kTizenServiceContentKey, content.release());
+  service->SetInteger(kTizenServiceIdKey, 1410);
+  service->SetString(kNamespaceKey, kTizenNamespacePrefix);
   widget->Set(kServiceKey, service.release());
   value->Set(keys::kWidgetKey, widget.release());
   std::shared_ptr<Manifest> manifest(new Manifest(std::move(value)));
@@ -259,13 +272,13 @@ TEST_F(ServiceHandlerTest, SingleServiceEntryIdSingleNameNotInTizen) {
   std::unique_ptr<DictionaryValue> service(new DictionaryValue());
   std::unique_ptr<DictionaryValue> content(new DictionaryValue());
   std::unique_ptr<DictionaryValue> name(new DictionaryValue());
-  content->SetString(keys::kTizenServiceContentSrcKey, "service.js");
-  content->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kXmlTextKey, "name");
-  service->Set(keys::kTizenServiceContentKey, content.release());
-  service->SetInteger(keys::kTizenServiceIdKey, 1410);
-  service->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  content->SetString(kTizenServiceContentSrcKey, "service.js");
+  content->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kXmlTextKey, "name");
+  service->Set(kTizenServiceContentKey, content.release());
+  service->SetInteger(kTizenServiceIdKey, 1410);
+  service->SetString(kNamespaceKey, kTizenNamespacePrefix);
   widget->Set(kServiceKey, service.release());
   value->Set(keys::kWidgetKey, widget.release());
   std::shared_ptr<Manifest> manifest(new Manifest(std::move(value)));
@@ -280,27 +293,26 @@ TEST_F(ServiceHandlerTest, SingleServiceEntryMultipleNames) {
   std::unique_ptr<DictionaryValue> widget(new DictionaryValue());
   std::unique_ptr<DictionaryValue> service(new DictionaryValue());
   std::unique_ptr<DictionaryValue> content(new DictionaryValue());
-  content->SetString(keys::kTizenServiceContentSrcKey, "service.js");
-  content->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  content->SetString(kTizenServiceContentSrcKey, "service.js");
+  content->SetString(kNamespaceKey, kTizenNamespacePrefix);
 
   std::unique_ptr<ListValue> name_list(new ListValue());
   for (auto& pair : {std::make_pair(std::string(), "first"),
                      std::make_pair(std::string("en"), "second"),
                      std::make_pair(std::string("de"), "third")}) {
     std::unique_ptr<DictionaryValue> name(new DictionaryValue());
-    name->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-    if (!pair.first.empty())
-      name->SetString(keys::kXmlLangKey, pair.first);
-    name->SetString(keys::kXmlTextKey, pair.second);
+    name->SetString(kNamespaceKey, kTizenNamespacePrefix);
+    if (!pair.first.empty()) name->SetString(kXmlLangKey, pair.first);
+    name->SetString(kXmlTextKey, pair.second);
     name_list->Append(name.release());
   }
-  service->Set(keys::kTizenServiceNameKey, name_list.release());
+  service->Set(kTizenServiceNameKey, name_list.release());
 
-  service->Set(keys::kTizenServiceContentKey, content.release());
-  service->SetString(keys::kTizenServiceIdKey, "correct003.appId");
-  service->SetString(keys::kTizenServiceOnBootKey, "false");
-  service->SetString(keys::kTizenServiceAutoRestartKey, "true");
-  service->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  service->Set(kTizenServiceContentKey, content.release());
+  service->SetString(kTizenServiceIdKey, "correct003.appId");
+  service->SetString(kTizenServiceOnBootKey, "false");
+  service->SetString(kTizenServiceAutoRestartKey, "true");
+  service->SetString(kNamespaceKey, kTizenNamespacePrefix);
   widget->Set(kServiceKey, service.release());
   value->Set(keys::kWidgetKey, widget.release());
   std::shared_ptr<Manifest> manifest(new Manifest(std::move(value)));
@@ -334,13 +346,13 @@ TEST_F(ServiceHandlerTest, SingleServiceEntryIdSingleContentNotInTizen) {
   std::unique_ptr<DictionaryValue> service(new DictionaryValue());
   std::unique_ptr<DictionaryValue> content(new DictionaryValue());
   std::unique_ptr<DictionaryValue> name(new DictionaryValue());
-  content->SetString(keys::kTizenServiceContentSrcKey, "service.js");
-  content->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kXmlTextKey, "name");
-  service->Set(keys::kTizenServiceNameKey, name.release());
-  service->SetInteger(keys::kTizenServiceIdKey, 1410);
-  service->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  content->SetString(kTizenServiceContentSrcKey, "service.js");
+  content->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kXmlTextKey, "name");
+  service->Set(kTizenServiceNameKey, name.release());
+  service->SetInteger(kTizenServiceIdKey, 1410);
+  service->SetString(kNamespaceKey, kTizenNamespacePrefix);
   widget->Set(kServiceKey, service.release());
   value->Set(keys::kWidgetKey, widget.release());
   std::shared_ptr<Manifest> manifest(new Manifest(std::move(value)));
@@ -355,11 +367,11 @@ TEST_F(ServiceHandlerTest, SingleServiceEntryContentMissing) {
   std::unique_ptr<DictionaryValue> widget(new DictionaryValue());
   std::unique_ptr<DictionaryValue> service(new DictionaryValue());
   std::unique_ptr<DictionaryValue> name(new DictionaryValue());
-  name->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kXmlTextKey, "name");
-  service->Set(keys::kTizenServiceNameKey, name.release());
-  service->SetInteger(keys::kTizenServiceIdKey, 1410);
-  service->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  name->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kXmlTextKey, "name");
+  service->Set(kTizenServiceNameKey, name.release());
+  service->SetInteger(kTizenServiceIdKey, 1410);
+  service->SetString(kNamespaceKey, kTizenNamespacePrefix);
   widget->Set(kServiceKey, service.release());
   value->Set(keys::kWidgetKey, widget.release());
   std::shared_ptr<Manifest> manifest(new Manifest(std::move(value)));
@@ -378,17 +390,17 @@ TEST_F(ServiceHandlerTest, SingleServiceEntryMultipleContents) {
   std::unique_ptr<ListValue> content_list(new ListValue());
   for (auto& start_file : {"content1.js", "content2.js"}) {
     std::unique_ptr<DictionaryValue> content(new DictionaryValue());
-    content->SetString(keys::kTizenServiceContentSrcKey, start_file);
-    content->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+    content->SetString(kTizenServiceContentSrcKey, start_file);
+    content->SetString(kNamespaceKey, kTizenNamespacePrefix);
     content_list->Append(content.release());
   }
-  service->Set(keys::kTizenServiceContentKey, content_list.release());
+  service->Set(kTizenServiceContentKey, content_list.release());
 
-  name->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kXmlTextKey, "name");
-  service->Set(keys::kTizenServiceNameKey, name.release());
-  service->SetInteger(keys::kTizenServiceIdKey, 1410);
-  service->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  name->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kXmlTextKey, "name");
+  service->Set(kTizenServiceNameKey, name.release());
+  service->SetInteger(kTizenServiceIdKey, 1410);
+  service->SetString(kNamespaceKey, kTizenNamespacePrefix);
   widget->Set(kServiceKey, service.release());
   value->Set(keys::kWidgetKey, widget.release());
   std::shared_ptr<Manifest> manifest(new Manifest(std::move(value)));
@@ -405,17 +417,17 @@ TEST_F(ServiceHandlerTest, SingleServiceEntrySingleIcon) {
   std::unique_ptr<DictionaryValue> content(new DictionaryValue());
   std::unique_ptr<DictionaryValue> name(new DictionaryValue());
   std::unique_ptr<DictionaryValue> icon(new DictionaryValue());
-  content->SetString(keys::kTizenServiceContentSrcKey, "service.js");
-  content->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kXmlTextKey, "name");
-  icon->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  icon->SetString(keys::kTizenServiceIconSrcKey, "my_icon.png");
-  service->Set(keys::kTizenServiceIconKey, icon.release());
-  service->Set(keys::kTizenServiceContentKey, content.release());
-  service->Set(keys::kTizenServiceNameKey, name.release());
-  service->SetString(keys::kTizenServiceIdKey, "correct001.appId");
-  service->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  content->SetString(kTizenServiceContentSrcKey, "service.js");
+  content->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kXmlTextKey, "name");
+  icon->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  icon->SetString(kTizenServiceIconSrcKey, "my_icon.png");
+  service->Set(kTizenServiceIconKey, icon.release());
+  service->Set(kTizenServiceContentKey, content.release());
+  service->Set(kTizenServiceNameKey, name.release());
+  service->SetString(kTizenServiceIdKey, "correct001.appId");
+  service->SetString(kNamespaceKey, kTizenNamespacePrefix);
   widget->Set(kServiceKey, service.release());
   value->Set(keys::kWidgetKey, widget.release());
   std::shared_ptr<Manifest> manifest(new Manifest(std::move(value)));
@@ -446,16 +458,16 @@ TEST_F(ServiceHandlerTest, SingleServiceEntrySingleIconNotInTizen) {
   std::unique_ptr<DictionaryValue> content(new DictionaryValue());
   std::unique_ptr<DictionaryValue> name(new DictionaryValue());
   std::unique_ptr<DictionaryValue> icon(new DictionaryValue());
-  content->SetString(keys::kTizenServiceContentSrcKey, "service.js");
-  content->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kXmlTextKey, "name");
-  icon->SetString(keys::kTizenServiceIconSrcKey, "my_icon.png");
-  service->Set(keys::kTizenServiceIconKey, icon.release());
-  service->Set(keys::kTizenServiceContentKey, content.release());
-  service->Set(keys::kTizenServiceNameKey, name.release());
-  service->SetString(keys::kTizenServiceIdKey, "correct001.appId");
-  service->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  content->SetString(kTizenServiceContentSrcKey, "service.js");
+  content->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kXmlTextKey, "name");
+  icon->SetString(kTizenServiceIconSrcKey, "my_icon.png");
+  service->Set(kTizenServiceIconKey, icon.release());
+  service->Set(kTizenServiceContentKey, content.release());
+  service->Set(kTizenServiceNameKey, name.release());
+  service->SetString(kTizenServiceIdKey, "correct001.appId");
+  service->SetString(kNamespaceKey, kTizenNamespacePrefix);
   widget->Set(kServiceKey, service.release());
   value->Set(keys::kWidgetKey, widget.release());
   std::shared_ptr<Manifest> manifest(new Manifest(std::move(value)));
@@ -485,24 +497,24 @@ TEST_F(ServiceHandlerTest, SingleServiceEntryMultipleIcon) {
   std::unique_ptr<DictionaryValue> service(new DictionaryValue());
   std::unique_ptr<DictionaryValue> content(new DictionaryValue());
   std::unique_ptr<DictionaryValue> name(new DictionaryValue());
-  content->SetString(keys::kTizenServiceContentSrcKey, "service.js");
-  content->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kXmlTextKey, "name");
+  content->SetString(kTizenServiceContentSrcKey, "service.js");
+  content->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kXmlTextKey, "name");
 
   std::unique_ptr<ListValue> icon_list(new ListValue());
   for (auto& icon_value : {"icon1.png", "icon2.png"}) {
     std::unique_ptr<DictionaryValue> icon(new DictionaryValue());
-    icon->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-    icon->SetString(keys::kTizenServiceIconSrcKey, icon_value);
+    icon->SetString(kNamespaceKey, kTizenNamespacePrefix);
+    icon->SetString(kTizenServiceIconSrcKey, icon_value);
     icon_list->Append(icon.release());
   }
 
-  service->Set(keys::kTizenServiceIconKey, icon_list.release());
-  service->Set(keys::kTizenServiceContentKey, content.release());
-  service->Set(keys::kTizenServiceNameKey, name.release());
-  service->SetString(keys::kTizenServiceIdKey, "correct001.appId");
-  service->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  service->Set(kTizenServiceIconKey, icon_list.release());
+  service->Set(kTizenServiceContentKey, content.release());
+  service->Set(kTizenServiceNameKey, name.release());
+  service->SetString(kTizenServiceIdKey, "correct001.appId");
+  service->SetString(kNamespaceKey, kTizenNamespacePrefix);
   widget->Set(kServiceKey, service.release());
   value->Set(keys::kWidgetKey, widget.release());
   std::shared_ptr<Manifest> manifest(new Manifest(std::move(value)));
@@ -519,17 +531,17 @@ TEST_F(ServiceHandlerTest, SingleServiceEntrySingleDescription) {
   std::unique_ptr<DictionaryValue> content(new DictionaryValue());
   std::unique_ptr<DictionaryValue> name(new DictionaryValue());
   std::unique_ptr<DictionaryValue> description(new DictionaryValue());
-  content->SetString(keys::kTizenServiceContentSrcKey, "service.js");
-  content->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kXmlTextKey, "name");
-  description->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  description->SetString(keys::kXmlTextKey, "my description");
-  service->Set(keys::kTizenServiceDescriptionKey, description.release());
-  service->Set(keys::kTizenServiceContentKey, content.release());
-  service->Set(keys::kTizenServiceNameKey, name.release());
-  service->SetString(keys::kTizenServiceIdKey, "correct001.appId");
-  service->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  content->SetString(kTizenServiceContentSrcKey, "service.js");
+  content->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kXmlTextKey, "name");
+  description->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  description->SetString(kXmlTextKey, "my description");
+  service->Set(kTizenServiceDescriptionKey, description.release());
+  service->Set(kTizenServiceContentKey, content.release());
+  service->Set(kTizenServiceNameKey, name.release());
+  service->SetString(kTizenServiceIdKey, "correct001.appId");
+  service->SetString(kNamespaceKey, kTizenNamespacePrefix);
   widget->Set(kServiceKey, service.release());
   value->Set(keys::kWidgetKey, widget.release());
   std::shared_ptr<Manifest> manifest(new Manifest(std::move(value)));
@@ -560,16 +572,16 @@ TEST_F(ServiceHandlerTest, SingleServiceEntrySingleDescriptionNotInTizen) {
   std::unique_ptr<DictionaryValue> content(new DictionaryValue());
   std::unique_ptr<DictionaryValue> name(new DictionaryValue());
   std::unique_ptr<DictionaryValue> description(new DictionaryValue());
-  content->SetString(keys::kTizenServiceContentSrcKey, "service.js");
-  content->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kXmlTextKey, "name");
-  description->SetString(keys::kXmlTextKey, "my description");
-  service->Set(keys::kTizenServiceDescriptionKey, description.release());
-  service->Set(keys::kTizenServiceContentKey, content.release());
-  service->Set(keys::kTizenServiceNameKey, name.release());
-  service->SetString(keys::kTizenServiceIdKey, "correct001.appId");
-  service->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  content->SetString(kTizenServiceContentSrcKey, "service.js");
+  content->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kXmlTextKey, "name");
+  description->SetString(kXmlTextKey, "my description");
+  service->Set(kTizenServiceDescriptionKey, description.release());
+  service->Set(kTizenServiceContentKey, content.release());
+  service->Set(kTizenServiceNameKey, name.release());
+  service->SetString(kTizenServiceIdKey, "correct001.appId");
+  service->SetString(kNamespaceKey, kTizenNamespacePrefix);
   widget->Set(kServiceKey, service.release());
   value->Set(keys::kWidgetKey, widget.release());
   std::shared_ptr<Manifest> manifest(new Manifest(std::move(value)));
@@ -599,24 +611,24 @@ TEST_F(ServiceHandlerTest, SingleServiceEntryMultipleDescription) {
   std::unique_ptr<DictionaryValue> service(new DictionaryValue());
   std::unique_ptr<DictionaryValue> content(new DictionaryValue());
   std::unique_ptr<DictionaryValue> name(new DictionaryValue());
-  content->SetString(keys::kTizenServiceContentSrcKey, "service.js");
-  content->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kXmlTextKey, "name");
+  content->SetString(kTizenServiceContentSrcKey, "service.js");
+  content->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kXmlTextKey, "name");
 
   std::unique_ptr<ListValue> description_list(new ListValue());
   for (auto& desc_value : {"1", "2"}) {
     std::unique_ptr<DictionaryValue> description(new DictionaryValue());
-    description->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-    description->SetString(keys::kXmlTextKey, desc_value);
+    description->SetString(kNamespaceKey, kTizenNamespacePrefix);
+    description->SetString(kXmlTextKey, desc_value);
     description_list->Append(description.release());
   }
-  service->Set(keys::kTizenServiceDescriptionKey, description_list.release());
+  service->Set(kTizenServiceDescriptionKey, description_list.release());
 
-  service->Set(keys::kTizenServiceContentKey, content.release());
-  service->Set(keys::kTizenServiceNameKey, name.release());
-  service->SetString(keys::kTizenServiceIdKey, "correct001.appId");
-  service->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  service->Set(kTizenServiceContentKey, content.release());
+  service->Set(kTizenServiceNameKey, name.release());
+  service->SetString(kTizenServiceIdKey, "correct001.appId");
+  service->SetString(kNamespaceKey, kTizenNamespacePrefix);
   widget->Set(kServiceKey, service.release());
   value->Set(keys::kWidgetKey, widget.release());
   std::shared_ptr<Manifest> manifest(new Manifest(std::move(value)));
@@ -633,18 +645,18 @@ TEST_F(ServiceHandlerTest, SingleServiceEntrySingleMetadata) {
   std::unique_ptr<DictionaryValue> content(new DictionaryValue());
   std::unique_ptr<DictionaryValue> name(new DictionaryValue());
   std::unique_ptr<DictionaryValue> metadata(new DictionaryValue());
-  content->SetString(keys::kTizenServiceContentSrcKey, "service.js");
-  content->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kXmlTextKey, "name");
-  metadata->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  metadata->SetString(keys::kTizenServiceMetadataKeyKey, "unique key");
-  metadata->SetString(keys::kTizenServiceMetadataValueKey, "some value");
-  service->Set(keys::kTizenServiceMetadataKey, metadata.release());
-  service->Set(keys::kTizenServiceContentKey, content.release());
-  service->Set(keys::kTizenServiceNameKey, name.release());
-  service->SetString(keys::kTizenServiceIdKey, "correct001.appId");
-  service->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  content->SetString(kTizenServiceContentSrcKey, "service.js");
+  content->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kXmlTextKey, "name");
+  metadata->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  metadata->SetString(kTizenServiceMetadataKeyKey, "unique key");
+  metadata->SetString(kTizenServiceMetadataValueKey, "some value");
+  service->Set(kTizenServiceMetadataKey, metadata.release());
+  service->Set(kTizenServiceContentKey, content.release());
+  service->Set(kTizenServiceNameKey, name.release());
+  service->SetString(kTizenServiceIdKey, "correct001.appId");
+  service->SetString(kNamespaceKey, kTizenNamespacePrefix);
   widget->Set(kServiceKey, service.release());
   value->Set(keys::kWidgetKey, widget.release());
   std::shared_ptr<Manifest> manifest(new Manifest(std::move(value)));
@@ -677,17 +689,17 @@ TEST_F(ServiceHandlerTest, SingleServiceEntrySingleMetadataNotInTizen) {
   std::unique_ptr<DictionaryValue> content(new DictionaryValue());
   std::unique_ptr<DictionaryValue> name(new DictionaryValue());
   std::unique_ptr<DictionaryValue> metadata(new DictionaryValue());
-  content->SetString(keys::kTizenServiceContentSrcKey, "service.js");
-  content->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kXmlTextKey, "name");
-  metadata->SetString(keys::kTizenServiceMetadataKeyKey, "unique key");
-  metadata->SetString(keys::kTizenServiceMetadataValueKey, "some value");
-  service->Set(keys::kTizenServiceMetadataKey, metadata.release());
-  service->Set(keys::kTizenServiceContentKey, content.release());
-  service->Set(keys::kTizenServiceNameKey, name.release());
-  service->SetString(keys::kTizenServiceIdKey, "correct001.appId");
-  service->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  content->SetString(kTizenServiceContentSrcKey, "service.js");
+  content->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kXmlTextKey, "name");
+  metadata->SetString(kTizenServiceMetadataKeyKey, "unique key");
+  metadata->SetString(kTizenServiceMetadataValueKey, "some value");
+  service->Set(kTizenServiceMetadataKey, metadata.release());
+  service->Set(kTizenServiceContentKey, content.release());
+  service->Set(kTizenServiceNameKey, name.release());
+  service->SetString(kTizenServiceIdKey, "correct001.appId");
+  service->SetString(kNamespaceKey, kTizenNamespacePrefix);
   widget->Set(kServiceKey, service.release());
   value->Set(keys::kWidgetKey, widget.release());
   std::shared_ptr<Manifest> manifest(new Manifest(std::move(value)));
@@ -717,27 +729,27 @@ TEST_F(ServiceHandlerTest, SingleServiceEntryMultipleMetadata) {
   std::unique_ptr<DictionaryValue> service(new DictionaryValue());
   std::unique_ptr<DictionaryValue> content(new DictionaryValue());
   std::unique_ptr<DictionaryValue> name(new DictionaryValue());
-  content->SetString(keys::kTizenServiceContentSrcKey, "service.js");
-  content->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kXmlTextKey, "name");
+  content->SetString(kTizenServiceContentSrcKey, "service.js");
+  content->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kXmlTextKey, "name");
 
   std::unique_ptr<ListValue> metadata_list(new ListValue());
   std::unique_ptr<DictionaryValue> metadata(new DictionaryValue());
-  metadata->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  metadata->SetString(keys::kTizenServiceMetadataKeyKey, "unique key");
-  metadata->SetString(keys::kTizenServiceMetadataValueKey, "some value");
+  metadata->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  metadata->SetString(kTizenServiceMetadataKeyKey, "unique key");
+  metadata->SetString(kTizenServiceMetadataValueKey, "some value");
   metadata_list->Append(metadata.release());
   std::unique_ptr<DictionaryValue> metadata2(new DictionaryValue());
-  metadata2->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  metadata2->SetString(keys::kTizenServiceMetadataKeyKey, "unique key 2");
+  metadata2->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  metadata2->SetString(kTizenServiceMetadataKeyKey, "unique key 2");
   metadata_list->Append(metadata2.release());
-  service->Set(keys::kTizenServiceMetadataKey, metadata_list.release());
+  service->Set(kTizenServiceMetadataKey, metadata_list.release());
 
-  service->Set(keys::kTizenServiceContentKey, content.release());
-  service->Set(keys::kTizenServiceNameKey, name.release());
-  service->SetString(keys::kTizenServiceIdKey, "correct001.appId");
-  service->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  service->Set(kTizenServiceContentKey, content.release());
+  service->Set(kTizenServiceNameKey, name.release());
+  service->SetString(kTizenServiceIdKey, "correct001.appId");
+  service->SetString(kNamespaceKey, kTizenNamespacePrefix);
   widget->Set(kServiceKey, service.release());
   value->Set(keys::kWidgetKey, widget.release());
   std::shared_ptr<Manifest> manifest(new Manifest(std::move(value)));
@@ -771,34 +783,34 @@ TEST_F(ServiceHandlerTest, SingleServiceEntryMultipleMetadataMixedNamespaces) {
   std::unique_ptr<DictionaryValue> service(new DictionaryValue());
   std::unique_ptr<DictionaryValue> content(new DictionaryValue());
   std::unique_ptr<DictionaryValue> name(new DictionaryValue());
-  content->SetString(keys::kTizenServiceContentSrcKey, "service.js");
-  content->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kXmlTextKey, "name");
+  content->SetString(kTizenServiceContentSrcKey, "service.js");
+  content->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kXmlTextKey, "name");
 
   std::unique_ptr<ListValue> metadata_list(new ListValue());
 
   std::unique_ptr<DictionaryValue> metadata(new DictionaryValue());
-  metadata->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  metadata->SetString(keys::kTizenServiceMetadataKeyKey, "unique key");
-  metadata->SetString(keys::kTizenServiceMetadataValueKey, "some value");
+  metadata->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  metadata->SetString(kTizenServiceMetadataKeyKey, "unique key");
+  metadata->SetString(kTizenServiceMetadataValueKey, "some value");
   metadata_list->Append(metadata.release());
 
   std::unique_ptr<DictionaryValue> metadata2(new DictionaryValue());
-  metadata2->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  metadata2->SetString(keys::kTizenServiceMetadataKeyKey, "unique key 2");
+  metadata2->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  metadata2->SetString(kTizenServiceMetadataKeyKey, "unique key 2");
   metadata_list->Append(metadata2.release());
 
   std::unique_ptr<DictionaryValue> metadata3(new DictionaryValue());
-  metadata3->SetString(keys::kTizenServiceMetadataKeyKey, "unique key 3");
+  metadata3->SetString(kTizenServiceMetadataKeyKey, "unique key 3");
   metadata_list->Append(metadata3.release());
 
-  service->Set(keys::kTizenServiceMetadataKey, metadata_list.release());
+  service->Set(kTizenServiceMetadataKey, metadata_list.release());
 
-  service->Set(keys::kTizenServiceContentKey, content.release());
-  service->Set(keys::kTizenServiceNameKey, name.release());
-  service->SetString(keys::kTizenServiceIdKey, "correct001.appId");
-  service->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  service->Set(kTizenServiceContentKey, content.release());
+  service->Set(kTizenServiceNameKey, name.release());
+  service->SetString(kTizenServiceIdKey, "correct001.appId");
+  service->SetString(kNamespaceKey, kTizenNamespacePrefix);
   widget->Set(kServiceKey, service.release());
   value->Set(keys::kWidgetKey, widget.release());
   std::shared_ptr<Manifest> manifest(new Manifest(std::move(value)));
@@ -833,17 +845,17 @@ TEST_F(ServiceHandlerTest, SingleServiceEntrySingleCategory) {
   std::unique_ptr<DictionaryValue> content(new DictionaryValue());
   std::unique_ptr<DictionaryValue> name(new DictionaryValue());
   std::unique_ptr<DictionaryValue> category(new DictionaryValue());
-  content->SetString(keys::kTizenServiceContentSrcKey, "service.js");
-  content->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kXmlTextKey, "name");
-  category->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  category->SetString(keys::kTizenServiceCategoryNameKey, "category name");
-  service->Set(keys::kTizenServiceCategoryKey, category.release());
-  service->Set(keys::kTizenServiceContentKey, content.release());
-  service->Set(keys::kTizenServiceNameKey, name.release());
-  service->SetString(keys::kTizenServiceIdKey, "correct001.appId");
-  service->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  content->SetString(kTizenServiceContentSrcKey, "service.js");
+  content->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kXmlTextKey, "name");
+  category->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  category->SetString(kTizenServiceCategoryNameKey, "category name");
+  service->Set(kTizenServiceCategoryKey, category.release());
+  service->Set(kTizenServiceContentKey, content.release());
+  service->Set(kTizenServiceNameKey, name.release());
+  service->SetString(kTizenServiceIdKey, "correct001.appId");
+  service->SetString(kNamespaceKey, kTizenNamespacePrefix);
   widget->Set(kServiceKey, service.release());
   value->Set(keys::kWidgetKey, widget.release());
   std::shared_ptr<Manifest> manifest(new Manifest(std::move(value)));
@@ -875,16 +887,16 @@ TEST_F(ServiceHandlerTest, SingleServiceEntrySingleCategoryNotInTizen) {
   std::unique_ptr<DictionaryValue> content(new DictionaryValue());
   std::unique_ptr<DictionaryValue> name(new DictionaryValue());
   std::unique_ptr<DictionaryValue> category(new DictionaryValue());
-  content->SetString(keys::kTizenServiceContentSrcKey, "service.js");
-  content->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kXmlTextKey, "name");
-  category->SetString(keys::kTizenServiceCategoryNameKey, "category name");
-  service->Set(keys::kTizenServiceCategoryKey, category.release());
-  service->Set(keys::kTizenServiceContentKey, content.release());
-  service->Set(keys::kTizenServiceNameKey, name.release());
-  service->SetString(keys::kTizenServiceIdKey, "correct001.appId");
-  service->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  content->SetString(kTizenServiceContentSrcKey, "service.js");
+  content->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kXmlTextKey, "name");
+  category->SetString(kTizenServiceCategoryNameKey, "category name");
+  service->Set(kTizenServiceCategoryKey, category.release());
+  service->Set(kTizenServiceContentKey, content.release());
+  service->Set(kTizenServiceNameKey, name.release());
+  service->SetString(kTizenServiceIdKey, "correct001.appId");
+  service->SetString(kNamespaceKey, kTizenNamespacePrefix);
   widget->Set(kServiceKey, service.release());
   value->Set(keys::kWidgetKey, widget.release());
   std::shared_ptr<Manifest> manifest(new Manifest(std::move(value)));
@@ -914,24 +926,24 @@ TEST_F(ServiceHandlerTest, SingleServiceEntryMultipleCategory) {
   std::unique_ptr<DictionaryValue> service(new DictionaryValue());
   std::unique_ptr<DictionaryValue> content(new DictionaryValue());
   std::unique_ptr<DictionaryValue> name(new DictionaryValue());
-  content->SetString(keys::kTizenServiceContentSrcKey, "service.js");
-  content->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  name->SetString(keys::kXmlTextKey, "name");
+  content->SetString(kTizenServiceContentSrcKey, "service.js");
+  content->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  name->SetString(kXmlTextKey, "name");
 
   std::unique_ptr<ListValue> catogory_list(new ListValue());
   for (auto& name : {"category name 1", "category name 2", "category name 3"}) {
     std::unique_ptr<DictionaryValue> category(new DictionaryValue());
-    category->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-    category->SetString(keys::kTizenServiceCategoryNameKey, name);
+    category->SetString(kNamespaceKey, kTizenNamespacePrefix);
+    category->SetString(kTizenServiceCategoryNameKey, name);
     catogory_list->Append(category.release());
   }
-  service->Set(keys::kTizenServiceCategoryKey, catogory_list.release());
+  service->Set(kTizenServiceCategoryKey, catogory_list.release());
 
-  service->Set(keys::kTizenServiceContentKey, content.release());
-  service->Set(keys::kTizenServiceNameKey, name.release());
-  service->SetString(keys::kTizenServiceIdKey, "correct001.appId");
-  service->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  service->Set(kTizenServiceContentKey, content.release());
+  service->Set(kTizenServiceNameKey, name.release());
+  service->SetString(kTizenServiceIdKey, "correct001.appId");
+  service->SetString(kNamespaceKey, kTizenNamespacePrefix);
   widget->Set(kServiceKey, service.release());
   value->Set(keys::kWidgetKey, widget.release());
   std::shared_ptr<Manifest> manifest(new Manifest(std::move(value)));
@@ -962,23 +974,21 @@ TEST_F(ServiceHandlerTest, MultipleServiceEntry) {
   std::unique_ptr<DictionaryValue> value(new DictionaryValue());
   std::unique_ptr<DictionaryValue> widget(new DictionaryValue());
   std::unique_ptr<ListValue> list(new ListValue());
-  std::unique_ptr<DictionaryValue> service1(
-      new DictionaryValue());
-  std::unique_ptr<DictionaryValue> service2(
-      new DictionaryValue());
-  service1->SetString(keys::kTizenServiceIdKey, "correct004.appId");
-  service1->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-  service2->SetString(keys::kTizenServiceIdKey, "correct005.appId");
-  service2->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
+  std::unique_ptr<DictionaryValue> service1(new DictionaryValue());
+  std::unique_ptr<DictionaryValue> service2(new DictionaryValue());
+  service1->SetString(kTizenServiceIdKey, "correct004.appId");
+  service1->SetString(kNamespaceKey, kTizenNamespacePrefix);
+  service2->SetString(kTizenServiceIdKey, "correct005.appId");
+  service2->SetString(kNamespaceKey, kTizenNamespacePrefix);
   for (auto& service : {service1.get(), service2.get()}) {
     std::unique_ptr<DictionaryValue> content(new DictionaryValue());
     std::unique_ptr<DictionaryValue> name(new DictionaryValue());
-    content->SetString(keys::kTizenServiceContentSrcKey, "service.js");
-    content->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-    name->SetString(keys::kNamespaceKey, keys::kTizenNamespacePrefix);
-    name->SetString(keys::kXmlTextKey, "name");
-    service->Set(keys::kTizenServiceContentKey, content.release());
-    service->Set(keys::kTizenServiceNameKey, name.release());
+    content->SetString(kTizenServiceContentSrcKey, "service.js");
+    content->SetString(kNamespaceKey, kTizenNamespacePrefix);
+    name->SetString(kNamespaceKey, kTizenNamespacePrefix);
+    name->SetString(kXmlTextKey, "name");
+    service->Set(kTizenServiceContentKey, content.release());
+    service->Set(kTizenServiceNameKey, name.release());
   }
   list->Append(service1.release());
   list->Append(service2.release());
@@ -1006,4 +1016,3 @@ TEST_F(ServiceHandlerTest, MultipleServiceEntry) {
 }
 
 }  // namespace parser
-