merge with master
[platform/framework/web/wrt.git] / src / view / webkit / view_logic_scheme_support.cpp
index cca7fd5..74f79d8 100644 (file)
@@ -40,18 +40,21 @@ char const * const TIZEN_CHANGE_USERAGNET = "tizen://changeUA";
 const int ORIENTATION_LANDSCAPE_ANGLE = 270;
 const int ORIENTATION_PORTAIT_ANGLE = 0;
 
+const int W3C_SCREEN_ORI_PORTRAIT_PRIMARY = 0;
+const int W3C_SCREEN_ORI_LANDSCAPE_PRIMARY = 90;
+
 static Eina_Bool exitAppIdlerCallback(void* /*data*/)
 {
     // webapp termination
     ewk_shutdown();
     elm_exit();
-    return ECORE_CALLBACK_CANCEL;}
-
+    return ECORE_CALLBACK_CANCEL;
+}
 } // namespace
 
 bool SchemeSupport::HandleUri(
-        const char* uri,
-        ViewModule::SchemeActionMap::NavigationContext context)
+    const char* uri,
+    ViewModule::SchemeActionMap::NavigationContext context)
 {
     return ViewModule::SchemeActionMap::HandleUri(uri,
                                                   context,
@@ -86,6 +89,7 @@ bool SchemeSupport::HandleTizenScheme(const char* uri,
     {
         LogInfo("Tizen scheme: " << uri << " orientation landscape");
         elm_win_rotation_with_resize_set(window, ORIENTATION_LANDSCAPE_ANGLE);
+        ewk_view_orientation_send(wkView, W3C_SCREEN_ORI_LANDSCAPE_PRIMARY);
         return true;
     } else if (strncmp(uri,
                        TIZEN_ORIENTATION_PORTAIT,
@@ -93,6 +97,7 @@ bool SchemeSupport::HandleTizenScheme(const char* uri,
     {
         LogInfo("Tizen scheme: " << uri << " orientation portait");
         elm_win_rotation_with_resize_set(window, ORIENTATION_PORTAIT_ANGLE);
+        ewk_view_orientation_send(wkView, W3C_SCREEN_ORI_PORTRAIT_PRIMARY);
         return true;
     } else if (strncmp(uri,
                        TIZEN_ORIENTATION_RESET,
@@ -100,16 +105,18 @@ bool SchemeSupport::HandleTizenScheme(const char* uri,
     {
         LogInfo("Tizen scheme: " << uri << " reset");
         elm_win_rotation_with_resize_set(window, ORIENTATION_PORTAIT_ANGLE);
+        ewk_view_orientation_send(wkView, W3C_SCREEN_ORI_PORTRAIT_PRIMARY);
         return true;
     } else if (strncmp(uri,
                        TIZEN_CHANGE_USERAGNET,
                        strlen(TIZEN_CHANGE_USERAGNET)) == 0)
     {
         LogInfo("Tizen scheme: " << uri << " change UA");
-        const char* userAgentString = strstr(uri, "=") + 1;
+        const char* userAgentString = strstr(uri, "=");
         if (NULL == userAgentString) {
             LogDebug("UA string is NULL");
         } else {
+            userAgentString++;
             LogDebug("Setting custom user agent as: " << userAgentString);
             ewk_view_user_agent_set(wkView, userAgentString);
         }
@@ -139,8 +146,7 @@ bool SchemeSupport::filterURIByScheme(Ewk_Policy_Decision* policyDecision,
         ewk_frame_is_main_frame(ewk_policy_decision_frame_get(policyDecision));
 
     using namespace ViewModule::SchemeActionMap;
-    if (HandleTizenScheme(url, window, wkView))
-    {
+    if (HandleTizenScheme(url, window, wkView)) {
         LogDebug("Scheme is tizen scheme");
         return false;
     }