[Release] wrt_0.8.225
authorJihoon Chung <jihoon.chung@samsung.com>
Sat, 22 Jun 2013 12:13:16 +0000 (21:13 +0900)
committerHoseon LEE <hoseon46.lee@samsung.com>
Sun, 29 Sep 2013 05:35:20 +0000 (14:35 +0900)
Change-Id: Ie331d03b0d526c24f43f5cebf2c132c7675f8fe5

47 files changed:
LICENSE.APLv2 [moved from LICENSE with 100% similarity]
LICENSE.Flora [new file with mode: 0644]
packaging/wrt.spec
src/api_new/ewk_context_manager.cpp
src/api_new/ewk_context_manager.h
src/api_new/user_delegates.h
src/domain/widget_data_types.cpp
src/domain/widget_data_types.h
src/view/common/application_launcher.cpp
src/view/common/message_support.h
src/view/common/scheme_action_map.cpp
src/view/common/scheme_action_map_data.h
src/view/i_view_module.h
src/view/webkit/injected-bundle/CMakeLists.txt
src/view/webkit/injected-bundle/injected_bundle_decryption_support.cpp
src/view/webkit/injected-bundle/injected_bundle_uri_handling.cpp
src/view/webkit/injected-bundle/injected_bundle_viewmodes_support.cpp [new file with mode: 0644]
src/view/webkit/injected-bundle/injected_bundle_viewmodes_support.h [new file with mode: 0644]
src/view/webkit/injected-bundle/wrt-injected-bundle.cpp
src/view/webkit/injected-bundle/wrt-injected-bundle.h
src/view/webkit/view_logic.cpp
src/view/webkit/view_logic.h
src/view/webkit/view_logic_geolocation_support.cpp [changed mode: 0755->0644]
src/view/webkit/view_logic_message_support.cpp
src/view/webkit/view_logic_message_support.h
src/view/webkit/view_logic_orientation_support.cpp
src/view/webkit/view_logic_orientation_support.h
src/wrt-client/CMakeLists.txt
src/wrt-client/auto_rotation_support.cpp [new file with mode: 0644]
src/wrt-client/auto_rotation_support.h [new file with mode: 0644]
src/wrt-client/client_service_support.cpp [new file with mode: 0644]
src/wrt-client/client_service_support.h [new file with mode: 0644]
src/wrt-client/splash_screen_support.cpp
src/wrt-client/window_data.cpp
src/wrt-client/window_data.h
src/wrt-client/wrt-client.cpp
src/wrt-client/wrt-client.h
src/wrt-launcher/CMakeLists.txt
src/wrt-launcher/wrt-launcher.cpp
src/wrt-launchpad-daemon/include/app_sock.h
src/wrt-launchpad-daemon/include/launchpad_util.h
src/wrt-launchpad-daemon/include/simple_util.h
src/wrt-launchpad-daemon/launchpad_src/launchpad.c
src/wrt-launchpad-daemon/legacy/preload.h
src/wrt-launchpad-daemon/legacy/preload_list_wrt.txt
tests/widgets/common/include/mock/MockViewModule.h
tests/widgets/common/src/mock/MockViewModule.cpp

similarity index 100%
rename from LICENSE
rename to LICENSE.APLv2
diff --git a/LICENSE.Flora b/LICENSE.Flora
new file mode 100644 (file)
index 0000000..4a0af40
--- /dev/null
@@ -0,0 +1,206 @@
+Flora License
+
+Version 1.1, April, 2013
+
+http://floralicense.org/license/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction,
+and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by
+the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and
+all other entities that control, are controlled by, or are
+under common control with that entity. For the purposes of
+this definition, "control" means (i) the power, direct or indirect,
+to cause the direction or management of such entity,
+whether by contract or otherwise, or (ii) ownership of fifty percent (50%)
+or more of the outstanding shares, or (iii) beneficial ownership of
+such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity
+exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications,
+including but not limited to software source code, documentation source,
+and configuration files.
+
+"Object" form shall mean any form resulting from mechanical
+transformation or translation of a Source form, including but
+not limited to compiled object code, generated documentation,
+and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form,
+made available under the License, as indicated by a copyright notice
+that is included in or attached to the work (an example is provided
+in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form,
+that is based on (or derived from) the Work and for which the editorial
+revisions, annotations, elaborations, or other modifications represent,
+as a whole, an original work of authorship. For the purposes of this License,
+Derivative Works shall not include works that remain separable from,
+or merely link (or bind by name) to the interfaces of, the Work and
+Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original
+version of the Work and any modifications or additions to that Work or
+Derivative Works thereof, that is intentionally submitted to Licensor
+for inclusion in the Work by the copyright owner or by an individual or
+Legal Entity authorized to submit on behalf of the copyright owner.
+For the purposes of this definition, "submitted" means any form of
+electronic, verbal, or written communication sent to the Licensor or
+its representatives, including but not limited to communication on
+electronic mailing lists, source code control systems, and issue
+tracking systems that are managed by, or on behalf of, the Licensor
+for the purpose of discussing and improving the Work, but excluding
+communication that is conspicuously marked or otherwise designated
+in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity
+on behalf of whom a Contribution has been received by Licensor and
+subsequently incorporated within the Work.
+
+"Tizen Certified Platform" shall mean a software platform that complies
+with the standards set forth in the Tizen Compliance Specification
+and passes the Tizen Compliance Tests as defined from time to time
+by the Tizen Technical Steering Group and certified by the Tizen
+Association or its designated agent.
+
+2. Grant of Copyright License.  Subject to the terms and conditions of
+this License, each Contributor hereby grants to You a perpetual,
+worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+copyright license to reproduce, prepare Derivative Works of,
+publicly display, publicly perform, sublicense, and distribute the
+Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License.  Subject to the terms and conditions of
+this License, each Contributor hereby grants to You a perpetual,
+worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+(except as stated in this section) patent license to make, have made,
+use, offer to sell, sell, import, and otherwise transfer the Work
+solely as incorporated into a Tizen Certified Platform, where such
+license applies only to those patent claims licensable by such
+Contributor that are necessarily infringed by their Contribution(s)
+alone or by combination of their Contribution(s) with the Work solely
+as incorporated into a Tizen Certified Platform to which such
+Contribution(s) was submitted. If You institute patent litigation
+against any entity (including a cross-claim or counterclaim
+in a lawsuit) alleging that the Work or a Contribution incorporated
+within the Work constitutes direct or contributory patent infringement,
+then any patent licenses granted to You under this License for that
+Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution.  You may reproduce and distribute copies of the
+Work or Derivative Works thereof pursuant to the copyright license
+above, in any medium, with or without modifications, and in Source or
+Object form, provided that You meet the following conditions:
+
+  1. You must give any other recipients of the Work or Derivative Works
+     a copy of this License; and
+  2. You must cause any modified files to carry prominent notices stating
+     that You changed the files; and
+  3. You must retain, in the Source form of any Derivative Works that
+     You distribute, all copyright, patent, trademark, and attribution
+     notices from the Source form of the Work, excluding those notices
+     that do not pertain to any part of the Derivative Works; and
+  4. If the Work includes a "NOTICE" text file as part of its distribution,
+     then any Derivative Works that You distribute must include a readable
+     copy of the attribution notices contained within such NOTICE file,
+     excluding those notices that do not pertain to any part of
+     the Derivative Works, in at least one of the following places:
+     within a NOTICE text file distributed as part of the Derivative Works;
+     within the Source form or documentation, if provided along with the
+     Derivative Works; or, within a display generated by the Derivative Works,
+     if and wherever such third-party notices normally appear.
+     The contents of the NOTICE file are for informational purposes only
+     and do not modify the License. You may add Your own attribution notices
+     within Derivative Works that You distribute, alongside or as an addendum
+     to the NOTICE text from the Work, provided that such additional attribution
+     notices cannot be construed as modifying the License. You may add Your own
+     copyright statement to Your modifications and may provide additional or
+     different license terms and conditions for use, reproduction, or
+     distribution of Your modifications, or for any such Derivative Works
+     as a whole, provided Your use, reproduction, and distribution of
+     the Work otherwise complies with the conditions stated in this License
+     and your own copyright statement or terms and conditions do not conflict
+     the conditions stated in the License including section 3.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+any Contribution intentionally submitted for inclusion in the Work
+by You to the Licensor shall be under the terms and conditions of
+this License, without any additional terms or conditions.
+Notwithstanding the above, nothing herein shall supersede or modify
+the terms of any separate license agreement you may have executed
+with Licensor regarding such Contributions.
+
+6. Trademarks.  This License does not grant permission to use the trade
+names, trademarks, service marks, or product names of the Licensor,
+except as required for reasonable and customary use in describing the
+origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+agreed to in writing, Licensor provides the Work (and each
+Contributor provides its Contributions) on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+implied, including, without limitation, any warranties or conditions
+of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+PARTICULAR PURPOSE. You are solely responsible for determining the
+appropriateness of using or redistributing the Work and assume any
+risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+whether in tort (including negligence), contract, or otherwise,
+unless required by applicable law (such as deliberate and grossly
+negligent acts) or agreed to in writing, shall any Contributor be
+liable to You for damages, including any direct, indirect, special,
+incidental, or consequential damages of any character arising as a
+result of this License or out of the use or inability to use the
+Work (including but not limited to damages for loss of goodwill,
+work stoppage, computer failure or malfunction, or any and all
+other commercial damages or losses), even if such Contributor
+has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+the Work or Derivative Works thereof, You may choose to offer,
+and charge a fee for, acceptance of support, warranty, indemnity,
+or other liability obligations and/or rights consistent with this
+License. However, in accepting such obligations, You may act only
+on Your own behalf and on Your sole responsibility, not on behalf
+of any other Contributor, and only if You agree to indemnify,
+defend, and hold each Contributor harmless for any liability
+incurred by, or claims asserted against, such Contributor by reason
+of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Flora License to your work
+
+To apply the Flora License to your work, attach the following
+boilerplate notice, with the fields enclosed by brackets "[]"
+replaced with your own identifying information. (Don't include
+the brackets!) The text should be enclosed in the appropriate
+comment syntax for the file format. We also recommend that a
+file or class name and description of purpose be included on the
+same "printed page" as the copyright notice for easier
+identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Flora License, Version 1.1 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://floralicense.org/license/
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
index 0a4fd12..d9cedf0 100644 (file)
@@ -1,7 +1,7 @@
 #git:framework/web/wrt
 Name:       wrt
 Summary:    web runtime
-Version:    0.8.215
+Version:    0.8.225
 Release:    1
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
@@ -94,7 +94,8 @@ make %{?jobs:-j%jobs}
 
 %install
 mkdir -p %{buildroot}/usr/share/license
-cp LICENSE %{buildroot}/usr/share/license/%{name}
+cp LICENSE.APLv2 %{buildroot}/usr/share/license/%{name}
+cp LICENSE.Flora %{buildroot}/usr/share/license/%{name}
 %make_install
 
 ## wrt-launchpad-daemon #######################################################
index d3f973a..7e9a049 100644 (file)
@@ -95,18 +95,7 @@ bool EwkContextManager::initialize()
     ADD_PROFILING_POINT("WebProcess fork", "stop");
 
     // proxy server setting
-    char *proxy = vconf_get_str(VCONFKEY_NETWORK_PROXY);
-    if (proxy && strlen(proxy) && strcmp(proxy, "0.0.0.0")) {
-        LogInfo("proxy address: " << proxy);
-        ewk_context_proxy_uri_set(m_ewkContext,  proxy);
-    } else {
-        LogInfo("proxy address is empty");
-        ewk_context_proxy_uri_set(m_ewkContext, NULL);
-    }
-
-    if (proxy) {
-        free(proxy);
-    }
+    setNetworkProxy();
 
     LogInfo("ewk_context_certificate_file_set() was called.");
     ewk_context_certificate_file_set(m_ewkContext, caCertPath.c_str());
@@ -190,6 +179,27 @@ void EwkContextManager::setCallbacks()
             vibrationClientStartCallback,
             vibrationClientStopCallback,
             this);
+
+    vconf_notify_key_changed(VCONFKEY_NETWORK_PROXY,
+                             vconfChangedCallback,
+                             this);
+}
+
+void EwkContextManager::unsetCallbacks()
+{
+    if (!m_initialized) {
+        return;
+    }
+
+    ewk_context_message_from_injected_bundle_callback_set(
+            m_ewkContext, NULL, NULL);
+    ewk_context_did_start_download_callback_set(
+            m_ewkContext, NULL, NULL);
+    ewk_context_vibration_client_callbacks_set(
+            m_ewkContext, NULL, NULL, NULL);
+
+    vconf_ignore_key_changed(VCONFKEY_NETWORK_PROXY,
+                             vconfChangedCallback);
 }
 
 void EwkContextManager::setAutoFullscreenMode()
@@ -250,21 +260,31 @@ void EwkContextManager::setCSPSupport()
                                          true);
 }
 
-void EwkContextManager::unsetCallbacks()
+void EwkContextManager::setNetworkProxy()
 {
-    if (!m_initialized) {
+    Assert(m_ewkContext);
+
+    int networkState;
+    if (vconf_get_int(VCONFKEY_NETWORK_STATUS,
+                      &networkState) != 0)
+    {
+        LogError("Fail to get network state");
+        return;
+    }
+    if (networkState == VCONFKEY_NETWORK_OFF) {
         return;
     }
 
-    ewk_context_message_from_injected_bundle_callback_set(
-            m_ewkContext, NULL, NULL);
-    ewk_context_did_start_download_callback_set(
-            m_ewkContext, NULL, NULL);
-    ewk_context_vibration_client_callbacks_set(
-            m_ewkContext, NULL, NULL, NULL);
+    char* proxy = vconf_get_str(VCONFKEY_NETWORK_PROXY);
+    if (proxy && strlen(proxy) && strcmp(proxy, "0.0.0.0")) {
+        LogInfo("proxy address: " << proxy);
+        ewk_context_proxy_uri_set(m_ewkContext, proxy);
+    } else {
+        LogInfo("proxy address is empty");
+        ewk_context_proxy_uri_set(m_ewkContext, NULL);
+    }
 }
 
-
 void EwkContextManager::messageFromInjectedBundleCallback(
         const char* name,
         const char* body,
@@ -275,7 +295,11 @@ void EwkContextManager::messageFromInjectedBundleCallback(
     LogDebug("did recive message: " << name);
 
     EwkContextManager* This = static_cast<EwkContextManager*>(clientInfo);
-    This->m_view->checkSyncMessageFromBundle(name, body, returnData);
+    if (returnData) {
+        This->m_view->checkSyncMessageFromBundle(name, body, returnData);
+    } else {
+        This->m_view->checkAsyncMessageFromBundle(name, body);
+    }
 }
 
 void EwkContextManager::didStartDownloadCallback(const char* downloadUrl, void* data)
@@ -303,6 +327,23 @@ void EwkContextManager::vibrationClientStopCallback(void* data)
     This->m_view->activateVibration(false, 0);
 }
 
+void EwkContextManager::vconfChangedCallback(keynode_t* keynode, void* data)
+{
+    LogDebug("enter");
+    char* key = vconf_keynode_get_name(keynode);
+
+    if (NULL == key) {
+        LogError("key is null");
+        return;
+    }
+    std::string keyString = key;
+    Assert(data);
+    EwkContextManager* This = static_cast<EwkContextManager*>(data);
+    if (keyString == VCONFKEY_NETWORK_PROXY) {
+        This->setNetworkProxy();
+    }
+}
+
 void EwkContextManager::handleLowMemory()
 {
     if (!m_ewkContext) {
index 9aaff1f..444c0f7 100644 (file)
@@ -24,7 +24,8 @@
 #ifndef EWK_CONTEXT_MANAGER_H
 #define EWK_CONTEXT_MANAGER_H
 
-#include<abstract_context_manager.h>
+#include <vconf.h>
+#include <abstract_context_manager.h>
 
 namespace WRT {
 
@@ -46,6 +47,7 @@ class EwkContextManager : public AbstractContextManager {
         void setAutoFullscreenMode();
         void setBackgroundSupport();
         void setCSPSupport();
+        void setNetworkProxy();
 
         // ewk context callback functions
         static void messageFromInjectedBundleCallback(
@@ -57,6 +59,9 @@ class EwkContextManager : public AbstractContextManager {
         static void vibrationClientStartCallback(uint64_t time, void* data);
         static void vibrationClientStopCallback(void* data);
 
+        // vconf callback functions
+        static void vconfChangedCallback(keynode_t* keynode, void* data);
+
         // members
         bool m_initialized;
         bool m_isInternalContext;
index 5d2dc0c..5112ad7 100644 (file)
@@ -46,6 +46,8 @@ typedef DPL::FastDelegate1<Evas_Object*, void> BufferUnsetCB;
 typedef DPL::FastDelegate1<Evas_Object*, void> BufferSetCB;
 typedef DPL::FastDelegate1<bool, void> ToggleFullscreenCB;
 typedef DPL::FastDelegate1<bool, void> EditorclientImeCB;
+typedef DPL::FastDelegate1<int, void> OrientationCB;
+typedef DPL::FastDelegate1<const std::string&, void> HWkeyCB;
 
 struct UserDelegates {
     ProgressStartedCB progressStarted;
@@ -65,7 +67,8 @@ struct UserDelegates {
     BufferUnsetCB bufferUnset;
     BufferSetCB bufferSet;
     ToggleFullscreenCB toggleFullscreen;
-    EditorclientImeCB editorClientIme;
+    OrientationCB setOrientation;
+    HWkeyCB hwkey;
 };
 
 typedef std::shared_ptr<UserDelegates> UserDelegatesPtr;
index 3517792..87ebb73 100644 (file)
@@ -99,7 +99,8 @@ WidgetSettingList::WidgetSettingList() :
     m_ContextMenu(ContextMenu_Enable),
     m_Encryption(Encryption_Disable),
     m_BackgroundSupport(BackgroundSupport_Disable),
-    m_ProgressbarPresence(ProgressBar_Disable)
+    m_ProgressbarPresence(ProgressBar_Disable),
+    m_HWkeyEvent(HWkeyEvent_Enable)
 {}
 
 WidgetSettingList::WidgetSettingList(WrtDB::WidgetSettings &widgetSettings)
@@ -111,6 +112,7 @@ WidgetSettingList::WidgetSettingList(WrtDB::WidgetSettings &widgetSettings)
     m_Encryption = Encryption_Disable;
     m_BackgroundSupport = BackgroundSupport_Disable;
     m_ProgressbarPresence = ProgressBar_Disable;
+    m_HWkeyEvent = HWkeyEvent_Enable;
 
     FOREACH(it, widgetSettings)
     {
@@ -203,6 +205,16 @@ WidgetSettingList::WidgetSettingList(WrtDB::WidgetSettings &widgetSettings)
                          value << "]");
                 m_ProgressbarPresence = ProgressBar_Disable;
             }
+        } else if (name == SETTING_NAME_HWKEY_EVENT) {
+            if (value == SETTING_VALUE_HWKEY_EVENT_ENABLE) {
+                m_HWkeyEvent = HWkeyEvent_Enable;
+            } else if (value == SETTING_VALUE_HWKEY_EVENT_DISABLE) {
+                m_HWkeyEvent = HWkeyEvent_Disable;
+            } else {
+                LogError("Invalid hwkey-event value!! [" <<
+                         value << "]");
+                m_HWkeyEvent = HWkeyEvent_Enable;
+            }
         } else {
             LogError("Invalid setting name!! [" << name << "]");
         }
@@ -277,6 +289,13 @@ WidgetSettingProgressBarPresence WidgetSettingList::getProgressBarPresence() con
     return m_ProgressbarPresence;
 }
 
+WidgetSettingHWkeyEventPresence WidgetSettingList::getHWkeyEvent() const
+{
+    LogDebug("m_HWkeyEvent: " << m_HWkeyEvent);
+
+    return m_HWkeyEvent;
+}
+
 bool WidgetSettingList::operator ==(const WidgetSettingList& other) const
 {
     return m_RotationLock == other.m_RotationLock &&
@@ -286,5 +305,6 @@ bool WidgetSettingList::operator ==(const WidgetSettingList& other) const
            m_Encryption == other.m_Encryption &&
            m_BackgroundSupport == other.m_BackgroundSupport &&
            m_UserAgent == other.m_UserAgent &&
-           m_ProgressbarPresence == other.m_ProgressbarPresence;
+           m_ProgressbarPresence == other.m_ProgressbarPresence &&
+           m_HWkeyEvent == other.m_HWkeyEvent;
 }
index ca90140..9d8f654 100644 (file)
@@ -110,6 +110,8 @@ static const DPL::String SETTING_NAME_USER_AGENT =
     L"user-agent";
 static const DPL::String SETTING_NAME_PROGRESSBAR_PRESENCE =
     L"progressbar-presence";
+static const DPL::String SETTING_NAME_HWKEY_EVENT =
+    L"hwkey-event";
 static const DPL::String SETTING_VALUE_ENABLE =
     L"enable";
 static const DPL::String SETTING_VALUE_DISABLE =
@@ -138,6 +140,10 @@ static const DPL::String SETTING_VALUE_PROGRESSBAR_PRESENCE_ENABLE =
     L"enable";
 static const DPL::String SETTING_VALUE_PROGRESSBAR_PRESENCE_DISABLE =
     L"disable";
+static const DPL::String SETTING_VALUE_HWKEY_EVENT_ENABLE =
+    L"enable";
+static const DPL::String SETTING_VALUE_HWKEY_EVENT_DISABLE =
+    L"disable";
 
 enum WidgetSettingScreenLock
 {
@@ -182,6 +188,12 @@ enum WidgetSettingProgressBarPresence
     ProgressBar_Disable    /* Default */
 };
 
+enum WidgetSettingHWkeyEventPresence
+{
+    HWkeyEvent_Enable,    /* Default */
+    HWkeyEvent_Disable
+};
+
 class WidgetSettingList
 {
   public:
@@ -205,7 +217,9 @@ class WidgetSettingList
 
     std::string getUserAgent() const;
 
-    WidgetSettingProgressBarPresence  getProgressBarPresence() const;
+    WidgetSettingProgressBarPresence getProgressBarPresence() const;
+
+    WidgetSettingHWkeyEventPresence getHWkeyEvent() const;
 
     bool operator ==(const WidgetSettingList& other) const;
 
@@ -217,6 +231,7 @@ class WidgetSettingList
     WidgetSettingEncryption m_Encryption;
     WidgetSettingBackgroundSupport m_BackgroundSupport;
     WidgetSettingProgressBarPresence m_ProgressbarPresence;
+    WidgetSettingHWkeyEventPresence m_HWkeyEvent;
     std::string m_UserAgent;
 };
 typedef std::shared_ptr<WidgetSettingList> WidgetSettingListPtr;
index 8dbb473..fc8f885 100644 (file)
@@ -134,7 +134,6 @@ void ApplicationLauncher::OnEventReceived(
             return;
         }
 
-        LogDebug("Success launch " << SERVICE_OPERATION_DOWNLOAD);
         service_destroy(serviceHandle);
         return;
     } else if (PKG_NAME_VIDEO_PLAYER == pkgName) {
index f657f0a..79b8e97 100644 (file)
@@ -31,8 +31,9 @@ const char * const SHUTDOWN = "ToInjectedBundle::SHUTDOWN";
 const char * const SET_CUSTOM_PROPERTIES =
     "ToInjectedBundle::SET_CUSTOM_PROPERTIES";
 const char * const DISPATCH_JS_EVENT = "ToInjectedBundle::DISPATCH_JS_EVENT";
-const char * const SET_XWINDOW_HANDLE =
-    "ToInjectedBundle::SET_XWINDOW_HANDLE";
+const char * const SET_XWINDOW_HANDLE = "ToInjectedBundle::SET_XWINDOW_HANDLE";
+const char * const SET_VIEWMODES = "ToInjectedBundle::SET_VIEWMODES";
+const char * const SET_VIEWMODES_MSGBODY_EXIT = "exit";
 } // namespace ToInectedBundle
 
 namespace ToUIProcess {
@@ -44,6 +45,7 @@ const char * const SEND_WEBPROCESS_PID = "ToUIProcess::SEND_WEBPROCESS_PID";
 
 namespace TizenScheme {
 const char * const GET_WINDOW_HANDLE = "tizen://getWindowHandle";
+const char * const CLEAR_ALL_COOKIES = "tizen://clearAllCookies";
 } // namespace ToUIProcess
 
 } //namespace BundleMessages
index fa661b7..ff81c5e 100644 (file)
@@ -107,7 +107,8 @@ struct AppSvcConversion {
  */
 struct ServiceOperation {
     const char* operation;
-    bool needUri;
+    const char* fakeUri;
+    const char* mime;
     std::list<AppSvcConversion> conversions;
 };
 
@@ -133,7 +134,8 @@ ServiceOperationMap initializeAppSvcOperations()
     // FILE, HTTP & HTTPS
     ServiceOperation viewOp;
     viewOp.operation = SERVICE_OPERATION_VIEW;
-    viewOp.needUri = true;
+    viewOp.fakeUri = NULL;
+    viewOp.mime = NULL;
     // no additional data
     ret.insert(std::make_pair(Scheme::FILE, viewOp));
     ret.insert(std::make_pair(Scheme::HTTP, viewOp));
@@ -142,7 +144,8 @@ ServiceOperationMap initializeAppSvcOperations()
     // SMS
     ServiceOperation smsOp;
     smsOp.operation = SERVICE_OPERATION_COMPOSE;
-    smsOp.needUri = false;
+    smsOp.fakeUri = NULL;
+    smsOp.mime = "*/*";
     smsOp.conversions.push_back(AppSvcConversion(SERVICE_DATA_TO, REGEX_SMS));
     smsOp.conversions.push_back(AppSvcConversion(SERVICE_DATA_TEXT, REGEX_BODY));
     ret.insert(std::make_pair(Scheme::SMS, smsOp));
@@ -150,7 +153,8 @@ ServiceOperationMap initializeAppSvcOperations()
     // SMSTO
     ServiceOperation smstoOp;
     smstoOp.operation = SERVICE_OPERATION_COMPOSE;
-    smstoOp.needUri = false;
+    smstoOp.fakeUri = "sms";
+    smstoOp.mime = "*/*";
     smstoOp.conversions.push_back(AppSvcConversion(SERVICE_DATA_TO, REGEX_SMSTO));
     smstoOp.conversions.push_back(AppSvcConversion(SERVICE_DATA_TEXT, REGEX_BODY));
     ret.insert(std::make_pair(Scheme::SMSTO, smstoOp));
@@ -159,7 +163,8 @@ ServiceOperationMap initializeAppSvcOperations()
     // MMSTO & MAILTO
     ServiceOperation sendOp;
     sendOp.operation = SERVICE_OPERATION_COMPOSE;
-    sendOp.needUri = true;
+    sendOp.fakeUri = NULL;
+    sendOp.mime = NULL;
     sendOp.conversions.push_back(AppSvcConversion(SERVICE_DATA_TO, REGEX_MMSTO));
     sendOp.conversions.push_back(AppSvcConversion(SERVICE_DATA_TO, REGEX_MAILTO));
     sendOp.conversions.push_back(AppSvcConversion(SERVICE_DATA_CC, REGEX_CC));
@@ -169,21 +174,123 @@ ServiceOperationMap initializeAppSvcOperations()
         AppSvcConversion(SERVICE_DATA_SUBJECT, REGEX_SUBJECT));
     sendOp.conversions.push_back(
         AppSvcConversion(SERVICE_DATA_TEXT, REGEX_BODY));
-    ret.insert(std::make_pair(Scheme::MMSTO, sendOp));
     ret.insert(std::make_pair(Scheme::MAILTO, sendOp));
+    sendOp.mime = "*/*";
+    ret.insert(std::make_pair(Scheme::MMSTO, sendOp));
 
     // TODO what about DATA?
 
     // TEL
     ServiceOperation telOp;
     telOp.operation = SERVICE_OPERATION_CALL;
-    telOp.needUri = true;
+    telOp.fakeUri = NULL;
     ret.insert(std::make_pair(Scheme::TEL, telOp));
 
     return ret;
 }
 
 ServiceOperationMap g_serviceOperationMap = initializeAppSvcOperations();
+
+void handleTizenServiceScheme(const char* uri)
+{
+    // <a href="tizen-service:AppID=com.samsung.myfile; key=key1, value=value1; end">Tizen Service</a>
+    std::string parameter = std::string(uri);
+    std::string appId;
+    size_t start, end = 0;
+
+    if (parameter.find("AppID=") != std::string::npos) {
+        start = parameter.find("AppID=") + strlen("AppID=");
+        end = parameter.find(";", start);
+        appId = parameter.substr(start, end-start);
+    } else {
+        LogError("parameter doesn't contain appID");
+        return;
+    }
+
+    service_h handle = NULL;
+    if (service_create(&handle) != SERVICE_ERROR_NONE) {
+        LogError("Fail to create service handle");
+        return;
+    }
+
+    if (service_set_app_id(handle, appId.c_str()) < 0) {
+        LogError("Fail to service_set_app_id");
+        service_destroy(handle);
+        return;
+    }
+
+    const char* KEY_KEY = "key=";
+    const char* KEY_VALUE = "value=";
+
+    char* buf = strdup(parameter.c_str());
+    const char* ptr = strtok(buf,";");
+    while (ptr != NULL) {
+        std::string string = ptr;
+        ptr = strtok (NULL, ";");
+
+        size_t devide = string.find(',');
+        if (devide == std::string::npos) {
+            continue;
+        }
+        size_t keyPos = string.find(KEY_KEY);
+        if (keyPos == std::string::npos) {
+            continue;
+        }
+        size_t valuePos = string.find(KEY_VALUE);
+        if (valuePos == std::string::npos) {
+            continue;
+        }
+
+        std::string key =
+            string.substr(keyPos + std::string(KEY_KEY).size(),
+                          devide - (keyPos + std::string(KEY_KEY).size()));
+        std::string value =
+            string.substr(valuePos + std::string(KEY_VALUE).size());
+
+        if (service_add_extra_data(handle, key.c_str(), value.c_str())) {
+            LogError("service_add_extra_data is failed.");
+            service_destroy(handle);
+            free(buf);
+            return;
+        }
+    }
+    free(buf);
+
+    CONTROLLER_POST_EVENT(
+        ApplicationLauncher,
+        ApplicationLauncherEvents::LaunchApplicationByAppService(
+            handle,
+            NULL,
+            NULL));
+}
+
+void handleUnknownScheme(const char* scheme, const char* uri)
+{
+    LogError("Invalid scheme: " << scheme);
+    // case of unknown scheme, send to app-control
+    // This is temporary soultion. "invalid" scheme should be handled by
+    // scheme map data
+
+    if (!strcmp(scheme, "tizen-service")) {
+        handleTizenServiceScheme(uri);
+        return;
+    } else {
+        // create service
+        service_h serviceHandle = NULL;
+        if (SERVICE_ERROR_NONE != service_create(&serviceHandle)) {
+            service_set_operation(serviceHandle, SERVICE_OPERATION_VIEW);
+            service_set_uri(serviceHandle, uri);
+            CONTROLLER_POST_EVENT(
+                ApplicationLauncher,
+                ApplicationLauncherEvents::LaunchApplicationByAppService(
+                    serviceHandle,
+                    NULL,
+                    NULL));
+        }
+    }
+}
+
+
 } // namespace
 
 namespace SchemeActionMap {
@@ -209,22 +316,7 @@ bool HandleUri(const char* uri,
     Scheme::Type type = scheme.GetType();
     if (type < Scheme::FILE || type >= Scheme::COUNT) {
         LogError("Invalid scheme: " << name);
-        // case of unknown scheme, send to app-control
-        // This is temporary soultion. "invalid" scheme should be handled by
-        // scheme map data
-
-        // create service
-        service_h serviceHandle = NULL;
-        if (SERVICE_ERROR_NONE != service_create(&serviceHandle)) {
-            service_set_operation(serviceHandle, SERVICE_OPERATION_VIEW);
-            service_set_uri(serviceHandle, uri);
-            CONTROLLER_POST_EVENT(
-                ApplicationLauncher,
-                ApplicationLauncherEvents::LaunchApplicationByAppService(
-                    serviceHandle,
-                    NULL,
-                    NULL));
-        }
+        handleUnknownScheme(name.c_str(), uri);
         return false;
     }
 
@@ -263,9 +355,21 @@ bool HandleUri(const char* uri,
         service_create(&serviceHandle);
         LogDebug("appsvc operation " << it->second.operation);
         service_set_operation(serviceHandle, it->second.operation);
-        if (it->second.needUri) {
+        if (it->second.fakeUri) {
+            size_t size = strlen(it->second.fakeUri) + strlen(uri) + 1;
+            char *newUri = new char[size];
+            strcpy(newUri, it->second.fakeUri);
+            const char* uriArgs = strstr(uri, ":");
+            strcpy(newUri + strlen(it->second.fakeUri), uriArgs);
+            service_set_uri(serviceHandle, newUri);
+            delete [] newUri;
+        }
+        else {
             service_set_uri(serviceHandle, uri);
         }
+        if (it->second.mime) {
+            service_set_mime(serviceHandle, it->second.mime);
+        }
 
         // this is safe as there are no other threads
         CURL* curl = curl_easy_init();
index 4571f4c..aabc65a 100644 (file)
@@ -62,6 +62,7 @@ const UriAction g_tizenActionMap[Scheme::COUNT][SchemeActionMap::COUNT] = {
     //  TOP_LEVEL           FRAME_LEVEL         NEW_WINDOW
     { URI_ACTION_WRT, URI_ACTION_WRT, URI_ACTION_WRT },           // FILE
     { URI_ACTION_APPSVC, URI_ACTION_APPSVC, URI_ACTION_APPSVC },  // SMS
+    { URI_ACTION_APPSVC, URI_ACTION_APPSVC, URI_ACTION_APPSVC },  // SMSTO
     { URI_ACTION_APPSVC, URI_ACTION_APPSVC, URI_ACTION_APPSVC },  // MMSTO
     { URI_ACTION_APPSVC, URI_ACTION_APPSVC, URI_ACTION_APPSVC },  // MAILTO
     { URI_ACTION_WRT, URI_ACTION_WRT, URI_ACTION_WRT },        // DATA
@@ -80,6 +81,7 @@ const UriAction g_wacActionMap[Scheme::COUNT][SchemeActionMap::COUNT] = {
     //  TOP_LEVEL           FRAME_LEVEL         NEW_WINDOW
     { URI_ACTION_WRT, URI_ACTION_WRT, URI_ACTION_APPSVC },        // FILE
     { URI_ACTION_APPSVC, URI_ACTION_APPSVC, URI_ACTION_APPSVC },  // SMS
+    { URI_ACTION_APPSVC, URI_ACTION_APPSVC, URI_ACTION_APPSVC },  // SMSTO
     { URI_ACTION_APPSVC, URI_ACTION_APPSVC, URI_ACTION_APPSVC },  // MMSTO
     { URI_ACTION_APPSVC, URI_ACTION_APPSVC, URI_ACTION_APPSVC },  // MAILTO
     { URI_ACTION_WRT, URI_ACTION_WRT, URI_ACTION_WRT },        // DATA
index 695140a..42b5128 100644 (file)
@@ -54,6 +54,9 @@ class IViewModule
             const char* name,
             const char* body,
             char** returnData) = 0;
+    virtual void checkAsyncMessageFromBundle(
+            const char* name,
+            const char* body) = 0;
     virtual void downloadData(const char* url) = 0;
     virtual void activateVibration(bool on, uint64_t time) = 0;
 };
index 5e445a8..ce05e33 100644 (file)
@@ -37,6 +37,7 @@ SET(INJECTED_BUNDLE_SOURCES
     ${PROJECT_SOURCE_DIR}/src/view/webkit/injected-bundle/wrt-injected-bundle.cpp
     ${PROJECT_SOURCE_DIR}/src/view/webkit/injected-bundle/injected_bundle_uri_handling.cpp
     ${PROJECT_SOURCE_DIR}/src/view/webkit/injected-bundle/injected_bundle_decryption_support.cpp
+    ${PROJECT_SOURCE_DIR}/src/view/webkit/injected-bundle/injected_bundle_viewmodes_support.cpp
     ${PROJECT_SOURCE_DIR}/src/view/webkit/injected-bundle/page_global_context_container.cpp
     ${PROJECT_SOURCE_DIR}/src/view/common/scheme.cpp
 )
index d0ef7fb..09680b2 100644 (file)
@@ -59,6 +59,7 @@ class DecryptionSupportImplementation
     bool m_isEncrypted;
     std::set<WrtDB::EncryptedFileInfo>::iterator m_targetIt;
     bool m_isPreload;
+    WrtDB::TizenPkgId m_pkgId;
 
 
     std::string getFilePath(const std::string& url)
@@ -108,7 +109,7 @@ class DecryptionSupportImplementation
 
             std::unique_ptr<unsigned char[]> DecryptedString(new unsigned
                     char[fileSize]);
-            std::string pkgid(DPL::ToUTF8String(m_appId));
+            std::string pkgid(DPL::ToUTF8String(m_pkgId));
 
             int writeCount = 0;
             do {
@@ -177,6 +178,7 @@ class DecryptionSupportImplementation
           m_isEncrypted = true;
           LogDebug("encrypted application");
         }
+        m_pkgId = dao.getTzPkgId();
 
         std::string installedPath =
             DPL::ToUTF8String(*dao.getWidgetInstalledPath());
index 3fda48f..b2ea952 100644 (file)
@@ -84,7 +84,7 @@ bool wildcardCompare(std::string wildcardString, std::string target)
     pcrecpp::RE("\\|").GlobalReplace("\\\\|", &re);
 
     // replace wildcard character to regex type
-    pcrecpp::RE("\\\*").GlobalReplace(".*", &re);
+    pcrecpp::RE("\\*").GlobalReplace(".*", &re);
 
     return pcrecpp::RE(re).FullMatch(target);
 }
diff --git a/src/view/webkit/injected-bundle/injected_bundle_viewmodes_support.cpp b/src/view/webkit/injected-bundle/injected_bundle_viewmodes_support.cpp
new file mode 100644 (file)
index 0000000..0d94b13
--- /dev/null
@@ -0,0 +1,231 @@
+/*
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+/*
+ * @file    injected_bundle_viewmodes_support.cpp
+ * @author  Jihoon Chung (jihoon.chung@samsung.com)
+ * @version 1.0
+ */
+
+#include "injected_bundle_viewmodes_support.h"
+
+#include <memory>
+#include <map>
+#include <set>
+#include <string>
+
+#include <dpl/log/log.h>
+#include <dpl/assert.h>
+#include <dpl/string.h>
+#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
+
+#include <WKString.h>
+#include <WKBundlePage.h>
+#include <WKBundlePagePrivate.h>
+
+namespace InjectedBundle {
+namespace {
+const std::string VIEWMODE_TYPE_MAXIMIZED = "maximized";
+const std::string VIEWMODE_TYPE_FULLSCREEN = "fullscreen";
+const std::string VIEWMODE_TYPE_WINDOWED = "windowed";
+
+typedef std::set<std::string> SupportViewmodesSet;
+SupportViewmodesSet g_supportViewmodes = {VIEWMODE_TYPE_MAXIMIZED,
+                                          VIEWMODE_TYPE_FULLSCREEN,
+                                          VIEWMODE_TYPE_WINDOWED};
+}
+
+//Implementation class
+class ViewmodesSupportImplementation
+{
+  private:
+    typedef std::map<WKBundlePageRef, std::string> ViewmodesMap;
+    typedef ViewmodesMap::iterator ViewmodesIt;
+
+    bool m_initialized;
+
+    WrtDB::TizenAppId m_appId;
+    WrtDB::WindowModeList m_modeList;
+    ViewmodesMap m_initialViewmodeMap;
+    ViewmodesMap m_currentViewmodeMap;
+
+    bool isExisted(WKBundlePageRef page)
+    {
+        ViewmodesIt viewmodeIt = m_initialViewmodeMap.find(page);
+        if (viewmodeIt == m_initialViewmodeMap.end()) {
+            return false;
+        }
+        return true;
+    }
+
+    std::string getChangedViewmode(void)
+    {
+        if (!m_currentViewmodeMap.empty()) {
+            ViewmodesIt curIt = m_currentViewmodeMap.begin();
+            ViewmodesIt initIt = m_initialViewmodeMap.begin();
+            if (curIt->second != initIt->second) {
+              return curIt->second;
+            }
+        }
+        return std::string();
+    }
+
+    bool isSupportViewmode(const std::string& mode)
+    {
+        if (g_supportViewmodes.find(mode) == g_supportViewmodes.end()) {
+            return false;
+        }
+        return true;
+    }
+
+  public:
+    ViewmodesSupportImplementation(WrtDB::TizenAppId appId) :
+        m_initialized(false),
+        m_appId(appId)
+    {
+        WrtDB::WidgetDAOReadOnly dao(m_appId);
+        m_modeList = dao.getWindowModes();
+
+        m_initialized = true;
+    }
+
+    void initialize(WKBundlePageRef page)
+    {
+        LogInfo("initialize");
+        if (!m_initialized) {
+            Assert(false);
+        }
+
+        if (isExisted(page)) {
+            LogError("This page is already initialized");
+            return;
+        }
+
+        // set initial viewmode from manifest
+        std::string initViewmode = VIEWMODE_TYPE_MAXIMIZED;
+        FOREACH(it, m_modeList) {
+            std::string mode = DPL::ToUTF8String(*it);
+            if (g_supportViewmodes.find(mode) != g_supportViewmodes.end()) {
+                initViewmode = mode;
+            }
+        }
+        m_initialViewmodeMap[page] = initViewmode;
+
+        // In case of current viewmode of chrome is changed,
+        // set to changed viewmode
+        std::string currentViewmode = getChangedViewmode();
+        if (currentViewmode.empty()) {
+            currentViewmode = initViewmode;
+        }
+        m_currentViewmodeMap[page] = currentViewmode;
+
+        WKBundlePageSetViewMode(page,
+                                WKStringCreateWithUTF8CString(
+                                currentViewmode.c_str()));
+    }
+
+    void deinitialize(WKBundlePageRef page)
+    {
+        LogInfo("deinitialize");
+        if (!m_initialized) {
+            Assert(false);
+        }
+        m_initialViewmodeMap.erase(page);
+        m_currentViewmodeMap.erase(page);
+    }
+
+    void setViewmodes(WKBundlePageRef page, const std::string& mode)
+    {
+        if (!m_initialized) {
+            Assert(false);
+        }
+
+        m_currentViewmodeMap[page] = mode;
+        WKBundlePageSetViewMode(page,
+                                WKStringCreateWithUTF8CString(
+                                    mode.c_str()));
+    }
+
+    void enterViewmodesAllPages(const std::string& mode)
+    {
+        LogInfo("setViewmodesAllPages");
+        if (!m_initialized) {
+            Assert(false);
+        }
+        if (!isSupportViewmode(mode)) {
+            LogError("Wrong viewmode : " << mode);
+            return;
+        }
+
+        FOREACH(it, m_currentViewmodeMap) {
+            setViewmodes(it->first, mode);
+        }
+    }
+
+    void exitViewmodes(WKBundlePageRef page)
+    {
+        if (!m_initialized) {
+            Assert(false);
+        }
+
+        std::string mode = m_initialViewmodeMap[page];
+        m_currentViewmodeMap[page] = mode;
+        WKBundlePageSetViewMode(page,
+                                WKStringCreateWithUTF8CString(
+                                    mode.c_str()));
+    }
+
+    void exitViewmodesAllPages(void)
+    {
+        LogInfo("exitViewmodesAllPages");
+        if (!m_initialized) {
+            Assert(false);
+        }
+
+        FOREACH(it, m_currentViewmodeMap) {
+            exitViewmodes(it->first);
+        }
+    }
+};
+
+ViewmodesSupport::ViewmodesSupport(WrtDB::TizenAppId appId) :
+    m_impl(new ViewmodesSupportImplementation(appId))
+{
+}
+
+ViewmodesSupport::~ViewmodesSupport()
+{
+}
+
+void ViewmodesSupport::initialize(WKBundlePageRef page)
+{
+    m_impl->initialize(page);
+}
+
+void ViewmodesSupport::deinitialize(WKBundlePageRef page)
+{
+    m_impl->deinitialize(page);
+}
+
+void ViewmodesSupport::enterViewmodesAllPages(const std::string& mode)
+{
+    m_impl->enterViewmodesAllPages(mode);
+}
+
+void ViewmodesSupport::exitViewmodesAllPages(void)
+{
+    m_impl->exitViewmodesAllPages();
+}
+}  // namespace InjectedBundle
diff --git a/src/view/webkit/injected-bundle/injected_bundle_viewmodes_support.h b/src/view/webkit/injected-bundle/injected_bundle_viewmodes_support.h
new file mode 100644 (file)
index 0000000..da1521b
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+/**
+ * @file    injected_bundle_viewmodes_support.h
+ * @author  Jihoon Chung (jihoon.chung@samsung.com)
+ * @version 1.0
+ */
+#ifndef INJECTED_BUNDLE_VIEWMODES_SUPPORT_H_
+#define INJECTED_BUNDLE_VIEWMODES_SUPPORT_H_
+
+#include <memory>
+#include <dpl/wrt-dao-ro/common_dao_types.h>
+
+#include <WKBundlePage.h>
+
+namespace InjectedBundle {
+class ViewmodesSupportImplementation;
+
+class ViewmodesSupport
+{
+  public:
+    ViewmodesSupport(WrtDB::TizenAppId appId);
+    virtual ~ViewmodesSupport();
+    void initialize(WKBundlePageRef page);
+    void deinitialize(WKBundlePageRef page);
+    void enterViewmodesAllPages(const std::string& mode);
+    void exitViewmodesAllPages(void);
+  private:
+    std::unique_ptr<ViewmodesSupportImplementation> m_impl;
+};
+} // namespace InjectedBundle
+
+#endif // INJECTED_BUNDLE_VIEWMODES_SUPPORT_H_
\ No newline at end of file
index 1928ccd..2726d5a 100644 (file)
@@ -72,6 +72,7 @@
 // URI localization on WebProcess side
 #include "injected_bundle_uri_handling.h"
 #include "injected_bundle_decryption_support.h"
+#include "injected_bundle_viewmodes_support.h"
 
 namespace {
 const char * const SCHEME_HTTP = "http";
@@ -82,8 +83,6 @@ const char * const SCHEME_BOX_SLASH = "box://";
 const char * const BLANK_PAGE_URL = "about:blank";
 const char * const HTML_MIME = "text/html";
 const char * const PHP_MIME = "application/x-php";
-const char * const VIEWMODE_TYPE_FULLSCREEN = "fullscreen";
-const char * const VIEWMODE_TYPE_MAXIMIZED = "maximized";
 const std::size_t FILE_BUF_MAX_SIZE = 1024; // bytes
 const std::size_t PLAIN_CHUNK_SIZE = 1008; // bytes
 const unsigned int UID_ROOT = 0;
@@ -164,6 +163,7 @@ void Bundle::didCreatePage(WKBundlePageRef page)
     m_pagesList.push_back(page);
     m_pageGlobalContext.insertContextForPage(page, context);
     LogDebug("created Page : " << page << " created JSContext : " << context);
+    m_viewmodesSupport->initialize(page);
 
     WKBundlePageResourceLoadClient resourceLoadClient = {
         kWKBundlePageResourceLoadClientCurrentVersion,  /* version */
@@ -235,6 +235,7 @@ void Bundle::willDestroyPage(WKBundlePageRef page)
     m_pagesList.remove(page);
     m_pageGlobalContext.removeContextForPage(page);
     m_pageContext[page].erase(context);
+    m_viewmodesSupport->deinitialize(page);
 
     PluginModule::unloadFrame(context);
     PluginModule::stop(context);
@@ -485,6 +486,8 @@ void Bundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody)
             bypassCORSforWARPAccessList(dao);
 #endif
             m_decryptionSupport->initialize(m_widgetTizenId);
+            m_viewmodesSupport.reset(
+                new InjectedBundle::ViewmodesSupport(m_widgetTizenId));
             m_initialized = true;
         } else {
             LogDebug("already initalized");
@@ -497,6 +500,18 @@ void Bundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody)
                 toString(static_cast<WKStringRef>(messageBody));
             LogDebug("set x window handle [" << msgString << "]");
             IPCMessageSupport::setXwindowHandle(atoi(msgString.c_str()));
+    } else if (WKStringIsEqualToUTF8CString(
+                   messageName,
+                   Message::ToInjectedBundle::SET_VIEWMODES))
+    {
+        std::string msgBody =
+            toString(static_cast<WKStringRef>(messageBody));
+        LogDebug("set viewmode to [" << msgBody << "]");
+        if (msgBody == Message::ToInjectedBundle::SET_VIEWMODES_MSGBODY_EXIT) {
+            m_viewmodesSupport->exitViewmodesAllPages();
+        } else {
+            m_viewmodesSupport->enterViewmodesAllPages(msgBody);
+        }
     }
 }
 
@@ -523,21 +538,6 @@ void Bundle::didStartProvisionalLoadForFrameCallback(
     LogDebug("didStartProvisionalLoadForFrameCallback called");
     Bundle* This = static_cast<Bundle*>(const_cast<void*>(clientInfo));
 
-    // set viewmode
-    WrtDB::WidgetDAOReadOnly dao(This->m_widgetTizenId);
-    WrtDB::WindowModeList modeList = dao.getWindowModes();
-    FOREACH(it, modeList) {
-        std::string viewMode = DPL::ToUTF8String(*it);
-        if (viewMode == VIEWMODE_TYPE_FULLSCREEN
-            || viewMode == VIEWMODE_TYPE_MAXIMIZED)
-        {
-            WKBundlePageSetViewMode(
-                page,
-                WKStringCreateWithUTF8CString(viewMode.c_str()));
-            break;
-        }
-    }
-
     if (This->m_pageGlobalContext.find(page) == This->m_pageGlobalContext.end()) {
         return;
     }
@@ -785,7 +785,7 @@ WKURLRequestRef Bundle::willSendRequestForFrame(WKURLRequestRef request)
     {
         if (logEnable){ LogDebug("external scheme return original WKURLRequestRef"); }
         WKRetain(request);
+
         return request;
     }
     else
@@ -803,11 +803,11 @@ WKURLRequestRef Bundle::willSendRequestForFrame(WKURLRequestRef request)
                 WKURLCreateWithUTF8CString(decryptString.c_str());
             WKURLRequestRef req = WKURLRequestCreateWithWKURL(destUrl);
             WKRelease(destUrl);
-            
+
             return req;
         }
     }
-    
+
     WKURLRef newUrl = WKURLCreateWithUTF8CString(localizedUrl.c_str());
     WKURLRequestRef req = WKURLRequestCreateWithWKURL(newUrl);
     WKRelease(newUrl);
@@ -855,12 +855,10 @@ WKBundlePagePolicyAction Bundle::decidePolicyForAction(
 
         // Send information about blocked URI to UIProcess
         WKStringRef urlStr = WKStringCreateWithUTF8CString(blockedUrl.c_str());
-        WKTypeRef retVal = NULL;
         WKStringRef blockMessage =
             WKStringCreateWithUTF8CString(Message::ToUIProcess::BLOCKED_URL);
-        WKBundlePostSynchronousMessage(m_bundle, blockMessage, urlStr, &retVal);
+        WKBundlePostMessage(m_bundle, blockMessage, urlStr);
         WKRelease(urlStr);
-        WKRelease(retVal);
         WKRelease(blockMessage);
         return WKBundlePagePolicyActionPassThrough;
     }
@@ -972,13 +970,11 @@ void Bundle::sendWebProcessPid()
     std::stringstream strPid;
     strPid << getpid();
     WKStringRef pidStr = WKStringCreateWithUTF8CString(strPid.str().c_str());
-    WKTypeRef retVal = NULL;
     WKStringRef message =
         WKStringCreateWithUTF8CString(
             Message::ToUIProcess::SEND_WEBPROCESS_PID);
-    WKBundlePostSynchronousMessage(m_bundle, message, pidStr, &retVal);
+    WKBundlePostMessage(m_bundle, message, pidStr);
     WKRelease(pidStr);
-    WKRelease(retVal);
     WKRelease(message);
 }
 #endif
index 223815c..41e4524 100644 (file)
@@ -40,6 +40,7 @@ WK_EXPORT void WKBundleInitialize(WKBundleRef bundle, WKTypeRef);
 
 namespace InjectedBundle {
 class DecryptionSupport;
+class ViewmodesSupport;
 }
 
 class Bundle
@@ -86,6 +87,7 @@ class Bundle
     bool m_initialized;
 
     std::unique_ptr<InjectedBundle::DecryptionSupport> m_decryptionSupport;
+    std::unique_ptr<InjectedBundle::ViewmodesSupport> m_viewmodesSupport;
 
     // WKBundlePageResourceLoadClient callback
     static WKURLRequestRef willSendRequestForFrameCallback(
@@ -185,7 +187,6 @@ class Bundle
 #ifdef MULTIPROCESS_SERVICE_SUPPORT_INLINE
     void sendWebProcessPid();
 #endif
-
 #ifdef CORS_WHITELISTING_ENABLED
     void bypassCORSforWARPAccessList(WrtDB::WidgetDAOReadOnly &dao);
 #endif
index 1215cd8..239025f 100644 (file)
@@ -100,6 +100,7 @@ const char* const DEFAULT_CSP_POLICY =
 #endif
 // SCHEME
 const char * const SCHEME_BOX_SLASH = "box://";
+const double ORIENTATION_THRESHOLD = 0.5;
 } // anonymous namespace
 
 std::map<const std::string,
@@ -187,6 +188,9 @@ ViewLogic::ViewLogic() :
     m_isBackgroundReload(false),
     m_isBackgroundSupport(false),
     m_rotateAngle(0),
+    m_deferredRotateAngle(
+        ViewModule::OrientationSupport::DEFERRED_ORIENTATION_EMPTY),
+    m_orientationThresholdTimer(NULL),
     m_appsSupport(new ViewModule::AppsSupport()),
     m_vibrationSupport(new ViewModule::VibrationSupport())
 {
@@ -476,13 +480,36 @@ void ViewLogic::setUserCallbacks(const WRT::UserDelegatesPtr& cbs)
 
 void ViewLogic::checkSyncMessageFromBundle(
         const char* name,
-        const char* body,
+        const char* /*body*/,
         char** returnData)
 {
     LogDebug("didReceiveSynchronousMessage called");
     Assert(name);
 
     LogDebug("received : " << name);
+    if (!strcmp(name, Message::TizenScheme::GET_WINDOW_HANDLE)) {
+        if (m_window) {
+            Ecore_X_Window handle = elm_win_xwindow_get(m_window);
+            if (handle != 0) {
+                std::stringstream ss;
+                ss << handle;
+                std::string ret  = ss.str();
+                if (returnData) {
+                    *returnData = strdup(ret.c_str());
+                }
+            } else {
+                LogInfo("X window isn't exist");
+            }
+        }
+    }
+}
+
+void ViewLogic::checkAsyncMessageFromBundle(const char* name, const char* body)
+{
+    LogDebug("checkAsyncMessageFromBundle called");
+    Assert(name);
+
+    LogDebug("received : " << name);
 
     if (!strcmp(name, Message::ToUIProcess::BLOCKED_URL)) {
         // Currently WebProcess informs obly about blocked
@@ -501,20 +528,14 @@ void ViewLogic::checkSyncMessageFromBundle(
             pid);
     }
 #endif
-    else if (!strcmp(name, Message::TizenScheme::GET_WINDOW_HANDLE)) {
-        if (m_window) {
-            Ecore_X_Window handle = elm_win_xwindow_get(m_window);
-            if (handle != 0) {
-                std::stringstream ss;
-                ss << handle;
-                std::string ret  = ss.str();
-                if (returnData) {
-                    *returnData = strdup(ret.c_str());
-                }
-            } else {
-                LogInfo("X window isn't exist");
-            }
+    else if (!strcmp(name, Message::TizenScheme::CLEAR_ALL_COOKIES)) {
+        Ewk_Cookie_Manager* cookieManager =
+            ewk_context_cookie_manager_get(m_ewkContext);
+        if (!cookieManager) {
+            LogError("Fail to get cookieManager");
+            return;
         }
+        ewk_cookie_manager_cookies_clear(cookieManager);
     }
 }
 
@@ -610,7 +631,6 @@ void ViewLogic::ewkClientInit(Evas_Object *wkView)
         wkView,
         exceededLocalFileSystemQuotaCallback,
         this);
-    // HW Key event callback
     evas_object_event_callback_add(
         wkView,
         EVAS_CALLBACK_KEY_UP,
@@ -634,11 +654,13 @@ void ViewLogic::ewkClientDeinit(Evas_Object *wkView)
     ewk_view_exceeded_database_quota_callback_set(wkView, NULL, NULL);
     ewk_view_exceeded_indexed_database_quota_callback_set(wkView, NULL, NULL);
     ewk_view_exceeded_local_file_system_quota_callback_set(wkView, NULL, NULL);
-    // HW Key event callback
-    evas_object_event_callback_del(
-        wkView,
-        EVAS_CALLBACK_KEY_UP,
-        keyupCallback);
+    evas_object_event_callback_del(wkView,
+                                   EVAS_CALLBACK_KEY_UP,
+                                   keyupCallback);
+    if (m_orientationThresholdTimer) {
+        ecore_timer_del(m_orientationThresholdTimer);
+        m_orientationThresholdTimer = NULL;
+    }
 }
 
 bool ViewLogic::createEwkView(Evas* canvas)
@@ -1385,22 +1407,41 @@ Eina_Bool ViewLogic::orientationLockCallback(
     LogDebug("orientationLockCallback called");
     Assert(data);
     ViewLogic* This = static_cast<ViewLogic*>(data);
+
+    if (This->m_orientationThresholdTimer) {
+        LogDebug("previous orientationLock isn't finished");
+        // Previous API call isn't finished. Keep angle and run it.
+        if (needLock == EINA_TRUE) {
+            // Screen.lockOrientation
+            This->m_deferredRotateAngle = orientation;
+        } else {
+            // Screen.unlockOrientation
+            This->m_deferredRotateAngle =
+                ViewModule::OrientationSupport::DEFERRED_ORIENTATION_UNLOCK;
+        }
+        return EINA_TRUE;
+    }
+
     This->m_rotateAngle = orientation;
 
     if (needLock == EINA_TRUE) {
         // Screen.lockOrientation
-        ViewModule::OrientationSupport::setOrientation(
-            This->m_window,
-            obj,
-            orientation);
+        int w3cAngle =
+            ViewModule::OrientationSupport::getW3COrientationAngle(orientation);
+        int winAngle =
+            ViewModule::OrientationSupport::getWinOrientationAngle(orientation);
+        ViewModule::OrientationSupport::setEwkOrientation(obj, w3cAngle);
+        if (!This->m_cbs->setOrientation.empty()) {
+            This->m_cbs->setOrientation(winAngle);
+        }
     } else {
         // Screen.unlockOrientation
         if (This->m_model->SettingList.Get().getRotationValue() ==
             Screen_AutoRotation)
         {
-            elm_win_wm_rotation_preferred_rotation_set(
-                This->m_window,
-                OrientationAngle::Window::UNLOCK);
+            if (!This->m_cbs->setOrientation.empty()) {
+                This->m_cbs->setOrientation(OrientationAngle::Window::UNLOCK);
+            }
             This->m_rotateAngle = 0;
         }
     }
@@ -1416,6 +1457,9 @@ void ViewLogic::enterFullscreenCallback(
     LogInfo("enterFullscreenCallback called");
     Assert(data);
     ViewLogic* This = static_cast<ViewLogic*>(data);
+    ViewLogicMessageSupport::setViewmodes(
+        This->m_ewkContext,
+        "fullscreen");
     if (!This->m_cbs->toggleFullscreen.empty()) {
         This->m_cbs->toggleFullscreen(true);
     }
@@ -1428,6 +1472,9 @@ void ViewLogic::exitFullscreenCallback(
     LogInfo("exitFullscreenCallback called");
     Assert(data);
     ViewLogic* This = static_cast<ViewLogic*>(data);
+    ViewLogicMessageSupport::setViewmodes(
+        This->m_ewkContext,
+        Message::ToInjectedBundle::SET_VIEWMODES_MSGBODY_EXIT);
     if (!This->m_cbs->toggleFullscreen.empty()) {
         This->m_cbs->toggleFullscreen(false);
     }
@@ -1464,10 +1511,6 @@ void ViewLogic::imeOpenedCallback(
     This->fireJavascriptEvent(
         static_cast<int>(SoftKeyboardChangeCustomEvent),
         &args);
-
-    if (!This->m_cbs->editorClientIme.empty()) {
-        This->m_cbs->editorClientIme(true);
-    }
 }
 
 void ViewLogic::imeClosedCallback(
@@ -1485,9 +1528,6 @@ void ViewLogic::imeClosedCallback(
     This->fireJavascriptEvent(
         static_cast<int>(SoftKeyboardChangeCustomEvent),
         &args);
-    if (!This->m_cbs->editorClientIme.empty()) {
-        This->m_cbs->editorClientIme(false);
-    }
 }
 
 void ViewLogic::usermediaPermissionRequestCallback(
@@ -1925,7 +1965,6 @@ void ViewLogic::keyupCallback(void* data,
                               Evas_Object* obj,
                               void* eventInfo)
 {
-    LogInfo("keyupCallback");
     Assert(data);
     ViewLogic* This = static_cast<ViewLogic*>(data);
 
@@ -1935,9 +1974,19 @@ void ViewLogic::keyupCallback(void* data,
 
     LogInfo("Key = [" << keyEvent->keyname << "]");
     if (!strcmp(keyEvent->keyname, KEY_BACK)) {
-        DispatchEventSupport::dispatchHwKeyEvent(obj, "back");
+        if (This->m_model->SettingList.Get().getHWkeyEvent() ==
+            HWkeyEvent_Enable)
+        {
+            DispatchEventSupport::dispatchHwKeyEvent(obj, "back");
+        }
+        This->m_cbs->hwkey("back");
     } else if (!strcmp(keyEvent->keyname, KEY_MENU)) {
-        DispatchEventSupport::dispatchHwKeyEvent(obj, "menu");
+        if (This->m_model->SettingList.Get().getHWkeyEvent() ==
+            HWkeyEvent_Enable)
+        {
+            DispatchEventSupport::dispatchHwKeyEvent(obj, "menu");
+        }
+        This->m_cbs->hwkey("menu");
     }
     return;
 
@@ -2071,7 +2120,7 @@ void ViewLogic::viewFrameRenderedCallback(
     Evas_Object* /*obj*/,
     void* /*eventInfo*/)
 {
-    LogInfo("enter");
+    //LogInfo("enter");
 }
 
 void ViewLogic::mediacontrolRotateHorizontal(void* data,
@@ -2082,10 +2131,13 @@ void ViewLogic::mediacontrolRotateHorizontal(void* data,
     Assert(data);
     Assert(obj);
     ViewLogic* This = static_cast<ViewLogic*>(data);
-    ViewModule::OrientationSupport::setOrientation(
-        This->m_window,
+    ViewModule::OrientationSupport::setEwkOrientation(
         obj,
-        ViewModule::OrientationSupport::Mode::LANDSCAPE_PRIMARY);
+        OrientationAngle::W3C::Landscape::PRIMARY);
+    if (!This->m_cbs->setOrientation.empty()) {
+        This->m_cbs->setOrientation(
+            OrientationAngle::Window::Landscape::PRIMARY);
+    }
 }
 
 void ViewLogic::mediacontrolRotateVertical(void* data,
@@ -2096,10 +2148,13 @@ void ViewLogic::mediacontrolRotateVertical(void* data,
     Assert(data);
     Assert(obj);
     ViewLogic* This = static_cast<ViewLogic*>(data);
-    ViewModule::OrientationSupport::setOrientation(
-        This->m_window,
+    ViewModule::OrientationSupport::setEwkOrientation(
         obj,
-        ViewModule::OrientationSupport::Mode::PORTRAIT_PRIMARY);
+        OrientationAngle::W3C::Portrait::PRIMARY);
+    if (!This->m_cbs->setOrientation.empty()) {
+        This->m_cbs->setOrientation(
+            OrientationAngle::Window::Portrait::PRIMARY);
+    }
 }
 
 void ViewLogic::mediacontrolRotateExit(void* data,
@@ -2110,32 +2165,98 @@ void ViewLogic::mediacontrolRotateExit(void* data,
     Assert(data);
     Assert(obj);
     ViewLogic* This = static_cast<ViewLogic*>(data);
+
+    int w3cAngle = 0;
+    int winAngle = 0;
     if (This->m_rotateAngle == 0) {
         // application hasn't call orientation lock
         WidgetSettingScreenLock screenLock =
             This->m_model->SettingList.Get().getRotationValue();
         if (screenLock == Screen_Portrait) {
-            ViewModule::OrientationSupport::setOrientation(
-                This->m_window,
-                obj,
-                ViewModule::OrientationSupport::Mode::PORTRAIT_PRIMARY);
+            w3cAngle = OrientationAngle::W3C::Portrait::PRIMARY;
+            winAngle = OrientationAngle::Window::Portrait::PRIMARY;
         } else if (screenLock == Screen_Landscape) {
-            ViewModule::OrientationSupport::setOrientation(
-                This->m_window,
-                obj,
-                ViewModule::OrientationSupport::Mode::LANDSCAPE_PRIMARY);
+            w3cAngle = OrientationAngle::W3C::Landscape::PRIMARY;
+            winAngle = OrientationAngle::Window::Landscape::PRIMARY;
         } else if (screenLock == Screen_AutoRotation) {
-            elm_win_wm_rotation_preferred_rotation_set(
-                This->m_window,
-                OrientationAngle::Window::UNLOCK);
+            if (!This->m_cbs->setOrientation.empty()) {
+                This->m_cbs->setOrientation(OrientationAngle::Window::UNLOCK);
+            }
+            return;
         }
     } else {
         // Restore previous orientation
-        ViewModule::OrientationSupport::setOrientation(
-            This->m_window,
-            obj,
-            This->m_rotateAngle);
+        w3cAngle =
+            ViewModule::OrientationSupport::getW3COrientationAngle(
+                This->m_rotateAngle);
+        winAngle =
+            ViewModule::OrientationSupport::getWinOrientationAngle(
+                This->m_rotateAngle);
+    }
+
+    ViewModule::OrientationSupport::setEwkOrientation(obj, w3cAngle);
+    if (!This->m_cbs->setOrientation.empty()) {
+        This->m_cbs->setOrientation(winAngle);
     }
+
+}
+
+Eina_Bool ViewLogic::orientationThresholdTimerCallback(void* data)
+{
+    LogInfo("orientationThresholdTimerCallback");
+    ViewLogic* This = static_cast<ViewLogic*>(data);
+
+    if (This->m_deferredRotateAngle ==
+        ViewModule::OrientationSupport::DEFERRED_ORIENTATION_EMPTY)
+    {
+        // There is no defered orientation API call
+        This->m_orientationThresholdTimer = NULL;
+        return ECORE_CALLBACK_CANCEL;
+    }
+
+    if (This->m_deferredRotateAngle != This->m_rotateAngle) {
+        This->m_rotateAngle = This->m_deferredRotateAngle;
+        int w3cAngle = 0;
+        int winAngle = 0;
+        if (This->m_rotateAngle == 0) {
+            WidgetSettingScreenLock screenLock =
+                This->m_model->SettingList.Get().getRotationValue();
+            if (screenLock == Screen_Portrait) {
+                w3cAngle = OrientationAngle::W3C::Portrait::PRIMARY;
+                winAngle = OrientationAngle::Window::Portrait::PRIMARY;
+            } else if (screenLock == Screen_Landscape) {
+                w3cAngle = OrientationAngle::W3C::Landscape::PRIMARY;
+                winAngle = OrientationAngle::Window::Landscape::PRIMARY;
+            } else if (screenLock == Screen_AutoRotation) {
+                if (!This->m_cbs->setOrientation.empty()) {
+                    This->m_cbs->setOrientation(OrientationAngle::Window::UNLOCK);
+                }
+                This->m_orientationThresholdTimer = NULL;
+                return ECORE_CALLBACK_CANCEL;
+            }
+        } else {
+            // Restore previous orientation
+            w3cAngle =
+                ViewModule::OrientationSupport::getW3COrientationAngle(
+                    This->m_rotateAngle);
+            winAngle =
+                ViewModule::OrientationSupport::getWinOrientationAngle(
+                    This->m_rotateAngle);
+        }
+
+        ViewModule::OrientationSupport::setEwkOrientation(
+            This->m_currentEwkView,
+            w3cAngle);
+        if (!This->m_cbs->setOrientation.empty()) {
+            This->m_cbs->setOrientation(winAngle);
+        }
+        This->m_deferredRotateAngle =
+            ViewModule::OrientationSupport::DEFERRED_ORIENTATION_EMPTY;
+        return ECORE_CALLBACK_RENEW;
+    }
+
+    This->m_orientationThresholdTimer = NULL;
+    return ECORE_CALLBACK_CANCEL;
 }
 
 void ViewLogic::requestUrlBlocked(const std::string& blockedUrl)
index 6da1ef4..bc9bd80 100644 (file)
@@ -68,6 +68,9 @@ class ViewLogic : public ViewModule::IViewModule
             const char* name,
             const char* body,
             char** returnData);
+    void checkAsyncMessageFromBundle(
+            const char* name,
+            const char* body);
     void downloadData(const char* url);
     void activateVibration(bool on, uint64_t time);
 
@@ -286,6 +289,9 @@ class ViewLogic : public ViewModule::IViewModule
     // idler callback
     static Eina_Bool windowCloseIdlerCallback(void *data);
 
+    // timer callback
+    static Eina_Bool orientationThresholdTimerCallback(void* data);
+
     // security
     void requestUrlBlocked(const std::string& blockedUrl);
 
@@ -312,6 +318,8 @@ class ViewLogic : public ViewModule::IViewModule
     bool m_isBackgroundReload;
     bool m_isBackgroundSupport;
     int m_rotateAngle;
+    int m_deferredRotateAngle;
+    Ecore_Timer* m_orientationThresholdTimer;
 
     std::unique_ptr<SchemeSupport> m_schemeSupport;
     std::unique_ptr<ViewModule::AppsSupport> m_appsSupport;
old mode 100755 (executable)
new mode 100644 (file)
index 4b5a614..ea96943
@@ -30,6 +30,7 @@
 #include <widget_string.h>
 #include <common/view_logic_security_origin_support.h>
 #include <Elementary.h>
+#include <app.h>
 
 namespace ViewModule {
 namespace GeolocationSupport {
@@ -49,9 +50,19 @@ void askUserForGeolocationPermission(
 {
     LogDebug("askUserForGeolocationPermission called");
     std::string body = WRT_BODY_PS_REQUESTS_YOUR_LOCATION;
+    std::string origin = DPL::ToUTF8String(data->m_originData.origin.host);
+    if (origin.empty()) {
+        char* name = NULL;
+        if (app_get_name(&name) == APP_ERROR_NONE) {
+            origin = name;
+            free(name);
+        } else {
+            origin = "application";
+        }
+    }
     body.replace(body.find(WRT_PS),
                  std::string(WRT_PS).size(),
-                 DPL::ToUTF8String(data->m_originData.origin.host).c_str());
+                 origin.c_str());
     Evas_Object* popup = createPopup(window,
                                      body.c_str(),
                                      WRT_BODY_REMEMBER_PREFERENCE,
index 1f09283..df866f8 100644 (file)
@@ -145,4 +145,10 @@ void setXwindowHandle(Ewk_Context* ewkContext, const unsigned int handle)
 
     ewk_context_message_post_to_injected_bundle(ewkContext, name, msg);
 }
-} // namespace ViewLogicMessageSupport
\ No newline at end of file
+
+void setViewmodes(Ewk_Context* ewkContext, const char* msg)
+{
+    const char* name = Message::ToInjectedBundle::SET_VIEWMODES;
+    ewk_context_message_post_to_injected_bundle(ewkContext, name, msg);
+}
+} // namespace ViewLogicMessageSupport
index d5944da..ef979a7 100644 (file)
@@ -45,6 +45,7 @@ void dispatchJavaScriptEvent(
     WrtPlugins::W3C::CustomEventType eventType,
     void* data);
 void setXwindowHandle(Ewk_Context* ewkContext, const unsigned int handle);
+void setViewmodes(Ewk_Context* ewkContext, const char* msg);
 } // namespace ViewLogicMessageSupport
 
 #endif // VIEW_LOGIC_MESSAGE_SUPPORT_H_
\ No newline at end of file
index d97d5a2..2a2169f 100644 (file)
 
 namespace ViewModule {
 
-void OrientationSupport::setOrientation(Evas_Object* window,
-                                        Evas_Object* ewk,
-                                        Mode orientation)
+int OrientationSupport::getWinOrientationAngle(int ewkOrientation)
 {
-    LogInfo("setOrientation called");
-    if (orientation == Mode::PORTRAIT_PRIMARY) {
-        LogDebug("orientation is portrait-primary");
-        elm_win_wm_rotation_preferred_rotation_set(
-            window,
-            OrientationAngle::Window::Portrait::PRIMARY);
-        ewk_view_orientation_send(
-            ewk,
-            OrientationAngle::W3C::Portrait::PRIMARY);
-    } else if (orientation == Mode::LANDSCAPE_PRIMARY) {
-        LogDebug("orientation is landscape-primary");
-        elm_win_wm_rotation_preferred_rotation_set(
-            window,
-            OrientationAngle::Window::Landscape::PRIMARY);
-        ewk_view_orientation_send(
-            ewk,
-             OrientationAngle::W3C::Landscape::PRIMARY);
-    } else if (orientation == Mode::PORTRAIT_SECONDARY) {
-        LogDebug("orientation is portrait-secondary");
-        elm_win_wm_rotation_preferred_rotation_set(
-            window,
-            OrientationAngle::Window::Portrait::SECONDARY);
-        ewk_view_orientation_send(
-            ewk,
-            OrientationAngle::W3C::Portrait::SECONDARY);
-    } else if (orientation == Mode::LANDSCAPE_SECONDARY) {
-        LogDebug("orientation is landscape-secondary");
-        elm_win_wm_rotation_preferred_rotation_set(
-            window,
-            OrientationAngle::Window::Landscape::SECONDARY);
-        ewk_view_orientation_send(
-            ewk,
-            OrientationAngle::W3C::Landscape::SECONDARY);
+    int angle;
+    if (ewkOrientation & EWK_SCREEN_ORIENTATION_PORTRAIT_PRIMARY) {
+        angle = OrientationAngle::Window::Portrait::PRIMARY;
+    } else if (ewkOrientation & EWK_SCREEN_ORIENTATION_LANDSCAPE_PRIMARY) {
+        angle = OrientationAngle::Window::Landscape::PRIMARY;
+    } else if (ewkOrientation & EWK_SCREEN_ORIENTATION_PORTRAIT_SECONDARY) {
+        angle = OrientationAngle::Window::Portrait::SECONDARY;
+    } else if (ewkOrientation & EWK_SCREEN_ORIENTATION_LANDSCAPE_SECONDARY) {
+        angle = OrientationAngle::Window::Landscape::SECONDARY;
     } else {
         LogDebug("Wrong orientation value is passed");
-        return;
+        Assert(false);
     }
+    return angle;
 }
 
-void OrientationSupport::setOrientation(Evas_Object* window,
-                                        Evas_Object* ewk,
-                                        int ewkOrientation)
+int OrientationSupport::getW3COrientationAngle(int ewkOrientation)
 {
-    LogInfo("setOrientation called");
-    Mode orientation;
+    int angle;
     if (ewkOrientation & EWK_SCREEN_ORIENTATION_PORTRAIT_PRIMARY) {
-        orientation = Mode::PORTRAIT_PRIMARY;
+        angle = OrientationAngle::W3C::Portrait::PRIMARY;
     } else if (ewkOrientation & EWK_SCREEN_ORIENTATION_LANDSCAPE_PRIMARY) {
-        orientation = Mode::LANDSCAPE_PRIMARY;
+        angle = OrientationAngle::W3C::Landscape::PRIMARY;
     } else if (ewkOrientation & EWK_SCREEN_ORIENTATION_PORTRAIT_SECONDARY) {
-        orientation = Mode::PORTRAIT_SECONDARY;
+        angle = OrientationAngle::W3C::Portrait::SECONDARY;
     } else if (ewkOrientation & EWK_SCREEN_ORIENTATION_LANDSCAPE_SECONDARY) {
-        orientation = Mode::LANDSCAPE_SECONDARY;
+        angle = OrientationAngle::W3C::Landscape::SECONDARY;
     } else {
         LogDebug("Wrong orientation value is passed");
-        return;
+        Assert(false);
     }
-    setOrientation(window, ewk, orientation);
+    return angle;
+}
+
+void OrientationSupport::setEwkOrientation(Evas_Object* ewk,
+                                           int angle)
+{
+    LogInfo("setOrientation called");
+    ewk_view_orientation_send(ewk, angle);
 }
-} // ViewModule
\ No newline at end of file
+} // ViewModule
index 019729b..2512afc 100644 (file)
 
 namespace ViewModule {
 namespace OrientationSupport {
-enum class Mode {
-PORTRAIT_PRIMARY = 0,
-LANDSCAPE_PRIMARY,
-PORTRAIT_SECONDARY,
-LANDSCAPE_SECONDARY
-};
-void setOrientation(Evas_Object* window,
-                    Evas_Object* ewk,
-                    Mode orientation);
-void setOrientation(Evas_Object* window,
-                    Evas_Object* ewk,
-                    int ewkOrientation);
+const int DEFERRED_ORIENTATION_EMPTY = -1;
+const int DEFERRED_ORIENTATION_UNLOCK = 0;
+
+int getWinOrientationAngle(int ewkOrientation);
+int getW3COrientationAngle(int ewkOrientation);
+void setEwkOrientation(Evas_Object* ewk, int angle);
 } // namespace OrientationSupport
 } // namespace ViewModule
 
index 2e868a4..15f0fb9 100644 (file)
@@ -17,16 +17,20 @@ SET(TARGET_WRT_CLIENT "wrt-client")
 
 SET(WRT_CLIENT_SRCS
     ${PROJECT_SOURCE_DIR}/src/wrt-client/window_data.cpp
+    ${PROJECT_SOURCE_DIR}/src/wrt-client/client_service_support.cpp
     ${PROJECT_SOURCE_DIR}/src/wrt-client/splash_screen_support.cpp
     ${PROJECT_SOURCE_DIR}/src/wrt-client/wrt-client.cpp
+    ${PROJECT_SOURCE_DIR}/src/wrt-client/auto_rotation_support.cpp
     ${PROJECT_SOURCE_DIR}/src/wrt-launchpad-daemon/src/process_pool.c
 )
 
 PKG_CHECK_MODULES(CLIENT_DEP
+    appcore-efl
+    capi-appfw-application
     dpl-wrt-dao-ro
     wrt-plugin-js-overlay
-    appcore-efl
     wrt-popup-wrt-runner
+    appsvc
     REQUIRED
 )
 
diff --git a/src/wrt-client/auto_rotation_support.cpp b/src/wrt-client/auto_rotation_support.cpp
new file mode 100644 (file)
index 0000000..2a6edd6
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+  * Copyright 2013  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.1 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://floralicense.org/license/
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  */
+/**
+ * @file    auto_rotation_support.cpp
+ * @author  Jihoon Chung (jihoon.chung@samsung.com)
+ * @version 1.0
+ * @brief   source file to support auto rotation of web application
+ */
+
+#include "auto_rotation_support.h"
+
+#include <Elementary.h>
+#include <EWebKit2.h>
+#include <dpl/log/log.h>
+#include <widget_data_types.h>
+
+namespace {
+const char* const WM_ROTATION_CHANGED_CALLBACK =  "wm,rotation,changed";
+}
+
+void AutoRotationSupport::setOrientation(Evas_Object* window, Evas_Object* ewkView, SplashScreenSupport* splashScreen)
+{
+    LogInfo("setOrientation");
+    int winAngle = elm_win_rotation_get(window);
+
+    if (splashScreen && splashScreen->isShowing())
+    {
+        splashScreen->resizeSplashScreen();
+    }
+
+    if (winAngle == OrientationAngle::Window::Portrait::PRIMARY) {
+        ewk_view_orientation_send(
+            ewkView,
+            OrientationAngle::W3C::Portrait::PRIMARY);
+    } else if (winAngle == OrientationAngle::Window::Portrait::SECONDARY) {
+        ewk_view_orientation_send(
+            ewkView,
+            OrientationAngle::W3C::Portrait::SECONDARY);
+    } else if (winAngle == OrientationAngle::Window::Landscape::PRIMARY) {
+        ewk_view_orientation_send(
+            ewkView,
+            OrientationAngle::W3C::Landscape::PRIMARY);
+    } else if (winAngle == OrientationAngle::Window::Landscape::SECONDARY) {
+        ewk_view_orientation_send(
+            ewkView,
+            OrientationAngle::W3C::Landscape::SECONDARY);
+    } else {
+        LogInfo("unknown angle is returned");
+    }
+}
+
+bool AutoRotationSupport::setAutoRotation(Evas_Object* window, Evas_Smart_Cb callback, const void *data)
+{
+    Assert(window);
+
+    if (elm_win_wm_rotation_supported_get(window)) {
+        const int rots[4] = {OrientationAngle::Window::Portrait::PRIMARY,
+                             OrientationAngle::Window::Portrait::SECONDARY,
+                             OrientationAngle::Window::Landscape::PRIMARY,
+                             OrientationAngle::Window::Landscape::SECONDARY};
+        elm_win_wm_rotation_available_rotations_set(window, rots, 4);
+        evas_object_smart_callback_add(window,
+                                       WM_ROTATION_CHANGED_CALLBACK,
+                                       callback,
+                                       data);
+        return true;
+    }
+    return false;
+}
+
+void AutoRotationSupport::unsetAutoRotation(Evas_Object* window, Evas_Smart_Cb callback)
+{
+    Assert(window);
+    evas_object_smart_callback_del(window,
+                                   WM_ROTATION_CHANGED_CALLBACK,
+                                   callback);
+}
+
diff --git a/src/wrt-client/auto_rotation_support.h b/src/wrt-client/auto_rotation_support.h
new file mode 100644 (file)
index 0000000..d8cc051
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+  * Copyright 2013  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.1 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://floralicense.org/license/
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  */
+/**
+ * @file    auto_rotation_support.h
+ * @author  Jihoon Chung (jihoon.chung@samsung.com)
+ * @version 1.0
+ * @brief   header file to support auto rotation of web application
+ */
+#ifndef AUTO_ROTATION_SUPPORT_H_
+#define AUTO_ROTATION_SUPPORT_H_
+
+#include <Elementary.h>
+#include <splash_screen_support.h>
+
+namespace AutoRotationSupport {
+bool setAutoRotation(Evas_Object* window, Evas_Smart_Cb callback, const void *data);
+void unsetAutoRotation(Evas_Object* window, Evas_Smart_Cb callback);
+void setOrientation(Evas_Object* window, Evas_Object* ewkView, SplashScreenSupport* splashScreen);
+} // namespace AUTO_ROTATION_SUPPORT
+
+#endif // AUTO_ROTATION_SUPPORT_H_
diff --git a/src/wrt-client/client_service_support.cpp b/src/wrt-client/client_service_support.cpp
new file mode 100644 (file)
index 0000000..d82b0c2
--- /dev/null
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+#include "client_service_support.h"
+#include <app.h>
+#include <string>
+#include <dpl/log/log.h>
+#include <dpl/exception.h>
+
+namespace ClientModule {
+namespace {
+class Exception
+{
+  public:
+    DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
+    DECLARE_EXCEPTION_TYPE(Base, ServiceHandleCreateError)
+    DECLARE_EXCEPTION_TYPE(Base, ServiceHandleSetError)
+};
+bool isError(int error);
+
+bool isError(int error) {
+    if (SERVICE_ERROR_NONE == error) {
+        return false;
+    } else {
+        LogError("Service error [" << error << "]");
+        return true;
+    }
+}
+}
+
+bool ServiceSupport::launchViewService(unsigned int windowHandle,
+                                       const std::string& url)
+{
+    if (url.empty() || url.size() == 0) {
+        LogError("Input url is invalid");
+        return false;
+    }
+
+    service_h serviceHandle = NULL;
+    Try {
+        int error = SERVICE_ERROR_NONE;
+        error = service_create(&serviceHandle);
+        if (isError(error)) {
+            Throw(Exception::ServiceHandleCreateError);
+        }
+
+        error = service_set_operation(serviceHandle, SERVICE_OPERATION_VIEW);
+        if (isError(error)) {
+            ThrowMsg(Exception::ServiceHandleSetError,
+                     "service_set_operation error");
+        }
+
+        error = service_set_uri(serviceHandle, url.c_str());
+        if (isError(error)) {
+            ThrowMsg(Exception::ServiceHandleSetError,
+                     "service_set_uri error");
+        }
+
+        if (windowHandle != 0) {
+            error = service_set_window(serviceHandle, windowHandle);
+            if (isError(error)) {
+                ThrowMsg(Exception::ServiceHandleSetError,
+                         "service_set_window error");
+            }
+        }
+
+        error = service_send_launch_request(serviceHandle, NULL, NULL);
+        if (isError(error)) {
+            ThrowMsg(Exception::ServiceHandleSetError,
+                     "service_send_launch_request error");
+        }
+        service_destroy(serviceHandle);
+    } Catch(Exception::ServiceHandleCreateError) {
+        LogError("Fail to create service handle");
+        return false;
+    } Catch(Exception::ServiceHandleSetError) {
+        LogError(_rethrown_exception.GetMessage());
+        service_destroy(serviceHandle);
+        return false;
+    } Catch(DPL::Exception) {
+        LogError(_rethrown_exception.GetMessage());
+        return false;
+    }
+
+    return true;
+}
+
+bool ServiceSupport::launchShareService(unsigned int windowHandle,
+                                        const std::string& url)
+{
+    if (url.empty() || url.size() == 0) {
+        LogError("Input url is invalid");
+        return false;
+    }
+
+    service_h serviceHandle = NULL;
+    Try {
+        int error = SERVICE_ERROR_NONE;
+        error = service_create(&serviceHandle);
+        if (isError(error)) {
+            Throw(Exception::ServiceHandleCreateError);
+        }
+
+        error = service_set_operation(serviceHandle,
+                                      SERVICE_OPERATION_SHARE_TEXT);
+        if (isError(error)) {
+            ThrowMsg(Exception::ServiceHandleSetError,
+                     "service_set_operation error");
+        }
+
+        if (windowHandle != 0) {
+            error = service_set_window(serviceHandle, windowHandle);
+            if (isError(error)) {
+                ThrowMsg(Exception::ServiceHandleSetError,
+                         "service_set_window error");
+            }
+        }
+
+        error = service_add_extra_data(serviceHandle,
+                                       SERVICE_DATA_TEXT,
+                                       url.c_str());
+        if (isError(error)) {
+            ThrowMsg(Exception::ServiceHandleSetError,
+                     "service_add_extra_data error");
+        }
+
+        error = service_send_launch_request(serviceHandle, NULL, NULL);
+        if (isError(error)) {
+            ThrowMsg(Exception::ServiceHandleSetError,
+                     "service_send_launch_request error");
+        }
+        service_destroy(serviceHandle);
+    } Catch(Exception::ServiceHandleCreateError) {
+        LogError("Fail to create service handle");
+        return false;
+    } Catch(Exception::ServiceHandleSetError) {
+        LogError(_rethrown_exception.GetMessage());
+        service_destroy(serviceHandle);
+        return false;
+    } Catch(DPL::Exception) {
+        LogError(_rethrown_exception.GetMessage());
+        return false;
+    }
+    return true;
+}
+
+} // ClientModule
diff --git a/src/wrt-client/client_service_support.h b/src/wrt-client/client_service_support.h
new file mode 100644 (file)
index 0000000..2255c18
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+#ifndef CLIENT_SERVICE_SUPPORT_H_
+#define CLIENT_SERVICE_SUPPORT_H_
+
+#include <string>
+
+namespace ClientModule {
+namespace ServiceSupport {
+bool launchViewService(unsigned int windowHandle, const std::string& url);
+bool launchShareService(unsigned int windowHandle, const std::string& url);
+} // ServiceSupport
+} // ClientModule
+#endif // CLIENT_SERVICE_SUPPORT_H_
index d770c69..2b0cfcb 100644 (file)
@@ -37,12 +37,12 @@ SplashScreenSupport::SplashScreenSupport(Evas_Object* parent, const char* image_
     m_parent(parent),
     m_splashScreen(NULL),
     m_splashScreenBg(NULL),
-    m_initialized(false),
-    m_isShowing(false),
     m_timer(NULL),
-    m_indicator(indicator),
     m_deviceWidth(0),
-    m_deviceHeight(0)
+    m_deviceHeight(0),
+    m_initialized(false),
+    m_isShowing(false),
+    m_indicator(indicator)
 {
     LogDebug("enter");
 
index 6cdaf98..acac622 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <ui-gadget.h>
 #include <dpl/log/log.h>
+#include <dpl/foreach.h>
 
 namespace {
 char const* const PLATFORM_EDJ_PATH = "/usr/share/edje/wrt/Platform.edj";
@@ -45,12 +46,18 @@ char const* const NOINDICATOR = "noindicator";
 char const* const INTERNAL_LAYOUT = "internal_layout";
 char const* const FLOATBACKWARD_BUTTON_STYLE = "wrt/backward";
 const std::string DESKTOP_PROFILE("desktop");
-const int PROGRESS_H = 7;
+const int PROGRESS_H = 10;
 } // anonymous namespace
 
 WindowData::WindowData(unsigned long pid, bool manualInit) :
     m_win(NULL),
-    m_naviframeBackButton(NULL),
+    m_user_layout(NULL),
+    m_conformant(NULL),
+    m_platform_layout(NULL),
+    m_navigation(NULL),
+    m_floatBackButton(NULL),
+    m_progressbar(NULL),
+    m_ctxpopup(NULL),
     m_initialized(false)
 {
     m_win = createWindow(pid);
@@ -85,7 +92,6 @@ void WindowData::init()
     evas_object_show(m_platform_layout);
     m_navigation = createNavigationBar(m_platform_layout);
     evas_object_show(m_navigation);
-    m_naviframeBackButton = createNaviframeBackbutton(m_navigation);
     m_user_layout = createUserLayout(m_navigation);
     evas_object_show(m_user_layout);
     m_progressbar = createProgressBar(m_win, m_user_layout);
@@ -116,22 +122,6 @@ void WindowData::toggleIndicator(bool fullscreen)
     }
 }
 
-void WindowData::toggleToolbar(bool enable)
-{
-    LogDebug("toolbar = " << (enable ? "enable" : "disable"));
-    Elm_Object_Item* naviIt = elm_naviframe_top_item_get(m_navigation);
-    if (enable) {
-        elm_object_item_signal_emit(naviIt, ELM_STATE_TOOLBAR_INSTANT_OPEN, "");
-    } else {
-        elm_object_item_signal_emit(naviIt, ELM_STATE_TOOLBAR_INSTANT_CLOSE, "");
-    }
-}
-
-bool WindowData::isFullscreen()
-{
-    return m_fullscreen;
-}
-
 void WindowData::setViewMode(
     bool fullscreen,
     bool backbutton)
@@ -140,14 +130,16 @@ void WindowData::setViewMode(
     LogDebug("fullscreen: " << fullscreen);
     LogDebug("backbutton: " << backbutton);
 
-    m_fullscreen = fullscreen;
-
-    toggleIndicator(m_fullscreen);
+    toggleIndicator(fullscreen);
+}
 
-    if (backbutton) {
-        // This code will be deprecated by naviframe back button
-        // createFloatBackButton();
-    }
+void WindowData::setOrientation(int angle)
+{
+    LogDebug("setOrientation");
+    Assert(m_win);
+    elm_win_wm_rotation_preferred_rotation_set(
+        m_win,
+        angle);
 }
 
 void WindowData::createFloatBackButton()
@@ -231,14 +223,6 @@ Evas_Object* WindowData::createNavigationBar(Evas_Object* parent)
     return navigation;
 }
 
-Evas_Object* WindowData::createNaviframeBackbutton(Evas_Object* parent)
-{
-    Assert(parent != NULL && "Parent for naviframe backbutton is null");
-    Evas_Object* object = elm_button_add(parent);
-    elm_object_style_set(object, "naviframe/end_btn/default");
-    return object;
-}
-
 Evas_Object* WindowData::createUserLayout(Evas_Object* parent)
 {
     Assert(parent != NULL && "Parent for User Layout is null");
@@ -255,7 +239,7 @@ Evas_Object* WindowData::createUserLayout(Evas_Object* parent)
             /* const char *title_label  */
             NULL,
             /* Evas_Object *prev_btn */
-            m_naviframeBackButton,
+            NULL,
             /* Evas_Object *next_btn */
             NULL,
             /* Evas_Object *content */
@@ -278,6 +262,42 @@ Evas_Object* WindowData::createProgressBar(Evas_Object* window, Evas_Object* par
     return progressbar;
 }
 
+Evas_Object* WindowData::createCtxPopup(Evas_Object* parent)
+{
+    Assert(parent != NULL && "Parent is null");
+    if (m_ctxpopupItemDataList.empty()) {
+        LogError("menu data is empty");
+        return NULL;
+    }
+
+    Evas_Object* object = elm_ctxpopup_add(parent);
+    FOREACH(it, m_ctxpopupItemDataList) {
+        Evas_Object* icon = NULL;
+        if (!it->iconPath.empty()) {
+            // create icon
+        }
+        elm_ctxpopup_item_append(object,
+                                 it->text.c_str(),
+                                 icon,
+                                 ctxpopupItemCallback,
+                                 this);
+    }
+
+    Elm_Object_Item* naviIt = elm_naviframe_top_item_get(parent);
+    Evas_Object* moreButton =
+        elm_object_item_part_content_get(naviIt, "toolbar_more_btn");
+    if (moreButton) {
+        Evas_Coord x, y, w, h;
+        evas_object_geometry_get(moreButton, &x, &y, &w, &h);
+        evas_object_move(object, x+w/2, y+h/2);
+    }
+    evas_object_smart_callback_add(object,
+                                   "dismissed",
+                                   ctxpopupDismissedCallback,
+                                   this);
+    return object;
+}
+
 void WindowData::setDesktopIcon()
 {
     // set window icon
@@ -288,15 +308,6 @@ void WindowData::setDesktopIcon()
     elm_win_icon_object_set(m_win, icon);
 }
 
-void WindowData::addNaviframeItemPopCallback(
-    NaviframePopCallbackType callback,
-    void* data)
-{
-    Assert(m_navigation != NULL && "m_navigation is null");
-    Elm_Object_Item* naviIt = elm_naviframe_top_item_get(m_navigation);
-    elm_naviframe_item_pop_cb_set(naviIt, callback, data);
-}
-
 void WindowData::addFloatBackButtonCallback(
     const char* event,
     CallbackType callback,
@@ -346,15 +357,7 @@ void WindowData::emitSignalForUserLayout(
 void WindowData::toggleFullscreen(bool fullscreen)
 {
     LogDebug(__PRETTY_FUNCTION__);
-
-    if (m_fullscreen == fullscreen) {
-        // window is in fullscreen mode and fullscreen mode is requested, or
-        // window is not in fullscreen and a request is made to exit fullscreen
-        // In these two situations we don't have to do anything here.
-        return;
-    }
     toggleIndicator(fullscreen);
-    m_fullscreen = fullscreen;
 }
 
 void WindowData::winProfileChangedCallback(void *data,
@@ -374,6 +377,20 @@ void WindowData::winProfileChangedCallback(void *data,
     }
 }
 
+void WindowData::showCtxpopup(void)
+{
+    m_ctxpopup = createCtxPopup(m_navigation);
+    if (!m_ctxpopup) {
+        return;
+    }
+    evas_object_show(m_ctxpopup);
+}
+
+void WindowData::setCtxpopupItemData(CtxpopupItemDataList data)
+{
+    m_ctxpopupItemDataList = data;
+}
+
 void WindowData::updateProgress(double value)
 {
     int x, y, w, h;
@@ -382,3 +399,39 @@ void WindowData::updateProgress(double value)
                        static_cast<int>(w * value),
                        static_cast<int>(PROGRESS_H * elm_config_scale_get()));
 }
+
+void WindowData::ctxpopupItemCallback(void* data,
+                                      Evas_Object* obj,
+                                      void* eventInfo)
+{
+    LogDebug("ctxpopupItemCallback");
+    Assert(data);
+    WindowData* This = static_cast<WindowData*>(data);
+
+    Assert(eventInfo);
+    Elm_Object_Item* it = static_cast<Elm_Object_Item*>(eventInfo);
+    const char* text = elm_object_item_text_get(it);
+    LogDebug("text " << text);
+
+    FOREACH(it, This->m_ctxpopupItemDataList) {
+        if (it->text == text) {
+            it->function();
+            break;
+        }
+    }
+    Assert(obj);
+    elm_ctxpopup_dismiss(obj);
+}
+
+void WindowData::ctxpopupDismissedCallback(void* data,
+                                           Evas_Object* obj,
+                                           void* /*eventInfo*/)
+{
+    LogDebug("ctxpopupDismissedCallback");
+    Assert(obj);
+    evas_object_del(obj);
+
+    Assert(data);
+    WindowData* This = static_cast<WindowData*>(data);
+    This->m_ctxpopup = NULL;
+}
index 0c1008b..a45c8a3 100644 (file)
 #define WINDOW_INITIALIZE_H_
 
 #include <dpl/framework_efl.h>
+#include <dpl/fast_delegate.h>
 
-#include <vector>
 #include <string>
+#include <list>
 #include <dpl/noncopyable.h>
 
 /*
@@ -50,19 +51,22 @@ class WindowData : private DPL::Noncopyable
     typedef Eina_Bool (*NaviframePopCallbackType)(
         void* data, Elm_Object_Item* it);
 
-    struct EventWithFunction
-    {
-        CallbackType function;
-        std::string eventName;
-        EventWithFunction(CallbackType a_function,
-                          const char * a_eventName) :
-            function(a_function),
-            eventName(a_eventName)
+  public:
+    typedef DPL::FastDelegate0<void> CtxpopupCallbackType;
+    struct CtxpopupItemData {
+        std::string text;
+        std::string iconPath;
+        CtxpopupCallbackType function;
+        CtxpopupItemData(std::string t,
+                         std::string p,
+                         CtxpopupCallbackType f) :
+            text(t),
+            iconPath(p),
+            function(f)
         {}
     };
-    typedef std::vector<EventWithFunction> EventWithFunctionVector;
+    typedef std::list<CtxpopupItemData> CtxpopupItemDataList;
 
-  public:
     Evas_Object* m_win;
     Evas_Object* m_user_layout;
 
@@ -72,9 +76,6 @@ class WindowData : private DPL::Noncopyable
     void init();
     void setEvasObjectForLayout(Evas_Object* evas_object);
     void unsetEvasObjectForLayout();
-    void addNaviframeItemPopCallback(
-        NaviframePopCallbackType callback,
-        void* data);
     void addFloatBackButtonCallback(
         const char* event,
         CallbackType callback,
@@ -92,41 +93,46 @@ class WindowData : private DPL::Noncopyable
     void emitSignalForUserLayout(
         const char* emission,
         const char* source);
-
     void setViewMode(
         bool fullscreen,
         bool backbutton);
-
+    void setOrientation(int angle);
     void toggleFullscreen(bool fullscreen);
-    void toggleToolbar(bool enable);
-    bool isFullscreen();
     static void winProfileChangedCallback(void *data,
                                           Evas_Object * obj,
                                           void *event_info);
+    void showCtxpopup(void);
+    void setCtxpopupItemData(CtxpopupItemDataList data);
     void updateProgress(double value);
 
   protected:
     Evas_Object* m_conformant;
     Evas_Object* m_platform_layout;
     Evas_Object* m_navigation;
-    Evas_Object* m_naviframeBackButton;
     Evas_Object* m_floatBackButton;
     Evas_Object* m_progressbar;
-    bool m_fullscreen;
+    Evas_Object* m_ctxpopup;
     bool m_initialized;
+    CtxpopupItemDataList m_ctxpopupItemDataList;
 
     Evas_Object* createWindow(unsigned long pid);
     Evas_Object* createConformant(Evas_Object* parent);
     Evas_Object* createPlatformLayout(Evas_Object* parent);
     Evas_Object* createNavigationBar(Evas_Object* parent);
-    Evas_Object* createNaviframeBackbutton(Evas_Object* parent);
     Evas_Object* createUserLayout(Evas_Object* parent);
     Evas_Object* createProgressBar(Evas_Object* window, Evas_Object* parent);
+    Evas_Object* createCtxPopup(Evas_Object* parent);
 
     void alignProgressPosition();
     void toggleIndicator(bool fullscreen);
     void createFloatBackButton();
     void setDesktopIcon();
-};
+    static void ctxpopupItemCallback(void* data,
+                                     Evas_Object* obj,
+                                     void* eventInfo);
+    static void ctxpopupDismissedCallback(void* data,
+                                          Evas_Object* obj,
+                                          void* eventInfo);
+ };
 
 #endif /* WINDOW_INITIALIZE_H_ */
index 36f415a..7429412 100644 (file)
 #include <popup-runner/PopupInvoker.h>
 #include <prepare_external_storage.h>
 #include <vconf.h>
+#include "auto_rotation_support.h"
 
 #include "process_pool.h"
 #include "menu_db_util.h"
 #include "launchpad_util.h"
+#include <appsvc.h>
+
+#include "client_service_support.h"
+
 
 //W3C PACKAGING enviroment variable name
 #define W3C_DEBUG_ENV_VARIABLE "DEBUG_LOAD_FINISH"
@@ -49,6 +54,7 @@ const char *EDJE_SHOW_PROGRESS_SIGNAL = "show,progress,signal";
 const char *EDJE_HIDE_PROGRESS_SIGNAL = "hide,progress,signal";
 const std::string VIEWMODE_TYPE_FULLSCREEN = "fullscreen";
 const std::string VIEWMODE_TYPE_MAXIMIZED = "maximized";
+const std::string VIEWMODE_TYPE_WINDOWED = "windowed";
 char const* const ELM_SWALLOW_CONTENT = "elm.swallow.content";
 const char* const BUNDLE_PATH = "/usr/lib/libwrt-injected-bundle.so";
 const char* const caCertPath = "/opt/usr/share/certs/ca-certificate.crt";
@@ -78,7 +84,8 @@ WrtClient::WrtClient(int argc, char **argv) :
     m_debuggerPort(0),
     m_returnStatus(ReturnStatus::Succeeded),
     m_widgetState(WidgetState::WidgetState_Stopped),
-    m_fullscreen(false)
+    m_initialViewMode(VIEWMODE_TYPE_MAXIMIZED),
+    m_currentViewMode(VIEWMODE_TYPE_MAXIMIZED)
 {
     Touch();
     LogDebug("App Created");
@@ -386,7 +393,15 @@ void WrtClient::loadFinishCallback(Evas_Object* webview)
         } else {
             sv.sival_int = -1;
         }
-        sigqueue(m_sdkLauncherPid, SIGRTMIN, sv);
+
+        bundle* request = NULL;
+        appsvc_create_result_bundle(
+            ApplicationDataSingleton::Instance().getBundle(),
+            &request);
+        char port[10] = {0,};
+        sprintf(port, "%d", debug->portnum);
+        appsvc_add_data(request, "port", port);
+        appsvc_send_result(request, APPSVC_RES_OK);
     }
 
     ApplicationDataSingleton::Instance().freeBundle();
@@ -398,7 +413,9 @@ void WrtClient::loadFinishCallback(Evas_Object* webview)
 
 void WrtClient::progressStartedCallback()
 {
-    if (m_settingList->getProgressBarPresence() == ProgressBar_Enable) {
+    if (m_settingList->getProgressBarPresence() == ProgressBar_Enable ||
+        m_currentViewMode == VIEWMODE_TYPE_WINDOWED)
+    {
         m_windowData->emitSignalForUserLayout(EDJE_SHOW_PROGRESS_SIGNAL, "");
         m_windowData->updateProgress(0);
     }
@@ -406,12 +423,18 @@ void WrtClient::progressStartedCallback()
 
 void WrtClient::loadProgressCallback(Evas_Object* /*webview*/, double value)
 {
-    m_windowData->updateProgress(value);
+    if (m_settingList->getProgressBarPresence() == ProgressBar_Enable ||
+        m_currentViewMode == VIEWMODE_TYPE_WINDOWED)
+    {
+        m_windowData->updateProgress(value);
+    }
 }
 
 void WrtClient::progressFinishCallback()
 {
-    if (m_settingList->getProgressBarPresence() == ProgressBar_Enable) {
+    if (m_settingList->getProgressBarPresence() == ProgressBar_Enable ||
+        m_currentViewMode == VIEWMODE_TYPE_WINDOWED)
+    {
         m_windowData->emitSignalForUserLayout(EDJE_HIDE_PROGRESS_SIGNAL, "");
     }
 }
@@ -437,25 +460,13 @@ void WrtClient::toggleFullscreenCallback(bool fullscreen)
     LogError("toggleFullscreen");
 
     if (fullscreen) {
+        // enter fullscreen
         m_windowData->toggleFullscreen(true);
-        if (m_settingList->getBackButtonPresence() == BackButton_Enable) {
-            m_windowData->toggleToolbar(false);
-        }
+        m_currentViewMode = VIEWMODE_TYPE_FULLSCREEN;
     } else {
+        // exit fullscreen
         m_windowData->toggleFullscreen(false);
-        if (m_settingList->getBackButtonPresence() == BackButton_Enable) {
-            m_windowData->toggleToolbar(true);
-        }
-    }
-}
-
-void WrtClient::imeChangedCallback(bool open)
-{
-    LogError("imeChangedCallback");
-    if (m_settingList->getBackButtonPresence() == BackButton_Enable &&
-        m_windowData->isFullscreen())
-    {
-        m_windowData->toggleToolbar(open);
+        m_currentViewMode = m_initialViewMode;
     }
 }
 
@@ -501,6 +512,7 @@ void WrtClient::launchStep()
             *defloc);
     }
 
+    setInitialViewMode();
     PrepareExternalStorageSingleton::Instance().Initialize(m_dao->getTizenPkgId());
 
     /* remove language change callback */
@@ -519,7 +531,8 @@ void WrtClient::launchStep()
     ADD_PROFILING_POINT("CreateWindow", "stop");
 
     // rotate window to initial value
-    setOrientationWindow();
+    setWindowInitialOrientation();
+    setCtxpopupItem();
 
     WRT::UserDelegatesPtr cbs(new WRT::UserDelegates);
 
@@ -529,8 +542,8 @@ void WrtClient::launchStep()
     {
         m_splashScreen.reset(new SplashScreenSupport(m_windowData->m_win,
             (DPL::ToUTF8String(*splashImgSrc)).c_str(),
-            !isFullscreen(),
-            (m_settingList->getRotationValue() == Screen_Landscape)));
+             m_currentViewMode != VIEWMODE_TYPE_FULLSCREEN,
+             m_settingList->getRotationValue() == Screen_Landscape));
         m_splashScreen->startSplashScreen();
     }
     ADD_PROFILING_POINT("Create splash screen", "stop");
@@ -544,13 +557,11 @@ void WrtClient::launchStep()
         return;
     }
     // send rotate information to ewk
-    setOrientationEwk();
+    setEwkInitialOrientation();
 
     //you can't show window with splash screen before PrepareView
     //ewk_view_add_with_context() in viewLogic breaks window
     m_windowData->init();
-    m_windowData->toggleToolbar(
-        m_settingList->getBackButtonPresence() == BackButton_Enable);
 
     WrtDB::WidgetLocalizedInfo localizedInfo =
         W3CFileLocalization::getLocalizedInfo(m_dao);
@@ -564,7 +575,6 @@ void WrtClient::launchStep()
     evas_object_show(m_windowData->m_win);
 
     initializeWindowModes();
-    connectElmCallback();
 
     m_widgetState = WidgetState_Authorizing;
     if (!m_widget->CheckBeforeLaunch()) {
@@ -585,7 +595,8 @@ void WrtClient::launchStep()
     cbs->webkitExit = DPL::MakeDelegate(this, &WrtClient::webkitExitCallback);
     cbs->webCrash = DPL::MakeDelegate(this, &WrtClient::webCrashCallback);
     cbs->toggleFullscreen = DPL::MakeDelegate(this, &WrtClient::toggleFullscreenCallback);
-    cbs->editorClientIme = DPL::MakeDelegate(this, &WrtClient::imeChangedCallback);
+    cbs->setOrientation = DPL::MakeDelegate(this, &WrtClient::setWindowOrientation);
+    cbs->hwkey = DPL::MakeDelegate(this, &WrtClient::hwkeyCallback);
 
     m_widget->SetUserDelegates(cbs);
     m_widget->Show();
@@ -594,43 +605,13 @@ void WrtClient::launchStep()
     ADD_PROFILING_POINT("launchStep", "stop");
 }
 
-bool WrtClient::isFullscreen()
-{
-    static bool first = true;
-
-    if (first)
-    {
-        Assert(m_dao);
-
-        first = false;
-        WrtDB::WindowModeList windowModes = m_dao->getWindowModes();
-
-        FOREACH(it, windowModes)
-        {
-            std::string viewMode = DPL::ToUTF8String(*it);
-            if (viewMode == VIEWMODE_TYPE_FULLSCREEN)
-            {
-                m_fullscreen = true;
-                break;
-            }
-            else if (viewMode == VIEWMODE_TYPE_MAXIMIZED)
-            {
-                break;
-            }
-        }
-    }
-
-    return m_fullscreen;
-}
-
 void WrtClient::initializeWindowModes()
 {
     Assert(m_windowData);
-
-    bool fullscreen = isFullscreen();
-    bool backbutton = (m_settingList->getBackButtonPresence() == BackButton_Enable);
-
-    m_windowData->setViewMode(fullscreen,
+    bool backbutton =
+        (m_settingList->getBackButtonPresence() == BackButton_Enable ||
+        m_currentViewMode == VIEWMODE_TYPE_WINDOWED);
+    m_windowData->setViewMode(m_currentViewMode == VIEWMODE_TYPE_FULLSCREEN,
                               backbutton);
 }
 
@@ -646,7 +627,7 @@ void WrtClient::backButtonCallback(void* data,
 }
 
 Eina_Bool WrtClient::naviframeBackButtonCallback(void* data,
-                                                 Elm_Object_Item* it)
+                                                 Elm_Object_Item* /*it*/)
 {
     LogInfo("BackButtonCallback");
     Assert(data);
@@ -667,42 +648,80 @@ int WrtClient::appcoreLowMemoryCallback(void* /*data*/)
     return 0;
 }
 
-void WrtClient::setOrientationWindow(void)
+void WrtClient::setInitialViewMode(void)
+{
+    Assert(m_dao);
+    WrtDB::WindowModeList windowModes = m_dao->getWindowModes();
+    FOREACH(it, windowModes) {
+        std::string viewMode = DPL::ToUTF8String(*it);
+        switch(viewMode[0]) {
+            case 'f':
+                if (viewMode == VIEWMODE_TYPE_FULLSCREEN) {
+                    m_initialViewMode = viewMode;
+                    m_currentViewMode = m_initialViewMode;
+                    break;
+                }
+                break;
+            case 'm':
+                if (viewMode == VIEWMODE_TYPE_MAXIMIZED) {
+                    m_initialViewMode = viewMode;
+                    m_currentViewMode = m_initialViewMode;
+                    break;
+                }
+                break;
+            case 'w':
+                if (viewMode == VIEWMODE_TYPE_WINDOWED) {
+                    m_initialViewMode = viewMode;
+                    m_currentViewMode = m_initialViewMode;
+                    break;
+                }
+                break;
+            default:
+                break;
+        }
+    }
+}
+
+void WrtClient::setWindowInitialOrientation(void)
 {
     Assert(m_windowData);
     Assert(m_dao);
 
     WidgetSettingScreenLock rotationValue = m_settingList->getRotationValue();
     if (rotationValue == Screen_Portrait) {
-        elm_win_wm_rotation_preferred_rotation_set(
-            m_windowData->m_win,
-            OrientationAngle::Window::Portrait::PRIMARY);
+        setWindowOrientation(OrientationAngle::Window::Portrait::PRIMARY);
     } else if (rotationValue == Screen_Landscape) {
-        elm_win_wm_rotation_preferred_rotation_set(
-            m_windowData->m_win,
-            OrientationAngle::Window::Landscape::PRIMARY);
+        setWindowOrientation(OrientationAngle::Window::Landscape::PRIMARY);
     } else if (rotationValue == Screen_AutoRotation) {
-        LogInfo("Nothing to do");
+        if (!AutoRotationSupport::setAutoRotation(m_windowData->m_win,
+                                                  autoRotationCallback,
+                                                  this))
+        {
+            LogError("Fail to set auto rotation");
+        }
     } else {
-        elm_win_wm_rotation_preferred_rotation_set(
-            m_windowData->m_win,
-            OrientationAngle::W3C::Portrait::PRIMARY);
+        setWindowOrientation(OrientationAngle::Window::Portrait::PRIMARY);
     }
 }
 
-void WrtClient::unsetOrientationWindow(void)
+void WrtClient::setWindowOrientation(int angle)
+{
+    Assert(m_windowData);
+    m_windowData->setOrientation(angle);
+}
+
+void WrtClient::unsetWindowOrientation(void)
 {
     Assert(m_windowData);
     Assert(m_dao);
 
     WidgetSettingScreenLock rotationValue = m_settingList->getRotationValue();
     if (rotationValue == Screen_AutoRotation) {
-        LogInfo("Nothing to do");
+        AutoRotationSupport::unsetAutoRotation(m_windowData->m_win, autoRotationCallback);
     }
 }
 
-
-void WrtClient::setOrientationEwk(void)
+void WrtClient::setEwkInitialOrientation(void)
 {
     Assert(m_widget);
     Assert(m_dao);
@@ -727,15 +746,89 @@ void WrtClient::setOrientationEwk(void)
     }
 }
 
-void WrtClient::connectElmCallback()
+void WrtClient::setCtxpopupItem(void)
 {
-    Assert(m_windowData);
-    Assert(m_dao);
+    WindowData::CtxpopupItemDataList data;
+
+    // 1. share
+    WindowData::CtxpopupCallbackType shareCallback =
+        DPL::MakeDelegate(this, &WrtClient::ctxpopupShare);
+    WindowData::CtxpopupItemData shareData("Share",
+                                           std::string(),
+                                           shareCallback);
+
+    // 2. reload
+    WindowData::CtxpopupCallbackType reloadCallback =
+        DPL::MakeDelegate(this, &WrtClient::ctxpopupReload);
+    WindowData::CtxpopupItemData reloadData("Reload",
+                                            std::string(),
+                                            reloadCallback);
+
+    // 3. Open in browser
+    WindowData::CtxpopupCallbackType launchBrowserCallback =
+        DPL::MakeDelegate(this, &WrtClient::ctxpopupLaunchBrowser);
+    WindowData::CtxpopupItemData launchBrowserData("Open in browser",
+                                                   std::string(),
+                                                   launchBrowserCallback);
+    data.push_back(shareData);
+    data.push_back(reloadData);
+    data.push_back(launchBrowserData);
+    m_windowData->setCtxpopupItemData(data);
+}
 
-    if (m_settingList->getBackButtonPresence() == BackButton_Enable) {
-        m_windowData->addNaviframeItemPopCallback(
-            WrtClient::naviframeBackButtonCallback,
-            this);
+void WrtClient::ctxpopupShare(void)
+{
+    LogDebug("share");
+    const char* url = ewk_view_url_get(m_widget->GetCurrentWebview());
+    if (!url) {
+        LogError("url is empty");
+        return;
+    }
+    if (ClientModule::ServiceSupport::launchShareService(
+            elm_win_xwindow_get(m_windowData->m_win),
+            url))
+    {
+        LogInfo("success");
+    } else {
+        LogInfo("fail");
+    }
+}
+
+void WrtClient::ctxpopupReload(void)
+{
+    LogDebug("reload");
+    ewk_view_reload(m_widget->GetCurrentWebview());
+}
+
+void WrtClient::ctxpopupLaunchBrowser(void)
+{
+    LogDebug("launchBrowser");
+    const char* url = ewk_view_url_get(m_widget->GetCurrentWebview());
+    if (!url) {
+        LogError("url is empty");
+        return;
+    }
+    if (ClientModule::ServiceSupport::launchViewService(
+            elm_win_xwindow_get(m_windowData->m_win),
+            url))
+    {
+        LogInfo("success");
+    } else {
+        LogInfo("fail");
+    }
+}
+
+void WrtClient::hwkeyCallback(const std::string& key)
+{
+    if (m_settingList->getBackButtonPresence() == BackButton_Enable
+        || m_currentViewMode == VIEWMODE_TYPE_WINDOWED)
+    {
+        if (key == "back") {
+            m_widget->Backward();
+        } else if (key == "menu") {
+            // UX isn't confirmed
+            // m_windowData->showCtxpopup();
+        }
     }
 }
 
@@ -770,7 +863,7 @@ void WrtClient::shutdownStep()
         m_widget->Hide();
         // AutoRotation use m_widget pointer internally.
         // It must be unset before m_widget is released.
-        unsetOrientationWindow();
+        unsetWindowOrientation();
         m_widget.reset();
         ewk_context_delete(s_preparedEwkContext);
         PrepareExternalStorageSingleton::Instance().Deinitialize();
@@ -783,6 +876,27 @@ void WrtClient::shutdownStep()
     Quit();
 }
 
+void WrtClient::autoRotationCallback(void* data, Evas_Object* obj, void* /*event*/)
+{
+    LogInfo("entered");
+
+    Assert(data);
+    Assert(obj);
+
+    WrtClient* This = static_cast<WrtClient*>(data);
+
+    This->autoRotationSetOrientation(obj);
+}
+
+void WrtClient::autoRotationSetOrientation(Evas_Object* obj)
+{
+    LogInfo("entered");
+    Assert(obj);
+
+    AutoRotationSupport::setOrientation(obj, m_widget->GetCurrentWebview(),
+                                (m_splashScreen) ? m_splashScreen.get(): NULL);
+}
+
 int WrtClient::languageChangedCallback(void *data)
 {
     LogDebug("Language Changed");
index 11f02c8..871edde 100644 (file)
@@ -56,6 +56,7 @@ class WrtClient :
     ReturnStatus::Type   getReturnStatus() const;
     virtual void Quit();
     static std::string getTizenIdFromArgument(int argc, char **argv);
+    void autoRotationSetOrientation(Evas_Object* obj);
 
   protected:
     virtual void OnStop();
@@ -72,9 +73,7 @@ class WrtClient :
     bool checkArgument();
     void setSdkLauncherDebugData();
     bool checkDebugMode(SDKDebugData* debugData);
-    void connectElmCallback();
     void initializeWindowModes();
-    bool isFullscreen();
 
     // Events
     virtual void OnEventReceived(const NextStepEvent& event);
@@ -85,15 +84,27 @@ class WrtClient :
                                    void* event_info);
     static Eina_Bool naviframeBackButtonCallback(void* data,
                                                  Elm_Object_Item* it);
-
-    // Low Memory Callback
     static int appcoreLowMemoryCallback(void* data);
     static int languageChangedCallback(void *data);
+    static void autoRotationCallback(void* data, Evas_Object* obj, void* event);
+
+    //view-mode
+    void setInitialViewMode();
 
     //orientation
-    void setOrientationWindow();
-    void unsetOrientationWindow();
-    void setOrientationEwk();
+    void setWindowOrientation(int angle);
+    void setWindowInitialOrientation();
+    void unsetWindowOrientation();
+    void setEwkInitialOrientation();
+
+    //ctxpopup
+    void setCtxpopupItem();
+    void ctxpopupShare();
+    void ctxpopupReload();
+    void ctxpopupLaunchBrowser();
+
+    // hwkey
+    void hwkeyCallback(const std::string& key);
 
     // launching steps
     void initStep();
@@ -106,7 +117,6 @@ class WrtClient :
     void webkitExitCallback();
     void webCrashCallback();
     void toggleFullscreenCallback(bool fullscreen);
-    void imeChangedCallback(bool open);
     void setLayout(Evas_Object* newBuffer);
     void unsetLayout(Evas_Object* currentBuffer);
 
@@ -127,7 +137,8 @@ class WrtClient :
     WidgetState m_widgetState;
     std::unique_ptr<WindowData> m_windowData;
     std::unique_ptr<SplashScreenSupport> m_splashScreen;
-    bool m_fullscreen;
+    std::string m_initialViewMode;
+    std::string m_currentViewMode;
 };
 
 #endif // WRT_CLIENT_H
index e8805ca..721e217 100644 (file)
@@ -26,6 +26,7 @@ PKG_CHECK_MODULES(LAUNCHER_PKGS
     dpl-wrt-dao-ro
     capi-appfw-app-manager
     capi-appfw-application
+    appsvc
     REQUIRED
 )
 
index b97a30b..edfa038 100644 (file)
@@ -33,6 +33,7 @@
 #include <dpl/wrt-dao-ro/global_dao_read_only.h>
 #include <dpl/wrt-dao-ro/config_parser_data.h>
 #include <dpl/exception.h>
+#include <appsvc.h>
 
 #define TIMEOUT_DEFAULT     10
 #define ROOT_DEFAULT_UID 0
@@ -198,7 +199,37 @@ static void print_help(FILE *stream, int /*exit_code*/)
         );
 }
 
-static void sighandler(int signo, siginfo_t *si, void *data);
+extern "C" int service_to_bundle(service_h service, bundle** data);
+
+static void serviceReplyCallback(service_h /*request*/,
+                                 service_h reply,
+                                 service_result_e /*result*/,
+                                 void* data)
+{
+    Ecore_Timer* serviceTimer = static_cast<Ecore_Timer*>(data);
+    if (serviceTimer != NULL) {
+        ecore_timer_del(serviceTimer);
+    }
+
+    bundle* b = NULL;
+    service_to_bundle(reply, &b);
+    const char* port = appsvc_get_data(b, "port");
+    if (port != NULL && strlen(port) > 0) {
+        printf("port: %s\n", port);
+        printf("result: %s\n", "launched");
+    } else {
+        printf("result: %s\n", "failed");
+    }
+    ecore_main_loop_quit();
+    return;
+}
+
+static Eina_Bool timerCallback(void* /*data*/)
+{
+    printf("result: %s\n", "failed");
+    ecore_main_loop_quit();
+    return EINA_FALSE;
+}
 
 int main(int argc, char* argv[])
 {
@@ -211,9 +242,9 @@ int main(int argc, char* argv[])
         char pid[6] = "";
         char op = '\0';
         bool isDebugMode = false;
-        struct sigaction sigact;
         bool dispHelp = false;
         bool dispList = false;
+        Ecore_Timer* serviceTimer = NULL;
 
         service_h serviceHandle = NULL;
         int ret = SERVICE_ERROR_NONE;
@@ -395,18 +426,7 @@ int main(int argc, char* argv[])
 
         if (op == 's') {
             /* check if this is request for debug mode, or not */
-            if (true == isDebugMode) {
-                /* wait for return from the widget */
-                sigemptyset(&sigact.sa_mask);
-                sigact.sa_flags = SA_SIGINFO;
-                sigact.sa_restorer = NULL;
-                sigact.sa_sigaction = sighandler;
-
-                if (sigaction(SIGRTMIN, &sigact, 0) == 1) {
-                    printf("result: %s\n", "failed");
-                    return -1;
-                }
-            } else {
+            if (true != isDebugMode) {
                 // case of "-d" option, service_create is already allocated
                 // create service
                 ret = service_create(&serviceHandle);
@@ -440,8 +460,15 @@ int main(int argc, char* argv[])
                     return -1;
                 }
 
+                if (true == isDebugMode) {
+                    ecore_init();
+                    serviceTimer = ecore_timer_add(timeout, timerCallback, NULL);
+                }
+
                 //launch service
-                ret = service_send_launch_request(serviceHandle, NULL, NULL);
+                ret = service_send_launch_request(serviceHandle,
+                                                  serviceReplyCallback,
+                                                  serviceTimer);
                 if (SERVICE_ERROR_NONE != ret) {
                     printf("result: %s\n", "failed");
                     service_destroy(serviceHandle);
@@ -455,10 +482,8 @@ int main(int argc, char* argv[])
             }
 
             if (true == isDebugMode) {
-                // wait RTS signal from widget by 5 second
-                sleep(timeout);
-                printf("result: %s\n", "failed");
-                return -1;
+                ecore_main_loop_begin();
+                return 0;
             }
             // This text should be showed for IDE
             printf("result: %s\n", "launched");
@@ -521,24 +546,3 @@ int main(int argc, char* argv[])
     UNHANDLED_EXCEPTION_HANDLER_END
 }
 
-static void sighandler(int signo, siginfo_t *si, void* /*data*/)
-{
-    /* check if this signal is type of RTS */
-    if (si->si_code == SI_QUEUE) {
-        //int port;
-        //printf("RTS pid : %d\n", si->si_pid);
-        //port = (int) si->si_value.sival_ptr;
-        //printf("RTS debug port : %d\n", port);
-        // This sival_int is wrt's status (like WRT_SUCCESS..)
-        // enum WRT_SUCCESS is 0
-        if (si->si_value.sival_int > 0) {
-            printf("port: %d\n", (int)si->si_value.sival_int);
-            printf("result: %s\n", "launched");
-        } else {
-            printf("result: %s\n", "failed");
-        }
-    } else {
-        printf("Not RT signal : %d\n", signo);
-    }
-    exit(0);
-}
index 4787d87..c9ca402 100644 (file)
 #define __APP_PKT_H_
 
 #include <unistd.h>
+#ifndef __USE_GNU
 #define __USE_GNU
+#endif
 #include <sys/socket.h>
 #include <linux/un.h>
 
+// forward declare
+struct ucred;
+
 enum app_cmd {
     APP_START,
     APP_OPEN,
index 43edb5d..7df4776 100644 (file)
@@ -350,7 +350,7 @@ _static_ void __wrt_launchpad_main_loop(app_pkt_t* pkt, char* out_app_path, int*
     }
 
     pkg_name = bundle_get_val(kb, AUL_K_PKG_NAME);
-    _D("pkg name : %s", pkg_name);
+    SECURE_LOGD("pkg name : %s", pkg_name);
 
     menu_info = _get_app_info_from_bundle_by_pkgname(pkg_name, kb);
     if (menu_info == NULL) {
@@ -372,7 +372,7 @@ _static_ void __wrt_launchpad_main_loop(app_pkt_t* pkt, char* out_app_path, int*
 
     __modify_bundle(kb, /*cr.pid - unused parameter*/ 0, menu_info, pkt->cmd);
     pkg_name = _get_pkgname(menu_info);
-    _D("pkg name : %s", pkg_name);
+    SECURE_LOGD("pkg name : %s", pkg_name);
 
     __wrt_prepare_exec(pkg_name, app_path, menu_info, kb);
 
index 06d0ccf..c29bd6a 100644 (file)
 #define _E(fmt, arg ...) LOGE(fmt,##arg)
 #define _D(fmt, arg ...) LOGD(fmt,##arg)
 
+#ifndef SECURE_LOGD
+#define SECURE_LOGD(fmt, arg...) LOGD(fmt,##arg)
+#endif
+
+#ifndef SECURE_LOGE
+#define SECURE_LOGE(fmt, arg...) LOGE(fmt,##arg)
+#endif
+
 #define retvm_if(expr, val, fmt, arg ...) do { \
         if (expr) { \
             _E(fmt,##arg); \
index 5fa0986..5e530cb 100644 (file)
@@ -528,7 +528,7 @@ _static_ void __launchpad_main_loop(int main_fd, int pool_fd)
     PERF("packet processing start");
 
     pkg_name = bundle_get_val(kb, AUL_K_PKG_NAME);
-    _D("pkg name : %s\n", pkg_name);
+    SECURE_LOGD("pkg name : %s\n", pkg_name);
 
     menu_info = _get_app_info_from_bundle_by_pkgname(pkg_name, kb);
     if (menu_info == NULL) {
@@ -595,7 +595,7 @@ _static_ void __launchpad_main_loop(int main_fd, int pool_fd)
             if (__prepare_exec(pkg_name, app_path,
                                menu_info, kb) < 0)
             {
-                _E("preparing work fail to launch - "
+                SECURE_LOGE("preparing work fail to launch - "
                    "can not launch %s\n", pkg_name);
                 exit(-1);
             }
index a2da81b..a988f74 100644 (file)
@@ -17,7 +17,6 @@
 #ifdef PRELOAD_ACTIVATE
 
 #include <dlfcn.h>
-#include <glib.h>
 
 #define PRELOAD_FILE        SHARE_PREFIX "/preload_list.txt"
 #define PRELOAD_FILE_WRT    SHARE_PREFIX "/preload_list_wrt.txt"
@@ -30,8 +29,6 @@ static int g_argc;
 static char **g_argv;
 static size_t max_cmdline_size = 0;
 
-static GSList *g_dlopen_handle_list = NULL;
-
 typedef struct handle_list_t {
     int (*dl_einit)();
     int (*dl_efini)();
@@ -52,79 +49,9 @@ static inline void __preload_init(int argc, char **argv)
     }
     _D("max_cmdline_size = %d", max_cmdline_size);
 
-    preload_list = fopen(PRELOAD_FILE, "rt");
-    if (preload_list == NULL) {
-        _E("no preload\n");
-        return;
-    }
-
-    while (fgets(soname, MAX_LOCAL_BUFSZ, preload_list) != NULL) {
-        size_t pos = strnlen(soname, MAX_LOCAL_BUFSZ);
-        if (pos > 0) {
-            soname[pos - 1] = '\0';
-        }
-
-        handle_list_t *entry = calloc(1, sizeof(handle_list_t));
-        if (!entry) {
-            _E("out of memory\n");
-            break;
-        }
-
-        entry->handle = dlopen(soname, RTLD_NOW);
-        if (entry->handle == NULL) {
-            free(entry);
-            continue;
-        }
-        _D("preload %s# - handle : %x\n", soname, entry->handle);
-
-        func = dlsym(entry->handle, EFL_PREINIT_FUNC);
-        if (func != NULL) {
-            _D("get pre-initialization function\n");
-            entry->dl_einit = func;
-            func = dlsym(entry->handle, EFL_SHUTDOWN_FUNC);
-            if (func != NULL) {
-                _D("get shutdown function\n");
-                entry->dl_efini = func;
-            }
-        }
-        g_dlopen_handle_list = g_slist_prepend(g_dlopen_handle_list, entry);
-    }
-    fclose(preload_list);
     preload_initialized = 1;
 }
 
-static inline int preinit_init()
-{
-    GSList *iter = NULL;
-    handle_list_t *entry;
-
-    for (iter = g_dlopen_handle_list; iter != NULL; iter = g_slist_next(iter)) {
-        entry = iter->data;
-        if (entry->dl_einit != NULL)
-            entry->dl_einit(0, NULL);
-    }
-    _D("pre-initialzation on");
-    return 0;
-}
-
-static inline int preinit_fini()
-{
-    GSList *iter = NULL;
-    handle_list_t *entry;
-
-    for (iter = g_dlopen_handle_list; iter != NULL; iter = g_slist_next(iter)) {
-        entry = iter->data;
-        if (entry->dl_efini != NULL)
-            entry->dl_efini();
-        if (entry->handle)
-            dlclose(entry->handle);
-    }
-    _D("pre-initialization off");
-    g_slist_free_full(g_dlopen_handle_list, free);
-    g_dlopen_handle_list = NULL;
-    return 0;
-}
-
 /* TODO : how to set cmdline gracefully ?? */
 static inline int __change_cmdline(char *cmdline)
 {
@@ -238,6 +165,7 @@ static inline void __preload_init_for_wrt()
         }
         handle = dlopen(soname, RTLD_NOW | RTLD_GLOBAL);
         if (handle == NULL) {
+            _E("dlopen(\"%s\") was failed!", soname);
             continue;
         }
         if (0 != __preload_save_dlopen_handle(handle)) {
index 675f10b..cd974e2 100644 (file)
@@ -1,3 +1,6 @@
+/usr/lib/libappcore-efl.so.1
+/usr/lib/libappcore-common.so.1
+/usr/lib/ecore/immodules/libisf-imf-module.so
 /usr/bin/wrt-client
 /usr/lib/libwrt-injected-bundle.so
 /usr/lib/wrt-plugins/w3c-widget-interface/libwrt-plugins-w3c-widget-interface.so
index 4149743..f9a21d6 100644 (file)
@@ -45,6 +45,9 @@ public:
           const char* name,
           const char* body,
           char** returnData);
+    void checkAsyncMessageFromBundle(
+            const char* name,
+            const char* body);
     void downloadData(const char* url);
     void activateVibration(bool on, uint64_t time);
 };
index bfc6374..d691b98 100644 (file)
@@ -83,6 +83,12 @@ void MockViewModule::checkSyncMessageFromBundle(
 {
 }
 
+void MockViewModule::checkAsyncMessageFromBundle(
+        const char* /*name*/,
+        const char* /*body*/)
+{
+}
+
 void MockViewModule::downloadData(const char* /*url*/)
 {
 }