Source code formating unification
authorPawel Sikorski <p.sikorski@samsung.com>
Tue, 5 Feb 2013 15:55:26 +0000 (16:55 +0100)
committerPawel Sikorski <p.sikorski@samsung.com>
Fri, 8 Feb 2013 14:00:01 +0000 (15:00 +0100)
[Issue#] N/A
[Problem] Source code was not formatted to any rules. In this situation
creating new patches or making review may become uncomfortable.
[Cause] No formatting rules/tool used.
[Solution] To make implementation and review process more comfortable, whole
wrt repository source code has been formatted with uncrustify tool. The
configuration of the tool is located in the repository (./uncrustify.cfg).

Command used (stored in uncrustify.sh):
uncrustify -c ./uncrustify.cfg --no-backup `find . -regex
"\(.*\.cpp\|.*\.h\|.*\.c\|.*\.cc\)" | grep -v "orm.h\|orm_generator.h"`

[Verification] Build the repository

Change-Id: Ic0c05e2c362ac2795f3a96c89f1ca2fae4f0d69f

104 files changed:
src/api_new/core_module.cpp
src/api_new/core_module.h
src/api_new/i_runnable_widget_object.h
src/api_new/runnable_widget_object.cpp
src/api_new/runnable_widget_object.h
src/api_new/runnable_widget_object_state.cpp
src/api_new/runnable_widget_object_state.h
src/domain/launch_user_data.h
src/domain/localization_setting.cpp
src/domain/localization_setting.h
src/domain/main_thread.cpp
src/domain/main_thread.h
src/domain/widget_data_types.cpp
src/domain/widget_data_types.h
src/domain/widget_deserialize_model.cpp
src/domain/widget_deserialize_model.h
src/domain/widget_model.cpp
src/domain/widget_model.h
src/plugin-service/wrt_plugin_module.cpp
src/plugin-service/wrt_plugin_module.h
src/profiling/profiling_util.cpp
src/profiling/profiling_util.h
src/view/common/application_data.cpp
src/view/common/application_data.h
src/view/common/application_launcher.cpp [changed mode: 0755->0644]
src/view/common/application_launcher.h
src/view/common/evas_object.cpp
src/view/common/evas_object.h
src/view/common/scheme.cpp
src/view/common/scheme.h
src/view/common/scheme_action_map.cpp
src/view/common/scheme_action_map.h
src/view/common/scheme_action_map_data.h
src/view/common/scheme_action_map_type.h
src/view/common/view_logic_apps_support.cpp
src/view/common/view_logic_apps_support.h
src/view/common/view_logic_custom_header_support.cpp
src/view/common/view_logic_custom_header_support.h
src/view/common/view_logic_geolocation_support.cpp
src/view/common/view_logic_geolocation_support.h
src/view/common/view_logic_password_support.cpp
src/view/common/view_logic_password_support.h
src/view/common/view_logic_security_origin_support.cpp
src/view/common/view_logic_security_origin_support.h
src/view/common/view_logic_security_support.cpp
src/view/common/view_logic_security_support.h
src/view/common/view_logic_storage_support.cpp
src/view/common/view_logic_storage_support.h
src/view/common/view_logic_uri_support.cpp
src/view/common/view_logic_uri_support.h
src/view/common/view_logic_user_agent_support.cpp
src/view/common/view_logic_user_agent_support.h
src/view/common/view_logic_vibration_support.cpp
src/view/common/view_logic_vibration_support.h
src/view/i_view_module.h [changed mode: 0755->0644]
src/view/view_module.cpp
src/view/webkit/bundles/bundle_uri_handling.cpp
src/view/webkit/bundles/bundle_uri_handling.h
src/view/webkit/bundles/plugin_module_support.cpp
src/view/webkit/bundles/plugin_module_support.h
src/view/webkit/bundles/wrt-wk2-bundle.cpp
src/view/webkit/bundles/wrt-wk2-bundle.h
src/view/webkit/view_logic.cpp [changed mode: 0755->0644]
src/view/webkit/view_logic.h [changed mode: 0755->0644]
src/view/webkit/view_logic_filesystem_support.cpp
src/view/webkit/view_logic_filesystem_support.h
src/view/webkit/view_logic_geolocation_support_webkit2.cpp
src/view/webkit/view_logic_geolocation_support_webkit2.h
src/view/webkit/view_logic_scheme_support.cpp
src/view/webkit/view_logic_scheme_support.h
src/view/webkit/view_logic_usermedia_support.cpp
src/view/webkit/view_logic_usermedia_support.h
src/view/webkit/view_logic_utils.cpp
src/view/webkit/view_logic_utils.h
src/view/webkit/view_logic_web_notification_support.cpp
src/view/webkit/view_logic_web_notification_support.h
src/view/webkit/view_logic_web_storage_support.cpp
src/view/webkit/view_logic_web_storage_support.h
src/wrt-client/splash_screen_support.cpp
src/wrt-client/splash_screen_support.h
src/wrt-client/window_data.cpp [changed mode: 0755->0644]
src/wrt-client/window_data.h [changed mode: 0755->0644]
src/wrt-client/wrt-client.cpp [changed mode: 0755->0644]
src/wrt-client/wrt-client.h [changed mode: 0755->0644]
src/wrt-launcher/wrt-launcher.cpp
src/wrt-launchpad-daemon/feature/preexec.h
src/wrt-launchpad-daemon/include/app_signal.h
src/wrt-launchpad-daemon/include/app_sock.h
src/wrt-launchpad-daemon/include/aul_util.h
src/wrt-launchpad-daemon/include/menu_db_util.h
src/wrt-launchpad-daemon/include/perf.h
src/wrt-launchpad-daemon/include/simple_util.h
src/wrt-launchpad-daemon/launchpad_src/access_control.h
src/wrt-launchpad-daemon/launchpad_src/config.h
src/wrt-launchpad-daemon/launchpad_src/gl.h
src/wrt-launchpad-daemon/launchpad_src/launchpad.c
src/wrt-launchpad-daemon/launchpad_src/sigchild.h
src/wrt-launchpad-daemon/launchpad_src/util_x.c
src/wrt-launchpad-daemon/launchpad_src/util_x.h
src/wrt-launchpad-daemon/legacy/preload.h
src/wrt-launchpad-daemon/src/app_sock.c
src/wrt-launchpad-daemon/src/simple_util.c
uncrustify.cfg [new file with mode: 0644]
uncrustify.sh [new file with mode: 0755]

index ee8c350..62030b2 100644 (file)
 
 #include <EWebKit2.h>
 
-
 IMPLEMENT_SINGLETON(WRT::CoreModule)
 
 namespace { //Anonymous
-
 const char * const bundlePath = "/usr/lib/wrt-wk2-bundles/libwrt-wk2-bundle.so";
 
 std::string cutOffFileName(const std::string& path)
@@ -85,17 +83,16 @@ bool checkPaths()
     if_ok &= (isDir(GetUserInstalledWidgetPath()));
     if (!if_ok) {
         LogError("Path <" << GetUserInstalledWidgetPath() <<
-            "> does not exist.");
+                 "> does not exist.");
     }
     return if_ok;
 }
-}// namespace anonymous
+} // namespace anonymous
 
 namespace WRT {
-
 class CoreModuleImpl
 {
-public:
+  public:
 
     CoreModuleImpl() : m_initialized(false), m_ewkContext(NULL)
     {
@@ -119,8 +116,7 @@ public:
             }
             Try
             {
-                if(!m_ewkContext)
-                {
+                if (!m_ewkContext) {
                     // Needed settings for WKContext are located here
                     // create Ewk_Context
                     Ewk_Context* newEwkContext =
@@ -143,8 +139,9 @@ public:
                 Ewk_Cookie_Manager *ewkCookieManager;
                 ewkCookieManager =
                     ewk_context_cookie_manager_get(m_ewkContext);
-                ewk_cookie_manager_accept_policy_set(ewkCookieManager,
-                                               EWK_COOKIE_ACCEPT_POLICY_ALWAYS);
+                ewk_cookie_manager_accept_policy_set(
+                    ewkCookieManager,
+                    EWK_COOKIE_ACCEPT_POLICY_ALWAYS);
                 ADD_PROFILING_POINT("WebProcess fork", "stop");
 
                 ADD_PROFILING_POINT("attach databases", "start");
@@ -158,7 +155,7 @@ public:
                 /* TODO:
                  * Do deinitialization: check on which step exception occured
                  * and deinitialize only initialized parts.
-                */
+                 */
                 return false;
             }
             m_initialized = true;
@@ -168,8 +165,7 @@ public:
 
     bool Init(Ewk_Context* ewk_context)
     {
-        if(ewk_context)
-        {
+        if (ewk_context) {
             m_ewkContext = ewk_context;
         }
 
@@ -189,7 +185,7 @@ public:
     }
 
     RunnableWidgetObjectPtr getRunnableWidgetObject(
-            const std::string& tizenId)
+        const std::string& tizenId)
     {
         PluginModuleSupport::init(m_ewkContext, tizenId);
 
@@ -243,18 +239,16 @@ public:
         return WrtDB::GlobalDAOReadOnly::GetDeveloperMode();
     }
 
-private:
+  private:
     bool m_initialized;
     Ewk_Context* m_ewkContext;
 };
 
 CoreModule::CoreModule() : m_impl(new CoreModuleImpl())
-{
-}
+{}
 
 CoreModule::~CoreModule()
-{
-}
+{}
 
 bool CoreModule::Init()
 {
@@ -272,7 +266,7 @@ void CoreModule::Terminate()
 }
 
 RunnableWidgetObjectPtr CoreModule::getRunnableWidgetObject(
-        const std::string& tizenId)
+    const std::string& tizenId)
 {
     return m_impl->getRunnableWidgetObject(tizenId);
 }
@@ -291,5 +285,4 @@ bool CoreModule::developerMode()
 {
     return m_impl->developerMode();
 }
-
 } /* namespace WRT */
index f436012..93d5a47 100644 (file)
@@ -32,7 +32,6 @@
 #include <EWebKit2.h>
 
 namespace WRT {
-
 class CoreModuleImpl; // forward declaration
 
 class CoreModule
@@ -69,7 +68,7 @@ class CoreModule
      * @return NULL on fail
      */
     RunnableWidgetObjectPtr getRunnableWidgetObject(
-            const std::string& tizenId);
+        const std::string& tizenId);
     /**
      * Gets from database global property of homeNetworkAccess
      * @return homeNetworkAccess value
@@ -95,6 +94,5 @@ class CoreModule
 };
 
 typedef DPL::Singleton<CoreModule> CoreModuleSingleton;
-
 } /* namespace WRT */
 #endif /* CORE_MODULE_H_ */
index a032f26..dca9c3a 100644 (file)
 #include <dpl/exception.h>
 
 namespace WRT {
-
 typedef DPL::FastDelegate0<void> ProgressFinishCB;
 typedef DPL::FastDelegate1<Evas_Object*, void> LoadStartCB;
 typedef DPL::FastDelegate1<Evas_Object*, void> LoadFinishCB;
 typedef DPL::FastDelegate0<void> WebCrashCB;
 typedef DPL::FastDelegate2<Evas**, Evas_Object*, void> WindowCreateBeforeCB;
-typedef DPL::FastDelegate2<Evas_Object*, Evas_Object*, void> WindowCreateAfterCB;
+typedef DPL::FastDelegate2<Evas_Object*, Evas_Object*,
+                           void> WindowCreateAfterCB;
 typedef DPL::FastDelegate1<Evas_Object*, void> WindowCloseCB;
 typedef DPL::FastDelegate0<void> WebkitExitCB;
 typedef DPL::FastDelegate1<bool, void> ResumeCB;
@@ -100,8 +100,9 @@ typedef std::shared_ptr<WidgetModel> WidgetModelPtr;
  *    \-------------(HIDDEN)
  *
  */
-class IRunnableWidgetObject {
-public:
+class IRunnableWidgetObject
+{
+  public:
     // IRunnableWidgetObject base exception
     DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
 
@@ -168,12 +169,10 @@ public:
      */
     virtual void FireJavascriptEvent(int event, void* data) = 0;
 
-
-    virtual ~IRunnableWidgetObject() {};
+    virtual ~IRunnableWidgetObject() {}
 };
 
 typedef std::shared_ptr<IRunnableWidgetObject> RunnableWidgetObjectPtr;
-
 }
 #endif /* RUNNABLE_WIDGET_OBJECT_INTERFACE_H_ */
 
index 61d96a2..6e37f4b 100644 (file)
@@ -39,18 +39,18 @@ const std::string ALREADY_RUNNING = _("IDS_BR_POP_ALREADY_RUNNING");
 const std::string INVALID_LOCALE = _("IDS_IM_POP_INVALID_WIDGET_LOCALE");
 const std::string STILL_AUTHORIZING = _("IDS_IM_POP_AUTHORIZING_ING_ATNT");
 const unsigned int UID_ROOT = 0;
-
 } // namespace anonymous
 
 namespace WRT {
-
-RunnableWidgetObject::RunnableWidgetObject(WidgetModelPtr &model, Ewk_Context* context) :
-        m_widgetModel(model),
-        m_view(ViewModule::createView()),
-        m_ewkContext(context)
+RunnableWidgetObject::RunnableWidgetObject(WidgetModelPtr &model,
+                                           Ewk_Context* context) :
+    m_widgetModel(model),
+    m_view(ViewModule::createView()),
+    m_ewkContext(context)
 {
     //set initial state of runnable object
-    m_guardstate = std::shared_ptr<State::RunnableWidgetObjectState>(new State::InitialState(*this));
+    m_guardstate = std::shared_ptr<State::RunnableWidgetObjectState>(
+            new State::InitialState(*this));
     // If current uid is 'root', change privilege to apps
     if (UID_ROOT == getuid()) {
         // Set privilege by tizen id
@@ -79,11 +79,10 @@ bool RunnableWidgetObject::CheckBeforeLaunch()
 
     wrt_ocsp_widget_verification_status_t response;
     if (m_widgetModel->Type.Get().appType == WrtDB::APP_TYPE_WAC20) {
-
         wrt_ocsp_initialize();
-        wrt_ocsp_verify_widget(WrtDB::WidgetDAOReadOnly::getHandle(m_widgetModel->TizenId), &response);
+        wrt_ocsp_verify_widget(WrtDB::WidgetDAOReadOnly::getHandle(
+                                   m_widgetModel->TizenId), &response);
         wrt_ocsp_shutdown();
-
     } else {
         response = WRT_OCSP_WIDGET_VERIFICATION_STATUS_GOOD;
     }
@@ -105,14 +104,13 @@ bool RunnableWidgetObject::CheckBeforeLaunch()
 }
 
 bool RunnableWidgetObject::PrepareView(const std::string &startUrl,
-        Evas_Object *window)
+                                       Evas_Object *window)
 {
     State::StateChange change = m_guardstate->allowPrepareView();
     Assert(window);
 
     ADD_PROFILING_POINT("view_logic_init", "start");
-    if(!m_view->createWebView(m_ewkContext, window))
-    {
+    if (!m_view->createWebView(m_ewkContext, window)) {
         return false;
     }
     m_view->initialize();
@@ -184,7 +182,8 @@ Evas_Object* RunnableWidgetObject::GetCurrentWebview()
     return cww;
 }
 
-void RunnableWidgetObject::SetUserDelegates(const UserDelegatesPtr& cbs) {
+void RunnableWidgetObject::SetUserDelegates(const UserDelegatesPtr& cbs)
+{
     State::StateChange change = m_guardstate->allowSetUserDelegates();
     m_view->setUserCallbacks(cbs);
     change.commit();
@@ -206,7 +205,8 @@ void RunnableWidgetObject::FireJavascriptEvent(int event, void* data)
     change.commit();
 }
 
-void RunnableWidgetObject::setNewState(std::shared_ptr<State::RunnableWidgetObjectState> sptr)
+void RunnableWidgetObject::setNewState(
+    std::shared_ptr<State::RunnableWidgetObjectState> sptr)
 {
     LogInfo("RunnableWidgetObject changes state to: " << sptr->toString());
     m_guardstate = sptr;
@@ -217,5 +217,4 @@ RunnableWidgetObject::~RunnableWidgetObject()
     LogDebug("");
     PluginModuleSupport::shutdown(m_ewkContext);
 }
-
 } /* namespace WRT */
index 281781c..1855a14 100644 (file)
@@ -40,16 +40,15 @@ class StateChange;
 #include <EWebKit2.h>
 
 namespace WRT {
-
 class RunnableWidgetObject : public IRunnableWidgetObject
 {
-public:
+  public:
     RunnableWidgetObject(WidgetModelPtr &model, Ewk_Context* context);
     virtual ~RunnableWidgetObject();
 
     bool CheckBeforeLaunch();
     bool PrepareView(const std::string &startUrl,
-            Evas_Object *window);
+                     Evas_Object *window);
     void Show(); //asynchronous function
     void Hide();
     void Suspend();
@@ -61,19 +60,19 @@ public:
     void Backward();
     void FireJavascriptEvent(int event, void* data);
 
-private:
+  private:
 
     bool CheckWACTestCertififedWidget();
 
     WidgetModelPtr m_widgetModel;
     ViewModule::IViewModulePtr m_view;
     Ewk_Context* m_ewkContext;
-    void setNewState(std::shared_ptr<WRT::State::RunnableWidgetObjectState> sptr);
+    void setNewState(
+        std::shared_ptr<WRT::State::RunnableWidgetObjectState> sptr);
 
     std::shared_ptr<State::RunnableWidgetObjectState> m_guardstate;
 
     friend class State::StateChange;
 };
-
 } /* namespace WRT */
 #endif /* RUNNABLE_WIDGET_OBJECT_H_ */
index bb1990f..6eeedba 100644 (file)
 
 namespace WRT {
 namespace State {
-
 const StateChange StateChange::NoChange = StateChange();
 
 StateChange::StateChange()
-{
-}
+{}
 
-StateChange::StateChange(RunnableWidgetObjectStatePtr sptr)
-    : m_sptr(sptr)
-{
-}
+StateChange::StateChange(RunnableWidgetObjectStatePtr sptr) :
+    m_sptr(sptr)
+{}
 
 void StateChange::commit()
 {
-    if(m_sptr)
-    {
+    if (m_sptr) {
         m_sptr->getObject().setNewState(m_sptr);
     }
 }
 
-RunnableWidgetObjectState::RunnableWidgetObjectState(RunnableWidgetObject & object)
-    : m_object(object)
-{
-}
+RunnableWidgetObjectState::RunnableWidgetObjectState(
+    RunnableWidgetObject & object) :
+    m_object(object)
+{}
 
 RunnableWidgetObjectState::~RunnableWidgetObjectState()
-{
-}
+{}
 
 RunnableWidgetObject & RunnableWidgetObjectState::getObject() const
 {
@@ -138,9 +133,9 @@ StateChange RunnableWidgetObjectState::allowFireJavascriptEvent()
              "FireJavascriptEvent cannot be called in current state ");
 }
 
-InitialState::InitialState(RunnableWidgetObject & object) : RunnableWidgetObjectState(object)
-{
-}
+InitialState::InitialState(RunnableWidgetObject & object) :
+    RunnableWidgetObjectState(object)
+{}
 
 std::string InitialState::toString() const
 {
@@ -160,17 +155,19 @@ StateChange InitialState::allowHide()
 
 StateChange InitialState::allowGetCurrentWebview()
 {
-    ThrowMsg(IRunnableWidgetObject::MethodInvocationForbidden,
-             "Cannot call GetCurrentWebview before RunnableWidgetObject initialization");
+    ThrowMsg(
+        IRunnableWidgetObject::MethodInvocationForbidden,
+        "Cannot call GetCurrentWebview before RunnableWidgetObject initialization");
 }
 
-PreparedState::PreparedState(RunnableWidgetObject & object) : RunnableWidgetObjectState(object)
-{
-}
+PreparedState::PreparedState(RunnableWidgetObject & object) :
+    RunnableWidgetObjectState(object)
+{}
 
 StateChange PreparedState::allowCheckBeforeLaunch()
 {
-    return StateChange(RunnableWidgetObjectStatePtr(new SecurityCheckedState(m_object)));
+    return StateChange(RunnableWidgetObjectStatePtr(new SecurityCheckedState(
+                                                        m_object)));
 }
 
 std::string PreparedState::toString() const
@@ -178,9 +175,9 @@ std::string PreparedState::toString() const
     return "PREPARED";
 }
 
-SecurityCheckedState::SecurityCheckedState(RunnableWidgetObject & object) : RunnableWidgetObjectState(object)
-{
-}
+SecurityCheckedState::SecurityCheckedState(RunnableWidgetObject & object) :
+    RunnableWidgetObjectState(object)
+{}
 
 std::string SecurityCheckedState::toString() const
 {
@@ -197,9 +194,9 @@ StateChange SecurityCheckedState::allowSetUserDelegates()
     return StateChange::NoChange;
 }
 
-ShowedState::ShowedState(RunnableWidgetObject & object) : RunnableWidgetObjectState(object)
-{
-}
+ShowedState::ShowedState(RunnableWidgetObject & object) :
+    RunnableWidgetObjectState(object)
+{}
 
 std::string ShowedState::toString() const
 {
@@ -236,9 +233,9 @@ StateChange ShowedState::allowFireJavascriptEvent()
     return StateChange::NoChange;
 }
 
-SuspendedState::SuspendedState(RunnableWidgetObject & object) : RunnableWidgetObjectState(object)
-{
-}
+SuspendedState::SuspendedState(RunnableWidgetObject & object) :
+    RunnableWidgetObjectState(object)
+{}
 
 std::string SuspendedState::toString() const
 {
@@ -255,9 +252,9 @@ StateChange SuspendedState::allowReset()
     return StateChange(RunnableWidgetObjectStatePtr(new ShowedState(m_object)));
 }
 
-HiddenState::HiddenState(RunnableWidgetObject & object) : RunnableWidgetObjectState(object)
-{
-}
+HiddenState::HiddenState(RunnableWidgetObject & object) :
+    RunnableWidgetObjectState(object)
+{}
 
 std::string HiddenState::toString() const
 {
@@ -269,6 +266,5 @@ StateChange HiddenState::allowHide()
     ThrowMsg(IRunnableWidgetObject::MethodInvocationForbidden,
              "Hide cannot be called in current state" << toString());
 }
-
 }
 }
index 3a246d3..fe9ea13 100644 (file)
@@ -29,7 +29,6 @@ class RunnableWidgetObject;
 namespace State {
 class RunnableWidgetObjectState;
 }
-
 }
 
 #include <dpl/exception.h>
@@ -38,7 +37,6 @@ class RunnableWidgetObjectState;
 
 namespace WRT {
 namespace State {
-
 typedef std::shared_ptr<RunnableWidgetObjectState> RunnableWidgetObjectStatePtr;
 
 /**
@@ -48,7 +46,7 @@ typedef std::shared_ptr<RunnableWidgetObjectState> RunnableWidgetObjectStatePtr;
  */
 class StateChange
 {
-public:
+  public:
     static const StateChange NoChange;
 
     StateChange();
@@ -58,7 +56,8 @@ public:
      * @brief commit actually performs change of state
      */
     void commit();
-private:
+
+  private:
     RunnableWidgetObjectStatePtr m_sptr;
 };
 
@@ -73,7 +72,7 @@ private:
  */
 class RunnableWidgetObjectState
 {
-public:
+  public:
     explicit RunnableWidgetObjectState(RunnableWidgetObject & object);
     virtual ~RunnableWidgetObjectState();
 
@@ -94,7 +93,7 @@ public:
     virtual std::string toString() const = 0;
     virtual RunnableWidgetObject & getObject() const;
 
-protected:
+  protected:
     RunnableWidgetObject & m_object;
 };
 
@@ -103,7 +102,7 @@ protected:
  */
 class InitialState : public RunnableWidgetObjectState
 {
-public:
+  public:
     explicit InitialState(RunnableWidgetObject & object);
     std::string toString() const;
 
@@ -117,7 +116,7 @@ public:
  */
 class PreparedState : public RunnableWidgetObjectState
 {
-public:
+  public:
     explicit PreparedState(RunnableWidgetObject & object);
     std::string toString() const;
 
@@ -129,7 +128,7 @@ public:
  */
 class SecurityCheckedState : public RunnableWidgetObjectState
 {
-public:
+  public:
     explicit SecurityCheckedState(RunnableWidgetObject & object);
     std::string toString() const;
 
@@ -142,7 +141,7 @@ public:
  */
 class ShowedState : public RunnableWidgetObjectState
 {
-public:
+  public:
     explicit ShowedState(RunnableWidgetObject & object);
     std::string toString() const;
 
@@ -159,7 +158,7 @@ public:
  */
 class SuspendedState : public RunnableWidgetObjectState
 {
-public:
+  public:
     explicit SuspendedState(RunnableWidgetObject & object);
     std::string toString() const;
 
@@ -172,13 +171,12 @@ public:
  */
 class HiddenState : public RunnableWidgetObjectState
 {
-public:
+  public:
     explicit HiddenState(RunnableWidgetObject & object);
     std::string toString() const;
 
     StateChange allowHide();
 };
-
 }
 }
 
index 755b0ff..c18bc88 100644 (file)
@@ -36,8 +36,7 @@ struct WrtLaunchData {
     WrtLaunchData() :
         wrtClientContext(NULL),
         sdkDebugData(NULL)
-    {
-    }
+    {}
 };
 
 struct SDKDebugData
@@ -50,8 +49,7 @@ struct SDKDebugData
         pid(NULL),
         portnum(-1),
         debugMode(false)
-    {
-    }
+    {}
 
     SDKDebugData(unsigned long *pidNum,
                  int portNum,
@@ -59,8 +57,7 @@ struct SDKDebugData
         pid(pidNum),
         portnum(portNum),
         debugMode(currentDebugMode)
-    {
-    }
+    {}
 };
 
 #endif // WRT_LAUNCH_USER_DATA_H_
index 82e0edb..79aae9e 100644 (file)
@@ -25,8 +25,7 @@
 
 #include <appcore-efl.h>
 
-namespace LocalizationSetting{
-
+namespace LocalizationSetting {
 void SetLanguageChangedCallback(LanguageChangedCallback cb, void *data)
 {
     LogDebug("Set language changed callback");
index 7f5dc34..adcca0a 100644 (file)
 #define LOCALIZATION_SETTING_H_
 
 namespace LocalizationSetting {
-
 typedef int (*LanguageChangedCallback)(void *data);
 
 void SetLanguageChangedCallback(LanguageChangedCallback cb, void *data);
-
 } //LocalizationSetting
 
 #endif // ifndef LOCALIZATION_SETTING_H_
index 9367b92..d2862cc 100644 (file)
@@ -31,8 +31,7 @@ IMPLEMENT_SINGLETON(MainThread)
 
 using namespace WrtDB;
 
-MainThread::MainThread() : m_attached(false) {
-}
+MainThread::MainThread() : m_attached(false) {}
 
 MainThread::~MainThread()
 {
index ad95089..df00289 100644 (file)
@@ -24,7 +24,8 @@
 
 #include <dpl/singleton.h>
 
-class MainThread {
+class MainThread
+{
   public:
     void AttachDatabases();
     void DetachDatabases();
index d92197c..2fee42c 100644 (file)
@@ -21,7 +21,8 @@
 /**
  * @file       widget_data_types.cpp
  * @author     Krzysztof Jackiewicz (k.jackiewicz@samsung.com)
- * @author     Tomasz Iwanek (t.iwanek@samsung.com) (implementation moved to cpp)
+ * @author     Tomasz Iwanek (t.iwanek@samsung.com) (implementation moved to
+ * cpp)
  * @version    0.1
  * @brief
  */
 #include <dpl/foreach.h>
 
 WidgetAccessList::WidgetAccessList() : m_isAccessAll(false)
-{
-}
+{}
 
-WidgetAccessList::WidgetAccessList(const WrtDB::WidgetAccessInfoList &widgetAccessInfoList) :
+WidgetAccessList::WidgetAccessList(
+    const WrtDB::WidgetAccessInfoList &widgetAccessInfoList) :
     m_isAccessAll(false)
 {
     FOREACH(it, widgetAccessInfoList)
@@ -98,8 +99,7 @@ WidgetSettingList::WidgetSettingList() :
     m_ContextMenu(ContextMenu_Enable),
     m_Encryption(Encryption_Disable),
     m_BackgroundSupport(BackgroundSupport_Disable)
-{
-}
+{}
 
 WidgetSettingList::WidgetSettingList(WidgetSettings &widgetSettings)
 {
@@ -134,43 +134,46 @@ WidgetSettingList::WidgetSettingList(WidgetSettings &widgetSettings)
                 m_IndicatorPresence = Indicator_Disable;
             } else {
                 LogError("Invalid indicator presence value!! [" <<
-                    value << "]");
+                         value << "]");
                 m_IndicatorPresence = Indicator_Enable;
             }
         } else if (name == SETTING_NAME_BACKBUTTON_PRESENCE) {
             if (value == SETTING_VALUE_BACKBUTTON_PRESENCE_ENALBE) {
                 m_BackButtonPresence = BackButton_Enable;
             } else if (value ==
-                            SETTING_VALUE_BACKBUTTON_PRESENCE_DISABLE) {
+                       SETTING_VALUE_BACKBUTTON_PRESENCE_DISABLE)
+            {
                 m_BackButtonPresence = BackButton_Disable;
             } else {
                 LogError("Invalid backbutton presence value!! [" <<
-                    value << "]");
+                         value << "]");
                 m_BackButtonPresence = BackButton_Disable;
             }
-        } else if ( name == SETTING_NAME_CONTEXT_MENU
+        } else if (name == SETTING_NAME_CONTEXT_MENU
 #ifndef DEPRECATED_SETTING_STRING
-                    || name == SETTING_NAME_CONTEXTMENU
+                   || name == SETTING_NAME_CONTEXTMENU
 #endif
-                  ) {
+                   )
+        {
             if (value == SETTING_VALUE_ENABLE) {
                 m_ContextMenu = ContextMenu_Enable;
             } else if (value == SETTING_VALUE_DISABLE) {
                 m_ContextMenu = ContextMenu_Disable;
             } else {
                 LogError("Invalid contextmenu value!! [" <<
-                    value << "]");
+                         value << "]");
                 m_ContextMenu = ContextMenu_Enable;
             }
         } else if (name == SETTING_NAME_ENCRYPTION) {
             if (value == SETTING_VALUE_ENCRYPTION_ENABLE) {
                 m_Encryption = Encryption_Enable;
             } else if (value ==
-                            SETTING_VALUE_ENCRYPTION_DISABLE) {
+                       SETTING_VALUE_ENCRYPTION_DISABLE)
+            {
                 m_Encryption = Encryption_Disable;
             } else {
                 LogError("Invalid encryption value!! [" <<
-                    value << "]");
+                         value << "]");
                 m_Encryption = Encryption_Disable;
             }
         } else if (name == SETTING_NAME_BACKGROUND_SUPPORT) {
@@ -180,7 +183,7 @@ WidgetSettingList::WidgetSettingList(WidgetSettings &widgetSettings)
                 m_BackgroundSupport = BackgroundSupport_Disable;
             } else {
                 LogError("Invalid background-support value!! [" <<
-                    value << "]");
+                         value << "]");
                 m_BackgroundSupport = BackgroundSupport_Disable;
             }
         } else if (name == SETTING_NAME_USER_AGENT) {
@@ -210,7 +213,8 @@ WidgetSettingIndicatorPresence WidgetSettingList::getIndicatorPresence() const
     return m_IndicatorPresence;
 }
 
-WidgetSettingBackButtonPresence WidgetSettingList::getBackButtonPresence() const
+WidgetSettingBackButtonPresence WidgetSettingList::getBackButtonPresence()
+const
 {
     return m_BackButtonPresence;
 }
@@ -246,10 +250,10 @@ std::string WidgetSettingList::getUserAgent() const
 bool WidgetSettingList::operator ==(const WidgetSettingList& other) const
 {
     return m_RotationLock == other.m_RotationLock &&
-        m_IndicatorPresence == other.m_IndicatorPresence &&
-        m_BackButtonPresence == other.m_BackButtonPresence &&
-        m_ContextMenu == other.m_ContextMenu &&
-        m_Encryption == other.m_Encryption &&
-        m_BackgroundSupport == other.m_BackgroundSupport &&
-        m_UserAgent == other.m_UserAgent;
+           m_IndicatorPresence == other.m_IndicatorPresence &&
+           m_BackButtonPresence == other.m_BackButtonPresence &&
+           m_ContextMenu == other.m_ContextMenu &&
+           m_Encryption == other.m_Encryption &&
+           m_BackgroundSupport == other.m_BackgroundSupport &&
+           m_UserAgent == other.m_UserAgent;
 }
index a3fcdf4..9d2e73a 100644 (file)
@@ -115,7 +115,7 @@ static const DPL::String SETTING_VALUE_ENABLE =
     L"enable";
 static const DPL::String SETTING_VALUE_DISABLE =
     L"disable";
-static const DPL::String SETTING_NAME_ENCRYPTION=
+static const DPL::String SETTING_NAME_ENCRYPTION =
     L"encryption";
 static const DPL::String SETTING_VALUE_SCREEN_ORIENTATION_PORTRAIT =
     L"portrait";
index 6c121d9..3a040a6 100644 (file)
@@ -27,9 +27,7 @@
 // to apply widget default locales instead of calling localizeWidgetModel()
 #include <dpl/localization/LanguageTagsProvider.h>
 
-
 namespace Domain {
-
 std::shared_ptr<WidgetModel> deserializeWidgetModel(const std::string& tizenId)
 {
     std::shared_ptr<WidgetModel> model;
@@ -40,9 +38,9 @@ std::shared_ptr<WidgetModel> deserializeWidgetModel(const std::string& tizenId)
 
         WrtDB::WidgetDAOReadOnly dao(dplTizenId);
         DPL::Optional<DPL::String> defloc = model->defaultlocale.Get();
-        if(!defloc.IsNull())
-        {
-            LanguageTagsProviderSingleton::Instance().addWidgetDefaultLocales(*defloc);
+        if (!defloc.IsNull()) {
+            LanguageTagsProviderSingleton::Instance().addWidgetDefaultLocales(
+                *defloc);
         }
 
         WrtDB::WidgetAccessInfoList widgetAccessInfoList;
@@ -65,6 +63,5 @@ std::shared_ptr<WidgetModel> deserializeWidgetModel(const std::string& tizenId)
     }
     return model;
 }
-
 } //Namespace Domain
 
index 83eb41f..21a8126 100644 (file)
 #include <dpl/wrt-dao-ro/wrt_db_types.h>
 
 namespace Domain {
-
 /**
  * @brief Creates widget model associated with selected
  * @param[in] tizenId
  * @retval WidgetModel
  */
 std::shared_ptr<WidgetModel> deserializeWidgetModel(const std::string& tizenId);
-
 } //Namespace Domain
 
 #endif // ifndef WRT_ENGINE_SRC_DOMAIN_WIDGET_DESERIALIZE_MODEL_H_
index ae62983..2cadbce 100644 (file)
@@ -30,7 +30,7 @@
 
 using namespace WrtDB;
 
-template <typename RetType, RetType (WidgetDAOReadOnly::*extFun)() const >
+template <typename RetType, RetType(WidgetDAOReadOnly::*extFun) () const >
 struct BindToWidgetDAO :
     DPL::Event::BindToDAO<WidgetModel,
                           RetType,
@@ -38,8 +38,7 @@ struct BindToWidgetDAO :
                           WidgetDAOReadOnly,
                           &WidgetModel::getTizenId,
                           extFun>
-{
-};
+{};
 
 template <typename RetType, RetType(*extFun) (DPL::String)>
 struct BindToWidgetDAOStatic :
@@ -48,15 +47,14 @@ struct BindToWidgetDAOStatic :
                                  DPL::String,
                                  &WidgetModel::getTizenId,
                                  extFun>
-{
-};
+{};
 
 WidgetModel::WidgetModel(const std::string &tizenId) :
     TizenId(DPL::FromASCIIString(tizenId)),
     TzPkgId(this, &BindToWidgetDAO<WrtDB::TizenPkgId,
                                    &WidgetDAOReadOnly::getTizenPkgId>::Get),
     Type(this, &BindToWidgetDAO<WidgetType,
-         &WidgetDAOReadOnly::getWidgetType>::Get),
+                                &WidgetDAOReadOnly::getWidgetType>::Get),
     ActualSize(this),
     PreferredSize(this,
                   &BindToWidgetDAO<WidgetSize,
@@ -105,15 +103,16 @@ WidgetModel::WidgetModel(const std::string &tizenId) :
         &BindToWidgetDAO<WindowModeList,
                          &WidgetDAOReadOnly::getWindowModes>::Get),
     //localized, so not binded
-//    AccessNetwork(this, false),
-//    WarpDefinitionEmpty(this),
+    //    AccessNetwork(this, false),
+    //    WarpDefinitionEmpty(this),
     BackSupported(
         this,
         //TODO this type has to be here now, as Property constructor is wrongly
         //chosen
         (DPL::Event::Property<bool,
-                       DPL::Event::PropertyReadOnly,
-                       DPL::Event::PropertyStorageDynamicCached>::ReadDelegateType) &
+                              DPL::Event::PropertyReadOnly,
+                              DPL::Event::PropertyStorageDynamicCached>::
+             ReadDelegateType) &
         BindToWidgetDAO<bool, &WidgetDAOReadOnly::getBackSupported>::Get),
     AccessList(this),
     IsTestWidget(
@@ -121,14 +120,14 @@ WidgetModel::WidgetModel(const std::string &tizenId) :
         //TODO this type has to be here now, as Property constructor is wrongly
         //chosen
         (DPL::Event::Property<bool,
-                       DPL::Event::PropertyReadOnly,
-                       DPL::Event::PropertyStorageDynamicCached>::ReadDelegateType) &
+                              DPL::Event::PropertyReadOnly,
+                              DPL::Event::PropertyStorageDynamicCached>::
+             ReadDelegateType) &
         BindToWidgetDAO<bool, &WidgetDAOReadOnly::isTestWidget>::Get),
 
     SettingList(this),
     AppServiceList(this)
-{
-}
+{}
 
 DPL::String WidgetModel::getTizenId() const
 {
index c261184..e25c31e 100644 (file)
@@ -58,8 +58,8 @@ class WidgetModel : public DPL::Event::Model
      */
     DPL::String TizenId;
     DPL::Event::Property<WrtDB::TizenPkgId,
-                      DPL::Event::PropertyReadOnly,
-                      DPL::Event::PropertyStorageDynamicCached> TzPkgId;
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamicCached> TzPkgId;
 
     /**
      * @brief Widget type
@@ -67,8 +67,8 @@ class WidgetModel : public DPL::Event::Model
      * Note: This is a readonly property
      */
     DPL::Event::Property<WrtDB::WidgetType,
-    DPL::Event::PropertyReadOnly,
-    DPL::Event::PropertyStorageDynamicCached> Type;
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamicCached> Type;
 
     /**
      * @brief Current widget actual size
@@ -79,8 +79,9 @@ class WidgetModel : public DPL::Event::Model
      * @brief Current widget preferred size
      */
     DPL::Event::Property<WidgetSize,
-                  DPL::Event::PropertyReadOnly,
-                  DPL::Event::PropertyStorageDynamicCached> PreferredSize;
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamicCached>
+    PreferredSize;
 
     /**
      * @brief Start URL for widget
@@ -106,29 +107,32 @@ class WidgetModel : public DPL::Event::Model
      * Gets path in which files of widget are being kept
      */
     DPL::Event::Property<DPL::String,
-                  DPL::Event::PropertyReadOnly,
-                  DPL::Event::PropertyStorageDynamicCached> InstallPath;
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamicCached> InstallPath;
 
     /**
      * @brief Path to widget's persistent storage.
      *
      * Gets path in which widget may store its persistent private data.
      */
-    DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> PersistentStoragePath;
+    DPL::Event::Property<DPL::String,
+                         DPL::Event::PropertyReadOnly> PersistentStoragePath;
 
     /**
      * @brief Path to widget's temporary storage.
      *
      * Gets path in which widget may store its temporary private data.
      */
-    DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> TemporaryStoragePath;
+    DPL::Event::Property<DPL::String,
+                         DPL::Event::PropertyReadOnly> TemporaryStoragePath;
 
     /**
      * @brief Widget defaultlocale
      */
     DPL::Event::Property<DPL::OptionalString,
-                  DPL::Event::PropertyReadOnly,
-                  DPL::Event::PropertyStorageDynamicCached> defaultlocale;
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamicCached>
+    defaultlocale;
 
     /**
      * @brief Widget name
@@ -164,15 +168,15 @@ class WidgetModel : public DPL::Event::Model
      * @brief Widget splash image src
      */
     DPL::Event::Property<DPL::OptionalString,
-                  DPL::Event::PropertyReadOnly,
-                  DPL::Event::PropertyStorageDynamicCached> SplashImg;
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamicCached> SplashImg;
 
     /**
      * @brief window mode
      */
     DPL::Event::Property<WrtDB::WindowModeList,
-                  DPL::Event::PropertyReadOnly,
-                  DPL::Event::PropertyStorageDynamic> WindowModes;
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamic> WindowModes;
 
     //    /**
     //     * @brief Value of network element.
@@ -189,8 +193,9 @@ class WidgetModel : public DPL::Event::Model
      * @brief Is back supported
      */
     DPL::Event::Property<bool,
-                  DPL::Event::PropertyReadOnly,
-                  DPL::Event::PropertyStorageDynamicCached> BackSupported;
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamicCached>
+    BackSupported;
 
     /**
      * @brief Widget access list
@@ -201,9 +206,8 @@ class WidgetModel : public DPL::Event::Model
      * @brief Is this DeveloperWidget
      */
     DPL::Event::Property<bool,
-                  DPL::Event::PropertyReadOnly,
-                  DPL::Event::PropertyStorageDynamicCached> IsTestWidget;
-
+                         DPL::Event::PropertyReadOnly,
+                         DPL::Event::PropertyStorageDynamicCached> IsTestWidget;
 
     DPL::Event::Property<WidgetSettingList> SettingList;
 
index 600e5fa..80720a3 100644 (file)
@@ -30,7 +30,6 @@
 #include <js_overlay_types.h>
 
 namespace PluginModule {
-
 void init(int widgetHandle)
 {
     LogDebug("initializing plugins module");
@@ -102,5 +101,4 @@ void unloadFrame(JSGlobalContextRef context)
     LogDebug("unload frame from web page (context:" << context << ")");
     PluginLogicSingleton::Instance().unloadFrame(context);
 }
-
 } // PluginModule
index 0203ac7..cd0d85f 100644 (file)
 #include <js_overlay_types.h>
 
 extern "C" {
-    typedef struct OpaqueJSContext* JSGlobalContextRef;
+typedef struct OpaqueJSContext* JSGlobalContextRef;
 }
 
 namespace PluginModule {
-
 //forward declaration
 void init(int widgetHandle);
 void start(int widgetHandle,
index 0207711..b8a08ef 100644 (file)
@@ -55,23 +55,25 @@ struct PacketResult
         name(0),
         prefix(0),
         description(0)
-    {
-    }
+    {}
     PacketResult(unsigned long long t,
-            const char* n,
-            const char* p,
-            const char* d) :
+                 const char* n,
+                 const char* p,
+                 const char* d) :
         time(t),
         name(n),
         prefix(p),
         description(d)
-    {
-    }
+    {}
 
     void Print(FILE *filePtr)
     {
-        if (!prefix) { prefix = ""; }
-        if (!description) { description = ""; }
+        if (!prefix) {
+            prefix = "";
+        }
+        if (!description) {
+            description = "";
+        }
         fprintf(filePtr, "%s#%s#%llu#[%s]\n", prefix, name, time, description);
     }
 };
@@ -134,24 +136,29 @@ std::string GetFormattedTime()
     localtime_r(&tv.tv_sec, &localNowTime);
 
     char format[64];
-    snprintf(format, sizeof(format), "%02i:%02i:%02i.%03i", localNowTime.tm_hour, localNowTime.tm_min, localNowTime.tm_sec, static_cast<int>(tv.tv_usec / 1000));
+    snprintf(format,
+             sizeof(format),
+             "%02i:%02i:%02i.%03i",
+             localNowTime.tm_hour,
+             localNowTime.tm_min,
+             localNowTime.tm_sec,
+             static_cast<int>(tv.tv_usec / 1000));
     return format;
 }
-
 } // namespace anonymous
 
 void AddStdoutProfilingMeasurment(const char* name, bool start)
 {
     std::ostringstream output;
-    output << "[" << GetFormattedTime()  << "] [](): " << name << " ";
+    output << "[" << GetFormattedTime() << "] [](): " << name << " ";
     output << (start ? "profiling##start" : "profiling##stop");
     fprintf(stdout, "%s\n", output.str().c_str());
 }
 
 extern "C"
 void AddProfilingMeasurment(const char* name,
-        const char* prefix,
-        const char* description)
+                            const char* prefix,
+                            const char* description)
 {
     DPL::Mutex::ScopedLock lock(m_mutex);
     struct timeval value;
index 64b909a..13ec532 100644 (file)
 #ifdef __cplusplus
 extern "C"
 void AddProfilingMeasurment(const char* name,
-        const char* prefix = 0,
-        const char* description = 0);
+                            const char* prefix = 0,
+                            const char* description = 0);
 #define ADD_PROFILING_POINT(name, ...) AddProfilingMeasurment(name, \
-                                                              ## __VA_ARGS__)
+                                                              ##__VA_ARGS__)
 #else //__cplusplus
 void AddProfilingMeasurment(const char* name,
-        const char* prefix,
-        const char* description);
+                            const char* prefix,
+                            const char* description);
 #define ADD_PROFILING_POINT(name, prefix, desc) AddProfilingMeasurment(name, \
                                                                        prefix, \
                                                                        desc)
index 2bfa7fd..23f7fd1 100644 (file)
@@ -30,12 +30,10 @@ IMPLEMENT_SINGLETON(ApplicationData)
 ApplicationData::ApplicationData() :
     m_originBundle(NULL),
     m_encodedBundle(NULL)
-{
-}
+{}
 
 ApplicationData::~ApplicationData()
-{
-}
+{}
 
 bundle* ApplicationData::getBundle() const
 {
@@ -49,8 +47,7 @@ const char* ApplicationData::getEncodedBundle() const
 
 bool ApplicationData::setBundle(bundle *originBundle)
 {
-    if (!originBundle)
-    {
+    if (!originBundle) {
         LogError("Bundle is empty!");
         return false;
     }
@@ -64,8 +61,7 @@ bool ApplicationData::setBundle(bundle *originBundle)
 bool ApplicationData::setEncodedBundle(bundle* originBundle)
 {
     int len, ret;
-    if (!originBundle)
-    {
+    if (!originBundle) {
         LogError("Bundle is empty!");
         return false;
     }
@@ -73,8 +69,7 @@ bool ApplicationData::setEncodedBundle(bundle* originBundle)
     freeEncodedBundle();
 
     ret = bundle_encode(originBundle, &m_encodedBundle, &len);
-    if(ret == -1)
-    {
+    if (ret == -1) {
         LogError("Failed to encode bundle data");
         return false;
     }
@@ -85,13 +80,11 @@ bool ApplicationData::setEncodedBundle(bundle* originBundle)
 
 void ApplicationData::freeBundle()
 {
-    if (!m_originBundle)
-    {
+    if (!m_originBundle) {
         return;
     }
 
-    if(!bundle_free(m_originBundle))
-    {
+    if (!bundle_free(m_originBundle)) {
         LogDebug("Bundle data freed for new bundle data");
         m_originBundle = NULL;
     }
@@ -99,15 +92,13 @@ void ApplicationData::freeBundle()
 
 void ApplicationData::freeEncodedBundle()
 {
-    if (!m_encodedBundle)
-    {
+    if (!m_encodedBundle) {
         return;
     }
 
-    if(m_encodedBundle)
-    {
-        if(!bundle_free_encoded_rawdata(
-                    &m_encodedBundle))
+    if (m_encodedBundle) {
+        if (!bundle_free_encoded_rawdata(
+                &m_encodedBundle))
         {
             LogDebug("Bundle data freed for new bundle data");
             m_encodedBundle = NULL;
index 1b23a96..7d183ce 100644 (file)
 
 class ApplicationData
 {
-    public:
-        bundle* getBundle() const;
-        const char* getEncodedBundle() const;
-        bool setBundle(bundle *originBundle);
-        bool setEncodedBundle(bundle* originBundle);
-        void freeBundle();
-        void freeEncodedBundle();
-
-    private:
-        ApplicationData();
-        ~ApplicationData();
-
-        bundle* m_originBundle;
-        bundle_raw* m_encodedBundle;
-
-        friend class DPL::Singleton<ApplicationData>;
+  public:
+    bundle* getBundle() const;
+    const char* getEncodedBundle() const;
+    bool setBundle(bundle *originBundle);
+    bool setEncodedBundle(bundle* originBundle);
+    void freeBundle();
+    void freeEncodedBundle();
+
+  private:
+    ApplicationData();
+    ~ApplicationData();
+
+    bundle* m_originBundle;
+    bundle_raw* m_encodedBundle;
+
+    friend class DPL::Singleton<ApplicationData>;
 };
 
 typedef DPL::Singleton<ApplicationData> ApplicationDataSingleton;
old mode 100755 (executable)
new mode 100644 (file)
index 8debb43..0212c81
@@ -42,15 +42,13 @@ const char * const SCHEME_TYPE_HTML5_VIDEO = "html5video";
 }
 
 ApplicationLauncher::ApplicationLauncher()
-{
-}
+{}
 
 ApplicationLauncher::~ApplicationLauncher()
-{
-}
+{}
 
 void ApplicationLauncher::OnEventReceived(
-        const ApplicationLauncherEvents::LaunchApplicationByAppService &event)
+    const ApplicationLauncherEvents::LaunchApplicationByAppService &event)
 {
     int result;
     bundle *args = event.GetArg0();
@@ -58,12 +56,13 @@ void ApplicationLauncher::OnEventReceived(
     void *userData = event.GetArg2();
     result = appsvc_run_service(args, 0, responseCallback, userData);
 
-    if (result < 0)
+    if (result < 0) {
         LogError("Failed to run AppService : " << result);
+    }
 }
 
 void ApplicationLauncher::OnEventReceived(
-        const ApplicationLauncherEvents::LaunchApplicationByPkgname &event)
+    const ApplicationLauncherEvents::LaunchApplicationByPkgname &event)
 {
     using namespace ApplicationLauncherPkgname;
     LogDebug("LaunchApplicationByPkgname");
@@ -162,7 +161,7 @@ void ApplicationLauncher::OnEventReceived(
             url = youtube->getYouTubeHD(uri.c_str());
             delete youtube;
         } else if (SCHEME_TYPE_RTSP == scheme ||
-                    (SCHEME_TYPE_HTML5_VIDEO == scheme))
+                   (SCHEME_TYPE_HTML5_VIDEO == scheme))
         {
             url = uri.c_str();
         } else {
index d33c5e7..d1eb925 100644 (file)
@@ -34,7 +34,7 @@
 
 namespace ApplicationLauncherEvents {
 DECLARE_GENERIC_EVENT_3(LaunchApplicationByAppService,
-                        bundle*,
+                        bundle *,
                         appsvc_res_fn,
                         void*)
 DECLARE_GENERIC_EVENT_4(LaunchApplicationByPkgname,
@@ -45,17 +45,20 @@ DECLARE_GENERIC_EVENT_4(LaunchApplicationByPkgname,
 } //namespace ApplicationLauncherEvents
 
 namespace ApplicationLauncherPkgname {
-    const std::string PKG_NAME_PREFIX = "com.samsung.";
-    const std::string PKG_NAME_DOWNLOAD_PROVIDER = PKG_NAME_PREFIX + "download-provider";
-    const std::string PKG_NAME_VIDEO_PLAYER = PKG_NAME_PREFIX + "video-player";
-    const std::string PKG_NAME_VT_MAIN = PKG_NAME_PREFIX + "vtmain";
+const std::string PKG_NAME_PREFIX = "com.samsung.";
+const std::string PKG_NAME_DOWNLOAD_PROVIDER = PKG_NAME_PREFIX +
+    "download-provider";
+const std::string PKG_NAME_VIDEO_PLAYER = PKG_NAME_PREFIX + "video-player";
+const std::string PKG_NAME_VT_MAIN = PKG_NAME_PREFIX + "vtmain";
 } // namespace ApplicationLauncherPkgname
 
 class ApplicationLauncher :
-        public DPL::Event::Controller<DPL::TypeListDecl<
-            ApplicationLauncherEvents::LaunchApplicationByPkgname,
-            ApplicationLauncherEvents::LaunchApplicationByAppService
-        >::Type>
+    public DPL::Event::Controller<DPL::TypeListDecl<
+                                      ApplicationLauncherEvents::
+                                          LaunchApplicationByPkgname,
+                                      ApplicationLauncherEvents::
+                                          LaunchApplicationByAppService
+                                      >::Type>
 {
   public:
     ApplicationLauncher();
@@ -64,10 +67,10 @@ class ApplicationLauncher :
 
   protected:
     virtual void OnEventReceived(
-            const ApplicationLauncherEvents::
+        const ApplicationLauncherEvents::
             LaunchApplicationByPkgname &event);
     virtual void OnEventReceived(
-            const ApplicationLauncherEvents::
+        const ApplicationLauncherEvents::
             LaunchApplicationByAppService &event);
 
   private:
index 087f99d..edc33d4 100644 (file)
@@ -17,7 +17,8 @@
  * @file        evas_object.cpp
  * @author      Lukasz Wrzosek (l.wrzosel@samsung.com)
  * @version     1.0
- * @brief       This file is the implementation for Evas_Object wrapper from Efl.
+ * @brief       This file is the implementation for Evas_Object wrapper from
+ * Efl.
  */
 
 #include "evas_object.h"
@@ -35,12 +36,11 @@ void EvasObject::IConnection::Disconnect()
 
 EvasObject::IConnection::IConnection(EvasObject::EvasObjectShared* object) :
     m_object(object)
-{
-}
+{}
 
 void EvasObject::IConnection::SmartCallbackWrapper(void* data,
-        Evas_Object* /*object*/,
-        void* event_info)
+                                                   Evas_Object* /*object*/,
+                                                   void* event_info)
 {
     Assert(data);
     IConnection* Calle = static_cast<IConnection*>(data);
@@ -48,9 +48,9 @@ void EvasObject::IConnection::SmartCallbackWrapper(void* data,
 }
 
 void EvasObject::IConnection::EvasCallbackWrapper(void* data,
-        Evas* /*evas*/,
-        Evas_Object* /*object*/,
-        void* event_info)
+                                                  Evas* /*evas*/,
+                                                  Evas_Object* /*object*/,
+                                                  void* event_info)
 {
     Assert(data);
     IConnection* Calle = static_cast<IConnection*>(data);
@@ -63,12 +63,11 @@ Evas_Object* EvasObject::EvasObjectShared::GetObject()
 }
 
 EvasObject::EvasObjectShared::SmartConnectionBase::SmartConnectionBase(
-        const std::string& name,
-        EvasObject::EvasObjectShared* object) :
+    const std::string& name,
+    EvasObject::EvasObjectShared* object) :
     IConnection(object),
     m_callbackName(name)
-{
-}
+{}
 
 void EvasObject::EvasObjectShared::SmartConnectionBase::ConnectPrv()
 {
@@ -85,12 +84,11 @@ void EvasObject::EvasObjectShared::SmartConnectionBase::DisconnectPrv()
 }
 
 EvasObject::EvasObjectShared::EvasConnectionBase::EvasConnectionBase(
-        Evas_Callback_Type type,
-        EvasObject::EvasObjectShared* object) :
+    Evas_Callback_Type type,
+    EvasObject::EvasObjectShared* object) :
     IConnection(object),
     m_callbackType(type)
-{
-}
+{}
 
 void EvasObject::EvasObjectShared::EvasConnectionBase::ConnectPrv()
 {
@@ -108,8 +106,7 @@ void EvasObject::EvasObjectShared::EvasConnectionBase::DisconnectPrv()
 
 EvasObject::EvasObjectShared::EvasObjectShared() :
     m_object(NULL)
-{
-}
+{}
 
 EvasObject::EvasObjectShared::EvasObjectShared(Evas_Object* object) :
     m_object(object)
@@ -166,9 +163,9 @@ void EvasObject::EvasObjectShared::DisconnectAll()
 }
 
 void EvasObject::EvasObjectShared::StaticOnDelEvent(void* data,
-        Evas* /*e*/,
-        Evas_Object* /*o*/,
-        void* /*ev*/)
+                                                    Evas* /*e*/,
+                                                    Evas_Object* /*o*/,
+                                                    void* /*ev*/)
 {
     Assert(data);
     EvasObjectShared* This = static_cast<EvasObjectShared*>(data);
@@ -183,23 +180,19 @@ void EvasObject::EvasObjectShared::StaticOnDelEvent(void* data,
 
 EvasObject::EvasObject() :
     m_object(new EvasObjectShared())
-{
-}
+{}
 
 EvasObject::EvasObject(Evas_Object* object) :
     m_object(new EvasObjectShared(object))
-{
-}
+{}
 
 EvasObject::EvasObject(const EvasObject& other) :
     m_object(other.m_object)
-{
-}
+{}
 
 //this destructor must be here to let pimpl with shared_ptr work without warning
 EvasObject::~EvasObject()
-{
-}
+{}
 
 EvasObject& EvasObject::operator=(const EvasObject& other)
 {
index 7f8585d..5073919 100644 (file)
@@ -49,17 +49,16 @@ class EvasObject
       private:
         IConnection(EvasObjectShared* object);
         virtual ~IConnection()
-        {
-        }
+        {}
         virtual void Call(void* /*event_info*/) = 0;
 
         static void SmartCallbackWrapper(void* data,
-                Evas_Object* /*object*/,
-                void* event_info);
+                                         Evas_Object* /*object*/,
+                                         void* event_info);
         static void EvasCallbackWrapper(void* data,
-                Evas* /*evas*/,
-                Evas_Object* /*object*/,
-                void* event_info);
+                                        Evas* /*evas*/,
+                                        Evas_Object* /*object*/,
+                                        void* event_info);
 
         virtual void ConnectPrv() = 0;
         virtual void DisconnectPrv() = 0;
@@ -82,7 +81,7 @@ class EvasObject
         {
           public:
             SmartConnectionBase(const std::string& name,
-                    EvasObjectShared* object);
+                                EvasObjectShared* object);
 
             virtual void ConnectPrv();
             virtual void DisconnectPrv();
@@ -98,18 +97,16 @@ class EvasObject
                                    Args ... args);
 
             SmartConnection(const std::string& name,
-                    CbType callback,
-                    EvasObjectShared* object,
-                    Args ... args) :
+                            CbType callback,
+                            EvasObjectShared* object,
+                            Args ... args) :
                 SmartConnectionBase(name, object),
                 m_callback(callback),
                 m_args(args ...)
-            {
-            }
+            {}
 
             virtual ~SmartConnection()
-            {
-            }
+            {}
 
             virtual void Call(void* event_info)
             {
@@ -133,20 +130,18 @@ class EvasObject
                                              void* event_info, ArgType1 *arg1);
 
             SmartMemberConnection1(const std::string& name,
-                    CbType callback,
-                    ThisType* callee,
-                    ArgType1* arg1,
-                    EvasObjectShared* object) :
+                                   CbType callback,
+                                   ThisType* callee,
+                                   ArgType1* arg1,
+                                   EvasObjectShared* object) :
                 SmartConnectionBase(name, object),
                 m_callback(callback),
                 m_callee(callee),
                 m_arg1(arg1)
-            {
-            }
+            {}
 
             virtual ~SmartMemberConnection1()
-            {
-            }
+            {}
 
             virtual void Call(void* event_info)
             {
@@ -168,22 +163,20 @@ class EvasObject
                                              ArgType2* arg2);
 
             SmartMemberConnection2(const std::string& name,
-                    CbType callback,
-                    ThisType* callee,
-                    ArgType1* arg1,
-                    ArgType2* arg2,
-                    EvasObjectShared* object) :
+                                   CbType callback,
+                                   ThisType* callee,
+                                   ArgType1* arg1,
+                                   ArgType2* arg2,
+                                   EvasObjectShared* object) :
                 SmartConnectionBase(name, object),
                 m_callback(callback),
                 m_callee(callee),
                 m_arg1(arg1),
                 m_arg2(arg2)
-            {
-            }
+            {}
 
             virtual ~SmartMemberConnection2()
-            {
-            }
+            {}
 
             virtual void Call(void* event_info)
             {
@@ -201,7 +194,7 @@ class EvasObject
         {
           public:
             EvasConnectionBase(Evas_Callback_Type type,
-                    EvasObjectShared* object);
+                               EvasObjectShared* object);
 
             virtual void ConnectPrv();
             virtual void DisconnectPrv();
@@ -217,18 +210,16 @@ class EvasObject
                                    ArgType1 *arg1);
 
             EvasConnection1(Evas_Callback_Type type,
-                    CbType callback,
-                    ArgType1* arg1,
-                    EvasObjectShared* object) :
+                            CbType callback,
+                            ArgType1* arg1,
+                            EvasObjectShared* object) :
                 EvasConnectionBase(type, object),
                 m_callback(callback),
                 m_arg1(arg1)
-            {
-            }
+            {}
 
             virtual ~EvasConnection1()
-            {
-            }
+            {}
 
             virtual void Call(void* event_info)
             {
@@ -248,20 +239,18 @@ class EvasObject
                                    ArgType1 *arg1, ArgType2 *arg2);
 
             EvasConnection2(Evas_Callback_Type type,
-                    CbType callback,
-                    ArgType1* arg1,
-                    ArgType2* arg2,
-                    EvasObjectShared* object) :
+                            CbType callback,
+                            ArgType1* arg1,
+                            ArgType2* arg2,
+                            EvasObjectShared* object) :
                 EvasConnectionBase(type, object),
                 m_callback(callback),
                 m_arg1(arg1),
                 m_arg2(arg2)
-            {
-            }
+            {}
 
             virtual ~EvasConnection2()
-            {
-            }
+            {}
 
             virtual void Call(void* event_info)
             {
@@ -282,20 +271,18 @@ class EvasObject
                                              void* event_info, ArgType1 *arg1);
 
             EvasMemberConnection1(Evas_Callback_Type type,
-                    CbType callback,
-                    ThisType* callee,
-                    ArgType1* arg1,
-                    EvasObjectShared* object) :
+                                  CbType callback,
+                                  ThisType* callee,
+                                  ArgType1* arg1,
+                                  EvasObjectShared* object) :
                 EvasConnectionBase(type, object),
                 m_callback(callback),
                 m_callee(callee),
                 m_arg1(arg1)
-            {
-            }
+            {}
 
             virtual ~EvasMemberConnection1()
-            {
-            }
+            {}
 
             virtual void Call(void* event_info)
             {
@@ -317,22 +304,20 @@ class EvasObject
                                              ArgType2* arg2);
 
             EvasMemberConnection2(Evas_Callback_Type type,
-                    CbType callback,
-                    ThisType* callee,
-                    ArgType1* arg1,
-                    ArgType2* arg2,
-                    EvasObjectShared* object) :
+                                  CbType callback,
+                                  ThisType* callee,
+                                  ArgType1* arg1,
+                                  ArgType2* arg2,
+                                  EvasObjectShared* object) :
                 EvasConnectionBase(type, object),
                 m_callback(callback),
                 m_callee(callee),
                 m_arg1(arg1),
                 m_arg2(arg2)
-            {
-            }
+            {}
 
             virtual ~EvasMemberConnection2()
-            {
-            }
+            {}
 
             virtual void Call(void* event_info)
             {
@@ -352,9 +337,11 @@ class EvasObject
         ~EvasObjectShared();
 
         template<typename ... Args>
-        IConnection* ConnectSmartCallback(const char* callbackName,
-                typename SmartConnection<Args ...>::CbType callback,
-                Args ... args)
+        IConnection* ConnectSmartCallback(
+            const char* callbackName,
+            typename SmartConnection<Args ...>::
+                CbType callback,
+            Args ... args)
         {
             Assert(m_object);
             Assert(callbackName);
@@ -371,12 +358,12 @@ class EvasObject
 
         template <class ThisType, class ArgType1, class ArgType2>
         IConnection* ConnectMemberSmartCallback(
-                const char* callbackName,
-                typename SmartMemberConnection2<ThisType, ArgType1,
-                                                ArgType2>::CbType callback,
-                ThisType* callee,
-                ArgType1* arg1,
-                ArgType2* arg2)
+            const char* callbackName,
+            typename SmartMemberConnection2<ThisType, ArgType1,
+                                            ArgType2>::CbType callback,
+            ThisType* callee,
+            ArgType1* arg1,
+            ArgType2* arg2)
         {
             Assert(m_object);
             Assert(callee);
@@ -397,11 +384,11 @@ class EvasObject
 
         template <class ThisType, class ArgType1>
         IConnection* ConnectMemberSmartCallback(
-                const char* callbackName,
-                typename SmartMemberConnection1<ThisType,
-                                                ArgType1>::CbType callback,
-                ThisType* callee,
-                ArgType1* arg1)
+            const char* callbackName,
+            typename SmartMemberConnection1<ThisType,
+                                            ArgType1>::CbType callback,
+            ThisType* callee,
+            ArgType1* arg1)
         {
             Assert(m_object);
             Assert(callee);
@@ -420,9 +407,11 @@ class EvasObject
 
         template <class ArgType1, class ArgType2>
         IConnection* ConnectEvasCallback(Evas_Callback_Type callbackType,
-                typename EvasConnection2<ArgType1, ArgType2>::CbType callback,
-                ArgType1* arg1,
-                ArgType2* arg2)
+                                         typename EvasConnection2<ArgType1,
+                                                                  ArgType2>::
+                                             CbType callback,
+                                         ArgType1* arg1,
+                                         ArgType2* arg2)
         {
             Assert(m_object);
             Assert(callbackType);
@@ -439,9 +428,11 @@ class EvasObject
         }
 
         template <class ArgType1>
-        IConnection* ConnectEvasCallback(Evas_Callback_Type callbackType,
-                typename EvasConnection1<ArgType1>::CbType callback,
-                ArgType1* arg1)
+        IConnection* ConnectEvasCallback(
+            Evas_Callback_Type callbackType,
+            typename EvasConnection1<ArgType1>::
+                CbType callback,
+            ArgType1* arg1)
         {
             Assert(m_object);
             Assert(callbackType);
@@ -458,12 +449,12 @@ class EvasObject
 
         template <class ThisType, class ArgType1, class ArgType2>
         IConnection* ConnectMemberEvasCallback(
-                Evas_Callback_Type callbackType,
-                typename EvasMemberConnection2<ThisType, ArgType1,
-                                               ArgType2>::CbType callback,
-                ThisType* callee,
-                ArgType1* arg1,
-                ArgType2* arg2)
+            Evas_Callback_Type callbackType,
+            typename EvasMemberConnection2<ThisType, ArgType1,
+                                           ArgType2>::CbType callback,
+            ThisType* callee,
+            ArgType1* arg1,
+            ArgType2* arg2)
         {
             Assert(m_object);
             Assert(callee);
@@ -484,11 +475,11 @@ class EvasObject
 
         template <class ThisType, class ArgType1>
         IConnection* ConnectMemberEvasCallback(
-                Evas_Callback_Type callbackType,
-                typename EvasMemberConnection1<ThisType,
-                                               ArgType1>::CbType callback,
-                ThisType* callee,
-                ArgType1* arg1)
+            Evas_Callback_Type callbackType,
+            typename EvasMemberConnection1<ThisType,
+                                           ArgType1>::CbType callback,
+            ThisType* callee,
+            ArgType1* arg1)
         {
             Assert(m_object);
             Assert(callee);
@@ -509,9 +500,9 @@ class EvasObject
         void DisconnectAll();
 
         static void StaticOnDelEvent(void* data,
-                Evas* /*e*/,
-                Evas_Object* /*o*/,
-                void* /*ev*/);
+                                     Evas* /*e*/,
+                                     Evas_Object* /*o*/,
+                                     void* /*ev*/);
 
         IConnectionsSet m_connections;
         Evas_Object* m_object;
@@ -539,10 +530,10 @@ class EvasObject
 
     template <class ... Args>
     IConnection* ConnectSmartCallback(
-            const char* callbackName,
-            typename EvasObjectShared::SmartConnection<Args ...>::CbType
-            callback,
-            Args ... args)
+        const char* callbackName,
+        typename EvasObjectShared::SmartConnection<Args ...>::CbType
+        callback,
+        Args ... args)
     {
         Assert(m_object);
         return m_object->ConnectSmartCallback(callbackName, callback, args ...);
@@ -550,14 +541,14 @@ class EvasObject
 
     template <class ThisType, class ArgType1, class ArgType2>
     IConnection* ConnectMemberSmartCallback(
-            const char* callbackName,
-            typename EvasObjectShared::SmartMemberConnection2<ThisType,
-                                                              ArgType1,
-                                                              ArgType2>::CbType
-            callback,
-            ThisType* callee,
-            ArgType1* arg1,
-            ArgType2* arg2)
+        const char* callbackName,
+        typename EvasObjectShared::SmartMemberConnection2<ThisType,
+                                                          ArgType1,
+                                                          ArgType2>::CbType
+        callback,
+        ThisType* callee,
+        ArgType1* arg1,
+        ArgType2* arg2)
     {
         Assert(m_object);
         Assert(callee);
@@ -571,12 +562,12 @@ class EvasObject
 
     template <class ThisType, class ArgType1>
     IConnection* ConnectMemberSmartCallback(
-            const char* callbackName,
-            typename EvasObjectShared::SmartMemberConnection1<ThisType,
-                                                              ArgType1>::CbType
-            callback,
-            ThisType* callee,
-            ArgType1* arg1)
+        const char* callbackName,
+        typename EvasObjectShared::SmartMemberConnection1<ThisType,
+                                                          ArgType1>::CbType
+        callback,
+        ThisType* callee,
+        ArgType1* arg1)
     {
         Assert(m_object);
         Assert(callee);
@@ -589,11 +580,11 @@ class EvasObject
 
     template <class ArgType1, class ArgType2>
     IConnection* ConnectEvasCallback(
-            Evas_Callback_Type callbackType,
-            typename EvasObjectShared::EvasConnection1<ArgType1>::CbType
-            callback,
-            ArgType1* arg1,
-            ArgType2* arg2)
+        Evas_Callback_Type callbackType,
+        typename EvasObjectShared::EvasConnection1<ArgType1>::CbType
+        callback,
+        ArgType1* arg1,
+        ArgType2* arg2)
     {
         Assert(m_object);
         return m_object->ConnectEvasCallback(callbackType, callback, arg1, arg2);
@@ -601,10 +592,10 @@ class EvasObject
 
     template <class ArgType1>
     IConnection* ConnectEvasCallback(
-            Evas_Callback_Type callbackType,
-            typename EvasObjectShared::EvasConnection1<ArgType1>::CbType
-            callback,
-            ArgType1* arg1)
+        Evas_Callback_Type callbackType,
+        typename EvasObjectShared::EvasConnection1<ArgType1>::CbType
+        callback,
+        ArgType1* arg1)
     {
         Assert(m_object);
         return m_object->ConnectEvasCallback(callbackType, callback, arg1);
@@ -612,12 +603,12 @@ class EvasObject
 
     template <class ThisType, class ArgType1>
     IConnection* ConnectMemberEvasCallback(
-            Evas_Callback_Type callbackType,
-            typename EvasObjectShared::EvasMemberConnection1<ThisType,
-                                                             ArgType1>::CbType
-            callback,
-            ThisType* callee,
-            ArgType1* arg1)
+        Evas_Callback_Type callbackType,
+        typename EvasObjectShared::EvasMemberConnection1<ThisType,
+                                                         ArgType1>::CbType
+        callback,
+        ThisType* callee,
+        ArgType1* arg1)
     {
         Assert(m_object);
         Assert(callee);
@@ -630,13 +621,13 @@ class EvasObject
 
     template <class ThisType, class ArgType1, class ArgType2>
     IConnection* ConnectMemberEvasCallback(
-            Evas_Callback_Type callbackType,
-            typename EvasObjectShared::EvasMemberConnection2<ThisType, ArgType1,
-                                                             ArgType2>::CbType
-            callback,
-            ThisType* callee,
-            ArgType1* arg1,
-            ArgType2* arg2)
+        Evas_Callback_Type callbackType,
+        typename EvasObjectShared::EvasMemberConnection2<ThisType, ArgType1,
+                                                         ArgType2>::CbType
+        callback,
+        ThisType* callee,
+        ArgType1* arg1,
+        ArgType2* arg2)
     {
         Assert(m_object);
         Assert(callee);
index b366190..7539c10 100644 (file)
 #include <dpl/log/log.h>
 
 namespace ViewModule {
-
 namespace {
-
 const char * const type2name[Scheme::COUNT] = {
-        "file",
-        "sms",
-        "mmsto",
-        "mailto",
-        "data",
-        "tel",
-        "http",
-        "https",
-        "widget",
-        "vnd.youtube",
-        "rtsp" };
+    "file",
+    "sms",
+    "mmsto",
+    "mailto",
+    "data",
+    "tel",
+    "http",
+    "https",
+    "widget",
+    "vnd.youtube",
+    "rtsp"
+};
 
 typedef std::map<std::string, Scheme::Type> SchemeMap;
 
@@ -46,7 +45,7 @@ SchemeMap PopulateMap()
 {
     LogInfo("Populating scheme map...");
     SchemeMap map;
-    for(size_t st = Scheme::FILE; st<Scheme::COUNT;++st) {
+    for (size_t st = Scheme::FILE; st < Scheme::COUNT; ++st) {
         LogInfo(" * " << type2name[st] << "->" << st);
         map[type2name[st]] = static_cast<Scheme::Type>(st);
     }
@@ -54,10 +53,10 @@ SchemeMap PopulateMap()
 }
 
 const SchemeMap name2type = PopulateMap();
-
 } // namespace
 
-Scheme::Scheme(const std::string& name) : m_name(name), m_type(INVALID) {
+Scheme::Scheme(const std::string& name) : m_name(name), m_type(INVALID)
+{
     m_type = GetType(name);
 }
 
@@ -70,11 +69,10 @@ std::string Scheme::GetName (Type type)
 Scheme::Type Scheme::GetType(const std::string& name)
 {
     auto it = name2type.find(name);
-    if(it == name2type.end()) {
+    if (it == name2type.end()) {
         LogError("Invalid scheme: " << name);
         return INVALID;
     }
     return it->second;
 }
-
 } /* namespace ViewModule */
index 5bc5729..e004efa 100644 (file)
@@ -25,9 +25,9 @@
 #include <string>
 
 namespace ViewModule {
-
-class Scheme {
-public:
+class Scheme
+{
+  public:
     enum Type {
         INVALID = -1,
         FILE = 0,
@@ -48,8 +48,14 @@ public:
     explicit Scheme(const std::string& name);
     virtual ~Scheme() {}
 
-    std::string GetName() const { return m_name; }
-    Type GetType() const { return m_type; }
+    std::string GetName() const
+    {
+        return m_name;
+    }
+    Type GetType() const
+    {
+        return m_type;
+    }
 
     static std::string GetName (Type type);
     static std::string GetName (size_t type)
@@ -58,10 +64,9 @@ public:
     }
     static Type GetType(const std::string& name);
 
-private:
+  private:
     std::string m_name;
     Type m_type;
 };
-
 } /* namespace ViewModule */
 #endif /* SCHEME_H_ */
index 2d2a46a..d27d13a 100644 (file)
@@ -31,9 +31,7 @@
 #include "scheme_action_map_data.h"
 
 namespace ViewModule {
-
 namespace {
-
 /*
  * Lazy construction pattern.
  * TODO Make it more general. Use variadic template/tuples/lambdas or sth. Move
@@ -42,22 +40,32 @@ namespace {
 template <typename T, typename Arg1>
 class Lazy
 {
-public:
+  public:
     explicit Lazy(const Arg1& arg1) :
         m_arg1(arg1),
         m_object(new std::unique_ptr<T>())
-    {
-    }
+    {}
     Lazy(const Lazy<T, Arg1>& other) :
         m_arg1(other.m_arg1),
         m_object(other.m_object)
+    {}
+
+    T& operator*()
     {
+        return GetObject();
+    }
+    const T& operator*() const
+    {
+        return GetObject();
+    }
+    const T* operator->() const
+    {
+        return &GetObject();
+    }
+    T* operator->()
+    {
+        return &GetObject();
     }
-
-    T& operator*()  { return GetObject(); }
-    const T& operator*() const { return GetObject(); }
-    const T* operator->() const  { return &GetObject(); }
-    T* operator->() { return &GetObject(); }
 
     Lazy<T, Arg1>& operator=(const Lazy<T, Arg1>& other)
     {
@@ -65,7 +73,8 @@ public:
         m_object = other.m_object;
         return *this;
     }
-private:
+
+  private:
     T& GetObject() const
     {
         if (!(*m_object)) {
@@ -84,12 +93,12 @@ private:
  * sms:5551212?body=expected%20text => APPSVC_DATA_TEXT + expected%20text
  */
 struct AppSvcConversion {
-    AppSvcConversion(char const * const keyValue, const std::string& regexStr):
+    AppSvcConversion(char const * const keyValue,
+                     const std::string& regexStr) :
         key(keyValue),
-        regex(regexStr) {
-    }
+        regex(regexStr) {}
     char const * const key;
-    Lazy<pcrecpp::RE,std::string> regex;
+    Lazy<pcrecpp::RE, std::string> regex;
 };
 
 /*
@@ -106,14 +115,14 @@ typedef std::map<Scheme::Type, AppSvcOperation> AppSvcOperationMap;
 
 // Regular expressions used to extract appsvc data from scheme
 // TODO what about multiple recipients?
-char const * const REGEX_BODY =         ".*[?&]body=([^&]+).*";
-char const * const REGEX_SMS =           "sms:([^&]+).*";
-char const * const REGEX_MMSTO =        "mmsto:([^&]+).*";
-char const * const REGEX_MAILTO =       "mailto:([^&]+).*";
-char const * const REGEX_TO =           ".*[?&]to=([^&]+).*";
-char const * const REGEX_CC =           ".*[?&]cc=([^&]+).*";
-char const * const REGEX_BCC =          ".*[?&]bcc=([^&]+).*";
-char const * const REGEX_SUBJECT =      ".*[?&]subject=([^&]+).*";
+char const * const REGEX_BODY = ".*[?&]body=([^&]+).*";
+char const * const REGEX_SMS = "sms:([^&]+).*";
+char const * const REGEX_MMSTO = "mmsto:([^&]+).*";
+char const * const REGEX_MAILTO = "mailto:([^&]+).*";
+char const * const REGEX_TO = ".*[?&]to=([^&]+).*";
+char const * const REGEX_CC = ".*[?&]cc=([^&]+).*";
+char const * const REGEX_BCC = ".*[?&]bcc=([^&]+).*";
+char const * const REGEX_SUBJECT = ".*[?&]subject=([^&]+).*";
 char const * const REGEX_DATA_CONTEXT = ".*;phone-context=([^:]+).*";
 
 AppSvcOperationMap initializeAppSvcOperations()
@@ -145,11 +154,11 @@ AppSvcOperationMap initializeAppSvcOperations()
     sendOp.conversions.push_back(AppSvcConversion(APPSVC_DATA_TO, REGEX_MAILTO));
     sendOp.conversions.push_back(AppSvcConversion(APPSVC_DATA_CC, REGEX_CC));
     sendOp.conversions.push_back(
-            AppSvcConversion(APPSVC_DATA_BCC, REGEX_BCC));
+        AppSvcConversion(APPSVC_DATA_BCC, REGEX_BCC));
     sendOp.conversions.push_back(
-            AppSvcConversion(APPSVC_DATA_SUBJECT, REGEX_SUBJECT));
+        AppSvcConversion(APPSVC_DATA_SUBJECT, REGEX_SUBJECT));
     sendOp.conversions.push_back(
-            AppSvcConversion(APPSVC_DATA_TEXT, REGEX_BODY));
+        AppSvcConversion(APPSVC_DATA_TEXT, REGEX_BODY));
     ret.insert(std::make_pair(Scheme::MMSTO, sendOp));
     ret.insert(std::make_pair(Scheme::MAILTO, sendOp));
 
@@ -167,12 +176,9 @@ AppSvcOperationMap initializeAppSvcOperations()
 }
 
 AppSvcOperationMap g_appSvcOperationMap = initializeAppSvcOperations();
-
 } // namespace
 
-
 namespace SchemeActionMap {
-
 bool HandleUri(const char* uri,
                NavigationContext context,
                WrtDB::AppType appType)
@@ -262,29 +268,27 @@ bool HandleUri(const char* uri,
 
         // TODO do we need a callback?
         CONTROLLER_POST_EVENT(
-                ApplicationLauncher,
-                ApplicationLauncherEvents::LaunchApplicationByAppService(
-                        bundleData,
-                        NULL,
-                        NULL));
+            ApplicationLauncher,
+            ApplicationLauncherEvents::LaunchApplicationByAppService(
+                bundleData,
+                NULL,
+                NULL));
         break;
     }
 
     case URI_ACTION_VIDEO:
         CONTROLLER_POST_EVENT(
-                ApplicationLauncher,
-                ApplicationLauncherEvents::LaunchApplicationByPkgname(
-                        ApplicationLauncherPkgname::PKG_NAME_VIDEO_PLAYER,
-                        name,
-                        uri,
-                        "null"));
+            ApplicationLauncher,
+            ApplicationLauncherEvents::LaunchApplicationByPkgname(
+                ApplicationLauncherPkgname::PKG_NAME_VIDEO_PLAYER,
+                name,
+                uri,
+                "null"));
         break;
     default:
         break;
     }
     return (action == URI_ACTION_WRT);
 }
-
 } // namespace SchemeActionMap
-
 } /* namespace ViewModule */
index 558693d..029d3e8 100644 (file)
 #include <dpl/wrt-dao-ro/common_dao_types.h>
 
 namespace ViewModule {
-
 namespace SchemeActionMap {
-    bool HandleUri(const char* uri, NavigationContext context, WrtDB::AppType appType);
+bool HandleUri(const char* uri,
+               NavigationContext context,
+               WrtDB::AppType appType);
 };
-
 } /* namespace ViewModule */
 #endif /* SCHEME_ACTION_MAP_H_ */
index 6710222..3a13f31 100644 (file)
@@ -23,9 +23,7 @@
 #include <scheme.h>
 
 namespace ViewModule {
-
 namespace {
-
 enum UriAction {
     URI_ACTION_WRT,       // load in WRT
     URI_ACTION_APPSVC,    // launch in APPSVC
@@ -61,38 +59,34 @@ enum UriAction {
 
 // TIZEN
 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},   // MMSTO
-    {URI_ACTION_APPSVC, URI_ACTION_APPSVC,  URI_ACTION_APPSVC},   // MAILTO
-    {URI_ACTION_WRT,    URI_ACTION_WRT,     URI_ACTION_WRT},   // DATA
-    {URI_ACTION_APPSVC, URI_ACTION_APPSVC,  URI_ACTION_APPSVC},   // TEL
-    {URI_ACTION_WRT,    URI_ACTION_WRT,     URI_ACTION_WRT},      // HTTP
-    {URI_ACTION_WRT,    URI_ACTION_WRT,     URI_ACTION_WRT},      // HTTPS
-    {URI_ACTION_WRT,    URI_ACTION_WRT,     URI_ACTION_WRT},      // WIDGET
-    {URI_ACTION_VIDEO,  URI_ACTION_VIDEO,   URI_ACTION_VIDEO},    // YOUTUBE
-    {URI_ACTION_VIDEO,  URI_ACTION_VIDEO,   URI_ACTION_VIDEO}     // RTSP
+    //  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 },  // MMSTO
+    { URI_ACTION_APPSVC, URI_ACTION_APPSVC, URI_ACTION_APPSVC },  // MAILTO
+    { URI_ACTION_WRT, URI_ACTION_WRT, URI_ACTION_WRT },        // DATA
+    { URI_ACTION_APPSVC, URI_ACTION_APPSVC, URI_ACTION_APPSVC },  // TEL
+    { URI_ACTION_WRT, URI_ACTION_WRT, URI_ACTION_WRT },           // HTTP
+    { URI_ACTION_WRT, URI_ACTION_WRT, URI_ACTION_WRT },           // HTTPS
+    { URI_ACTION_WRT, URI_ACTION_WRT, URI_ACTION_WRT },           // WIDGET
+    { URI_ACTION_VIDEO, URI_ACTION_VIDEO, URI_ACTION_VIDEO },     // YOUTUBE
+    { URI_ACTION_VIDEO, URI_ACTION_VIDEO, URI_ACTION_VIDEO }      // RTSP
 };
 
 // WAC
 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},   // MMSTO
-    {URI_ACTION_APPSVC, URI_ACTION_APPSVC,  URI_ACTION_APPSVC},   // MAILTO
-    {URI_ACTION_WRT,    URI_ACTION_WRT,     URI_ACTION_WRT},   // DATA
-    {URI_ACTION_APPSVC, URI_ACTION_APPSVC,  URI_ACTION_APPSVC},   // TEL
-    {URI_ACTION_APPSVC, URI_ACTION_WRT,     URI_ACTION_APPSVC},   // HTTP
-    {URI_ACTION_APPSVC, URI_ACTION_WRT,     URI_ACTION_APPSVC},   // HTTPS
-    {URI_ACTION_WRT,    URI_ACTION_WRT,     URI_ACTION_APPSVC},   // WIDGET
-    {URI_ACTION_VIDEO,  URI_ACTION_VIDEO,   URI_ACTION_VIDEO},    // YOUTUBE
-    {URI_ACTION_VIDEO,  URI_ACTION_VIDEO,   URI_ACTION_VIDEO}     // RTSP
+    //  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 },  // MMSTO
+    { URI_ACTION_APPSVC, URI_ACTION_APPSVC, URI_ACTION_APPSVC },  // MAILTO
+    { URI_ACTION_WRT, URI_ACTION_WRT, URI_ACTION_WRT },        // DATA
+    { URI_ACTION_APPSVC, URI_ACTION_APPSVC, URI_ACTION_APPSVC },  // TEL
+    { URI_ACTION_APPSVC, URI_ACTION_WRT, URI_ACTION_APPSVC },     // HTTP
+    { URI_ACTION_APPSVC, URI_ACTION_WRT, URI_ACTION_APPSVC },     // HTTPS
+    { URI_ACTION_WRT, URI_ACTION_WRT, URI_ACTION_APPSVC },        // WIDGET
+    { URI_ACTION_VIDEO, URI_ACTION_VIDEO, URI_ACTION_VIDEO },     // YOUTUBE
+    { URI_ACTION_VIDEO, URI_ACTION_VIDEO, URI_ACTION_VIDEO }      // RTSP
 };
-
 }
-
 }
index 05e3bb7..334e01e 100644 (file)
 
 namespace ViewModule {
 namespace SchemeActionMap {
-    enum NavigationContext {
-        TOP_LEVEL = 0,
-        FRAME_LEVEL,
-        NEW_WINDOW,
+enum NavigationContext {
+    TOP_LEVEL = 0,
+    FRAME_LEVEL,
+    NEW_WINDOW,
 
-        COUNT
-    };
+    COUNT
+};
 } // namespace SchemeActionMap
 } // namespace ViewModule
 #endif /* SCHEME_ACTION_MAP_TYPE_H_ */
index 84e48c0..9aeafd1 100644 (file)
@@ -28,7 +28,6 @@
 #include <application_launcher.h>
 
 namespace ViewModule {
-
 namespace {
 const char* const SCHEME_TYPE_HTML5_VIDEO = "html5video";
 const char* const HTTP_STREAMING_MPEG_MIMETYPE = "application/x-mpegurl";
@@ -52,8 +51,7 @@ class AppsSupportImplementation
     AppsSupportImplementation() :
         m_widgetModel(NULL),
         m_initialized(false)
-    {
-    }
+    {}
 
     ~AppsSupportImplementation()
     {
@@ -72,7 +70,7 @@ class AppsSupportImplementation
         ApplicationLauncherSingleton::Instance().Touch();
 
         ApplicationLauncherSingleton::Instance().setWidgetTizenId(
-                DPL::ToUTF8String(m_widgetModel->TizenId));
+            DPL::ToUTF8String(m_widgetModel->TizenId));
 
         LogDebug("Initialized");
         m_initialized = true;
@@ -144,8 +142,8 @@ class AppsSupportImplementation
 
         // ignore case match of string of mime type
         int isAppServiceable = httpMultimediaRequest(
-            mimeType ? std::string(mimeType) : "null",
-            url ? std::string(url) : "null");
+                mimeType ? std::string(mimeType) : "null",
+                url ? std::string(url) : "null");
 
         if (isAppServiceable) {
             LogInfo("Application Service start");
@@ -183,13 +181,11 @@ class AppsSupportImplementation
     }
 };
 
-AppsSupport::AppsSupport(): m_impl(new AppsSupportImplementation)
-{
-}
+AppsSupport::AppsSupport() : m_impl(new AppsSupportImplementation)
+{}
 
 AppsSupport::~AppsSupport()
-{
-}
+{}
 
 void AppsSupport::initialize(WidgetModel *widgetModel)
 {
@@ -212,5 +208,4 @@ void AppsSupport::downloadRequest(const char *url,
 {
     m_impl->downloadRequest(url, mimeType, userParam);
 }
-
-}//namespace
+} //namespace
index a84a671..aeb89fc 100644 (file)
@@ -28,7 +28,6 @@
 class WidgetModel; //Forward declaration
 
 namespace ViewModule {
-
 class AppsSupportImplementation; //Forward declaration
 
 class AppsSupport
@@ -41,14 +40,13 @@ class AppsSupport
     void deinitialize();
     void html5VideoRequest(void* event_info);
     void downloadRequest(
-            const char *url,
-            const char *mimeType,
-            const char *userParam);
+        const char *url,
+        const char *mimeType,
+        const char *userParam);
 
   private:
     std::unique_ptr<AppsSupportImplementation> m_impl;
 };
-
 } //namespace
 
 #endif /* VIEW_LOGIC_APPS_SUPPORT_H_ */
index 3d573d8..3c4b90b 100644 (file)
@@ -33,7 +33,6 @@ const std::string LANGUAGE_EN = "en";
 
 namespace ViewModule {
 namespace CustomHeaderSupport {
-
 std::string getValueByField(const std::string field)
 {
     LogDebug("Field : " << field);
index 4e7c386..8b82b18 100644 (file)
@@ -26,9 +26,9 @@
 
 namespace ViewModule {
 namespace CustomHeaderSupport {
-    const std::string ACCEPT_LANGUAGE = "Accept-Language";
+const std::string ACCEPT_LANGUAGE = "Accept-Language";
 
-    std::string getValueByField(const std::string field);
+std::string getValueByField(const std::string field);
 } // namespace UserAgentSupport
 } // namespace CustomHeaderSupport
 
index 45475f6..0dad918 100644 (file)
@@ -35,27 +35,25 @@ const char * const GEOLOCATION_ASK_MSG =
 
 namespace ViewModule {
 namespace GeolocationSupport {
-
 bool askUserForPermission()
 {
     return Wrt::Popup::PopupInvoker().askYesNo(
-        GEOLOCATION_ASK_TITLE,
-        GEOLOCATION_ASK_MSG);
+               GEOLOCATION_ASK_TITLE,
+               GEOLOCATION_ASK_MSG);
 }
 
 bool checkRequestedStateOfGeolocationFeature(WrtDB::WidgetDAOReadOnlyPtr dao)
 {
     WrtDB::DbWidgetFeature geolocationFeature;
     geolocationFeature.name = DPL::FromASCIIString(
-        WrtDB::GlobalConfig::GetW3CGeolocationFeatureName() );
+            WrtDB::GlobalConfig::GetW3CGeolocationFeatureName() );
 
     auto features = dao->getFeaturesList();
 
     auto it = features.find(geolocationFeature);
 
-    if ( it != features.end() )
-    {
-        if(it->rejected){
+    if (it != features.end() ) {
+        if (it->rejected) {
             LogInfo("Feature rejected by ACE");
             return false;
         }
@@ -67,34 +65,31 @@ bool checkRequestedStateOfGeolocationFeature(WrtDB::WidgetDAOReadOnlyPtr dao)
 
 bool getLocalizationState(const DPL::String& tizenId, bool enableHighAccuracy)
 {
-    LogDebug ("Get localization state");
+    LogDebug("Get localization state");
 
     WrtDB::WidgetDAOReadOnlyPtr dao(new WrtDB::WidgetDAOReadOnly(tizenId));
 
-    if (dao->getWidgetType() == WrtDB::APP_TYPE_TIZENWEBAPP)
-    {
+    if (dao->getWidgetType() == WrtDB::APP_TYPE_TIZENWEBAPP) {
         return askUserForPermission();
     }
 
     return checkRequestedStateOfGeolocationFeature(dao) &&
-        ViewModule::SecuritySupport::geolocationACECheck(tizenId,
-            enableHighAccuracy);
+           ViewModule::SecuritySupport::geolocationACECheck(tizenId,
+                                                            enableHighAccuracy);
 }
 
 bool getGeolocationModuleState(const DPL::String& tizenId)
 {
-    LogDebug ("Get geolocation state");
+    LogDebug("Get geolocation state");
 
     WrtDB::WidgetDAOReadOnlyPtr dao(new WrtDB::WidgetDAOReadOnly(tizenId));
 
-    if (dao->getWidgetType() == WrtDB::APP_TYPE_TIZENWEBAPP)
-    {
+    if (dao->getWidgetType() == WrtDB::APP_TYPE_TIZENWEBAPP) {
         LogInfo("Geolocation enable for tizen app");
         return true;
     }
 
     return checkRequestedStateOfGeolocationFeature(dao);
 }
-
 } // namespace GeolocationSupport
 } // namespace ViewModule
index 3802223..c290058 100644 (file)
@@ -25,7 +25,6 @@
 
 namespace ViewModule {
 namespace GeolocationSupport {
-
 /*
  * @returns true if user allowed for share current position
  * @returns false otherwise
@@ -35,11 +34,12 @@ bool getLocalizationState(const DPL::String& tizenId, bool enableHighAccuracy);
 /*
  * The function returns requested state of geolocation module
  *
- * @returns true if geolocation module(navigator.geolocation object) should be enabled
- *          false if geolocation module(navigator.geolocation object) should be disabled
+ * @returns true if geolocation module(navigator.geolocation object) should be
+ * enabled
+ *          false if geolocation module(navigator.geolocation object) should be
+ * disabled
  */
 bool getGeolocationModuleState(const DPL::String& tizenId);
-
 }
 } // namespace ViewModule
 
index 1777fa2..95bad28 100644 (file)
 
 namespace ViewModule {
 namespace PasswordSupport {
-
 namespace {
 const char *SCHEME_TYPE_HTTP = "http";
 const char *SCHEME_TYPE_HTTPS = "https";
-const char *AUTOSAVEIDPASS_OFF          = "OFF";
-const char *AUTOSAVEIDPASS_ON           = "ON";
-const char *AUTOSAVEIDPASS_ALWAYS_ASK   = "ALWAYS_ASK";
+const char *AUTOSAVEIDPASS_OFF = "OFF";
+const char *AUTOSAVEIDPASS_ON = "ON";
+const char *AUTOSAVEIDPASS_ALWAYS_ASK = "ALWAYS_ASK";
 // This message isn't confirmed by UX guide
 // It should be change to use IDS for translate
 const char AUTOSAVE_ASK_MSG[] = "Do you want to remember the password on ";
@@ -88,7 +87,6 @@ Eina_Bool submitFormDataSet(const Eina_Hash* /*hash*/,
 
     return EINA_TRUE;
 }
-
 }
 
 void submitClicked(std::string uri, Eina_Hash* data)
@@ -199,7 +197,7 @@ DPL::Optional<DPL::String> jsForAutoFillData(const char *uri)
     FOREACH(iterator, submitData) {
         keyOstring << DOUBLE_QUOTES << iterator->key << DOUBLE_QUOTES;
         valueOstring << DOUBLE_QUOTES << iterator->value << DOUBLE_QUOTES;
-        if (*iterator !=  submitData.back()) {
+        if (*iterator != submitData.back()) {
             keyOstring << COMMA;
             valueOstring << COMMA;
         }
@@ -245,6 +243,5 @@ DPL::Optional<DPL::String> jsForAutoFillData(const char *uri)
 
     return DPL::FromUTF8String(jsStr);
 }
-
 } // namespaec PasswordSupport
 } // namespaec ViewModule
index 0f63c9f..aab681c 100644 (file)
 
 namespace ViewModule {
 namespace PasswordSupport {
-
 void submitClicked(std::string uri, Eina_Hash* data);
 DPL::Optional<DPL::String> jsForAutoFillData(const char *uri);
-
 } // namespace PasswordSupport
 } // namespace ViewModule
 
index 31fe832..b1c7a77 100644 (file)
@@ -53,8 +53,7 @@ class SecurityOriginSupportImplementation
     }
 
     ~SecurityOriginSupportImplementation()
-    {
-    }
+    {}
 
     SecurityOriginDB::SecurityOriginDAO* getSecurityOriginDAO(void)
     {
@@ -63,7 +62,8 @@ class SecurityOriginSupportImplementation
             LogDebug("initialize securityOriginDAO");
             m_securityOriginDAO =
                 SecurityOriginDB::SecurityOriginDAOPtr(
-                    new SecurityOriginDB::SecurityOriginDAO(m_model->TzPkgId.Get()));
+                    new SecurityOriginDB::SecurityOriginDAO(m_model->TzPkgId.
+                                                                Get()));
             // initialize security result data. Remove allow, deny for
             m_securityOriginDAO->removeSecurityOriginData(
                 SecurityOriginDB::RESULT_ALLOW_ONCE);
@@ -80,16 +80,16 @@ class SecurityOriginSupportImplementation
         std::string key;
         if (feature == FEATURE_GEOLOCATION) {
             key = WrtDB::VconfConfig::GetVconfKeyGeolocationUsage(
-                m_model->TizenId);
+                    m_model->TizenId);
         } else if (feature == FEATURE_WEB_NOTIFICATION) {
             key = WrtDB::VconfConfig::GetVconfKeyWebNotificationUsage(
-                m_model->TizenId);
+                    m_model->TizenId);
         } else if (feature == FEATURE_WEB_DATABASE) {
             key = WrtDB::VconfConfig::GetVconfKeyWebDatabaseUsage(
-                m_model->TizenId);
+                    m_model->TizenId);
         } else if (feature == FEATURE_FILE_SYSTEM_ACCESS) {
             key = WrtDB::VconfConfig::GetVconfKeyFilesystemUsage(
-                m_model->TizenId);
+                    m_model->TizenId);
         } else {
             Assert("Wrong feature argument is input");
         }
@@ -105,14 +105,13 @@ class SecurityOriginSupportImplementation
 
 SecurityOriginSupport::SecurityOriginSupport(WidgetModel* widgetModel) :
     m_impl(new SecurityOriginSupportImplementation(widgetModel))
-{
-}
+{}
 
 SecurityOriginSupport::~SecurityOriginSupport()
-{
-}
+{}
 
-SecurityOriginDB::SecurityOriginDAO* SecurityOriginSupport::getSecurityOriginDAO(void)
+SecurityOriginDB::SecurityOriginDAO* SecurityOriginSupport::
+    getSecurityOriginDAO(void)
 {
     return m_impl->getSecurityOriginDAO();
 }
@@ -123,11 +122,13 @@ WrtDB::SettingsType SecurityOriginSupport::isNeedPermissionCheck(
     return m_impl->isNeedPermissionCheck(feature);
 }
 
-Evas_Object* SecurityOriginSupportUtil::createPopup(Evas_Object* window,
-                         const char* bodyText,
-                         const char* checkText,
-                         Evas_Smart_Cb buttonCallback,
-                         void* data)
+Evas_Object* SecurityOriginSupportUtil::createPopup(
+    Evas_Object* window,
+    const char* bodyText,
+    const char* checkText,
+    Evas_Smart_Cb
+    buttonCallback,
+    void* data)
 {
     LogDebug("createPopup");
     Evas_Object* popup = elm_popup_add(window);
@@ -187,12 +188,13 @@ Evas_Object* SecurityOriginSupportUtil::getCheck(Evas_Object* popup)
         return NULL;
     }
     Evas_Object* check = elm_object_part_content_get(
-        elm_object_content_get(popup),
-        "elm.swallow.end");
+            elm_object_content_get(popup),
+            "elm.swallow.end");
     return check;
 }
 
-SecurityOriginDB::Result SecurityOriginSupportUtil::getResult(Evas_Object* button)
+SecurityOriginDB::Result SecurityOriginSupportUtil::getResult(
+    Evas_Object* button)
 {
     using namespace SecurityOriginDB;
 
@@ -210,9 +212,11 @@ SecurityOriginDB::Result SecurityOriginSupportUtil::getResult(Evas_Object* butto
         return RESULT_UNKNOWN;
     }
     if (allow) {
-        return elm_check_state_get(check) ? RESULT_ALLOW_ALWAYS : RESULT_ALLOW_ONCE;
+        return elm_check_state_get(check) ? RESULT_ALLOW_ALWAYS :
+               RESULT_ALLOW_ONCE;
     } else {
-        return elm_check_state_get(check) ? RESULT_DENY_ALWAYS : RESULT_DENY_ONCE;
+        return elm_check_state_get(check) ? RESULT_DENY_ALWAYS :
+               RESULT_DENY_ONCE;
     }
 }
 } // namespace ViewModule
index f7fadc0..2563aec 100644 (file)
 
 class WidgetModel;
 namespace SecurityOriginDB {
-    class SecurityOriginDAO;
+class SecurityOriginDAO;
 }
 
 namespace ViewModule {
-
 class SecurityOriginSupportImplementation;
 
 class SecurityOriginSupport
@@ -63,11 +62,10 @@ class PermissionData
         SecurityOriginDB::SecurityOriginDAO* originDao,
         SecurityOriginDB::SecurityOriginData originData,
         void* data) :
-            m_originDao(originDao),
-            m_originData(originData),
-            m_data(data)
-    {
-    };
+        m_originDao(originDao),
+        m_originData(originData),
+        m_data(data)
+    {}
 };
 
 Evas_Object* createPopup(Evas_Object* window,
@@ -81,5 +79,4 @@ SecurityOriginDB::Result getResult(Evas_Object* button);
 };
 } // namespace ViewModule
 
-
 #endif // VIEW_LOGIC_SECURITY_ORIGIN_SUPPORT_H_
index 0ea1df0..1c689d0 100644 (file)
@@ -31,9 +31,7 @@
 
 namespace ViewModule {
 namespace SecuritySupport {
-
 namespace {
-
 const char *GEOLOCATION_DEV_CAP = "geolocation.position";
 const char *GEOLOCATION_PARAM_NAME = "param:enableHighAccuracy";
 const char *GEOLOCATION_PARAM_VALUE = "true";
@@ -71,12 +69,11 @@ bool simpleAceCheck(
 
     LogDebug("Result is: " << static_cast<int>(result));
 
-    delete [] aceRequest.dev_cap_list.items[0].param_list.items;
-    delete [] aceRequest.dev_cap_list.items;
+    delete[] aceRequest.dev_cap_list.items[0].param_list.items;
+    delete[] aceRequest.dev_cap_list.items;
 
     return ACE_OK == ret && ACE_TRUE == result;
 }
-
 } //TODO copied from view_logic.cpp
 
 bool checkWhitelist(const char *url)
@@ -92,7 +89,8 @@ bool checkWhitelist(const char *url)
     return whiteURIList.isRequiredIRI(DPL::FromUTF8String(std::string(url)));
 }
 
-bool geolocationACECheck(const DPL::String& tizenId, bool highAccuracy) {
+bool geolocationACECheck(const DPL::String& tizenId, bool highAccuracy)
+{
     const char *paramName = NULL;
     const char *paramValue = NULL;
     if (highAccuracy) {
@@ -100,11 +98,10 @@ bool geolocationACECheck(const DPL::String& tizenId, bool highAccuracy) {
         paramValue = GEOLOCATION_PARAM_VALUE;
     }
     return simpleAceCheck(
-        tizenId,
-        GEOLOCATION_DEV_CAP,
-        paramName,
-        paramValue);
+               tizenId,
+               GEOLOCATION_DEV_CAP,
+               paramName,
+               paramValue);
 }
-
 } // namespace SecuritySupport
 } //namespace ViewModule
index 215b207..364c5d5 100644 (file)
@@ -30,12 +30,10 @@ class WidgetModel;
 
 namespace ViewModule {
 namespace SecuritySupport {
-
 char const * const PARAM_URL = "param:url";
 
 bool checkWhitelist(const char *url);
 bool geolocationACECheck(const DPL::String& tizenId, bool highAccuracy);
-
 } // namespace SecuritySupport
 } // namespace ViewModule
 
index e4fc832..258c637 100644 (file)
 
 namespace ViewModule {
 namespace StorageSupport {
-
-namespace
-{ //anonymous
-    const mode_t TEMPORARY_STORAGE_MODE = 0700;
+namespace { //anonymous
+const mode_t TEMPORARY_STORAGE_MODE = 0700;
 }
 
 void initializeStorage(WidgetModel *widgetModel)
@@ -43,10 +41,10 @@ void initializeStorage(WidgetModel *widgetModel)
 
     // create temporary storage
     std::string path =
-            DPL::ToUTF8String(widgetModel->TemporaryStoragePath.Get());
-    if(!WrtUtilMakeDir(path, TEMPORARY_STORAGE_MODE)){
+        DPL::ToUTF8String(widgetModel->TemporaryStoragePath.Get());
+    if (!WrtUtilMakeDir(path, TEMPORARY_STORAGE_MODE)) {
         ThrowMsg(DPL::CommonException::InternalError,
-                   "Fail to initialize temporary storage");
+                 "Fail to initialize temporary storage");
     }
 }
 
@@ -57,12 +55,11 @@ void deinitializeStorage(WidgetModel *widgetModel)
 
     // remove temporary storage
     std::string path =
-            DPL::ToUTF8String(widgetModel->TemporaryStoragePath.Get());
-    if(!WrtUtilRemove(path)){
+        DPL::ToUTF8String(widgetModel->TemporaryStoragePath.Get());
+    if (!WrtUtilRemove(path)) {
         ThrowMsg(DPL::CommonException::InternalError,
-                   "Fail to deinitialize temporary storage");
+                 "Fail to deinitialize temporary storage");
     }
 }
-
 } // namespace StorageSupport
 } // namespace ViewModule
index 742b2b4..c7c9eb1 100644 (file)
@@ -27,10 +27,8 @@ class WidgetModel;
 
 namespace ViewModule {
 namespace StorageSupport {
-
 void initializeStorage(WidgetModel *widgetModel);
 void deinitializeStorage(WidgetModel *widgetModel);
-
 } // namespace StorageSupport
 } // namespace ViewModule
 
index d3d7d44..6de0f46 100644 (file)
@@ -36,7 +36,6 @@
 
 namespace ViewModule {
 namespace UriSupport {
-
 namespace {
 enum ServiceDataType
 {
@@ -78,7 +77,7 @@ std::vector<std::string> parseScheme(const std::string &scheme)
     if (pos != std::string::npos) {
         schemeParts.push_back(scheme.substr(0, pos));
         schemeParts.push_back(
-                scheme.substr(pos + 1, scheme.length() - pos - 1));
+            scheme.substr(pos + 1, scheme.length() - pos - 1));
     }
     return schemeParts;
 }
@@ -144,47 +143,46 @@ std::string prepareUrl(const std::string &url, const std::string &insert)
 }
 
 std::string getCustomHandlerProtocolUri(
-        WidgetModel *widgetModel,
-        const std::string &schemeType,
-        const std::string &schemeValue)
+    WidgetModel *widgetModel,
+    const std::string &schemeType,
+    const std::string &schemeValue)
 {
     CustomHandlerDB::Interface::attachDatabaseRO();
     CustomHandlerDB::CustomHandlerDAOReadOnly handlersDao(widgetModel->TizenId);
     CustomHandlerDB::CustomHandlerPtr handler =
-            handlersDao.getActivProtocolHandler(
-                DPL::FromASCIIString(schemeType));
+        handlersDao.getActivProtocolHandler(
+            DPL::FromASCIIString(schemeType));
     CustomHandlerDB::Interface::detachDatabase();
     if (handler) {
         LogDebug("Found handler, url: " << handler->url);
         return prepareUrl(DPL::ToUTF8String(handler->base_url) +
-                DPL::ToUTF8String(handler->url), schemeValue);
+                          DPL::ToUTF8String(handler->url), schemeValue);
     }
     return "";
 }
 
 std::string getCustomHandlerContentUri(
-        WidgetModel *widgetModel,
-        const std::string &mime,
-        const std::string &mimeValue)
+    WidgetModel *widgetModel,
+    const std::string &mime,
+    const std::string &mimeValue)
 {
     CustomHandlerDB::Interface::attachDatabaseRO();
     CustomHandlerDB::CustomHandlerDAOReadOnly handlersDao(widgetModel->TizenId);
     CustomHandlerDB::CustomHandlerPtr handler =
-            handlersDao.getActivContentHandler(
-                DPL::FromASCIIString(mime));
+        handlersDao.getActivContentHandler(
+            DPL::FromASCIIString(mime));
     CustomHandlerDB::Interface::detachDatabase();
     if (handler) {
         LogDebug("Found handler, url: " << handler->url);
         return prepareUrl(DPL::ToUTF8String(handler->base_url) +
-                DPL::ToUTF8String(handler->url), mimeValue);
+                          DPL::ToUTF8String(handler->url), mimeValue);
     }
     return "";
 }
 
 std::string getAppServiceUri(bundle *bundle, WidgetModel *widgetModel)
 {
-    if(!bundle)
-    {
+    if (!bundle) {
         LogError("Bundle is empty");
         return std::string("");
     }
@@ -221,14 +219,14 @@ std::string getAppServiceUri(bundle *bundle, WidgetModel *widgetModel)
     if (schemeParts.size() > 1) {
         LogDebug("Scheme parts: " << schemeParts[0] << ", " << schemeParts[1]);
         return getCustomHandlerProtocolUri(
-                widgetModel, schemeParts[0], schemeParts[1]);
+                   widgetModel, schemeParts[0], schemeParts[1]);
     }
     if (mime != "") {
         value = appsvc_get_data(bundle, APPSVC_DATA_SELECTED);
         if (value != NULL) {
             LogDebug("Use mime type for: " << value);
             return getCustomHandlerContentUri(
-                    widgetModel, mime, std::string(value));
+                       widgetModel, mime, std::string(value));
         } else {
             LogError("Selected file for mime is null, nothind to do");
         }
@@ -258,11 +256,12 @@ std::string getUri(WidgetModel *widgetModel, const std::string &defaultUri)
     std::string preFix = DPL::ToUTF8String(widgetModel->PrefixURL.Get());
 
     if (strstr(startUri.c_str(), "http") == startUri.c_str() ||
-            strstr( startUri.c_str(), preFix.c_str()) == startUri.c_str()) {
+        strstr(startUri.c_str(), preFix.c_str()) == startUri.c_str())
+    {
         uri = DPL::FromUTF8String(startUri);
     } else {
         uri = widgetModel->PrefixURL.Get() +
-        DPL::FromUTF8String(startUri);
+            DPL::FromUTF8String(startUri);
     }
     return DPL::ToUTF8String(uri).c_str();
 }
@@ -304,6 +303,5 @@ DPL::OptionalString localizeURI(const DPL::String& inputURI,
         return DPL::OptionalString(uri);
     }
 }
-
 } // namespace UriSupportImplementation
 } // namespace ViewModule
index e6b7090..d1dc00e 100644 (file)
@@ -31,12 +31,10 @@ class WidgetModel;
 
 namespace ViewModule {
 namespace UriSupport {
-
 std::string getUri(WidgetModel *widgetModel, const std::string &defaultUri);
 
 DPL::OptionalString localizeURI(const DPL::String& inputURI,
                                 const WidgetModel* model);
-
 } // namespace UriSupport
 } // namespace ViewModule
 
index 0f3883e..0e0a05d 100644 (file)
@@ -36,7 +36,6 @@ const std::string SYSTEM_USER_AGENT = "System user agent";
 
 namespace ViewModule {
 namespace UserAgentSupport {
-
 std::string getUserAgentFromVconf()
 {
     using namespace WrtDB;
@@ -68,7 +67,8 @@ std::string getUserAgentFromVconf()
         }
     } else {
         DPL::String value =
-            GlobalDAOReadOnly::GetUserAgentValue(DPL::FromUTF8String(userAgentName));
+            GlobalDAOReadOnly::GetUserAgentValue(DPL::FromUTF8String(
+                                                     userAgentName));
         userAgent = DPL::ToUTF8String(value);
         LogDebug("value : " << value);
     }
index c37e2e9..c166ecf 100644 (file)
@@ -26,7 +26,7 @@
 
 namespace ViewModule {
 namespace UserAgentSupport {
-    std::string getUserAgentFromVconf();
+std::string getUserAgentFromVconf();
 } // namespace UserAgentSupport
 } // namespace ViewModule
 
index 8c90818..2185368 100644 (file)
 #include <haptic.h>
 
 namespace ViewModule {
-
-VibrationSupport::VibrationSupport(): m_initialized(false),
-                                             m_handle(NULL),
-                                             m_effect_handle(NULL)
-{
-}
+VibrationSupport::VibrationSupport() : m_initialized(false),
+    m_handle(NULL),
+    m_effect_handle(NULL)
+{}
 
 VibrationSupport::~VibrationSupport()
 {
@@ -45,17 +43,13 @@ void VibrationSupport::deinitialize(void)
 {
     LogDebug("deinitialize");
 
-    if( m_initialized )
-    {
+    if (m_initialized) {
         int ret = haptic_close(m_handle);
 
-        if( HAPTIC_ERROR_NONE == ret )
-        {
+        if (HAPTIC_ERROR_NONE == ret) {
             m_initialized = false;
             LogDebug("deinitialize success");
-        }
-        else
-        {
+        } else {
             m_initialized = true;
             LogDebug("deinitialize failed - error code : " << ret);
         }
@@ -66,10 +60,8 @@ void VibrationSupport::startVibration(const long vibrationTime)
 {
     LogDebug("startVibration called");
 
-    if ( m_initialized == false )
-    {
-        if ( initializeVibration() == false )
-        {
+    if (m_initialized == false) {
+        if (initializeVibration() == false) {
             return;
         }
     }
@@ -77,12 +69,9 @@ void VibrationSupport::startVibration(const long vibrationTime)
     int time = static_cast<int>(vibrationTime);
     int ret = haptic_vibrate_monotone(m_handle, time, &m_effect_handle);
 
-    if( HAPTIC_ERROR_NONE == ret )
-    {
+    if (HAPTIC_ERROR_NONE == ret) {
         LogDebug("haptic_vibrate_monotone success");
-    }
-    else
-    {
+    } else {
         LogDebug("haptic_vibrate_monotone failed - error code : " << ret);
     }
 
@@ -92,19 +81,15 @@ void VibrationSupport::startVibration(const long vibrationTime)
 void VibrationSupport::stopVibration(void)
 {
     LogDebug("stopVibration called");
-    if ( m_initialized == false )
-    {
+    if (m_initialized == false) {
         return;
     }
 
     int ret = haptic_stop_all_effects(m_handle);
 
-    if( HAPTIC_ERROR_NONE == ret )
-    {
+    if (HAPTIC_ERROR_NONE == ret) {
         LogDebug("haptic_stop_all_effects success");
-    }
-    else
-    {
+    } else {
         LogDebug("haptic_stop_all_effects failed - error code : " << ret);
     }
 
@@ -115,20 +100,15 @@ bool VibrationSupport::initializeVibration(void)
 {
     LogDebug("initializeVibration called");
 
-
-    if ( m_initialized == false )
-    {
+    if (m_initialized == false) {
         haptic_device_h handle = NULL;
         int ret = haptic_open(HAPTIC_DEVICE_0, &handle);
 
-        if ( ret == HAPTIC_ERROR_NONE )
-        {
+        if (ret == HAPTIC_ERROR_NONE) {
             LogDebug("initializeVibration success");
             m_initialized = true;
             m_handle = handle;
-        }
-        else
-        {
+        } else {
             LogDebug("initializeVibration failed - error code : " << ret);
             m_initialized = false;
             m_handle = NULL;
@@ -137,5 +117,4 @@ bool VibrationSupport::initializeVibration(void)
 
     return m_initialized;
 }
-
 } // namespace ViewModule
index 642288d..a9d248c 100644 (file)
@@ -24,7 +24,6 @@
 #include <haptic.h>
 
 namespace ViewModule {
-
 class VibrationSupport
 {
   public:
@@ -43,7 +42,6 @@ class VibrationSupport
 
     bool initializeVibration(void);
 };
-
 } // namespace ViewModule
 
 #endif // VIEW_LOGIC_VIBRATION_SUPPORT_H_
old mode 100755 (executable)
new mode 100644 (file)
index 8622b01..c63b5d3
 
 class WidgetModel; //FORWARD DECLARATION
 namespace ViewModule {
-
 /** \brief Interface to ViewModule. Object of IViewModule type is returned from
  *  ViewModuleMgr factory.
  */
 class IViewModule
 {
-public:
+  public:
     virtual bool createWebView(Ewk_Context* context,
                                Evas_Object* window) = 0;
     virtual void destroyWebView() = 0;
@@ -46,7 +45,7 @@ public:
     virtual void prepareView(WidgetModel *, const std::string &) = 0;
     virtual void showWidget() = 0;
     virtual void hideWidget() = 0;
-    virtual void suspendWidget()= 0;
+    virtual void suspendWidget() = 0;
     virtual void resumeWidget() = 0;
     virtual void resetWidget() = 0;
     virtual void backward() = 0;
@@ -63,7 +62,6 @@ typedef std::shared_ptr<IViewModule> IViewModulePtr;
  * to IViewModule object.
  */
 IViewModulePtr createView();
-
 } //namespace
 
 #endif /* WRT_SRC_VIEW_I_VIEW_MODULE_H_ */
index 2b9d00a..79f1993 100644 (file)
 #include "i_view_module.h"
 #include <view_logic.h>
 
-namespace ViewModule
-{
-
+namespace ViewModule {
 IViewModulePtr createView()
 {
     IViewModulePtr ptr(new ViewLogic());
     return ptr;
 }
-
 } //namespace
index 1d34020..656cd89 100644 (file)
 #include <WKType.h>
 
 namespace {
-
 char const * const SCHEME_TYPE_FILE = "file";
 char const * const SCHEME_TYPE_WIDGET = "widget";
 char const * const WARP_ERROR_MSG =
-        "file:///usr/etc/wrt/warp_security_error.msg";
+    "file:///usr/etc/wrt/warp_security_error.msg";
 char const * const PARAM_URL = "param:url";
 char const * const ACE_IGNORED_SCHEMA[] = { "file://", "widget://", "data:",
-    "tel:", "sms:", "mmsto:", "mailto:", 0 };
+                                            "tel:", "sms:", "mmsto:", "mailto:",
+                                            0 };
 
 WKStringRef block_message = WKStringCreateWithUTF8CString("uri_block_msg");
 
-
 bool checkWARP(const char *url, const DPL::String& tizenId)
 {
     // ignore WARP in test mode
@@ -69,7 +68,7 @@ bool checkWARP(const char *url, const DPL::String& tizenId)
     dao.getWidgetAccessInfo(widgetAccessInfoList);
 
     return (static_cast<WidgetAccessList>(widgetAccessInfoList)).isRequiredIRI(
-            DPL::FromUTF8String(std::string(url)));
+               DPL::FromUTF8String(std::string(url)));
 }
 
 bool checkACE(const char* url, bool xhr, const DPL::String& tizenId)
@@ -101,19 +100,18 @@ bool checkACE(const char* url, bool xhr, const DPL::String& tizenId)
 
     if (xhr) {
         aceRequest.dev_cap_list.items[0].name =
-                const_cast<ace_string_t>(devCapNamesXHR);
+            const_cast<ace_string_t>(devCapNamesXHR);
     } else {
         aceRequest.dev_cap_list.items[0].name =
-                const_cast<ace_string_t>(devCapNamesMarkup);
+            const_cast<ace_string_t>(devCapNamesMarkup);
     }
 
     aceRequest.dev_cap_list.items[0].param_list.count = 1;
     aceRequest.dev_cap_list.items[0].param_list.items = new ace_param_t[1];
     aceRequest.dev_cap_list.items[0].param_list.items[0].name =
-            const_cast<ace_string_t>(PARAM_URL);
+        const_cast<ace_string_t>(PARAM_URL);
     aceRequest.dev_cap_list.items[0].param_list.items[0].value =
-            const_cast<ace_string_t>(url);
-
+        const_cast<ace_string_t>(url);
 
     ace_bool_t result = ACE_FALSE;
 
@@ -123,31 +121,27 @@ bool checkACE(const char* url, bool xhr, const DPL::String& tizenId)
 
     LogDebug("Result is: " << static_cast<int>(result));
 
-    delete [] aceRequest.dev_cap_list.items[0].param_list.items;
-    delete [] aceRequest.dev_cap_list.items;
+    delete[] aceRequest.dev_cap_list.items[0].param_list.items;
+    delete[] aceRequest.dev_cap_list.items;
 
     return ACE_OK == ret && ACE_TRUE == result;
 }
 
-
 bool filterURIBySecurity(DPL::OptionalString &op_uri,
-         bool is_xhr,
-         const DPL::String& tizenId)
+                         bool is_xhr,
+                         const DPL::String& tizenId)
 {
-    if (!op_uri)
-    {
+    if (!op_uri) {
         return true; //accept empty uri
     }
 
     auto uri = DPL::ToUTF8String(*op_uri);
-    if (!checkWARP(uri.c_str(), tizenId))
-    {
+    if (!checkWARP(uri.c_str(), tizenId)) {
         LogDebug("Request was blocked by WARP: " << uri);
         return false;
     }
 
-    if (!checkACE(uri.c_str(), is_xhr, tizenId))
-    {
+    if (!checkACE(uri.c_str(), is_xhr, tizenId)) {
         LogDebug("Request was blocked by ACE: " << uri);
         return false;
     }
@@ -157,28 +151,27 @@ bool filterURIBySecurity(DPL::OptionalString &op_uri,
 } // namespace (anonymous)
 
 namespace BundleURIHandling {
-
 DPL::Optional<DPL::String> processURI(const DPL::String& inputURI,
-        bool is_xhr, const DPL::String& tizenId, WKBundleRef bundle)
+                                      bool is_xhr,
+                                      const DPL::String& tizenId,
+                                      WKBundleRef bundle)
 {
     DPL::Optional<DPL::String> uri = localizeURI(inputURI, tizenId);
 
-    if (uri.IsNull())
-    {
+    if (uri.IsNull()) {
         LogDebug("uri is empty");
         return uri;
     }
 
     // check ACE, WARP
-    if (!filterURIBySecurity(uri, is_xhr, tizenId))
-    {
+    if (!filterURIBySecurity(uri, is_xhr, tizenId)) {
         WKStringRef urlStr = WKStringCreateWithUTF8CString(
                 DPL::ToUTF8String(*uri).c_str());
         WKTypeRef retVal = NULL;
         // Send information about blocked URI to view_logic
         LogInfo("Sent blocked uri to open browser later : " << uri);
         WKBundlePostSynchronousMessage(bundle, block_message,
-                urlStr, &retVal);
+                                       urlStr, &retVal);
         WKRelease(urlStr);
         WKRelease(retVal);
         return DPL::Optional<DPL::String>::Null;
@@ -188,7 +181,7 @@ DPL::Optional<DPL::String> processURI(const DPL::String& inputURI,
 }
 
 DPL::OptionalString localizeURI(const DPL::String& inputURI,
-        const DPL::String& tizenId)
+                                const DPL::String& tizenId)
 {
     auto uri = DPL::ToUTF8String(inputURI);
     LogDebug("localizing url: " << uri);
@@ -224,5 +217,4 @@ DPL::OptionalString localizeURI(const DPL::String& inputURI,
         return DPL::OptionalString(uri);
     }
 }
-
 } // namespace BundleURIHandling
index 75e3428..28634fa 100644 (file)
 #include <WKBundle.h>
 
 namespace BundleURIHandling {
-    DPL::Optional<DPL::String> processURI(const DPL::String& inputURI,
-            bool is_xhr, const DPL::String& tizenId, WKBundleRef bundle);
-    DPL::OptionalString localizeURI(const DPL::String& inputURI,
-            const DPL::String& tizenId);
+DPL::Optional<DPL::String> processURI(const DPL::String& inputURI,
+                                      bool is_xhr,
+                                      const DPL::String& tizenId,
+                                      WKBundleRef bundle);
+DPL::OptionalString localizeURI(const DPL::String& inputURI,
+                                const DPL::String& tizenId);
 }
 
-
 #endif /* BUNDLE_URI_HANDLING_H_ */
index 1c56cb8..f59e01f 100644 (file)
@@ -28,7 +28,6 @@
 #include <js_overlay_types.h>
 
 namespace PluginModuleSupport {
-
 void init(Ewk_Context* ewkContext, const std::string& tizenId)
 {
     const char* name = BundleMessages::INIT;
@@ -51,21 +50,15 @@ void start(Ewk_Context* ewkContext,
 
     ssMsg << "_" << scale << " ";
 
-    if(encodedBundle)
-    {
+    if (encodedBundle) {
         ssMsg << "_" << encodedBundle << " ";
-    }
-    else
-    {
+    } else {
         ssMsg << "null" << " ";
     }
 
-    if(theme)
-    {
+    if (theme) {
         ssMsg << "_" << theme << " ";
-    }
-    else
-    {
+    } else {
         ssMsg << "null" << " ";
     }
 
@@ -86,37 +79,28 @@ void shutdown(Ewk_Context* ewkContext)
 }
 
 void setCustomProperties(
-        Ewk_Context* ewkContext,
-        double* scale,
-        const char* encodedBundle,
-        const char* theme )
+    Ewk_Context* ewkContext,
+    double* scale,
+    const char* encodedBundle,
+    const char* theme)
 {
     std::stringstream ssMsg;
 
-    if(scale)
-    {
+    if (scale) {
         ssMsg << "_" << *scale << " ";
-    }
-    else
-    {
+    } else {
         ssMsg << "null" << " ";
     }
 
-    if(encodedBundle)
-    {
+    if (encodedBundle) {
         ssMsg << "_" << encodedBundle << " ";
-    }
-    else
-    {
+    } else {
         ssMsg << "null" << " ";
     }
 
-    if(theme)
-    {
+    if (theme) {
         ssMsg << "_" << theme;
-    }
-    else
-    {
+    } else {
         ssMsg << "null";
     }
 
@@ -129,9 +113,9 @@ void setCustomProperties(
 }
 
 void dispatchJavaScriptEvent(
-        Ewk_Context* ewkContext,
-        WrtPlugins::W3C::CustomEventType eventType,
-        void *data)
+    Ewk_Context* ewkContext,
+    WrtPlugins::W3C::CustomEventType eventType,
+    void *data)
 {
     using namespace WrtPlugins::W3C;
     std::stringstream str;
@@ -166,5 +150,4 @@ void resume(Ewk_Context* ewkContext)
     const char* name = BundleMessages::RESUME;
     ewk_context_message_post_to_injected_bundle(ewkContext, name, name);
 }
-
-}//namespace PluginModuleSupport
+} //namespace PluginModuleSupport
index 4889645..95de035 100644 (file)
@@ -41,14 +41,14 @@ void suspend(Ewk_Context* ewkContext);
 void resume(Ewk_Context* ewkContext);
 
 void setCustomProperties(
-        Ewk_Context* ewkContext,
-        double* scale = NULL,
-        const char* encodedBundle = NULL,
-        const char* theme = NULL);
+    Ewk_Context* ewkContext,
+    double* scale = NULL,
+    const char* encodedBundle = NULL,
+    const char* theme = NULL);
 void dispatchJavaScriptEvent(
-        Ewk_Context* ewkContext,
-        WrtPlugins::W3C::CustomEventType eventType,
-        void* data);
+    Ewk_Context* ewkContext,
+    WrtPlugins::W3C::CustomEventType eventType,
+    void* data);
 } // namespace PluginModuleSupport
 
 #endif /* WRT_SRC_VIEW_WEBKIT2_PLUGIN_MODULE_SUPPORT_H_ */
index fa3f957..4adab07 100644 (file)
@@ -108,8 +108,7 @@ Bundle::~Bundle()
 {
     WrtDB::WrtDatabase::detachFromThread();
 
-    if (!m_pagesList.empty())
-    {
+    if (!m_pagesList.empty()) {
         LogError("There are not closed pages!");
     }
 
@@ -118,9 +117,9 @@ Bundle::~Bundle()
 }
 
 void Bundle::didCreatePageCallback(
-        WKBundleRef /*bundle*/,
-        WKBundlePageRef page,
-        const void* clientInfo)
+    WKBundleRef /*bundle*/,
+    WKBundlePageRef page,
+    const void* clientInfo)
 {
     LOG_PROFILE_START("didCreatePageCallback");
     LogDebug("didCreatePageCallback called");
@@ -130,10 +129,10 @@ void Bundle::didCreatePageCallback(
 }
 
 void Bundle::didReceiveMessageCallback(
-        WKBundleRef /*bundle*/,
-        WKStringRef messageName,
-        WKTypeRef messageBody,
-        const void *clientInfo)
+    WKBundleRef /*bundle*/,
+    WKStringRef messageName,
+    WKTypeRef messageBody,
+    const void *clientInfo)
 {
     LogDebug("didReceiveMessageCallback called");
     Bundle* bundle = static_cast<Bundle*>(const_cast<void*>(clientInfo));
@@ -141,9 +140,9 @@ void Bundle::didReceiveMessageCallback(
 }
 
 void Bundle::willDestroyPageCallback(
-        WKBundleRef /*bundle*/,
-        WKBundlePageRef page,
-        const void* clientInfo)
+    WKBundleRef /*bundle*/,
+    WKBundlePageRef page,
+    const void* clientInfo)
 {
     LogDebug("willDestroyPageCallback called");
     Bundle* This = static_cast<Bundle*>(const_cast<void*>(clientInfo));
@@ -158,7 +157,7 @@ void Bundle::didCreatePage(WKBundlePageRef page)
     m_pageGlobalContext[page] = context;
     LogDebug("created Page : " << page << " created JSContext : " << context);
 
-    WKBundlePageResourceLoadClient resourceLoadClient =  {
+    WKBundlePageResourceLoadClient resourceLoadClient = {
         kWKBundlePageResourceLoadClientCurrentVersion,  /* version */
         this, /* clientinfo */
         0, /* didInitiateLoadForResource */
@@ -177,14 +176,13 @@ void Bundle::didCreatePage(WKBundlePageRef page)
     WKBundlePagePolicyClient policyClient = {
         kWKBundlePagePolicyClientCurrentVersion,        /* version */
         this,                                           /* clientInfo */
-        pageDecidePolicyForNavigationActionCallback,    /* decidePolicyForNavigationAction */
-        0,                                              /* decidePolicyForNewWindowAction */
-        pageDecidePolicyForResponseCallback,            /* decidePolicyForResponse */
-        0,                                              /* unableToImplementPolicy */
+        pageDecidePolicyForNavigationActionCallback,    /**/
+        0,                                 /* decidePolicyForNewWindowAction */
+        pageDecidePolicyForResponseCallback,    /* decidePolicyForResponse */
+        0,                                      /* unableToImplementPolicy */
     };
     WKBundlePageSetPolicyClient(page, &policyClient);
-
-};
+}
 
 void Bundle::willDestroyPage(WKBundlePageRef page)
 {
@@ -198,25 +196,24 @@ void Bundle::willDestroyPage(WKBundlePageRef page)
     PluginModule::stop(context);
 }
 
-void Bundle::fixWKMessageArgs(std::string & argScale, std::string & argEncodedBundle, std::string & argTheme)
+void Bundle::fixWKMessageArgs(std::string & argScale,
+                              std::string & argEncodedBundle,
+                              std::string & argTheme)
 {
-    if (argScale != "null" && argScale[0] == '_')
-    {
+    if (argScale != "null" && argScale[0] == '_') {
         argScale.erase(0, 1);
 
         std::stringstream ssScale(argScale);
         ssScale >> m_scale;
     }
 
-    if (argEncodedBundle != "null" && argEncodedBundle[0] == '_')
-    {
+    if (argEncodedBundle != "null" && argEncodedBundle[0] == '_') {
         argEncodedBundle.erase(0, 1);
 
         m_encodedBundle = argEncodedBundle;
     }
 
-    if (argTheme != "null" && argTheme[0] == '_')
-    {
+    if (argTheme != "null" && argTheme[0] == '_') {
         argTheme.erase(0, 1);
 
         m_theme = argTheme;
@@ -256,35 +253,30 @@ void Bundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody)
 
         // ** Language tags setting completed **
         fixWKMessageArgs(argScale, argEncodedBundle, argTheme);
-    }
-    else if (WKStringIsEqualToUTF8CString(messageName,
-                                          BundleMessages::SHUTDOWN))
+    } else if (WKStringIsEqualToUTF8CString(messageName,
+                                            BundleMessages::SHUTDOWN))
     {
         LogDebug("shutdown plugins");
 
-        if (m_pagesList.empty())
-        {
+        if (m_pagesList.empty()) {
             PluginModule::shutdown();
+        } else {
+            LogInfo(
+                "PluginModule shutdown ignored, there are still alive pages!");
         }
-        else
-        {
-            LogInfo("PluginModule shutdown ignored, there are still alive pages!");
-        }
-    }
-    else if (WKStringIsEqualToUTF8CString(messageName,
-                                          BundleMessages::SUSPEND))
+    } else if (WKStringIsEqualToUTF8CString(messageName,
+                                            BundleMessages::SUSPEND))
     {
         LogDebug("suspend plugins");
         requestSuspend();
-    }
-    else if (WKStringIsEqualToUTF8CString(messageName,
-                                          BundleMessages::RESUME))
+    } else if (WKStringIsEqualToUTF8CString(messageName,
+                                            BundleMessages::RESUME))
     {
         LogDebug("resume plugins");
         requestResume();
-    }
-    else if (WKStringIsEqualToUTF8CString(messageName,
-                                          BundleMessages::SET_CUSTOM_PROPERTIES))
+    } else if (WKStringIsEqualToUTF8CString(messageName,
+                                            BundleMessages::
+                                                SET_CUSTOM_PROPERTIES))
     {
         LogDebug("reset custom properties of window objects");
         // set information from ui process
@@ -303,17 +295,15 @@ void Bundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody)
 
         //apply for each context
         PageGlobalContext::iterator it = m_pageGlobalContext.begin();
-        for (; it != m_pageGlobalContext.end(); ++it)
-        {
+        for (; it != m_pageGlobalContext.end(); ++it) {
             PluginModule::setCustomProperties(it->second,
                                               m_scale,
                                               m_encodedBundle.c_str(),
                                               m_theme.c_str());
         }
-    }
-    else if (WKStringIsEqualToUTF8CString(
-                 messageName,
-                 BundleMessages::DISPATCH_JAVASCRIPT_EVENT))
+    } else if (WKStringIsEqualToUTF8CString(
+                   messageName,
+                   BundleMessages::DISPATCH_JAVASCRIPT_EVENT))
     {
         LogDebug("dispatch javascript event to created frames");
         // set information from ui process
@@ -334,21 +324,19 @@ void Bundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody)
 
         //apply for each context
         PageGlobalContext::iterator it = m_pageGlobalContext.begin();
-        for (; it != m_pageGlobalContext.end(); ++it)
-        {
+        for (; it != m_pageGlobalContext.end(); ++it) {
             PluginModule::dispatchJavaScriptEvent(
-                    it->second,
-                    static_cast<WrtPlugins::W3C::CustomEventType>(eventType),
-                    args);
+                it->second,
+                static_cast<WrtPlugins::W3C::CustomEventType>(eventType),
+                args);
         }
 
         if (args) {
             delete static_cast<SoftKeyboardChangeArgs *>(args);
         }
-    }
-    else if (WKStringIsEqualToUTF8CString(
-             messageName,
-             BundleMessages::INIT))
+    } else if (WKStringIsEqualToUTF8CString(
+                   messageName,
+                   BundleMessages::INIT))
     {
         LogDebug("initializing plugins");
         auto msgString = toString(static_cast<WKStringRef>(messageBody));
@@ -365,11 +353,12 @@ void Bundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody)
         // reset language tags (create new tags based on system locales)
         LanguageTagsProviderSingleton::Instance().resetLanguageTags();
         DPL::OptionalString defaultLocale = dao.getDefaultlocale();
-        if(!defaultLocale.IsNull())
-        {
-            LanguageTagsProviderSingleton::Instance().addWidgetDefaultLocales(*defaultLocale);
+        if (!defaultLocale.IsNull()) {
+            LanguageTagsProviderSingleton::Instance().addWidgetDefaultLocales(
+                *defaultLocale);
         }
-        LanguageTags tags = LanguageTagsProviderSingleton::Instance().getLanguageTags();
+        LanguageTags tags =
+            LanguageTagsProviderSingleton::Instance().getLanguageTags();
         LogDebug("Current widget locales (language tags):");
         FOREACH(it, tags) {
             LogDebug("Locale: " << *it);
@@ -386,12 +375,12 @@ void Bundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody)
 }
 
 WKURLRequestRef Bundle::willSendRequestForFrameCallback(
-        WKBundlePageRef /*page*/,
-        WKBundleFrameRef /*frame*/,
-        uint64_t /*resourceIdentifier*/,
-        WKURLRequestRef request,
-        WKURLResponseRef /*response*/,
-        const void *clientInfo)
+    WKBundlePageRef /*page*/,
+    WKBundleFrameRef /*frame*/,
+    uint64_t /*resourceIdentifier*/,
+    WKURLRequestRef request,
+    WKURLResponseRef /*response*/,
+    const void *clientInfo)
 {
     LogDebug("willSendRequestForFrameCallback called");
     Bundle* This = static_cast<Bundle*>(const_cast<void*>(clientInfo));
@@ -399,10 +388,10 @@ WKURLRequestRef Bundle::willSendRequestForFrameCallback(
 }
 
 void Bundle::didStartProvisionalLoadForFrameCallback(
-        WKBundlePageRef page,
-        WKBundleFrameRef frame,
-        WKTypeRef* /*userData*/,
-        const void *clientInfo)
+    WKBundlePageRef page,
+    WKBundleFrameRef frame,
+    WKTypeRef* /*userData*/,
+    const void *clientInfo)
 {
     LogDebug("didStartProvisionalLoadForFrameCallback called");
     Bundle* This = static_cast<Bundle*>(const_cast<void*>(clientInfo));
@@ -444,20 +433,18 @@ void Bundle::didStartProvisionalLoadForFrameCallback(
 }
 
 void Bundle::didRemoveFrameFromHierarchyCallback(
-        WKBundlePageRef page,
-        WKBundleFrameRef frame,
-        WKTypeRef* /*userData*/,
-        const void *clientInfo)
+    WKBundlePageRef page,
+    WKBundleFrameRef frame,
+    WKTypeRef* /*userData*/,
+    const void *clientInfo)
 {
     LogDebug("didFinishLoadForResourceCallback called");
     Bundle* This = static_cast<Bundle*>(const_cast<void*>(clientInfo));
 
-    if (This->m_pageGlobalContext.count(page) == 0)
-    {
+    if (This->m_pageGlobalContext.count(page) == 0) {
         return;
     }
-    if (This->m_pageContext.count(page) == 0)
-    {
+    if (This->m_pageContext.count(page) == 0) {
         return;
     }
 
@@ -465,8 +452,7 @@ void Bundle::didRemoveFrameFromHierarchyCallback(
 
     ContextSet::iterator i = This->m_pageContext[page].find(context);
 
-    if (i == This->m_pageContext[page].end())
-    {
+    if (i == This->m_pageContext[page].end()) {
         LogWarning("Tried to unload frame which has never been loaded");
         return;
     }
@@ -477,10 +463,10 @@ void Bundle::didRemoveFrameFromHierarchyCallback(
 }
 
 void Bundle::didFinishLoadForResourceCallback(
-        WKBundlePageRef /*page*/,
-        WKBundleFrameRef frame,
-        uint64_t /*resourceIdentifier*/,
-        const void* clientInfo)
+    WKBundlePageRef /*page*/,
+    WKBundleFrameRef frame,
+    uint64_t /*resourceIdentifier*/,
+    const void* clientInfo)
 {
     LogDebug("didFinishLoadForResourceCallback called");
     Bundle* This = static_cast<Bundle*>(const_cast<void*>(clientInfo));
@@ -490,20 +476,16 @@ void Bundle::didFinishLoadForResourceCallback(
 
     // If url is NULL, this url has been already blocked by willsend
     // So current page should be moved to previous page
-    if (url == NULL)
-    {
-        if (WKBundleFrameIsMainFrame(frame))
-        {
+    if (url == NULL) {
+        if (WKBundleFrameIsMainFrame(frame)) {
             LogInfo("url is NULL. Go back to previous view");
             WKStringRef blockedURL =
                 WKStringCreateWithUTF8CString(URICHANGE_BLOCKED_URL);
             WKBundlePostSynchronousMessage(This->m_bundle,
-                                        This->m_uriChangedMessage,
-                                        blockedURL,
-                                        &retVal);
-        }
-        else
-        {
+                                           This->m_uriChangedMessage,
+                                           blockedURL,
+                                           &retVal);
+        } else {
             LogInfo("Blocked uri in IFrame.");
         }
         return;
@@ -512,10 +494,10 @@ void Bundle::didFinishLoadForResourceCallback(
 }
 
 void Bundle::didCommitLoadForFrameCallback(
-        WKBundlePageRef page,
-        WKBundleFrameRef frame,
-        WKTypeRef* /*userData*/,
-        const void *clientInfo)
+    WKBundlePageRef page,
+    WKBundleFrameRef frame,
+    WKTypeRef* /*userData*/,
+    const void *clientInfo)
 {
     LogInfo("didCommitLoadForFrameCallback called");
     LOG_PROFILE_START("didCommitLoadForFrameCallback");
@@ -533,15 +515,14 @@ void Bundle::didCommitLoadForFrameCallback(
 
     This->m_pageContext[page].insert(context);
 
-    if (!WKBundleFrameIsMainFrame(frame))
-    {
+    if (!WKBundleFrameIsMainFrame(frame)) {
         LogInfo("frame isn't main frame");
         PluginModule::start(
-                    WrtDB::WidgetDAOReadOnly::getHandle(This->m_widgetTizenId),
-                    context,
-                    This->m_scale,
-                    This->m_encodedBundle.c_str(),
-                    This->m_theme.c_str());
+            WrtDB::WidgetDAOReadOnly::getHandle(This->m_widgetTizenId),
+            context,
+            This->m_scale,
+            This->m_encodedBundle.c_str(),
+            This->m_theme.c_str());
         PluginModule::loadFrame(context);
         return;
     }
@@ -549,8 +530,7 @@ void Bundle::didCommitLoadForFrameCallback(
     std::string scheme = getScheme(toString(url));
     std::string result = URICHANGE_PLUGIN_RESTART;
 
-    if (scheme == SCHEME_HTTP || scheme == SCHEME_HTTPS)
-    {
+    if (scheme == SCHEME_HTTP || scheme == SCHEME_HTTPS) {
         WKStringRef urlStr = WKURLCopyString(url);
         WKBundlePostSynchronousMessage(This->m_bundle,
                                        This->m_uriChangedMessage,
@@ -563,21 +543,18 @@ void Bundle::didCommitLoadForFrameCallback(
     }
     LogInfo("result from UI process : " << result);
 
-    if (result == URICHANGE_PLUGIN_STOP_ONLY)
-    {
+    if (result == URICHANGE_PLUGIN_STOP_ONLY) {
         PluginModule::stop(context);
-    }
-    else if (result == URICHANGE_PLUGIN_RESTART)
-    {
+    } else if (result == URICHANGE_PLUGIN_RESTART) {
         PluginModule::stop(context);
         This->m_pageGlobalContext[page] = context;
         LOG_PROFILE_START("PluginModule start");
         PluginModule::start(
-                WrtDB::WidgetDAOReadOnly::getHandle(This->m_widgetTizenId),
-                context,
-                This->m_scale,
-                This->m_encodedBundle.c_str(),
-                This->m_theme.c_str() );
+            WrtDB::WidgetDAOReadOnly::getHandle(This->m_widgetTizenId),
+            context,
+            This->m_scale,
+            This->m_encodedBundle.c_str(),
+            This->m_theme.c_str() );
         LOG_PROFILE_STOP("PluginModule start");
 
         PluginModule::loadFrame(context);
@@ -586,12 +563,12 @@ void Bundle::didCommitLoadForFrameCallback(
 }
 
 WKBundlePagePolicyAction Bundle::pageDecidePolicyForNavigationActionCallback(
-        WKBundlePageRef             page,
-        WKBundleFrameRef            frame,
-        WKBundleNavigationActionRef navigationAction,
-        WKURLRequestRef             request,
-        WKTypeRef*                  userData,
-        const void*                 clientInfo)
+    WKBundlePageRef page,
+    WKBundleFrameRef frame,
+    WKBundleNavigationActionRef navigationAction,
+    WKURLRequestRef request,
+    WKTypeRef*                  userData,
+    const void*                 clientInfo)
 {
     LogDebug("pageDecidePolicyForNavigationActionCallback called");
 
@@ -605,12 +582,12 @@ WKBundlePagePolicyAction Bundle::pageDecidePolicyForNavigationActionCallback(
 }
 
 WKBundlePagePolicyAction Bundle::pageDecidePolicyForResponseCallback(
-        WKBundlePageRef     /* page */,
-        WKBundleFrameRef    /* frame */,
-        WKURLResponseRef    response,
-        WKURLRequestRef     /* request */,
-        WKTypeRef*          /* userData */,
-        const void*         /* clientInfo */)
+    WKBundlePageRef /* page */,
+    WKBundleFrameRef /* frame */,
+    WKURLResponseRef response,
+    WKURLRequestRef /* request */,
+    WKTypeRef*          /* userData */,
+    const void*         /* clientInfo */)
 {
     LogDebug("pageDecidePolicyForResponseCallback called");
 
@@ -621,13 +598,11 @@ WKBundlePagePolicyAction Bundle::pageDecidePolicyForResponseCallback(
     LogDebug("contentTypeRef : " << contentType);
     WKRelease(contentTypeRef);
 
-    if (contentType == HTML_MIME)
-    {
+    if (contentType == HTML_MIME) {
         LogDebug("Accepting HTML_MIME type");
         return WKBundlePagePolicyActionUse;
     }
-    if (contentType == PHP_MIME)
-    {
+    if (contentType == PHP_MIME) {
         LogDebug("Accepting php type");
         return WKBundlePagePolicyActionUse;
     }
@@ -644,15 +619,18 @@ WKURLRequestRef Bundle::willSendRequestForFrame(WKURLRequestRef request)
     bool is_xhr = true; // Webkit should inform if it's XHR
     DPL::String dplurl = DPL::FromUTF8String(toString(urlStr));
     WKRelease(urlStr);
-    DPL::Optional<DPL::String> newurl = BundleURIHandling::processURI(dplurl,
-            is_xhr, m_widgetTizenId, m_bundle);
+    DPL::Optional<DPL::String> newurl = BundleURIHandling::processURI(
+            dplurl,
+            is_xhr,
+            m_widgetTizenId,
+            m_bundle);
 
     if (newurl.IsNull()) {
         LogDebug("URI is blocked");
         WKRelease(url);
         return NULL;
     } else {
-        LogDebug("URI processing result: " << *newurl );
+        LogDebug("URI processing result: " << *newurl);
         std::string tmpUrlStr = DPL::ToUTF8String(*newurl);
         if (tmpUrlStr.empty()) {
             LogDebug("uri is blocked");
@@ -680,16 +658,17 @@ WKURLRequestRef Bundle::willSendRequestForFrame(WKURLRequestRef request)
             std::string checkUrl = toString(tmpUrl);
             int getFileSize;
 
-            if(m_encrypted) {
-                if(isEncryptedResource(checkUrl, getFileSize)) {
+            if (m_encrypted) {
+                if (isEncryptedResource(checkUrl, getFileSize)) {
                     std::string decryptString = DecryptResource(checkUrl,
-                            getFileSize);
+                                                                getFileSize);
                     if (!decryptString.empty()) {
                         std::string destString = DATA_STRING;
 
                         std::string mimeString =
-                            DPL::ToUTF8String(MimeTypeUtils::identifyFileMimeType(
-                                        DPL::FromUTF8String(checkUrl)));
+                            DPL::ToUTF8String(
+                                MimeTypeUtils::identifyFileMimeType(
+                                    DPL::FromUTF8String(checkUrl)));
 
                         destString += mimeString;
                         destString += BASE64_STRING;
@@ -699,7 +678,8 @@ WKURLRequestRef Bundle::willSendRequestForFrame(WKURLRequestRef request)
                         WKURLRef destUrl =
                             WKURLCreateWithUTF8CString(decryptString.c_str());
 
-                        WKURLRequestRef req = WKURLRequestCreateWithWKURL(destUrl);
+                        WKURLRequestRef req = WKURLRequestCreateWithWKURL(
+                                destUrl);
                         WKRelease(destUrl);
                         LogDebug("return value " << decryptString << "]]");
                         return req;
@@ -715,11 +695,11 @@ WKURLRequestRef Bundle::willSendRequestForFrame(WKURLRequestRef request)
 }
 
 WKBundlePagePolicyAction Bundle::pageDecidePolicyForNavigationAction(
-       WKBundlePageRef             /* page */,
-       WKBundleFrameRef            frame,
-       WKBundleNavigationActionRef /* navigationAction */,
-       WKURLRequestRef             request,
-       WKTypeRef*                  /* userData */)
+    WKBundlePageRef /* page */,
+    WKBundleFrameRef frame,
+    WKBundleNavigationActionRef /* navigationAction */,
+    WKURLRequestRef request,
+    WKTypeRef*                  /* userData */)
 {
     using namespace ViewModule;
     using namespace ViewModule::SchemeActionMap;
@@ -731,8 +711,7 @@ WKBundlePagePolicyAction Bundle::pageDecidePolicyForNavigationAction(
     LogInfo("Uri being checked: " << request_uri);
 
     // exception uri
-    if( request_uri == BLANK_PAGE_URL )
-    {
+    if (request_uri == BLANK_PAGE_URL) {
         return WKBundlePagePolicyActionUse;
     }
 
@@ -740,8 +719,7 @@ WKBundlePagePolicyAction Bundle::pageDecidePolicyForNavigationAction(
     std::string request_scheme = getScheme(request_uri);
 
     // is tizen schem?
-    if ( request_scheme == TIZEN_SCHEME )
-    {
+    if (request_scheme == TIZEN_SCHEME) {
         return WKBundlePagePolicyActionPassThrough;
     }
 
@@ -764,29 +742,22 @@ WKBundlePagePolicyAction Bundle::pageDecidePolicyForNavigationAction(
 
     UriAction action;
 
-    if (m_widgetType == WrtDB::APP_TYPE_WAC20)
-    {
+    if (m_widgetType == WrtDB::APP_TYPE_WAC20) {
         action = g_wacActionMap[type][ctx];
-    }
-    else if (m_widgetType == WrtDB::APP_TYPE_TIZENWEBAPP)
-    {
+    } else if (m_widgetType == WrtDB::APP_TYPE_TIZENWEBAPP) {
         action = g_tizenActionMap[type][ctx];
-    }
-    else
-    {
+    } else {
         LogError("Unsupported application type: " << type);
         return WKBundlePagePolicyActionPassThrough;
     }
 
     LogDebug("Uri action: " << action);
 
-    if (action == URI_ACTION_WRT)
-    {
+    if (action == URI_ACTION_WRT) {
         return WKBundlePagePolicyActionUse;
     }
 
     return WKBundlePagePolicyActionPassThrough;
-
 }
 
 std::string Bundle::toString(WKStringRef str)
@@ -831,8 +802,7 @@ std::string Bundle::getScheme(std::string uri)
     std::size_t found = uri.find(':');
     std::string str;
 
-    if (found != std::string::npos)
-    {
+    if (found != std::string::npos) {
         str = uri.substr(0, found);
     }
 
@@ -844,8 +814,8 @@ bool Bundle::isEncryptedResource(std::string Url, int &size)
     std::string filePath;
 
     size_t pos = Url.find_first_not_of(SCHEME_FILE);
-    if ( std::string::npos != pos) {
-        filePath = Url.substr(pos-1);
+    if (std::string::npos != pos) {
+        filePath = Url.substr(pos - 1);
     }
 
     if (m_encryptedFiles.empty()) {
@@ -858,8 +828,9 @@ bool Bundle::isEncryptedResource(std::string Url, int &size)
     info.fileName = DPL::FromUTF8String(filePath);
 
     if ((0 == strncmp(Url.c_str(), SCHEME_FILE, strlen(SCHEME_FILE))) &&
-            (m_encryptedFiles.end() != (it =
-             m_encryptedFiles.find(info)))) {
+        (m_encryptedFiles.end() != (it =
+                                        m_encryptedFiles.find(info))))
+    {
         LogDebug(" info file name : " << it->fileName);
         LogDebug(" info file size : " << it->fileSize);
         size = it->fileSize;
@@ -873,8 +844,8 @@ std::string Bundle::DecryptResource(std::string resource, int size)
     std::string filePath;
 
     size_t pos = resource.find_first_not_of(SCHEME_FILE);
-    if ( std::string::npos != pos) {
-        filePath = resource.substr(pos-1);
+    if (std::string::npos != pos) {
+        filePath = resource.substr(pos - 1);
     }
 
     struct stat buf;
@@ -882,7 +853,8 @@ std::string Bundle::DecryptResource(std::string resource, int size)
         if (NULL == m_resDec) {
             using namespace WrtDB;
             m_resDec = new
-                WRTDecryptor::ResourceDecryptor(DPL::ToUTF8String(m_widgetTizenId));
+                WRTDecryptor::ResourceDecryptor(DPL::ToUTF8String(
+                                                    m_widgetTizenId));
             WrtDB::WidgetDAOReadOnly(m_widgetTizenId).
                 getEncryptedFileList(m_encryptedFiles);
         }
@@ -891,13 +863,13 @@ std::string Bundle::DecryptResource(std::string resource, int size)
         memset(contents, 0, bufSize);
 
         FILE* fp = fopen(filePath.c_str(), "rb");
-        if ( NULL == fp) {
+        if (NULL == fp) {
             LogDebug("Couldnot open file : " << filePath);
             return std::string();
         }
 
         size_t ret = fread(contents, sizeof(unsigned char), buf.st_size, fp);
-        if (ret <  static_cast<size_t>(buf.st_size) ){
+        if (ret < static_cast<size_t>(buf.st_size) ) {
             LogDebug("Couldnot read file : " << filePath);
             fclose(fp);
             return std::string();
@@ -909,7 +881,7 @@ std::string Bundle::DecryptResource(std::string resource, int size)
         unsigned char outDecBuf[bufSize];
         memset(outDecBuf, 0, bufSize);
         m_resDec->GetDecryptedChunk(contents, outDecBuf, bufSize);
-        memset(outDecBuf+size, '\n', bufSize - size);
+        memset(outDecBuf + size, '\n', bufSize - size);
 
         LogDebug("resource need to encoding base64");
         BIO *bmem, *b64;
@@ -922,7 +894,7 @@ std::string Bundle::DecryptResource(std::string resource, int size)
         BIO_flush(b64);
         BIO_get_mem_ptr(b64, &bptr);
 
-        std::string base64Enc((char *)bptr->data, bptr->length-1);
+        std::string base64Enc((char *)bptr->data, bptr->length - 1);
         BIO_free_all(b64);
 
         return base64Enc;
@@ -935,7 +907,7 @@ void Bundle::requestSuspend()
     LogDebug("Unregister callbacks");
     FOREACH(page, m_pagesList)
     {
-        WKBundlePageSetPageLoaderClient(*page,NULL);
+        WKBundlePageSetPageLoaderClient(*page, NULL);
     }
 }
 
@@ -955,7 +927,7 @@ void Bundle::connectLoaderClientCallbacksToPage(WKBundlePageRef page)
     WKBundlePageLoaderClient loaderClient = {
         kWKBundlePageLoaderClientCurrentVersion,
         this, /* clientinfo */
-        didStartProvisionalLoadForFrameCallback, /* didStartProvisionalLoadForFrame */
+        didStartProvisionalLoadForFrameCallback, /* StartProvisionLoadForFrm */
         0, /* didReceiveServerRedirectForProvisionalLoadForFrame */
         0, /* didFailProvisionalLoadWithErrorForFrame */
         didCommitLoadForFrameCallback, /* didCommitLoadForFrame */
@@ -987,29 +959,28 @@ void Bundle::connectLoaderClientCallbacksToPage(WKBundlePageRef page)
     WKBundlePageSetPageLoaderClient(page, &loaderClient);
 }
 
-
 extern "C"
 {
-    WK_EXPORT
-    void WKBundleInitialize(WKBundleRef bundle,
-                            WKTypeRef)
-    {
-        DPL::Log::LogSystemSingleton::Instance().SetTag("WRT-BUNDLE");
-        LogDebug("Bundle initialized");
-
-        DPL::Event::GetMainEventDispatcherInstance().ResetCrossEventCallHandler();
-        LogDebug("ResetCrossEventCallHandler()");
-
-        static Bundle s_bundle = Bundle(bundle);
-
-        WKBundleClient client = {
-            kWKBundleClientCurrentVersion,
-            &s_bundle,
-            &Bundle::didCreatePageCallback,
-            &Bundle::willDestroyPageCallback,
-            0, /* didInitializePageGroup */
-            &Bundle::didReceiveMessageCallback
-        };
-        WKBundleSetClient(bundle, &client);
+WK_EXPORT
+void WKBundleInitialize(WKBundleRef bundle,
+                        WKTypeRef)
+{
+    DPL::Log::LogSystemSingleton::Instance().SetTag("WRT-BUNDLE");
+    LogDebug("Bundle initialized");
+
+    DPL::Event::GetMainEventDispatcherInstance().ResetCrossEventCallHandler();
+    LogDebug("ResetCrossEventCallHandler()");
+
+    static Bundle s_bundle = Bundle(bundle);
+
+    WKBundleClient client = {
+        kWKBundleClientCurrentVersion,
+        &s_bundle,
+        &Bundle::didCreatePageCallback,
+        &Bundle::willDestroyPageCallback,
+        0,     /* didInitializePageGroup */
+        &Bundle::didReceiveMessageCallback
+    };
+    WKBundleSetClient(bundle, &client);
 }
 }
index 5b91ce4..10c5016 100644 (file)
 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
 
 extern "C" {
-    WK_EXPORT void WKBundleInitialize(WKBundleRef bundle, WKTypeRef);
+WK_EXPORT void WKBundleInitialize(WKBundleRef bundle, WKTypeRef);
 }
 
-class Bundle {
+class Bundle
+{
   public:
     Bundle(WKBundleRef bundle);
     ~Bundle();
 
     // WKBundleClient callback
     static void didCreatePageCallback(
-            WKBundleRef bundle,
-            WKBundlePageRef page,
-            const void* clientInfo);
+        WKBundleRef bundle,
+        WKBundlePageRef page,
+        const void* clientInfo);
     static void willDestroyPageCallback(
-            WKBundleRef bundle,
-            WKBundlePageRef page,
-            const void* clientInfo);
+        WKBundleRef bundle,
+        WKBundlePageRef page,
+        const void* clientInfo);
     static void didReceiveMessageCallback(
-            WKBundleRef,
-            WKStringRef messageName,
-            WKTypeRef messageBody,
-            const void *clientInfo);
+        WKBundleRef,
+        WKStringRef messageName,
+        WKTypeRef messageBody,
+        const void *clientInfo);
 
   private:
     WKStringRef m_uriChangedMessage;
@@ -79,47 +80,47 @@ class Bundle {
 
     // WKBundlePageResourceLoadClient callback
     static WKURLRequestRef willSendRequestForFrameCallback(
-            WKBundlePageRef,
-            WKBundleFrameRef,
-            uint64_t resourceIdentifier,
-            WKURLRequestRef request,
-            WKURLResponseRef,
-            const void *clientInfo);
+        WKBundlePageRef,
+        WKBundleFrameRef,
+        uint64_t resourceIdentifier,
+        WKURLRequestRef request,
+        WKURLResponseRef,
+        const void *clientInfo);
     static void didFinishLoadForResourceCallback(
-            WKBundlePageRef page,
-            WKBundleFrameRef frame,
-            uint64_t resourceIdentifier,
-            const void* clientInfo);
+        WKBundlePageRef page,
+        WKBundleFrameRef frame,
+        uint64_t resourceIdentifier,
+        const void* clientInfo);
 
     // WKBundlePageDidStartProvisionalLoadForFrame callback
     static void didStartProvisionalLoadForFrameCallback(
-            WKBundlePageRef page,
-            WKBundleFrameRef frame,
-            WKTypeRef* userData,
-            const void *clientInfo);
+        WKBundlePageRef page,
+        WKBundleFrameRef frame,
+        WKTypeRef* userData,
+        const void *clientInfo);
 
     // WKBundlePageDidRemoveFrameFromHierarchy callback
     static void didRemoveFrameFromHierarchyCallback(
-            WKBundlePageRef page,
-            WKBundleFrameRef frame,
-            WKTypeRef* userData,
-            const void *clientInfo);
+        WKBundlePageRef page,
+        WKBundleFrameRef frame,
+        WKTypeRef* userData,
+        const void *clientInfo);
 
     // WKBundlePageLoaderClient callback
     static void didCommitLoadForFrameCallback(
-            WKBundlePageRef page,
-            WKBundleFrameRef frame,
-            WKTypeRef*,
-            const void *clientInfo);
+        WKBundlePageRef page,
+        WKBundleFrameRef frame,
+        WKTypeRef*,
+        const void *clientInfo);
 
     // WKBundlePageDecidePolicyForNavigationActionCallback
     static WKBundlePagePolicyAction pageDecidePolicyForNavigationActionCallback(
-            WKBundlePageRef page,
-            WKBundleFrameRef frame,
-            WKBundleNavigationActionRef navigationAction,
-            WKURLRequestRef request,
-            WKTypeRef* userData,
-            const void* clientInfo);
+        WKBundlePageRef page,
+        WKBundleFrameRef frame,
+        WKBundleNavigationActionRef navigationAction,
+        WKURLRequestRef request,
+        WKTypeRef* userData,
+        const void* clientInfo);
 
     // WKBundlePageDecidePolicyForResponseCallback
     static WKBundlePagePolicyAction pageDecidePolicyForResponseCallback(
@@ -134,16 +135,16 @@ class Bundle {
     void didCreatePage(WKBundlePageRef page);
     void willDestroyPage(WKBundlePageRef page);
     void didReceiveMessage(
-            WKStringRef messageName,
-            WKTypeRef messageBody);
+        WKStringRef messageName,
+        WKTypeRef messageBody);
 
     // WKBundlePageResourceLoadClient
     WKURLRequestRef willSendRequestForFrame(WKURLRequestRef request);
     WKBundlePagePolicyAction pageDecidePolicyForNavigationAction(
-        WKBundlePageRef             page,
-        WKBundleFrameRef            frame,
+        WKBundlePageRef page,
+        WKBundleFrameRef frame,
         WKBundleNavigationActionRef navigationAction,
-        WKURLRequestRef             request,
+        WKURLRequestRef request,
         WKTypeRef*                  userData);
 
     // basic
@@ -157,14 +158,13 @@ class Bundle {
     std::string DecryptResource(std::string resource, int size);
 
     void fixWKMessageArgs(std::string & argScale,
-        std::string & argEncodedBundle, std::string & argTheme);
+                          std::string & argEncodedBundle,
+                          std::string & argTheme);
 
     void requestSuspend();
     void requestResume();
 
     void connectLoaderClientCallbacksToPage(WKBundlePageRef page);
-
-
 };
 
 #endif /* WRT_SRC_VIEW_WEBKIT2_WRT_WK2_BUNDLE_H_ */
old mode 100755 (executable)
new mode 100644 (file)
index 59ed640..3914b3f
@@ -98,67 +98,78 @@ const char * const CERTIFICATE_CONFIRM_REQUEST_ASK_TITLE =
 const char * const CERTIFICATE_CONFIRM_REQUEST_ASK_BODY =
     "This site's security certificate is not trusted! Do you acess this site?";
 
-const wchar_t* BACKGROUND_ENABLED = L"background_enabled" ;
-
+const wchar_t* BACKGROUND_ENABLED = L"background_enabled";
 } // anonymous namespace
 
-std::map<const std::string, const Evas_Smart_Cb> ViewLogic::m_ewkCallbacksMap =
-{
-    {"load,started", &ViewLogic::loadStartedCallback},
-    {"load,finished", &ViewLogic::loadFinishedCallback},
-    {"title,changed", &ViewLogic::titleChangedCallback},
-    {"load,progress", &ViewLogic::loadProgressCallback},
-    {"load,progress,finished", &ViewLogic::loadProgressFinishedCallback},
-    {"process,crashed", &ViewLogic::processCrashedCallback},
+std::map<const std::string,
+         const Evas_Smart_Cb> ViewLogic::m_ewkCallbacksMap = {
+    { "load,started", &ViewLogic::loadStartedCallback },
+    { "load,finished", &ViewLogic::loadFinishedCallback },
+    { "title,changed", &ViewLogic::titleChangedCallback },
+    { "load,progress", &ViewLogic::loadProgressCallback },
+    { "load,progress,finished", &ViewLogic::loadProgressFinishedCallback },
+    { "process,crashed", &ViewLogic::processCrashedCallback },
     // WKPageUIClient
-    {"create,window", &ViewLogic::createWindowCallback},
-    {"close,window", &ViewLogic::closeWindowCallback},
+    { "create,window", &ViewLogic::createWindowCallback },
+    { "close,window", &ViewLogic::closeWindowCallback },
     // WKPagePolicyClient
-    {"policy,navigation,decide", &ViewLogic::policyNavigationDecideCallback},
-    {"policy,newwindow,decide", &ViewLogic::policyNewWindowDecideCallback},
-    {"policy,response,decide", &ViewLogic::pageResponseDecideCallback},
+    { "policy,navigation,decide", &ViewLogic::policyNavigationDecideCallback },
+    { "policy,newwindow,decide", &ViewLogic::policyNewWindowDecideCallback },
+    { "policy,response,decide", &ViewLogic::pageResponseDecideCallback },
     // WKPageContextMenuClient
-    {"contextmenu,customize", &ViewLogic::contextmenuCustomizeCallback},
+    { "contextmenu,customize", &ViewLogic::contextmenuCustomizeCallback },
     // WKPageFormClient
-    {"form,submit", &ViewLogic::formSubmitCallback},
+    { "form,submit", &ViewLogic::formSubmitCallback },
     // EWK Geolocation Callback
-    {"request,geolocation,permission", &ViewLogic::geolocationPermissionRequestCallback},
+    { "request,geolocation,permission",
+      &ViewLogic::geolocationPermissionRequestCallback },
     // EWK Notification Callback
-    {"notification,show", &ViewLogic::notificationShowCallback},
-    {"notification,cancel", &ViewLogic::notificationCancelCallback},
-    {"notification,permission,request", &ViewLogic::notificationPermissionRequestCallback},
-
-    {"database,quota,exceeded", &ViewLogic::databaseUsagePermissionRequestCallback},
-    {"filesystem,permission,request", &ViewLogic::fileSystemPermissionRequestCallback},
-    {"fullscreen,enterfullscreen", &ViewLogic::enterFullscreenCallback},
-    {"fullscreen,exitfullscreen", &ViewLogic::exitFullscreenCallback},
+    { "notification,show", &ViewLogic::notificationShowCallback },
+    { "notification,cancel", &ViewLogic::notificationCancelCallback },
+    { "notification,permission,request",
+      &ViewLogic::notificationPermissionRequestCallback },
+
+    { "database,quota,exceeded",
+      &ViewLogic::databaseUsagePermissionRequestCallback },
+    { "filesystem,permission,request",
+      &ViewLogic::fileSystemPermissionRequestCallback },
+    { "fullscreen,enterfullscreen", &ViewLogic::enterFullscreenCallback },
+    { "fullscreen,exitfullscreen", &ViewLogic::exitFullscreenCallback },
     // IME Callback
     // when ime start to be showed on the webview,
     // this callback will be called
-    {"inputmethod,changed", &ViewLogic::imeChangedCallback},
+    { "inputmethod,changed", &ViewLogic::imeChangedCallback },
     // this callback will be called
     //  when ime finishes to be showed on the webview
     // "event_info" arg of this callback is always NULL point
     // if web content should know size of ime,
     //  use "inputmethod,changed" instead of this.
     //
-    {"editorclient,ime,opened", &ViewLogic::imeOpenedCallback},
+    { "editorclient,ime,opened", &ViewLogic::imeOpenedCallback },
     // when ime finished to be hidden,
     // this callback will be called
-    {"editorclient,ime,closed", &ViewLogic::imeClosedCallback},
+    { "editorclient,ime,closed", &ViewLogic::imeClosedCallback },
     // EWK Usermedia Callback
-    {"usermedia,permission,request", &ViewLogic::usermediaPermissionRequestCallback},
+    { "usermedia,permission,request",
+      &ViewLogic::usermediaPermissionRequestCallback },
     // Custom handlers
-    {"protocolhandler,registration,requested", &ViewLogic::protocolHandlerRegistrationCallback},
-    {"protocolhandler,isregistered", &ViewLogic::protocolHandlerIsRegisteredCallback},
-    {"protocolhandler,unregistration,requested", &ViewLogic::protocolHandlerUnregistrationCallback},
-    {"contenthandler,registration,requested", &ViewLogic::contentHandlerRegistrationCallback},
-    {"contenthandler,isregistered", &ViewLogic::contentHandlerIsRegisteredCallback},
-    {"contenthandler,unregistration,requested", &ViewLogic::contentHandlerUnregistrationCallback},
-    {"request,certificate,confirm", &ViewLogic::certificateConfirmRequestCallback}
+    { "protocolhandler,registration,requested",
+      &ViewLogic::protocolHandlerRegistrationCallback },
+    { "protocolhandler,isregistered",
+      &ViewLogic::protocolHandlerIsRegisteredCallback },
+    { "protocolhandler,unregistration,requested",
+      &ViewLogic::protocolHandlerUnregistrationCallback },
+    { "contenthandler,registration,requested",
+      &ViewLogic::contentHandlerRegistrationCallback },
+    { "contenthandler,isregistered",
+      &ViewLogic::contentHandlerIsRegisteredCallback },
+    { "contenthandler,unregistration,requested",
+      &ViewLogic::contentHandlerUnregistrationCallback },
+    { "request,certificate,confirm",
+      &ViewLogic::certificateConfirmRequestCallback }
 };
 
-ViewLogic::ViewLogic():
+ViewLogic::ViewLogic() :
     m_ewkContext(0),
     m_currentEwkView(0),
     m_window(NULL),
@@ -169,10 +180,9 @@ ViewLogic::ViewLogic():
     m_appsSupport(new ViewModule::AppsSupport()),
     m_vibrationSupport(new ViewModule::VibrationSupport()),
     m_attachedToCustomHandlerDao(false)
-{
-}
+{}
 
-ViewLogic::~ViewLogic ()
+ViewLogic::~ViewLogic()
 {
     detachFromCustomHandlersDao();
 }
@@ -185,8 +195,7 @@ bool ViewLogic::createWebView(Ewk_Context* context,
     Assert(NULL != m_ewkContext);
     Assert(window);
     m_window = window;
-    if(!createEwkView(evas_object_evas_get(m_window)))
-    {
+    if (!createEwkView(evas_object_evas_get(m_window))) {
         return false;
     }
     return true;
@@ -298,7 +307,7 @@ void ViewLogic::suspendWidget()
     if (!m_cbs->suspend.empty()) {
         m_cbs->suspend(true);
     }
-};
+}
 
 void ViewLogic::resumeWidget()
 {
@@ -315,19 +324,19 @@ void ViewLogic::resumeWidget()
         }
     }
 
-   /* window system team recomend removing this win_raise code. */
+    /* window system team recomend removing this win_raise code. */
     /*
-    if (m_window) {
-        elm_win_raise(m_window);
-    }
-    */
+     * if (m_window) {
+     *  elm_win_raise(m_window);
+     * }
+     */
     evas_object_focus_set(m_currentEwkView, EINA_TRUE);
 
     // call user callback
     if (!m_cbs->resume.empty()) {
         m_cbs->resume(true);
     }
-};
+}
 
 void ViewLogic::resetWidget()
 {
@@ -348,7 +357,7 @@ void ViewLogic::resetWidget()
 
     // check if current url is service url for this tizen service
     std::string requestedUri =
-            ViewModule::UriSupport::getUri(m_model, m_startUrl);
+        ViewModule::UriSupport::getUri(m_model, m_startUrl);
     DPL::OptionalString servicedUri = ViewModule::UriSupport::localizeURI(
             DPL::FromUTF8String(requestedUri.c_str()),
             m_model);
@@ -461,7 +470,7 @@ void ViewLogic::initializeEwkContext(Ewk_Context* newEwkContext)
         ewk_context_proxy_uri_set(newEwkContext, NULL);
     } else {
         LogInfo("proxy address [" << proxyAddress << "]");
-        ewk_context_proxy_uri_set(newEwkContext,  proxyAddress);
+        ewk_context_proxy_uri_set(newEwkContext, proxyAddress);
     }
 
     if (proxyAddress) {
@@ -489,7 +498,7 @@ void ViewLogic::initializeEwkContext(Ewk_Context* newEwkContext)
         this);
 
     ewk_context_certificate_file_set(m_ewkContext,
-        "/opt/usr/share/certs/ca-certificate.crt");
+                                     "/opt/usr/share/certs/ca-certificate.crt");
 
     // set to member value
     m_ewkContext = newEwkContext;
@@ -499,27 +508,28 @@ void ViewLogic::finalizeEwkContext()
 {
     LogInfo("finalizeEwkContext called");
     ewk_context_message_from_injected_bundle_callback_set(
-            m_ewkContext,
-            NULL,
-            NULL);
+        m_ewkContext,
+        NULL,
+        NULL);
     ewk_context_did_start_download_callback_set(
-            m_ewkContext,
-            NULL,
-            NULL);
+        m_ewkContext,
+        NULL,
+        NULL);
     ewk_context_vibration_client_callbacks_set(
-            m_ewkContext,
-            NULL,
-            NULL,
-            NULL);
-//    ewk_context_delete(m_ewkContext);
-//    m_ewkContext = 0;
+        m_ewkContext,
+        NULL,
+        NULL,
+        NULL);
+    //    ewk_context_delete(m_ewkContext);
+    //    m_ewkContext = 0;
 }
 
 void ViewLogic::initializeSupport()
 {
     // background support
-    if( m_model->SettingList.Get().getBackgroundSupport()
-        == BackgroundSupport_Enable ) {
+    if (m_model->SettingList.Get().getBackgroundSupport()
+        == BackgroundSupport_Enable)
+    {
         LogDebug("Background support enabled, set process active");
         pid_t pid = getpid();
         sysman_inform_active(pid);
@@ -531,7 +541,7 @@ void ViewLogic::initializeSupport()
         WrtDB::PropertyDAOReadOnly::WidgetPropertyValue bgEnableValue =
             dao.getPropertyValue(DPL::String(BACKGROUND_ENABLED));
 
-        if(!bgEnableValue.IsNull() && !bgEnableValue->compare(L"true")) {
+        if (!bgEnableValue.IsNull() && !bgEnableValue->compare(L"true")) {
             //skip suspendWidget
             LogDebug("Background support enabled, set process active");
             pid_t pid = getpid();
@@ -554,7 +564,7 @@ void ViewLogic::initializeSupport()
     ewk_context_memory_saving_mode_set(
         m_ewkContext,
         static_cast<WrtDB::SettingsType>(result) ==
-            WrtDB::SETTINGS_TYPE_ON ? EINA_TRUE : EINA_FALSE);
+        WrtDB::SETTINGS_TYPE_ON ? EINA_TRUE : EINA_FALSE);
     m_schemeSupport.reset(new SchemeSupport(m_model->Type.Get().appType));
     ViewModule::StorageSupport::initializeStorage(m_model);
     m_appsSupport->initialize(m_model);
@@ -575,7 +585,8 @@ void ViewLogic::initializePluginLoading()
         m_model->SettingList.Get().isEncrypted());
 }
 
-void ViewLogic::ewkClientInit(Evas_Object *wkView) {
+void ViewLogic::ewkClientInit(Evas_Object *wkView)
+{
     Assert(NULL != wkView && "ewk_view not created at this point");
 
     FOREACH(it, m_ewkCallbacksMap) {
@@ -592,7 +603,8 @@ void ViewLogic::ewkClientInit(Evas_Object *wkView) {
         this);
 }
 
-void ViewLogic::ewkClientDeinit(Evas_Object *wkView) {
+void ViewLogic::ewkClientDeinit(Evas_Object *wkView)
+{
     LogDebug("ewkClientDeinit");
     Assert(NULL != wkView && "ewk_view not created at this point");
 
@@ -614,14 +626,14 @@ bool ViewLogic::createEwkView(Evas* canvas)
     Assert(canvas);
     ADD_PROFILING_POINT("ewk_view_add_with_context", "start");
     Evas_Object* newEwkView = ewk_view_add_with_context(
-        canvas,
-        m_ewkContext);
+            canvas,
+            m_ewkContext);
     ADD_PROFILING_POINT("ewk_view_add_with_context", "stop");
 
     if (!newEwkView) {
         LogError("View creation failed");
         Wrt::Popup::PopupInvoker().showInfo(
-                "Info", "View creation failed","close");
+            "Info", "View creation failed", "close");
         return false;
     }
 
@@ -632,7 +644,7 @@ bool ViewLogic::createEwkView(Evas* canvas)
     ewkCookieManager =
         ewk_context_cookie_manager_get(m_ewkContext);
     ewk_cookie_manager_accept_policy_set(ewkCookieManager,
-                           EWK_COOKIE_ACCEPT_POLICY_ALWAYS);
+                                         EWK_COOKIE_ACCEPT_POLICY_ALWAYS);
 
     LogInfo("push webview: " << newEwkView);
     m_ewkViewList.push_back(newEwkView);
@@ -684,7 +696,8 @@ void ViewLogic::prepareEwkView(Evas_Object *wkView)
     // The followings are not implemeted yet by webkit2
     //      ewk_view_setting_accelerated_compositing_enable_set(EINA_TRUE);
     //      ewk_view_mode_set();
-    //      ewk_view_setting_enable_specified_plugin_set(EINA_TRUE, FLASH_MIME_TYPE);
+    //      ewk_view_setting_enable_specified_plugin_set(EINA_TRUE,
+    // FLASH_MIME_TYPE);
     //      ewk_view_setting_html5video_external_player_enable_set(EINA_FALSE);
     //      ewk_view_show_ime_on_autofocus_set(EINA_TRUE);
     //      elm_webview_show_magnifier_set(EINA_FALSE);
@@ -807,10 +820,10 @@ void ViewLogic::suspendWebkit(Evas_Object *wkView)
 }
 
 void ViewLogic::contextMessageFromInjectedBundleCallback(
-        const char* name,
-        const char* body,
-        char** returnData,
-        void* clientInfo)
+    const char* name,
+    const char* body,
+    char** returnData,
+    void* clientInfo)
 {
     LogDebug("contextMessageFromInjectedBundleCallback called");
     Assert(clientInfo);
@@ -831,8 +844,8 @@ void ViewLogic::contextMessageFromInjectedBundleCallback(
 }
 
 void ViewLogic::didStartDownloadCallback(
-        const char* downloadUrl,
-        void* data)
+    const char* downloadUrl,
+    void* data)
 {
     LogDebug("didStartDownloadCallback called");
     Assert(data);
@@ -846,9 +859,9 @@ void ViewLogic::didStartDownloadCallback(
 }
 
 void ViewLogic::loadStartedCallback(
-        void* data,
-        Evas_Object* obj,
-        void* /*eventInfo*/)
+    void* data,
+    Evas_Object* obj,
+    void* /*eventInfo*/)
 {
     LogDebug("loadStartedCallback called");
     Assert(data);
@@ -859,13 +872,12 @@ void ViewLogic::loadStartedCallback(
     if (!This->m_cbs->loadStart.empty()) {
         This->m_cbs->loadStart(obj);
     }
-
 }
 
 void ViewLogic::loadFinishedCallback(
-        void* data,
-        Evas_Object* obj,
-        void* /*eventInfo*/)
+    void* data,
+    Evas_Object* obj,
+    void* /*eventInfo*/)
 {
     LogDebug("loadFinishedCallback called");
     Assert(data);
@@ -883,11 +895,11 @@ void ViewLogic::loadFinishedCallback(
         } else {
             std::string jsStr = DPL::ToUTF8String(*jsOptionalString).c_str();
 
-            if(EINA_FALSE == ewk_view_script_execute(
-                This->m_currentEwkView,
-                jsStr.c_str(),
-                didRunJavaScriptCallback,
-                This))
+            if (EINA_FALSE == ewk_view_script_execute(
+                    This->m_currentEwkView,
+                    jsStr.c_str(),
+                    didRunJavaScriptCallback,
+                    This))
             {
                 LogError("JS for auto fill data failed.");
             }
@@ -922,9 +934,9 @@ void ViewLogic::loadFinishedCallback(
 }
 
 void ViewLogic::titleChangedCallback(
-        void* data,
-        Evas_Object* /*obj*/,
-        void* eventInfo)
+    void* data,
+    Evas_Object* /*obj*/,
+    void* eventInfo)
 {
     LogDebug("titleChangedCallback called");
     Assert(data);
@@ -943,18 +955,18 @@ void ViewLogic::titleChangedCallback(
 }
 
 void ViewLogic::loadProgressCallback(
-        void* /*data*/,
-        Evas_Object* /*obj*/,
-        void* eventInfo)
+    void* /*data*/,
+    Evas_Object* /*obj*/,
+    void* eventInfo)
 {
     double* progress = static_cast<double*>(eventInfo);
     LogDebug("didChangeProgressCallback progress = " << *progress);
 }
 
 void ViewLogic::loadProgressFinishedCallback(
-        void* data,
-        Evas_Object* /*obj*/,
-        void* /*eventInfo*/)
+    void* data,
+    Evas_Object* /*obj*/,
+    void* /*eventInfo*/)
 {
     LogDebug("didFinishProgressCallback");
     Assert(data);
@@ -965,14 +977,14 @@ void ViewLogic::loadProgressFinishedCallback(
 }
 
 void ViewLogic::processCrashedCallback(
-        void* data,
-        Evas_Object* /*obj*/,
-        void* eventInfo)
+    void* data,
+    Evas_Object* /*obj*/,
+    void* eventInfo)
 {
     LogInfo("processCrashedCallback");
     Assert(data);
     ViewLogic const * const view =
-            static_cast<ViewLogic const * const>(data);
+        static_cast<ViewLogic const * const>(data);
     if (!view->m_cbs->webCrash.empty()) {
         view->m_cbs->webCrash();
     }
@@ -983,9 +995,9 @@ void ViewLogic::processCrashedCallback(
 }
 
 void ViewLogic::createWindowCallback(
-        void* data,
-        Evas_Object* obj,
-        void* eventInfo)
+    void* data,
+    Evas_Object* obj,
+    void* eventInfo)
 {
     LogDebug("createWindowCallback");
     Assert(data);
@@ -1029,9 +1041,9 @@ void ViewLogic::createWindowCallback(
 }
 
 void ViewLogic::closeWindowCallback(
-        void* data,
-        Evas_Object* obj,
-        void* /*eventInfo*/)
+    void* data,
+    Evas_Object* obj,
+    void* /*eventInfo*/)
 {
     LogDebug("closeWindowCallback");
     ViewLogic* This = static_cast<ViewLogic*>(data);
@@ -1040,9 +1052,9 @@ void ViewLogic::closeWindowCallback(
 }
 
 void ViewLogic::policyNavigationDecideCallback(
-        void* data,
-        Evas_Object* /*obj*/,
-        void* eventInfo)
+    void* data,
+    Evas_Object* /*obj*/,
+    void* eventInfo)
 {
     LogDebug("policyNavigationDecideCallback called");
     Assert(data);
@@ -1062,7 +1074,7 @@ void ViewLogic::policyNavigationDecideCallback(
     } else {
         // check whether this is new empty window
         const char* activeUrl = ewk_view_url_get(This->m_currentEwkView);
-        if(!activeUrl || 0 == strlen(activeUrl)) {
+        if (!activeUrl || 0 == strlen(activeUrl)) {
             /*
              * The view is empty and scheme has been handled externally. When
              * user gets back from the external application he'd see blank page
@@ -1091,9 +1103,9 @@ void ViewLogic::policyNavigationDecideCallback(
 }
 
 void ViewLogic::policyNewWindowDecideCallback(
-        void* data,
-        Evas_Object* /*obj*/,
-        void* eventInfo)
+    void* data,
+    Evas_Object* /*obj*/,
+    void* eventInfo)
 {
     LogDebug("policyNewWindowDecideCallback called");
     Assert(data);
@@ -1116,9 +1128,9 @@ void ViewLogic::policyNewWindowDecideCallback(
 }
 
 void ViewLogic::pageResponseDecideCallback(
-        void* data,
-        Evas_Object* /*obj*/,
-        void* eventInfo)
+    void* data,
+    Evas_Object* /*obj*/,
+    void* eventInfo)
 {
     LogDebug("pageResponseDecideCallback called");
     Assert(data);
@@ -1137,7 +1149,7 @@ void ViewLogic::pageResponseDecideCallback(
         ewk_policy_decision_suspend(policyDecision);
 
         // get uri information
-        const char* url =  ewk_policy_decision_url_get(policyDecision);
+        const char* url = ewk_policy_decision_url_get(policyDecision);
         if (NULL == url || strlen(url) == 0) {
             LogDebug("url data is empty");
             ewk_policy_decision_use(policyDecision);
@@ -1170,9 +1182,9 @@ void ViewLogic::pageResponseDecideCallback(
 }
 
 void ViewLogic::contextmenuCustomizeCallback(
-        void* data,
-        Evas_Object* /*obj*/,
-        void* eventInfo)
+    void* data,
+    Evas_Object* /*obj*/,
+    void* eventInfo)
 {
     LogDebug("contextmenuCustomizeCallback called");
     Assert(data);
@@ -1181,11 +1193,12 @@ void ViewLogic::contextmenuCustomizeCallback(
     Ewk_Context_Menu* menu = static_cast<Ewk_Context_Menu*>(eventInfo);
     if ((This->m_model->Type.Get().appType == WrtDB::APP_TYPE_TIZENWEBAPP) &&
         (This->m_model->SettingList.Get().getContextMenu()
-            == ContextMenu_Disable))
+         == ContextMenu_Disable))
     {
         LogDebug("ContextMenu Disable!!");
         for (unsigned int idx = 0; idx < ewk_context_menu_item_count(menu);) {
-            Ewk_Context_Menu_Item* item = ewk_context_menu_nth_item_get(menu, idx);
+            Ewk_Context_Menu_Item* item = ewk_context_menu_nth_item_get(menu,
+                                                                        idx);
             Assert(item);
             ewk_context_menu_item_remove(menu, item);
         }
@@ -1194,7 +1207,8 @@ void ViewLogic::contextmenuCustomizeCallback(
         int menu_num = ewk_context_menu_item_count(menu);
         unsigned int idx = 0;
         do {
-            Ewk_Context_Menu_Item* item = ewk_context_menu_nth_item_get(menu, idx);
+            Ewk_Context_Menu_Item* item = ewk_context_menu_nth_item_get(menu,
+                                                                        idx);
             if (!item) {
                 idx++;
                 continue;
@@ -1202,38 +1216,38 @@ void ViewLogic::contextmenuCustomizeCallback(
             Ewk_Context_Menu_Item_Tag tag = ewk_context_menu_item_tag_get(item);
 
             switch (tag) {
-                case EWK_CONTEXT_MENU_ITEM_TAG_OPEN_IMAGE_IN_NEW_WINDOW:
-                    ewk_context_menu_item_remove(menu, item);
-                    continue;
+            case EWK_CONTEXT_MENU_ITEM_TAG_OPEN_IMAGE_IN_NEW_WINDOW:
+                ewk_context_menu_item_remove(menu, item);
+                continue;
 
-                case EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK_IN_NEW_WINDOW:
-                    ewk_context_menu_item_remove(menu, item);
-                    continue;
+            case EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK_IN_NEW_WINDOW:
+                ewk_context_menu_item_remove(menu, item);
+                continue;
 
-                case EWK_CONTEXT_MENU_ITEM_TAG_OPEN_FRAME_IN_NEW_WINDOW:
-                    ewk_context_menu_item_remove(menu, item);
-                    continue;
+            case EWK_CONTEXT_MENU_ITEM_TAG_OPEN_FRAME_IN_NEW_WINDOW:
+                ewk_context_menu_item_remove(menu, item);
+                continue;
 
-                case EWK_CONTEXT_MENU_ITEM_TAG_OPEN_MEDIA_IN_NEW_WINDOW:
-                    ewk_context_menu_item_remove(menu, item);
-                    continue;
+            case EWK_CONTEXT_MENU_ITEM_TAG_OPEN_MEDIA_IN_NEW_WINDOW:
+                ewk_context_menu_item_remove(menu, item);
+                continue;
 
-                case EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_WEB:
-                    ewk_context_menu_item_remove(menu, item);
-                    continue;
+            case EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_WEB:
+                ewk_context_menu_item_remove(menu, item);
+                continue;
 
-                default:
-                    idx++;
-                    break;
+            default:
+                idx++;
+                break;
             }
         } while (idx < menu_num);
     }
 }
 
 void ViewLogic::formSubmitCallback(
-        void* /*data*/,
-        Evas_Object* /*obj*/,
-        void* eventInfo)
+    void* /*data*/,
+    Evas_Object* /*obj*/,
+    void* eventInfo)
 {
     LogDebug("formSubmitCallback called");
     Assert(eventInfo);
@@ -1250,18 +1264,18 @@ void ViewLogic::formSubmitCallback(
 }
 
 void ViewLogic::geolocationPermissionRequestCallback(
-        void* data,
-        Evas_Object* /*obj*/,
-        void* eventInfo)
+    void* data,
+    Evas_Object* /*obj*/,
+    void* eventInfo)
 {
     Assert(data);
     ViewLogic* This = static_cast<ViewLogic*>(data);
     Assert(eventInfo);
     Ewk_Geolocation_Permission_Data* permissionRequest =
-         static_cast<Ewk_Geolocation_Permission_Data*>(eventInfo);
+        static_cast<Ewk_Geolocation_Permission_Data*>(eventInfo);
 
     if (This->m_securityOriginSupport->isNeedPermissionCheck(
-        SecurityOriginDB::FEATURE_GEOLOCATION)
+            SecurityOriginDB::FEATURE_GEOLOCATION)
         == WrtDB::SETTINGS_TYPE_OFF)
     {
         ewk_geolocation_permission_request_allow_set(
@@ -1276,9 +1290,9 @@ void ViewLogic::geolocationPermissionRequestCallback(
 }
 
 void ViewLogic::notificationShowCallback(
-        void* data,
-        Evas_Object* /*obj*/,
-        void* eventInfo)
+    void* data,
+    Evas_Object* /*obj*/,
+    void* eventInfo)
 {
     LogDebug("notificationShowCallback called");
     Assert(data);
@@ -1290,9 +1304,9 @@ void ViewLogic::notificationShowCallback(
     using namespace ViewModule::WebNotification;
 
     WebNotificationDataPtr notiData(
-            new WebNotificationData(
-                This->m_model,
-                ewk_notification_id_get(noti)));
+        new WebNotificationData(
+            This->m_model,
+            ewk_notification_id_get(noti)));
 
     DPL::OptionalString string =
         DPL::FromUTF8String(ewk_notification_icon_url_get(noti));
@@ -1318,23 +1332,23 @@ void ViewLogic::notificationShowCallback(
 }
 
 void ViewLogic::notificationCancelCallback(
-        void* /*data*/,
-        Evas_Object* /*obj*/,
-        void* /*eventInfo*/)
+    void* /*data*/,
+    Evas_Object* /*obj*/,
+    void* /*eventInfo*/)
 {
     LogDebug("notificationCancelCallback called");
 }
 
 void ViewLogic::notificationPermissionRequestCallback(
-        void* data,
-        Evas_Object* /*obj*/,
-        void* eventInfo)
+    void* data,
+    Evas_Object* /*obj*/,
+    void* eventInfo)
 {
     LogDebug("notificationPermissionRequestCallback called");
     Assert(data);
     ViewLogic* This = static_cast<ViewLogic*>(data);
     if (This->m_securityOriginSupport->isNeedPermissionCheck(
-        SecurityOriginDB::FEATURE_WEB_NOTIFICATION)
+            SecurityOriginDB::FEATURE_WEB_NOTIFICATION)
         == WrtDB::SETTINGS_TYPE_OFF)
     {
         Ewk_Notification_Permission_Request* request =
@@ -1377,10 +1391,10 @@ void ViewLogic::vibrationCancelCallback(void* data)
 
 // EWK Orientation Callback
 Eina_Bool ViewLogic::orientationLockCallback(
-        Evas_Object* obj,
-        Eina_Bool /*needLock*/,
-        int orientation,
-        void* data)
+    Evas_Object* obj,
+    Eina_Bool /*needLock*/,
+    int orientation,
+    void* data)
 {
     LogDebug("orientationLockCallback called");
     Assert(data);
@@ -1390,15 +1404,15 @@ Eina_Bool ViewLogic::orientationLockCallback(
         LogDebug("orientation is portrait-primary");
         elm_win_rotation_with_resize_set(This->m_window, 0);
         ewk_view_orientation_send(obj, 0);
-    } else if(orientation & EWK_SCREEN_ORIENTATION_LANDSCAPE_PRIMARY) {
+    } else if (orientation & EWK_SCREEN_ORIENTATION_LANDSCAPE_PRIMARY) {
         LogDebug("orientation is landscape-primary");
         elm_win_rotation_with_resize_set(This->m_window, 270);
         ewk_view_orientation_send(obj, 90);
-    } else if(orientation & EWK_SCREEN_ORIENTATION_PORTRAIT_SECONDARY) {
+    } else if (orientation & EWK_SCREEN_ORIENTATION_PORTRAIT_SECONDARY) {
         LogDebug("orientation is portrait-secondary");
         elm_win_rotation_with_resize_set(This->m_window, 180);
         ewk_view_orientation_send(obj, 180);
-    } else if(orientation & EWK_SCREEN_ORIENTATION_LANDSCAPE_SECONDARY) {
+    } else if (orientation & EWK_SCREEN_ORIENTATION_LANDSCAPE_SECONDARY) {
         LogDebug("orientation is landscape-secondary");
         elm_win_rotation_with_resize_set(This->m_window, 90);
         ewk_view_orientation_send(obj, -90);
@@ -1409,12 +1423,11 @@ Eina_Bool ViewLogic::orientationLockCallback(
     return EINA_TRUE;
 }
 
-
 // Fullscreen API callbacks
 void ViewLogic::enterFullscreenCallback(
-        void* data,
-        Evas_Object* /*obj*/,
-        void* /*eventInfo*/)
+    void* data,
+    Evas_Object* /*obj*/,
+    void* /*eventInfo*/)
 {
     LogInfo("enterFullscreenCallback called");
     Assert(data);
@@ -1424,9 +1437,9 @@ void ViewLogic::enterFullscreenCallback(
     }
 }
 void ViewLogic::exitFullscreenCallback(
-        void* data,
-        Evas_Object* /*obj*/,
-        void* /*eventInfo*/)
+    void* data,
+    Evas_Object* /*obj*/,
+    void* /*eventInfo*/)
 {
     LogInfo("exitFullscreenCallback called");
     Assert(data);
@@ -1437,9 +1450,9 @@ void ViewLogic::exitFullscreenCallback(
 }
 
 void ViewLogic::imeChangedCallback(
-        void* data,
-        Evas_Object* /*obj*/,
-        void* eventInfo)
+    void* data,
+    Evas_Object* /*obj*/,
+    void* eventInfo)
 {
     LogDebug("enter");
     Assert(data);
@@ -1451,9 +1464,9 @@ void ViewLogic::imeChangedCallback(
 }
 
 void ViewLogic::imeOpenedCallback(
-        void* data,
-        Evas_Object* /*obj*/,
-        void* /*eventInfo*/)
+    void* data,
+    Evas_Object* /*obj*/,
+    void* /*eventInfo*/)
 {
     LogDebug("enter");
     Assert(data);
@@ -1465,14 +1478,14 @@ void ViewLogic::imeOpenedCallback(
     args.width = This->m_imeWidth;
     args.height = This->m_imeHeight;
     This->fireJavascriptEvent(
-            static_cast<int>(SoftKeyboardChangeCustomEvent),
-            &args);
+        static_cast<int>(SoftKeyboardChangeCustomEvent),
+        &args);
 }
 
 void ViewLogic::imeClosedCallback(
-        void* data,
-        Evas_Object* /*obj*/,
-        void* /*eventInfo*/)
+    void* data,
+    Evas_Object* /*obj*/,
+    void* /*eventInfo*/)
 {
     LogDebug("enter");
     Assert(data);
@@ -1483,14 +1496,14 @@ void ViewLogic::imeClosedCallback(
     args.state = IME_STATE_OFF;
 
     This->fireJavascriptEvent(
-            static_cast<int>(SoftKeyboardChangeCustomEvent),
-            &args);
+        static_cast<int>(SoftKeyboardChangeCustomEvent),
+        &args);
 }
 
 void ViewLogic::usermediaPermissionRequestCallback(
-        void* data,
-        Evas_Object* /*obj*/,
-        void* eventInfo)
+    void* data,
+    Evas_Object* /*obj*/,
+    void* eventInfo)
 {
     LogDebug("usermediaPermissionRequestCallback called");
     Assert(data);
@@ -1499,14 +1512,14 @@ void ViewLogic::usermediaPermissionRequestCallback(
                                                              eventInfo);
 }
 
-
 // helper method
 CustomHandlerDB::CustomHandlerPtr getCustomHandlerFromData(void* data)
 {
     Assert(data);
     Ewk_Custom_Handlers_Data* handler =
-                static_cast<Ewk_Custom_Handlers_Data*>(data);
-    CustomHandlerDB::CustomHandlerPtr customHandler(new CustomHandlerDB::CustomHandler());
+        static_cast<Ewk_Custom_Handlers_Data*>(data);
+    CustomHandlerDB::CustomHandlerPtr customHandler(
+        new CustomHandlerDB::CustomHandler());
     const char* base_url = ewk_custom_handlers_data_base_url_get(handler);
     if (base_url) {
         LogDebug("base url: " << base_url);
@@ -1588,27 +1601,29 @@ char const * const contentBlackList[contentBlackListLenth] = {
  * @param customHandler
  */
 void saveUserResponse(Wrt::Popup::PopupResponse response,
-        CustomHandlerDB::CustomHandlerPtr customHandler)
+                      CustomHandlerDB::CustomHandlerPtr customHandler)
 {
     switch (response) {
-        case Wrt::Popup::YES_DO_REMEMBER:
-            LogDebug("User allowed, remember");
-            customHandler->user_decision = static_cast<CustomHandlerDB::HandlerState>
-                (CustomHandlerDB::Agreed | CustomHandlerDB::DecisionSaved);
-            break;
-        case Wrt::Popup::YES_DONT_REMEMBER:
-            LogDebug("User allowed, don't remember");
-            customHandler->user_decision = CustomHandlerDB::Agreed;
-            break;
-        case Wrt::Popup::NO_DO_REMEMBER:
-            LogDebug("User didn't allow, remember");
-            customHandler->user_decision = static_cast<CustomHandlerDB::HandlerState>
-                    (CustomHandlerDB::Declined | CustomHandlerDB::DecisionSaved);
-            break;
-        case Wrt::Popup::NO_DONT_REMEMBER:
-            LogDebug("User didn't allow, don't remember");
-            customHandler->user_decision = CustomHandlerDB::Declined;
-            break;
+    case Wrt::Popup::YES_DO_REMEMBER:
+        LogDebug("User allowed, remember");
+        customHandler->user_decision =
+            static_cast<CustomHandlerDB::HandlerState>
+            (CustomHandlerDB::Agreed | CustomHandlerDB::DecisionSaved);
+        break;
+    case Wrt::Popup::YES_DONT_REMEMBER:
+        LogDebug("User allowed, don't remember");
+        customHandler->user_decision = CustomHandlerDB::Agreed;
+        break;
+    case Wrt::Popup::NO_DO_REMEMBER:
+        LogDebug("User didn't allow, remember");
+        customHandler->user_decision =
+            static_cast<CustomHandlerDB::HandlerState>
+            (CustomHandlerDB::Declined | CustomHandlerDB::DecisionSaved);
+        break;
+    case Wrt::Popup::NO_DONT_REMEMBER:
+        LogDebug("User didn't allow, don't remember");
+        customHandler->user_decision = CustomHandlerDB::Declined;
+        break;
     }
 }
 
@@ -1623,7 +1638,7 @@ void ViewLogic::protocolHandlerRegistrationCallback(void* data,
     Assert(data);
     LogDebug("enter");
     CustomHandlerDB::CustomHandlerPtr customHandler =
-            getCustomHandlerFromData(eventInfo);
+        getCustomHandlerFromData(eventInfo);
 
     std::string scheme = DPL::ToUTF8String(customHandler->target);
     if (scheme.empty()) {
@@ -1634,8 +1649,7 @@ void ViewLogic::protocolHandlerRegistrationCallback(void* data,
     bool matched = false;
     //scheme on whiteList
     for (int i = 0; i < protocolWhiteListLenth; ++i) {
-        if (0 == strcmp(protocolWhiteList[i], scheme.c_str()))
-        {
+        if (0 == strcmp(protocolWhiteList[i], scheme.c_str())) {
             LogDebug("Match found, protocol can be handled");
             matched = true;
         }
@@ -1649,8 +1663,7 @@ void ViewLogic::protocolHandlerRegistrationCallback(void* data,
         }
         int l = 4;
         char c = scheme[l];
-        while (c != '\0')
-        {
+        while (c != '\0') {
             if (c < 'a' || c > 'z') {
                 LogWarning("Wrong char inside scheme. "
                            << "Only lowercase ASCII letters accepted");
@@ -1666,32 +1679,35 @@ void ViewLogic::protocolHandlerRegistrationCallback(void* data,
     This->attachToCustomHandlersDao();
     CustomHandlerDB::CustomHandlerDAO handlersDao(This->m_model->TizenId);
     CustomHandlerDB::CustomHandlerPtr handler =
-            handlersDao.getProtocolHandler(customHandler->target,
-                                           customHandler->url,
-                                           customHandler->base_url);
+        handlersDao.getProtocolHandler(customHandler->target,
+                                       customHandler->url,
+                                       customHandler->base_url);
     if (handler && (handler->user_decision & CustomHandlerDB::DecisionSaved)) {
         LogDebug("Protocol already registered - nothing to do");
     } else {
         LogDebug("Protocol handler not found");
         Wrt::Popup::PopupResponse response =
-            GlobalSettings::PopupsTestModeEnabled() ? Wrt::Popup::YES_DO_REMEMBER :
-                Wrt::Popup::PopupInvoker().askYesNoCheckbox(
-                        PROTOCOL_HANDLER_ASK_TITLE,
-                        PROTOCOL_HANDLER_ASK_MSG,
-                        PROTOCOL_HANDLER_ASK_REMEMBER);
+            GlobalSettings::PopupsTestModeEnabled() ? Wrt::Popup::
+                YES_DO_REMEMBER :
+            Wrt::Popup::PopupInvoker().askYesNoCheckbox(
+                PROTOCOL_HANDLER_ASK_TITLE,
+                PROTOCOL_HANDLER_ASK_MSG,
+                PROTOCOL_HANDLER_ASK_REMEMBER);
         saveUserResponse(response, customHandler);
-        if (customHandler->user_decision == CustomHandlerDB::Declined)
+        if (customHandler->user_decision == CustomHandlerDB::Declined) {
             return;
+        }
         handlersDao.registerProtocolHandler(*(customHandler.get()));
         if (customHandler->user_decision & CustomHandlerDB::Agreed) {
             //TODO remove old default handler somehow from appsvc
             LogDebug("Registering appservice entry");
             int ret = appsvc_set_defapp(APPSVC_OPERATION_VIEW,
-                    NULL,
-                    DPL::ToUTF8String(customHandler->target).c_str(),
-                    DPL::ToUTF8String(This->m_model->TizenId).c_str());
-            if (APPSVC_RET_OK != ret)
-            {
+                                        NULL,
+                                        DPL::ToUTF8String(
+                                            customHandler->target).c_str(),
+                                        DPL::ToUTF8String(This->m_model->
+                                                              TizenId).c_str());
+            if (APPSVC_RET_OK != ret) {
                 LogWarning("Appsvc entry failed: " << ret);
             }
         }
@@ -1706,28 +1722,31 @@ void ViewLogic::protocolHandlerIsRegisteredCallback(void* data,
                                                     void* eventInfo)
 {
     LogDebug("enter");
-    CustomHandlerDB::CustomHandlerPtr customHandler = getCustomHandlerFromData(eventInfo);
+    CustomHandlerDB::CustomHandlerPtr customHandler = getCustomHandlerFromData(
+            eventInfo);
     ViewLogic* This = static_cast<ViewLogic*>(data);
     LogDebug("Creating handlers dao");
     This->attachToCustomHandlersDao();
     CustomHandlerDB::CustomHandlerDAO handlersDao(This->m_model->TizenId);
-        CustomHandlerDB::CustomHandlerPtr handler =
-            handlersDao.getProtocolHandler(customHandler->target,
-                                           customHandler->url,
-                                           customHandler->base_url);
+    CustomHandlerDB::CustomHandlerPtr handler =
+        handlersDao.getProtocolHandler(customHandler->target,
+                                       customHandler->url,
+                                       customHandler->base_url);
     if (handler) {
-        if (handler->user_decision & CustomHandlerDB::Agreed)
+        if (handler->user_decision & CustomHandlerDB::Agreed) {
             ewk_custom_handlers_data_result_set(
                 static_cast<Ewk_Custom_Handlers_Data*>(data),
                 EWK_CUSTOM_HANDLERS_REGISTERED);
-        else
+        } else {
             ewk_custom_handlers_data_result_set(
                 static_cast<Ewk_Custom_Handlers_Data*>(data),
                 EWK_CUSTOM_HANDLERS_DECLINED);
-    } else
-            ewk_custom_handlers_data_result_set(
-                static_cast<Ewk_Custom_Handlers_Data*>(data),
-                EWK_CUSTOM_HANDLERS_NEW);
+        }
+    } else {
+        ewk_custom_handlers_data_result_set(
+            static_cast<Ewk_Custom_Handlers_Data*>(data),
+            EWK_CUSTOM_HANDLERS_NEW);
+    }
     This->detachFromCustomHandlersDao();
 }
 
@@ -1737,7 +1756,7 @@ void ViewLogic::protocolHandlerUnregistrationCallback(void* data,
 {
     LogDebug("enter");
     CustomHandlerDB::CustomHandlerPtr customHandler =
-            getCustomHandlerFromData(eventInfo);
+        getCustomHandlerFromData(eventInfo);
     ViewLogic* This = static_cast<ViewLogic*>(data);
     LogDebug("Creating handlers dao");
     This->attachToCustomHandlersDao();
@@ -1747,14 +1766,16 @@ void ViewLogic::protocolHandlerUnregistrationCallback(void* data,
                                        customHandler->url,
                                        customHandler->base_url);
     if (handlerCheck) {
-        if (handlerCheck->user_decision & CustomHandlerDB::Agreed)
+        if (handlerCheck->user_decision & CustomHandlerDB::Agreed) {
             appsvc_unset_defapp(DPL::ToUTF8String(This->m_model->TizenId).c_str());
+        }
 
         handlersDao.unregisterProtocolHandler(customHandler->target,
                                               customHandler->url,
                                               customHandler->base_url);
-    } else
+    } else {
         LogDebug("Nothing to unregister");
+    }
 
     This->detachFromCustomHandlersDao();
 }
@@ -1766,17 +1787,15 @@ void ViewLogic::contentHandlerRegistrationCallback(void* data,
     Assert(data);
     LogDebug("enter");
     CustomHandlerDB::CustomHandlerPtr customHandler =
-            getCustomHandlerFromData(eventInfo);
+        getCustomHandlerFromData(eventInfo);
 
     std::string mimeType = DPL::ToUTF8String(customHandler->target);
     if (mimeType.empty()) {
         LogError("No mimeType provided.");
         return;
     }
-    for (int i = 0; i < contentBlackListLenth; ++i)
-    {
-        if (0 == strcmp(contentBlackList[i], mimeType.c_str()))
-        {
+    for (int i = 0; i < contentBlackListLenth; ++i) {
+        if (0 == strcmp(contentBlackList[i], mimeType.c_str())) {
             LogWarning("mimeType blacklisted");
             //throw SecurityException
             return;
@@ -1787,33 +1806,36 @@ void ViewLogic::contentHandlerRegistrationCallback(void* data,
     LogDebug("Creating handlers dao");
     This->attachToCustomHandlersDao();
     CustomHandlerDB::CustomHandlerDAO handlersDao(This->m_model->TizenId);
-        CustomHandlerDB::CustomHandlerPtr handler =
-            handlersDao.getContentHandler(customHandler->target,
-                                          customHandler->url,
-                                          customHandler->base_url);
+    CustomHandlerDB::CustomHandlerPtr handler =
+        handlersDao.getContentHandler(customHandler->target,
+                                      customHandler->url,
+                                      customHandler->base_url);
     if (handler && (handler->user_decision & CustomHandlerDB::DecisionSaved)) {
         LogDebug("Protocol already registered - nothing to do");
     } else {
         LogDebug("Protocol handler not found");
         Wrt::Popup::PopupResponse response =
-            GlobalSettings::PopupsTestModeEnabled() ? Wrt::Popup::YES_DO_REMEMBER :
-                Wrt::Popup::PopupInvoker().askYesNoCheckbox(
-                        CONTENT_HANDLER_ASK_TITLE,
-                        CONTENT_HANDLER_ASK_MSG,
-                        CONTENT_HANDLER_AKS_REMEMBER);
+            GlobalSettings::PopupsTestModeEnabled() ? Wrt::Popup::
+                YES_DO_REMEMBER :
+            Wrt::Popup::PopupInvoker().askYesNoCheckbox(
+                CONTENT_HANDLER_ASK_TITLE,
+                CONTENT_HANDLER_ASK_MSG,
+                CONTENT_HANDLER_AKS_REMEMBER);
         saveUserResponse(response, customHandler);
-        if (customHandler->user_decision == CustomHandlerDB::Declined)
+        if (customHandler->user_decision == CustomHandlerDB::Declined) {
             return;
+        }
         handlersDao.registerContentHandler(*(customHandler.get()));
         if (customHandler->user_decision & CustomHandlerDB::Agreed) {
             //TODO remove old default handler somehow from appsvc
             LogDebug("Registering appservice entry");
             int ret = appsvc_set_defapp(APPSVC_OPERATION_VIEW,
-                    DPL::ToUTF8String(customHandler->target).c_str(),
-                    NULL,
-                    DPL::ToUTF8String(This->m_model->TizenId).c_str());
-            if (APPSVC_RET_OK != ret)
-            {
+                                        DPL::ToUTF8String(
+                                            customHandler->target).c_str(),
+                                        NULL,
+                                        DPL::ToUTF8String(This->m_model->
+                                                              TizenId).c_str());
+            if (APPSVC_RET_OK != ret) {
                 LogWarning("Appsvc entry failed: " << ret);
             }
         }
@@ -1834,23 +1856,25 @@ void ViewLogic::contentHandlerIsRegisteredCallback(void* data,
 
     This->attachToCustomHandlersDao();
     CustomHandlerDB::CustomHandlerDAO handlersDao(This->m_model->TizenId);
-        CustomHandlerDB::CustomHandlerPtr handler =
-            handlersDao.getContentHandler(customHandler->target,
-                                          customHandler->url,
-                                          customHandler->base_url);
+    CustomHandlerDB::CustomHandlerPtr handler =
+        handlersDao.getContentHandler(customHandler->target,
+                                      customHandler->url,
+                                      customHandler->base_url);
     if (handler) {
-        if (handler->user_decision & CustomHandlerDB::Agreed)
+        if (handler->user_decision & CustomHandlerDB::Agreed) {
             ewk_custom_handlers_data_result_set(
                 static_cast<Ewk_Custom_Handlers_Data*>(data),
                 EWK_CUSTOM_HANDLERS_REGISTERED);
-        else
+        } else {
             ewk_custom_handlers_data_result_set(
                 static_cast<Ewk_Custom_Handlers_Data*>(data),
                 EWK_CUSTOM_HANDLERS_DECLINED);
-    } else
-            ewk_custom_handlers_data_result_set(
-                static_cast<Ewk_Custom_Handlers_Data*>(data),
-                EWK_CUSTOM_HANDLERS_NEW);
+        }
+    } else {
+        ewk_custom_handlers_data_result_set(
+            static_cast<Ewk_Custom_Handlers_Data*>(data),
+            EWK_CUSTOM_HANDLERS_NEW);
+    }
     This->detachFromCustomHandlersDao();
 }
 
@@ -1860,31 +1884,33 @@ void ViewLogic::contentHandlerUnregistrationCallback(void* data,
 {
     LogDebug("enter");
     CustomHandlerDB::CustomHandlerPtr customHandler =
-            getCustomHandlerFromData(eventInfo);
+        getCustomHandlerFromData(eventInfo);
     ViewLogic* This = static_cast<ViewLogic*>(data);
     LogDebug("Creating handlers dao");
     This->attachToCustomHandlersDao();
     CustomHandlerDB::CustomHandlerDAO handlersDao(This->m_model->TizenId);
-        CustomHandlerDB::CustomHandlerPtr handlerCheck =
-            handlersDao.getContentHandler(customHandler->target,
-                                           customHandler->url,
-                                           customHandler->base_url);
-        if (handlerCheck) {
-            if (handlerCheck->user_decision & CustomHandlerDB::Agreed)
-                appsvc_unset_defapp(DPL::ToUTF8String(This->m_model->TizenId).c_str());
-
-            handlersDao.unregisterContentHandler(customHandler->target,
-                                                     customHandler->url,
-                                                     customHandler->base_url);
-        } else
-            LogDebug("Nothing to unregister");
+    CustomHandlerDB::CustomHandlerPtr handlerCheck =
+        handlersDao.getContentHandler(customHandler->target,
+                                      customHandler->url,
+                                      customHandler->base_url);
+    if (handlerCheck) {
+        if (handlerCheck->user_decision & CustomHandlerDB::Agreed) {
+            appsvc_unset_defapp(DPL::ToUTF8String(This->m_model->TizenId).c_str());
+        }
+
+        handlersDao.unregisterContentHandler(customHandler->target,
+                                             customHandler->url,
+                                             customHandler->base_url);
+    } else {
+        LogDebug("Nothing to unregister");
+    }
     This->detachFromCustomHandlersDao();
 }
 
 void ViewLogic::didRunJavaScriptCallback(
-        Evas_Object* /*obj*/,
-        const char* result,
-        void* /*userData*/)
+    Evas_Object* /*obj*/,
+    const char* result,
+    void* /*userData*/)
 {
     LogInfo("didRunJavaScriptCallback called");
     LogInfo("result = " << result);
@@ -1927,7 +1953,7 @@ void ViewLogic::databaseUsagePermissionRequestCallback(
     Assert(eventInfo);
 
     if (This->m_securityOriginSupport->isNeedPermissionCheck(
-        SecurityOriginDB::FEATURE_WEB_DATABASE)
+            SecurityOriginDB::FEATURE_WEB_DATABASE)
         == WrtDB::SETTINGS_TYPE_OFF)
     {
         // default value is deny
@@ -1938,7 +1964,7 @@ void ViewLogic::databaseUsagePermissionRequestCallback(
         This->m_securityOriginSupport->getSecurityOriginDAO(),
         eventInfo);
     return;
- }
+}
 
 void ViewLogic::fileSystemPermissionRequestCallback(
     void* data,
@@ -1950,11 +1976,11 @@ void ViewLogic::fileSystemPermissionRequestCallback(
     ViewLogic* This = static_cast<ViewLogic*>(data);
 
     if (This->m_securityOriginSupport->isNeedPermissionCheck(
-        SecurityOriginDB::FEATURE_FILE_SYSTEM_ACCESS)
+            SecurityOriginDB::FEATURE_FILE_SYSTEM_ACCESS)
         == WrtDB::SETTINGS_TYPE_OFF)
     {
         Ewk_Context_File_System_Permission* fileSystemPermission =
-             static_cast<Ewk_Context_File_System_Permission*>(eventInfo);
+            static_cast<Ewk_Context_File_System_Permission*>(eventInfo);
         ewk_context_file_system_permission_allow_set(fileSystemPermission,
                                                      EINA_FALSE);
         return;
@@ -1977,16 +2003,15 @@ void ViewLogic::certificateConfirmRequestCallback(
     Assert(data);
     ViewLogic* This = static_cast<ViewLogic*>(data);
     Assert(eventInfo);
-        Ewk_Certificate_Policy_Decision* certificatePolicyDecision =
+    Ewk_Certificate_Policy_Decision* certificatePolicyDecision =
         static_cast<Ewk_Certificate_Policy_Decision*>(eventInfo);
 
     bool status = This->askUserForCertificateConfirm();
-    if(!status) {
+    if (!status) {
         ewk_certificate_policy_decision_allowed_set(
             certificatePolicyDecision,
             EINA_FALSE);
-    }
-    else {
+    } else {
         ewk_certificate_policy_decision_allowed_set(
             certificatePolicyDecision,
             EINA_TRUE);
@@ -1996,21 +2021,21 @@ void ViewLogic::certificateConfirmRequestCallback(
 bool ViewLogic::askUserForCertificateConfirm()
 {
     return Wrt::Popup::PopupInvoker().askYesNo(
-        CERTIFICATE_CONFIRM_REQUEST_ASK_TITLE,
-        CERTIFICATE_CONFIRM_REQUEST_ASK_BODY);
+               CERTIFICATE_CONFIRM_REQUEST_ASK_TITLE,
+               CERTIFICATE_CONFIRM_REQUEST_ASK_BODY);
 }
 
 void ViewLogic::didRecieveMessageFromInjectedBundle(
-        const char* name,
-        const char* /*body*/)
+    const char* name,
+    const char* /*body*/)
 {
     LogDebug("did recive message " << name);
 }
 
 void ViewLogic::didReceiveSynchronousMessage(
-        const char* name,
-        const char* body,
-        char** returnData)
+    const char* name,
+    const char* body,
+    char** returnData)
 {
     LogDebug("didReceiveSynchronousMessage called");
     Assert(name);
@@ -2032,7 +2057,7 @@ void ViewLogic::didReceiveSynchronousMessage(
     } else if (!strcmp(name, uriChangedMessageName)) {
         LogDebug("received : " << uriChangedMessageName);
         std::string ret = requestUriChanged(DPL::FromUTF8String(body));
-        *returnData =  strdup(ret.c_str());
+        *returnData = strdup(ret.c_str());
     }
 }
 
@@ -2054,10 +2079,8 @@ std::string ViewLogic::requestUriChanged(const DPL::String& changedURL)
     // If url is same to URICHANGE_BLOCKED_URL,
     // this url has been already blocked by willsend.
     // So current page should be moved to previous page
-    if (url == URICHANGE_BLOCKED_URL)
-    {
-        if (m_model->Type.Get().appType == WrtDB::APP_TYPE_TIZENWEBAPP)
-        {
+    if (url == URICHANGE_BLOCKED_URL) {
+        if (m_model->Type.Get().appType == WrtDB::APP_TYPE_TIZENWEBAPP) {
             // block this page and open it in browser
             LogDebug("Request was blocked by WARP: " << url.c_str());
             if (!m_blockedUri.empty()) {
@@ -2150,7 +2173,7 @@ void ViewLogic::windowClose()
 
         // resume ewkView
         /* In case we support many pages in parallel
-           then view is not suspended*/
+         * then view is not suspended*/
         //resumeEwkView(m_currentEwkView);
 
         // show ewkView
old mode 100755 (executable)
new mode 100644 (file)
index 753a828..b7006c1
@@ -88,97 +88,97 @@ class ViewLogic : public ViewModule::IViewModule
 
     // message from injected bundle Callback
     static void contextMessageFromInjectedBundleCallback(
-            const char* name,
-            const char* body,
-            char** returnData,
-            void* userData);
+        const char* name,
+        const char* body,
+        char** returnData,
+        void* userData);
 
     // EWK Context Callback
     static void didStartDownloadCallback(
-            const char* downloadUrl,
-            void* data);
+        const char* downloadUrl,
+        void* data);
 
     // WKPageLoaderClient
     static void loadStartedCallback(
-            void* data,
-            Evas_Object* obj,
-            void* eventInfo);
+        void* data,
+        Evas_Object* obj,
+        void* eventInfo);
     static void loadFinishedCallback(
-            void* data,
-            Evas_Object* obj,
-            void* eventInfo);
+        void* data,
+        Evas_Object* obj,
+        void* eventInfo);
     static void titleChangedCallback(
-            void* data,
-            Evas_Object* obj,
-            void* eventInfo);
+        void* data,
+        Evas_Object* obj,
+        void* eventInfo);
     static void loadProgressCallback(
-            void* data,
-            Evas_Object* obj,
-            void* eventInfo);
+        void* data,
+        Evas_Object* obj,
+        void* eventInfo);
     static void loadProgressFinishedCallback(
-            void* data,
-            Evas_Object* obj,
-            void* eventInfo);
+        void* data,
+        Evas_Object* obj,
+        void* eventInfo);
     static void processCrashedCallback(
-            void* data,
-            Evas_Object* obj,
-            void* eventInfo);
+        void* data,
+        Evas_Object* obj,
+        void* eventInfo);
 
     // EWK Callback
     static void createWindowCallback(
-            void* data,
-            Evas_Object* obj,
-            void* eventInfo);
+        void* data,
+        Evas_Object* obj,
+        void* eventInfo);
     static void closeWindowCallback(
-            void* data,
-            Evas_Object* obj,
-            void* eventInfo);
+        void* data,
+        Evas_Object* obj,
+        void* eventInfo);
 
     // EWK PolicyDecide Callback
     static void policyNavigationDecideCallback(
-            void* data,
-            Evas_Object* obj,
-            void* eventInfo);
+        void* data,
+        Evas_Object* obj,
+        void* eventInfo);
     static void policyNewWindowDecideCallback(
-            void* data,
-            Evas_Object* obj,
-            void* eventInfo);
+        void* data,
+        Evas_Object* obj,
+        void* eventInfo);
     static void pageResponseDecideCallback(
-            void* data,
-            Evas_Object* obj,
-            void* eventInfo);
+        void* data,
+        Evas_Object* obj,
+        void* eventInfo);
 
     // EWK ContextMenu Callback
     static void contextmenuCustomizeCallback(
-            void* data,
-            Evas_Object* obj,
-            void* eventInfo);
+        void* data,
+        Evas_Object* obj,
+        void* eventInfo);
 
     // EWK FormClient Callback
     static void formSubmitCallback(
-            void *data,
-            Evas_Object *obj,
-            void *eventInfo);
+        void *data,
+        Evas_Object *obj,
+        void *eventInfo);
 
     // EWK Geolocation Callback
     static void geolocationPermissionRequestCallback(
-            void* data,
-            Evas_Object* obj,
-            void* eventInfo);
+        void* data,
+        Evas_Object* obj,
+        void* eventInfo);
 
     // EWK Notification Callback
     static void notificationShowCallback(
-            void* data,
-            Evas_Object* obj,
-            void* eventInfo);
+        void* data,
+        Evas_Object* obj,
+        void* eventInfo);
     static void notificationCancelCallback(
-            void* data,
-            Evas_Object* obj,
-            void* eventInfo);
+        void* data,
+        Evas_Object* obj,
+        void* eventInfo);
     static void notificationPermissionRequestCallback(
-            void* data,
-            Evas_Object* obj,
-            void* eventInfo);
+        void* data,
+        Evas_Object* obj,
+        void* eventInfo);
 
     // EWK Vibration Callback
     static void vibrationVibrateCallback(uint64_t time, void* data);
@@ -186,61 +186,61 @@ class ViewLogic : public ViewModule::IViewModule
 
     // EWK Orientation Callback
     static Eina_Bool orientationLockCallback(
-            Evas_Object* obj,
-            Eina_Bool needLock,
-            int orientation,
-            void* data);
+        Evas_Object* obj,
+        Eina_Bool needLock,
+        int orientation,
+        void* data);
 
     // EWK Fullscreen API callbacks
     static void enterFullscreenCallback(
-            void* data,
-            Evas_Object* obj,
-            void* eventInfo);
+        void* data,
+        Evas_Object* obj,
+        void* eventInfo);
     static void exitFullscreenCallback(
-            void* data,
-            Evas_Object* obj,
-            void* eventInfo);
+        void* data,
+        Evas_Object* obj,
+        void* eventInfo);
 
     // EWK IME Change/Show/Hide Callback
     static void imeChangedCallback(
-            void* data,
-            Evas_Object* obj,
-            void* eventInfo);
+        void* data,
+        Evas_Object* obj,
+        void* eventInfo);
     static void imeOpenedCallback(
-            void* data,
-            Evas_Object* obj,
-            void* eventInfo);
+        void* data,
+        Evas_Object* obj,
+        void* eventInfo);
     static void imeClosedCallback(
-            void* data,
-            Evas_Object* obj,
-            void* eventInfo);
+        void* data,
+        Evas_Object* obj,
+        void* eventInfo);
 
     // EWK Usermedia Callback
     static void usermediaPermissionRequestCallback(
-            void* data,
-            Evas_Object* obj,
-            void* eventInfo);
+        void* data,
+        Evas_Object* obj,
+        void* eventInfo);
 
     // custom content/scheme handlers
     static void protocolHandlerRegistrationCallback(void* data,
-            Evas_Object* obj,
-            void* eventInfo);
+                                                    Evas_Object* obj,
+                                                    void* eventInfo);
     static void protocolHandlerIsRegisteredCallback(void* data,
-            Evas_Object* obj,
-            void* eventInfo);
+                                                    Evas_Object* obj,
+                                                    void* eventInfo);
     static void protocolHandlerUnregistrationCallback(void* data,
-            Evas_Object* obj,
-            void* eventInfo);
+                                                      Evas_Object* obj,
+                                                      void* eventInfo);
 
     static void contentHandlerRegistrationCallback(void* data,
-            Evas_Object* obj,
-            void* eventInfo);
+                                                   Evas_Object* obj,
+                                                   void* eventInfo);
     static void contentHandlerIsRegisteredCallback(void* data,
-            Evas_Object* obj,
-            void* eventInfo);
+                                                   Evas_Object* obj,
+                                                   void* eventInfo);
     static void contentHandlerUnregistrationCallback(void* data,
-            Evas_Object* obj,
-            void* eventInfo);
+                                                     Evas_Object* obj,
+                                                     void* eventInfo);
 
     // database usage permission request callback
     static void databaseUsagePermissionRequestCallback(
@@ -263,9 +263,9 @@ class ViewLogic : public ViewModule::IViewModule
 
     // JS execute callback
     static void didRunJavaScriptCallback(
-            Evas_Object* obj,
-            const char* result,
-            void* userData);
+        Evas_Object* obj,
+        const char* result,
+        void* userData);
 
     // idler callback
     static Eina_Bool windowCloseIdlerCallback(void *data);
@@ -275,12 +275,12 @@ class ViewLogic : public ViewModule::IViewModule
 
     //bundle
     void didRecieveMessageFromInjectedBundle(
-            const char* name,
-            const char* body);
+        const char* name,
+        const char* body);
     void didReceiveSynchronousMessage(
-            const char* name,
-            const char* body,
-            char** returnData);
+        const char* name,
+        const char* body,
+        char** returnData);
 
     // security
     void rememberBlockedURI(const DPL::String& str);
index 55e9949..cbea174 100644 (file)
@@ -30,7 +30,6 @@
 #include <Elementary.h>
 
 namespace ViewModule {
-
 using namespace SecurityOriginDB;
 using namespace ViewModule::SecurityOriginSupportUtil;
 
@@ -74,17 +73,18 @@ void popupCallback(void* data, Evas_Object* obj, void* /*eventInfo*/)
     Assert(data);
     PermissionData* permData = static_cast<PermissionData*>(data);
     Ewk_Context_File_System_Permission* fileSystemPermission =
-            static_cast<Ewk_Context_File_System_Permission*>(permData->m_data);
+        static_cast<Ewk_Context_File_System_Permission*>(permData->m_data);
 
     Evas_Object* popup = getPopup(obj);
     Result result = getResult(obj);
 
     if (result != RESULT_UNKNOWN) {
-        permData->m_originDao->setSecurityOriginData(permData->m_originData, result);
+        permData->m_originDao->setSecurityOriginData(permData->m_originData,
+                                                     result);
     }
     Eina_Bool ret =
         (result == RESULT_ALLOW_ALWAYS || result == RESULT_ALLOW_ONCE) ?
-            EINA_TRUE : EINA_FALSE;
+        EINA_TRUE : EINA_FALSE;
     ewk_context_file_system_permission_allow_set(fileSystemPermission,
                                                  ret);
     delete permData;
@@ -105,7 +105,7 @@ void FileSystemSupport::fileSystemPermissionRequest(
         static_cast<Ewk_Context_File_System_Permission*>(data);
     Ewk_Security_Origin* ewkOrigin =
         ewk_context_file_system_permission_origin_get(
-        fileSystemPermission);
+            fileSystemPermission);
     Assert(ewkOrigin);
 
     SecurityOriginData securityOriginData(
index e0f24eb..7465f03 100644 (file)
 #include <Elementary.h>
 
 namespace SecurityOriginDB {
-    class SecurityOriginDAO;
+class SecurityOriginDAO;
 }
 
 namespace ViewModule {
 namespace FileSystemSupport {
-
 void fileSystemPermissionRequest(
-        Evas_Object* window,
-        SecurityOriginDB::SecurityOriginDAO* securityOriginDAO,
-        void* data);
-
+    Evas_Object* window,
+    SecurityOriginDB::SecurityOriginDAO* securityOriginDAO,
+    void* data);
 } // namespace FileSystemSupport
 } // namespace ViewModule
 
index 197d658..853ab16 100644 (file)
@@ -33,7 +33,6 @@
 namespace ViewModule {
 namespace GeolocationSupport {
 namespace Webkit2 {
-
 using namespace SecurityOriginDB;
 using namespace ViewModule::SecurityOriginSupportUtil;
 
@@ -74,20 +73,21 @@ void popupCallback(void* data, Evas_Object* obj, void* /*eventInfo*/)
     Assert(data);
     PermissionData* permData = static_cast<PermissionData*>(data);
     Ewk_Geolocation_Permission_Data* permissionRequest =
-            static_cast<Ewk_Geolocation_Permission_Data*>(permData->m_data);
+        static_cast<Ewk_Geolocation_Permission_Data*>(permData->m_data);
 
     Evas_Object* popup = getPopup(obj);
     Result result = getResult(obj);
 
     if (result != RESULT_UNKNOWN) {
-        permData->m_originDao->setSecurityOriginData(permData->m_originData, result);
+        permData->m_originDao->setSecurityOriginData(permData->m_originData,
+                                                     result);
     }
     Eina_Bool ret =
         (result == RESULT_ALLOW_ALWAYS || result == RESULT_ALLOW_ONCE) ?
-            EINA_TRUE : EINA_FALSE;
+        EINA_TRUE : EINA_FALSE;
     ewk_geolocation_permission_request_allow_set(
-                ewk_geolocation_permission_request_get(permissionRequest),
-                ret);
+        ewk_geolocation_permission_request_get(permissionRequest),
+        ret);
     delete permData;
     evas_object_hide(popup);
     evas_object_del(popup);
@@ -95,9 +95,9 @@ void popupCallback(void* data, Evas_Object* obj, void* /*eventInfo*/)
 } // namespace
 
 void geolocationPermissionRequest(
-        Evas_Object* window,
-        SecurityOriginDB::SecurityOriginDAO* securityOriginDAO,
-        void* data)
+    Evas_Object* window,
+    SecurityOriginDB::SecurityOriginDAO* securityOriginDAO,
+    void* data)
 {
     LogDebug("geolocationPermissionRequest called");
     Assert(securityOriginDAO);
@@ -141,6 +141,5 @@ void geolocationPermissionRequest(
     return;
 }
 }
-
 } // namespace GeolocationSupport
 } // namespace ViewModule
index bbe2600..e1869b6 100644 (file)
 #include <Elementary.h>
 
 namespace SecurityOriginDB {
-    class SecurityOriginDAO;
+class SecurityOriginDAO;
 }
 
 namespace ViewModule {
 namespace GeolocationSupport {
 namespace Webkit2 {
-
 void geolocationPermissionRequest(
-        Evas_Object* window,
-        SecurityOriginDB::SecurityOriginDAO* securityOriginDAO,
-        void* data);
-
+    Evas_Object* window,
+    SecurityOriginDB::SecurityOriginDAO* securityOriginDAO,
+    void* data);
 }
 } // namespace GeolocationSupport
 } // namespace ViewModule
index 9366fa1..3cef451 100644 (file)
@@ -45,13 +45,13 @@ static Eina_Bool exitAppIdlerCallback(void* /*data*/)
     // webapp termination
     ewk_shutdown();
     elm_exit();
-    return ECORE_CALLBACK_CANCEL;}
-
+    return ECORE_CALLBACK_CANCEL;
+}
 } // namespace
 
 bool SchemeSupport::HandleUri(
-        const char* uri,
-        ViewModule::SchemeActionMap::NavigationContext context)
+    const char* uri,
+    ViewModule::SchemeActionMap::NavigationContext context)
 {
     return ViewModule::SchemeActionMap::HandleUri(uri,
                                                   context,
@@ -140,8 +140,7 @@ bool SchemeSupport::filterURIByScheme(Ewk_Policy_Decision* policyDecision,
         ewk_frame_is_main_frame(ewk_policy_decision_frame_get(policyDecision));
 
     using namespace ViewModule::SchemeActionMap;
-    if (HandleTizenScheme(url, window, wkView))
-    {
+    if (HandleTizenScheme(url, window, wkView)) {
         LogDebug("Scheme is tizen scheme");
         return false;
     }
index 0072c0b..73a9560 100644 (file)
@@ -30,7 +30,8 @@
 class WindowData;
 class WidgetModel;
 
-class SchemeSupport {
+class SchemeSupport
+{
   public:
     explicit SchemeSupport(WrtDB::AppType type) : m_type(type) {}
     bool HandleTizenScheme(const char* uri,
@@ -44,6 +45,7 @@ class SchemeSupport {
                            WidgetModel* model,
                            Evas_Object* window,
                            Evas_Object* wkView);
+
   private:
     WrtDB::AppType m_type;
 };
index 445f754..c55f23a 100644 (file)
@@ -27,7 +27,6 @@
 #include <EWebKit2.h>
 
 namespace ViewModule {
-
 namespace {
 const char* const USERMEDIA_USE_ASK_BODY =
     "This application wants to use your media";
@@ -92,7 +91,7 @@ void popupCallback(void* data, Evas_Object* obj, void* /*eventInfo*/)
 } // namespace
 
 void UsermediaSupport::usermediaPermissionRequest(Evas_Object* window,
-                                                   void* data)
+                                                  void* data)
 {
     LogDebug("usermediaPermissionRequest called");
     Assert(window);
index 27f5e70..f6ab0e3 100644 (file)
 
 namespace ViewModule {
 namespace UsermediaSupport {
-
 void usermediaPermissionRequest(
-        Evas_Object* window,
-        void* data);
-
+    Evas_Object* window,
+    void* data);
 } // namespace UsermediaSupport
 } // namespace ViewModule
 
index 49dbb41..df08cde 100644 (file)
@@ -23,7 +23,6 @@
 
 namespace ViewModule {
 namespace Utils {
-
 DPL::OptionalString toString(WKStringRef str)
 {
     if (WKStringIsEmpty(str)) {
@@ -71,6 +70,5 @@ DPL::OptionalString toString(WKErrorRef err)
     WKRelease(desc);
     return str;
 }
-
 } // namespace Utils
 } // namespace ViewModule
index 4908263..42be1ae 100644 (file)
 
 namespace ViewModule {
 namespace Utils {
-
 DPL::OptionalString toString(WKStringRef str);
 DPL::OptionalString toString(WKURLRef url);
 DPL::OptionalString toString(WKURLRequestRef req);
 DPL::OptionalString toString(WKFrameRef req);
 DPL::OptionalString toString(WKErrorRef err);
-
 } // namespace Utils
 } // namespace ViewModule
 
index 11c3924..e0f840c 100644 (file)
@@ -40,17 +40,15 @@ const char* const WEB_NOTIFICATION_ASK_BODY_PREFIX = "Do you want to allow ";
 const char* const WEB_NOTIFICATION_ASK_BODY_POSTFIX =
     " to use web notificaion?";
 const char* const WEB_NOTIFICATION_ASK_CHECK = "Don't ask again";
-
 }
 
 namespace ViewModule {
 namespace WebNotification {
-
 using namespace SecurityOriginDB;
 using namespace ViewModule::SecurityOriginSupportUtil;
 
-class WebNotificationPermissionData
-    public ViewModule::SecurityOriginSupportUtil::PermissionData
+class WebNotificationPermissionData :
+    public ViewModule::SecurityOriginSupportUtil::PermissionData
 {
   public:
     Ewk_Context* m_ewkContext;
@@ -60,13 +58,12 @@ class WebNotificationPermissionData
         SecurityOriginDB::SecurityOriginData originData,
         Ewk_Context* ewkContext,
         void* data) :
-            ViewModule::SecurityOriginSupportUtil::PermissionData(
-                originDao,
-                originData,
-                data),
-            m_ewkContext(ewkContext)
-    {
-    };
+        ViewModule::SecurityOriginSupportUtil::PermissionData(
+            originDao,
+            originData,
+            data),
+        m_ewkContext(ewkContext)
+    {}
 };
 
 bool notificationShow(WebNotificationDataPtr notiData);
@@ -88,8 +85,7 @@ WebNotificationData::WebNotificationData(WidgetModel* widgetModel,
 }
 
 WebNotificationData::~WebNotificationData()
-{
-}
+{}
 
 void webNotificationPermissionRequest(
     Evas_Object* window,
@@ -132,9 +128,9 @@ void webNotificationPermissionRequest(
     // ask to user
     WebNotificationPermissionData* permissionData =
         new WebNotificationPermissionData(securityOriginDAO,
-                           securityOriginData,
-                           ewkContext,
-                           data);
+                                          securityOriginData,
+                                          ewkContext,
+                                          data);
 
     // suspend notification
     ewk_notification_permission_request_suspend(request);
@@ -160,7 +156,9 @@ bool notificationShow(WebNotificationDataPtr notiData)
     Try {
         // create notification
         noti_h = notification_new(
-            NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_NONE, notiData->m_id);
+                NOTIFICATION_TYPE_NOTI,
+                NOTIFICATION_GROUP_ID_NONE,
+                notiData->m_id);
         if (!noti_h) {
             LogError("Fail to notification_new");
             return false;
@@ -168,22 +166,22 @@ bool notificationShow(WebNotificationDataPtr notiData)
 
         // set notification title
         error = notification_set_text(
-            noti_h,
-            NOTIFICATION_TEXT_TYPE_TITLE,
-            notiData->m_title.c_str(),
-            NULL,
-            NOTIFICATION_VARIABLE_TYPE_NONE);
+                noti_h,
+                NOTIFICATION_TEXT_TYPE_TITLE,
+                notiData->m_title.c_str(),
+                NULL,
+                NOTIFICATION_VARIABLE_TYPE_NONE);
         if (error != NOTIFICATION_ERROR_NONE) {
             ThrowMsg(Exception::NotificationShowError, "Fail to set title");
         }
 
         // set notification content
         error = notification_set_text(
-            noti_h,
-            NOTIFICATION_TEXT_TYPE_CONTENT,
-            notiData->m_body.c_str(),
-            NULL,
-            NOTIFICATION_VARIABLE_TYPE_NONE);
+                noti_h,
+                NOTIFICATION_TEXT_TYPE_CONTENT,
+                notiData->m_body.c_str(),
+                NULL,
+                NOTIFICATION_VARIABLE_TYPE_NONE);
         if (error != NOTIFICATION_ERROR_NONE) {
             ThrowMsg(Exception::NotificationShowError,
                      "Fail to set content:" << error);
@@ -202,9 +200,9 @@ bool notificationShow(WebNotificationDataPtr notiData)
         // In this case, set to default package image.
         if (true == validIconURL) {
             error = notification_set_image(
-                noti_h,
-                NOTIFICATION_IMAGE_TYPE_ICON,
-                notiData->m_iconURL.c_str());
+                    noti_h,
+                    NOTIFICATION_IMAGE_TYPE_ICON,
+                    notiData->m_iconURL.c_str());
             if (error != NOTIFICATION_ERROR_NONE) {
                 ThrowMsg(Exception::NotificationShowError,
                          "Fail to free notification: " << error);
@@ -226,8 +224,8 @@ bool notificationShow(WebNotificationDataPtr notiData)
         if (noti_h) {
             error = notification_free(noti_h);
             if (error != NOTIFICATION_ERROR_NONE) {
-                        ThrowMsg(Exception::NotificationShowError,
-                                 "Fail to free notification: " << error);
+                ThrowMsg(Exception::NotificationShowError,
+                         "Fail to free notification: " << error);
             }
             noti_h = NULL;
         }
@@ -270,8 +268,8 @@ bool downloadImage(WebNotificationDataPtr notiData)
     // download path is
     // /opt/apps/tizen_id/data + '/' + filename
     std::string downloadPath =
-    DPL::ToUTF8String(
-            notiData->m_widgetModel->PersistentStoragePath.Get()) +  "/";
+        DPL::ToUTF8String(
+            notiData->m_widgetModel->PersistentStoragePath.Get()) + "/";
     LogDebug("downloadPath " << downloadPath);
 
     // Make valid filename
@@ -319,7 +317,7 @@ bool downloadImage(WebNotificationDataPtr notiData)
         }
         fclose(fp);
         curl_easy_cleanup(curl);
-    } Catch (DPL::Exception) {
+    } Catch(DPL::Exception) {
         LogError(_rethrown_exception.GetMessage());
         fclose(fp);
         curl_easy_cleanup(curl);
@@ -373,11 +371,12 @@ void popupCallback(void* data, Evas_Object* obj, void* /*eventInfo*/)
     Result result = getResult(obj);
 
     if (result != RESULT_UNKNOWN) {
-        permData->m_originDao->setSecurityOriginData(permData->m_originData, result);
+        permData->m_originDao->setSecurityOriginData(permData->m_originData,
+                                                     result);
     }
     Eina_Bool ret =
         (result == RESULT_ALLOW_ALWAYS || result == RESULT_ALLOW_ONCE) ?
-            EINA_TRUE : EINA_FALSE;
+        EINA_TRUE : EINA_FALSE;
     ewk_notification_permission_request_response(permData->m_ewkContext,
                                                  request,
                                                  ret);
@@ -385,7 +384,5 @@ void popupCallback(void* data, Evas_Object* obj, void* /*eventInfo*/)
     evas_object_hide(popup);
     evas_object_del(popup);
 }
-
-
 } // namespace WebNotification
 } //namespace ViewModule
index 2d8fd58..de37cac 100644 (file)
 //Forward declarations
 class WidgetModel;
 namespace SecurityOriginDB {
-    class SecurityOriginDAO;
+class SecurityOriginDAO;
 }
 
 namespace ViewModule {
 namespace WebNotification {
-
-class WebNotificationData {
+class WebNotificationData
+{
   public:
     WebNotificationData(WidgetModel* widgetModel, uint64_t id);
     virtual ~WebNotificationData();
@@ -51,7 +51,8 @@ class WebNotificationData {
 
 typedef std::shared_ptr<WebNotificationData> WebNotificationDataPtr;
 
-class Exception {
+class Exception
+{
   public:
     DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
     DECLARE_EXCEPTION_TYPE(Base, InitError)
@@ -65,7 +66,6 @@ void webNotificationPermissionRequest(
     Ewk_Context* ewkContext,
     void* data);
 bool showWebNotification(WebNotificationDataPtr notiData);
-
 } // namespace SecuritySupport
 } // namespace WebNotification
 
index f1bf7d2..4b899a7 100644 (file)
@@ -31,7 +31,6 @@
 #include <Elementary.h>
 
 namespace ViewModule {
-
 using namespace SecurityOriginDB;
 using namespace ViewModule::SecurityOriginSupportUtil;
 
@@ -56,11 +55,12 @@ void askUserForWebStorageCreatePermission(
     LogDebug("askUserForWebStorageCreatePermission called");
     PermissionData* permData = static_cast<PermissionData*>(data);
     Ewk_Context_Exceeded_Quota* exceededQuota =
-            static_cast<Ewk_Context_Exceeded_Quota*>(permData->m_data);
+        static_cast<Ewk_Context_Exceeded_Quota*>(permData->m_data);
 
     std::ostringstream size;
-    size << ewk_context_web_database_exceeded_quota_expected_usage_get(exceededQuota) /
-        (1024 * 1024);
+    size << ewk_context_web_database_exceeded_quota_expected_usage_get(
+        exceededQuota) /
+    (1024 * 1024);
 
     std::string body =
         WEB_STORAGE_CREATE_ASK_BODY_PREFIX +
@@ -90,20 +90,21 @@ void popupCallback(void* data, Evas_Object* obj, void* /*eventInfo*/)
     Assert(data);
     PermissionData* permData = static_cast<PermissionData*>(data);
     Ewk_Context_Exceeded_Quota* exceededQuota =
-            static_cast<Ewk_Context_Exceeded_Quota*>(permData->m_data);
+        static_cast<Ewk_Context_Exceeded_Quota*>(permData->m_data);
 
     Evas_Object* popup = getPopup(obj);
     Result result = getResult(obj);
 
     if (result != RESULT_UNKNOWN) {
-        permData->m_originDao->setSecurityOriginData(permData->m_originData, result);
+        permData->m_originDao->setSecurityOriginData(permData->m_originData,
+                                                     result);
     }
-    if  (result == RESULT_ALLOW_ALWAYS || result == RESULT_ALLOW_ONCE) {
+    if (result == RESULT_ALLOW_ALWAYS || result == RESULT_ALLOW_ONCE) {
         ewk_context_web_database_exceeded_quota_new_quota_set(
             exceededQuota,
             ewk_context_web_database_exceeded_quota_expected_usage_get(
                 exceededQuota) +
-            10*(1024*1024)); //10MB
+            10 * (1024 * 1024)); //10MB
     }
 
     delete permData;
@@ -139,10 +140,10 @@ void WebStorageSupport::webStorageCreatePermissionRequest(
     if (RESULT_ALLOW_ONCE == result || RESULT_ALLOW_ALWAYS == result) {
         LogDebug("allow");
         ewk_context_web_database_exceeded_quota_new_quota_set(
-                exceededQuota,
-                ewk_context_web_database_exceeded_quota_expected_usage_get(
-                    exceededQuota) +
-                10*(1024*1024)); //10MB
+            exceededQuota,
+            ewk_context_web_database_exceeded_quota_expected_usage_get(
+                exceededQuota) +
+            10 * (1024 * 1024)); //10MB
         return;
     } else if (RESULT_DENY_ONCE == result || RESULT_DENY_ALWAYS == result) {
         LogDebug("deny");
index 537489d..2d77433 100644 (file)
 #include <Elementary.h>
 
 namespace SecurityOriginDB {
-    class SecurityOriginDAO;
+class SecurityOriginDAO;
 }
 
 namespace ViewModule {
 namespace WebStorageSupport {
-
 void webStorageCreatePermissionRequest(
-        Evas_Object* window,
-        SecurityOriginDB::SecurityOriginDAO* securityOriginDAO,
-        void* data);
-
+    Evas_Object* window,
+    SecurityOriginDB::SecurityOriginDAO* securityOriginDAO,
+    void* data);
 } // namespace WebStorageSupport
 } // namespace ViewModule
 
index 3d11e47..6cdce5b 100644 (file)
@@ -23,7 +23,6 @@
 #include <dpl/log/log.h>
 #include <Elementary.h>
 
-
 SplashScreenSupport::SplashScreenSupport(Evas_Object* parent)
 {
     LogDebug("enter");
@@ -41,7 +40,8 @@ SplashScreenSupport::~SplashScreenSupport()
     LogDebug("enter");
 }
 
-bool SplashScreenSupport::createSplashScreen(const DPL::OptionalString imagePath)
+bool SplashScreenSupport::createSplashScreen(
+    const DPL::OptionalString imagePath)
 {
     LogDebug("initializing splash screen");
 
index 9a4d548..b32aa09 100644 (file)
@@ -27,7 +27,6 @@
 #include <Evas.h>
 #include <memory>
 
-
 class SplashScreenSupport
 {
   public:
@@ -37,6 +36,7 @@ class SplashScreenSupport
     bool createSplashScreen(const DPL::OptionalString imagePath);
     void startSplashScreen();
     void stopSplashScreen();
+
   private:
     void setSplashImagePath(const char * image_path);
 
old mode 100755 (executable)
new mode 100644 (file)
index d021321..9088532
@@ -39,7 +39,6 @@ char const* const INDICATOR = "indicator";
 char const* const NOINDICATOR = "noindicator";
 char const* const INTERNAL_LAYOUT = "internal_layout";
 char const* const FLOATBACKWARD_BUTTON_STYLE = "wrt/backward";
-
 } // anonymous namespace
 
 WindowData::WindowData(unsigned long pid, bool manualInit) :
@@ -48,8 +47,7 @@ WindowData::WindowData(unsigned long pid, bool manualInit) :
 {
     m_win = createWindow(pid);
 
-    if (!manualInit)
-    {
+    if (!manualInit) {
         init();
     }
 }
@@ -89,7 +87,7 @@ void WindowData::unsetEvasObjectForLayout()
 
 void WindowData::toggleIndicator(bool fullscreen)
 {
-    LogDebug("fullscreen=" << (fullscreen?"true":"false"));
+    LogDebug("fullscreen=" << (fullscreen ? "true" : "false"));
 
     if (!fullscreen) {
         elm_win_indicator_mode_set(m_win, ELM_WIN_INDICATOR_SHOW);
@@ -99,8 +97,8 @@ void WindowData::toggleIndicator(bool fullscreen)
 }
 
 void WindowData::setViewMode(
-        bool fullscreen,
-        bool backbutton)
+    bool fullscreen,
+    bool backbutton)
 {
     LogDebug("setViewMode");
     LogDebug("fullscreen: " << fullscreen);
@@ -113,7 +111,6 @@ void WindowData::setViewMode(
     if (backbutton) {
         createFloatBackButton();
     }
-
 }
 
 void WindowData::createFloatBackButton()
@@ -150,7 +147,7 @@ Evas_Object* WindowData::createConformant(Evas_Object* parent)
     Evas_Object* conformant = elm_conformant_add(parent);
 
     evas_object_size_hint_weight_set(
-            conformant, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+        conformant, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
     evas_object_size_hint_align_set(conformant, EVAS_HINT_FILL, EVAS_HINT_FILL);
     elm_win_resize_object_add(parent, conformant);
     return conformant;
@@ -165,15 +162,15 @@ Evas_Object* WindowData::createPlatformLayout(Evas_Object* parent)
     ADD_PROFILING_POINT("elm_layout_theme_set", "stop");
 
     evas_object_size_hint_align_set(platform_layout,
-            EVAS_HINT_FILL,
-            EVAS_HINT_FILL);
+                                    EVAS_HINT_FILL,
+                                    EVAS_HINT_FILL);
     evas_object_size_hint_weight_set(platform_layout,
-            EVAS_HINT_EXPAND,
-            EVAS_HINT_EXPAND);
+                                     EVAS_HINT_EXPAND,
+                                     EVAS_HINT_EXPAND);
 
     elm_object_content_set(parent, platform_layout);
     edje_object_signal_emit(
-            elm_layout_edje_get(platform_layout), ELM_STATE_SHOW_CONTENT, ELM);
+        elm_layout_edje_get(platform_layout), ELM_STATE_SHOW_CONTENT, ELM);
     return platform_layout;
 }
 
@@ -183,11 +180,11 @@ Evas_Object* WindowData::createNavigationBar(Evas_Object* parent)
     Evas_Object* navigation = elm_naviframe_add(parent);
 
     evas_object_size_hint_align_set(navigation,
-            EVAS_HINT_FILL,
-            EVAS_HINT_FILL);
+                                    EVAS_HINT_FILL,
+                                    EVAS_HINT_FILL);
     evas_object_size_hint_weight_set(navigation,
-            EVAS_HINT_EXPAND,
-            EVAS_HINT_EXPAND);
+                                     EVAS_HINT_EXPAND,
+                                     EVAS_HINT_EXPAND);
     elm_object_part_content_set(parent, ELM_SWALLOW_CONTENT, navigation);
     //elm_object_content_set(parent, navigation);
     return navigation;
@@ -199,23 +196,23 @@ Evas_Object* WindowData::createUserLayout(Evas_Object* parent)
     Evas_Object* layout = elm_layout_add(parent);
     elm_layout_file_set(layout, DAEMON_EDJ_PATH, "client");
     evas_object_size_hint_weight_set(
-            layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+        layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
     evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
 
     ADD_PROFILING_POINT("elm_naviframe_item_push", "start");
     Elm_Object_Item* naviIt = elm_naviframe_item_push(
-        /* Evas_Object *obj */
-        parent,
-        /* const char *title_label  */
-        "",
-        /* Evas_Object *prev_btn */
-        NULL,
-        /* Evas_Object *next_btn */
-        NULL,
-        /* Evas_Object *content */
-        layout,
-        /* const char *item_style */
-        NULL);
+            /* Evas_Object *obj */
+            parent,
+            /* const char *title_label  */
+            "",
+            /* Evas_Object *prev_btn */
+            NULL,
+            /* Evas_Object *next_btn */
+            NULL,
+            /* Evas_Object *content */
+            layout,
+            /* const char *item_style */
+            NULL);
 
     elm_naviframe_item_title_visible_set(naviIt, EINA_FALSE);
 
@@ -223,58 +220,58 @@ Evas_Object* WindowData::createUserLayout(Evas_Object* parent)
 }
 
 void WindowData::addNaviBackButtonCallback(
-        const char* event,
-        CallbackType callback,
-        const void* data)
+    const char* event,
+    CallbackType callback,
+    const void* data)
 {
     Assert(m_naviBackButton != NULL && "m_naviBackButton is null");
     evas_object_smart_callback_add(m_naviBackButton, event, callback, data);
 }
 
 void* WindowData::delNaviBackButtonCallback(
-        const char* event,
-        CallbackType callBack)
+    const char* event,
+    CallbackType callBack)
 {
     Assert(m_naviBackButton != NULL && "m_naviBackButton is null");
     return evas_object_smart_callback_del(m_naviBackButton, event, callBack);
 }
 
 void WindowData::addFloatBackButtonCallback(
-        const char* event,
-        CallbackType callback,
-        const void* data)
+    const char* event,
+    CallbackType callback,
+    const void* data)
 {
     Assert(m_floatBackButton != NULL && "m_floatBackButton is null");
     evas_object_smart_callback_add(m_floatBackButton, event, callback, data);
 }
 
 void* WindowData::delFloatBackButtonCallback(
-        const char* event,
-        CallbackType callBack)
+    const char* event,
+    CallbackType callBack)
 {
     Assert(m_floatBackButton != NULL && "m_floatBackButton is null");
     return evas_object_smart_callback_del(m_floatBackButton, event, callBack);
 }
 
 void WindowData::userlayoutCallbackAdd(
-        const Evas_Callback_Type event,
-        EvasCallbackType callback,
-        const void* data)
+    const Evas_Callback_Type event,
+    EvasCallbackType callback,
+    const void* data)
 {
     Assert(m_user_layout != NULL && "m_user_layout is null");
     evas_object_event_callback_add(m_user_layout, event, callback, data);
 }
 
 void* WindowData::userlayoutCallbackDel(
-        const Evas_Callback_Type event,
-        EvasCallbackType callBack)
+    const Evas_Callback_Type event,
+    EvasCallbackType callBack)
 {
     Assert(m_user_layout != NULL && "m_user_layout is null");
     return evas_object_event_callback_del(m_user_layout, event, callBack);
 }
 
 void WindowData::emitSignalForUserLayout(
-        const char* emission, const char* source)
+    const char* emission, const char* source)
 {
     LogInfo("emitSignalForUserLayout called");
     Assert(m_user_layout != NULL && "m_user_layout is null");
@@ -282,7 +279,7 @@ void WindowData::emitSignalForUserLayout(
     Assert(source != NULL && "source is null");
 
     edje_object_signal_emit(
-            elm_layout_edje_get(m_user_layout), emission, source);
+        elm_layout_edje_get(m_user_layout), emission, source);
 }
 
 void WindowData::toggleFullscreen(bool fullscreen)
@@ -298,8 +295,9 @@ void WindowData::toggleFullscreen(bool fullscreen)
         return;
     }
 
-    if (!m_fullscreen) //If ViewMode is not fullscreen, toggle indicator
+    if (!m_fullscreen) //If ViewMode is not fullscreen, toggle indicator
         toggleIndicator(fullscreen);
+    }
 
     alreadyFullscreen = !alreadyFullscreen;
 }
old mode 100755 (executable)
new mode 100644 (file)
index 64c827b..389ca7c
@@ -44,9 +44,9 @@ class WindowData : private DPL::Noncopyable
 {
   private:
     typedef void (*CallbackType)(
-            void* data, Evas_Object* obj, void* event_info);
+        void* data, Evas_Object* obj, void* event_info);
     typedef void (*EvasCallbackType)(
-            void* data, Evas* evas, Evas_Object* obj, void* event_info);
+        void* data, Evas* evas, Evas_Object* obj, void* event_info);
 
     struct EventWithFunction
     {
@@ -56,8 +56,7 @@ class WindowData : private DPL::Noncopyable
                           const char * a_eventName) :
             function(a_function),
             eventName(a_eventName)
-        {
-        }
+        {}
     };
     typedef std::vector<EventWithFunction> EventWithFunctionVector;
 
@@ -65,40 +64,40 @@ class WindowData : private DPL::Noncopyable
     Evas_Object* m_win;
     Evas_Object* m_user_layout;
 
-    explicit WindowData(unsigned long pid, bool manualInit=false);
+    explicit WindowData(unsigned long pid, bool manualInit = false);
     virtual ~WindowData();
 
     void init();
     void setEvasObjectForLayout(Evas_Object* evas_object);
     void unsetEvasObjectForLayout();
     void addNaviBackButtonCallback(
-            const char* event,
-            CallbackType callback,
-            const void* data);
+        const char* event,
+        CallbackType callback,
+        const void* data);
     void* delNaviBackButtonCallback(
-            const char* event,
-            CallbackType callBack);
+        const char* event,
+        CallbackType callBack);
     void addFloatBackButtonCallback(
-            const char* event,
-            CallbackType callback,
-            const void* data);
+        const char* event,
+        CallbackType callback,
+        const void* data);
     void* delFloatBackButtonCallback(
-            const char* event,
-            CallbackType callBack);
+        const char* event,
+        CallbackType callBack);
     void userlayoutCallbackAdd(
-            const Evas_Callback_Type event,
-            EvasCallbackType callback,
-            const void* data);
+        const Evas_Callback_Type event,
+        EvasCallbackType callback,
+        const void* data);
     void* userlayoutCallbackDel(
-            const Evas_Callback_Type event,
-            EvasCallbackType callback);
+        const Evas_Callback_Type event,
+        EvasCallbackType callback);
     void emitSignalForUserLayout(
-            const char* emission,
-            const char* source);
+        const char* emission,
+        const char* source);
 
     void setViewMode(
-            bool fullscreen,
-            bool backbutton);
+        bool fullscreen,
+        bool backbutton);
 
     void toggleFullscreen(bool fullscreen);
 
old mode 100755 (executable)
new mode 100644 (file)
index 16d8fb9..7a17e38
@@ -72,7 +72,6 @@ void WrtClient::OnStop()
     LogInfo("Stopping Dummy Client");
 }
 
-
 void WrtClient::OnCreate()
 {
     LogInfo("On Create");
@@ -80,7 +79,6 @@ void WrtClient::OnCreate()
     ewk_init();
 }
 
-
 void WrtClient::OnResume()
 {
     if (m_widgetState != WidgetState_Suspended) {
@@ -91,7 +89,6 @@ void WrtClient::OnResume()
     m_widgetState = WidgetState_Running;
 }
 
-
 void WrtClient::OnPause()
 {
     LogDebug("On pause");
@@ -124,12 +121,9 @@ void WrtClient::OnReset(bundle *b)
         m_windowData->emitSignalForUserLayout(EDJE_SHOW_BACKWARD_SIGNAL, "");
         m_widgetState = WidgetState_Running;
     } else {
-        if (true == checkArgument())
-        {
+        if (true == checkArgument()) {
             setStep();
-        }
-        else
-        {
+        } else {
             showHelpAndQuit();
         }
     }
@@ -161,7 +155,7 @@ bool WrtClient::checkArgument()
 {
     std::string tizenId = getTizenIdFromArgument(m_argc, m_argv);
 
-    if(tizenId.empty()){
+    if (tizenId.empty()) {
         // Just show help
         return false;
     } else {
@@ -190,7 +184,8 @@ std::string WrtClient::getTizenIdFromArgument(int argc, char **argv)
         if (arg == "-h" || arg == "--help") {
             return "";
         } else if (arg == "-l" || arg == "--launch" ||
-                arg == "-t" || arg == "--tizen") {
+                   arg == "-t" || arg == "--tizen")
+        {
             if (argc != 3) {
                 return "";
             }
@@ -261,9 +256,9 @@ bool WrtClient::checkDebugMode(SDKDebugData* debugData)
         // In WAC widget, only test widgets can use web inspector.
         // In TIZEN widget,
         // every launched widgets as debug mode can use it.
-        if (m_dao->getWidgetType().appType == WrtDB::APP_TYPE_WAC20)
-        {
-            bool developerMode = WRT::CoreModuleSingleton::Instance().developerMode();
+        if (m_dao->getWidgetType().appType == WrtDB::APP_TYPE_WAC20) {
+            bool developerMode =
+                WRT::CoreModuleSingleton::Instance().developerMode();
             //This code will be activated
             //after WAC test certificate is used by SDK
             //bool isTestWidget = view->m_widgetModel->IsTestWidget.Get();
@@ -301,7 +296,7 @@ void WrtClient::initStep()
     // other type events. To give a chance of execute to other events,
     // ecore_timer_add was used.
     DPL::Event::ControllerEventHandler<NextStepEvent>::PostTimedEvent(
-            NextStepEvent(),0.001);
+        NextStepEvent(), 0.001);
 }
 
 bool WrtClient::checkWACTestCertififedWidget()
@@ -325,12 +320,11 @@ bool WrtClient::checkWACTestCertififedWidget()
     LogDebug("Is developer Mode: " << developerMode);
 
     if (developerWidget) {
-        if(!developerMode)
-        {
+        if (!developerMode) {
             LogError("WAC test certified developer widget is needed for " <<
-                    "developer mode");
+                     "developer mode");
             return false;
-        }else{
+        } else {
             //TODO: WR-4660 (show popup about developer widget
             //      during launch
             LogInfo("POPUP: THIS IS TEST WIDGET!");
@@ -352,8 +346,7 @@ void WrtClient::loadFinishCallback(Evas_Object* webview)
     // Start inspector server, if current mode is debugger mode.
     // In the WK2 case, ewk_view_inspector_server_start should
     // be called after WebProcess is created.
-    if (checkDebugMode(debug))
-    {
+    if (checkDebugMode(debug)) {
         debug->portnum =
             ewk_view_inspector_server_start(m_widget->GetCurrentWebview(), 0);
         if (debug->portnum == 0) {
@@ -368,10 +361,9 @@ void WrtClient::loadFinishCallback(Evas_Object* webview)
 
     //w3c packaging test debug (message on 4>)
     const char * makeScreen = getenv(W3C_DEBUG_ENV_VARIABLE);
-    if(makeScreen != NULL && strcmp(makeScreen, "1") == 0)
-    {
+    if (makeScreen != NULL && strcmp(makeScreen, "1") == 0) {
         FILE* doutput = fdopen(4, "w");
-        fprintf(doutput,"didFinishLoadForFrameCallback: ready\n");
+        fprintf(doutput, "didFinishLoadForFrameCallback: ready\n");
         fclose(doutput);
     }
 
@@ -390,19 +382,18 @@ void WrtClient::loadFinishCallback(Evas_Object* webview)
         m_returnStatus = ReturnStatus::Failed;
         //shutdownStep
         DPL::Event::ControllerEventHandler<NextStepEvent>::
-                PostEvent(NextStepEvent());
+            PostEvent(NextStepEvent());
     }
 
-    if(debug->debugMode)
-    {
+    if (debug->debugMode) {
         LogDebug("Send RT signal to wrt-launcher(pid: " << m_sdkLauncherPid);
         union sigval sv;
         /* send real time signal with result to wrt-launcher */
-        if(webview) {
+        if (webview) {
             LogDebug("userData->portnum : " << debug->portnum);
             sv.sival_int = debug->portnum;
         } else {
-           sv.sival_int = -1;
+            sv.sival_int = -1;
         }
         sigqueue(m_sdkLauncherPid, SIGRTMIN, sv);
     }
@@ -424,7 +415,7 @@ void WrtClient::webkitExitCallback()
     LogDebug("window close called, terminating app");
     SwitchToStep(&WrtClient::shutdownStep);
     DPL::Event::ControllerEventHandler<NextStepEvent>::PostEvent(
-            NextStepEvent());
+        NextStepEvent());
 }
 
 void WrtClient::webCrashCallback()
@@ -432,10 +423,9 @@ void WrtClient::webCrashCallback()
     LogError("webProcess crashed");
     SwitchToStep(&WrtClient::shutdownStep);
     DPL::Event::ControllerEventHandler<NextStepEvent>::PostEvent(
-            NextStepEvent());
+        NextStepEvent());
 }
 
-
 void WrtClient::launchStep()
 {
     ADD_PROFILING_POINT("launchStep", "start");
@@ -443,35 +433,35 @@ void WrtClient::launchStep()
 
     ADD_PROFILING_POINT("getRunnableWidgetObject", "start");
     m_widget = WRT::CoreModuleSingleton::Instance()
-                    .getRunnableWidgetObject(m_tizenId);
+            .getRunnableWidgetObject(m_tizenId);
     ADD_PROFILING_POINT("getRunnableWidgetObject", "stop");
 
     if (!m_widget) {
         LogError("RunnableWidgetObject is NULL, stop launchStep");
         DPL::Event::ControllerEventHandler<NextStepEvent>::PostEvent(
-                    NextStepEvent());
+            NextStepEvent());
         return;
     }
 
     if (m_widgetState == WidgetState_Running) {
         LogWarning("Widget already running, stop launchStep");
         DPL::Event::ControllerEventHandler<NextStepEvent>::PostEvent(
-                    NextStepEvent());
+            NextStepEvent());
         return;
     }
 
     if (m_widgetState == WidgetState_Authorizing) {
         LogWarning("Widget already authorizing, stop launchStep");
         DPL::Event::ControllerEventHandler<NextStepEvent>::PostEvent(
-                    NextStepEvent());
+            NextStepEvent());
         return;
     }
 
     m_dao.reset(new WrtDB::WidgetDAOReadOnly(DPL::FromASCIIString(m_tizenId)));
     DPL::Optional<DPL::String> defloc = m_dao->getDefaultlocale();
-    if(!defloc.IsNull())
-    {
-        LanguageTagsProviderSingleton::Instance().addWidgetDefaultLocales(*defloc);
+    if (!defloc.IsNull()) {
+        LanguageTagsProviderSingleton::Instance().addWidgetDefaultLocales(
+            *defloc);
     }
 
     // For localizationsetting not changed on widget running
@@ -479,26 +469,30 @@ void WrtClient::launchStep()
     //        languageChangedCallback, this);
 
     ADD_PROFILING_POINT("CreateWindow", "start");
-    m_windowData.reset(new WindowData(static_cast<unsigned long>(getpid()), true));
+    m_windowData.reset(new WindowData(static_cast<unsigned long>(getpid()),
+                                      true));
     ADD_PROFILING_POINT("CreateWindow", "stop");
 
     WRT::UserDelegatesPtr cbs(new WRT::UserDelegates);
     ADD_PROFILING_POINT("Create splash screen", "start");
     m_splashScreen.reset(
-            new SplashScreenSupport(m_windowData->m_win));
+        new SplashScreenSupport(m_windowData->m_win));
     if (m_splashScreen->createSplashScreen(m_dao->getSplashImgSrc())) {
         m_splashScreen->startSplashScreen();
-        cbs->progressFinish = DPL::MakeDelegate(this, &WrtClient::progressFinishCallback);
+        cbs->progressFinish = DPL::MakeDelegate(
+                this,
+                &WrtClient::
+                    progressFinishCallback);
     }
     ADD_PROFILING_POINT("Create splash screen", "stop");
     DPL::OptionalString startUrl = W3CFileLocalization::getStartFile(m_dao);
     if (!m_widget->PrepareView(DPL::ToUTF8String(*startUrl),
-            m_windowData->m_win))
+                               m_windowData->m_win))
     {
         DPL::Event::ControllerEventHandler<NextStepEvent>::PostEvent(
-                    NextStepEvent());
+            NextStepEvent());
         return;
-     }
+    }
     //you can't show window with splash screen before PrepareView
     //ewk_view_add_with_context() in viewLogic breaks window
 
@@ -506,7 +500,7 @@ void WrtClient::launchStep()
 
     WrtDB::WidgetLocalizedInfo localizedInfo =
         W3CFileLocalization::getLocalizedInfo(m_dao);
-    std:: string name = "";
+    std::string name = "";
     if (!(localizedInfo.name.IsNull())) {
         name = DPL::ToUTF8String(*(localizedInfo.name));
     }
@@ -515,8 +509,7 @@ void WrtClient::launchStep()
     initializeWindowModes();
     connectElmCallback();
 
-    if (!checkWACTestCertififedWidget())
-    {
+    if (!checkWACTestCertififedWidget()) {
         LogWarning("WAC Certificate failed, stop launchStep");
         return;
     }
@@ -525,7 +518,7 @@ void WrtClient::launchStep()
     if (!m_widget->CheckBeforeLaunch()) {
         LogError("CheckBeforeLaunch failed, stop launchStep");
         DPL::Event::ControllerEventHandler<NextStepEvent>::PostEvent(
-                    NextStepEvent());
+            NextStepEvent());
         return;
     }
     LogInfo("Widget launch accepted. Entering running state");
@@ -536,7 +529,8 @@ void WrtClient::launchStep()
     cbs->bufferUnset = DPL::MakeDelegate(this, &WrtClient::unsetLayout);
     cbs->webkitExit = DPL::MakeDelegate(this, &WrtClient::webkitExitCallback);
     cbs->webCrash = DPL::MakeDelegate(this, &WrtClient::webCrashCallback);
-    cbs->toggleFullscreen = DPL::MakeDelegate(m_windowData.get(), &WindowData::toggleFullscreen);
+    cbs->toggleFullscreen = DPL::MakeDelegate(
+            m_windowData.get(), &WindowData::toggleFullscreen);
 
     m_widget->SetUserDelegates(cbs);
     m_widget->Show();
@@ -551,13 +545,13 @@ void WrtClient::initializeWindowModes()
     auto windowModes = m_dao->getWindowModes();
     bool fullscreen = false;
     bool backbutton = false;
-     if (m_dao->getWidgetType().appType == WrtDB::APP_TYPE_TIZENWEBAPP) {
-         WidgetSettings widgetSettings;
-         m_dao->getWidgetSettings(widgetSettings);
-         WidgetSettingList settings(widgetSettings);
+    if (m_dao->getWidgetType().appType == WrtDB::APP_TYPE_TIZENWEBAPP) {
+        WidgetSettings widgetSettings;
+        m_dao->getWidgetSettings(widgetSettings);
+        WidgetSettingList settings(widgetSettings);
         backbutton =
             (settings.getBackButtonPresence() == BackButton_Enable);
-     }
+    }
 
     FOREACH(it, windowModes)
     {
@@ -571,12 +565,12 @@ void WrtClient::initializeWindowModes()
     }
 
     m_windowData->setViewMode(fullscreen,
-            backbutton);
+                              backbutton);
 }
 
 void WrtClient::backButtonCallback(void* data,
-                                     Evas_Object * /*obj*/,
-                                     void * /*event_info*/)
+                                   Evas_Object * /*obj*/,
+                                   void * /*event_info*/)
 {
     LogInfo("BackButtonCallback");
     Assert(data);
@@ -596,9 +590,9 @@ void WrtClient::connectElmCallback()
         WidgetSettingList settings(widgetSettings);
         if (settings.getBackButtonPresence() == BackButton_Enable) {
             m_windowData->addFloatBackButtonCallback(
-            "clicked",
-            &WrtClient::backButtonCallback,
-            this);
+                "clicked",
+                &WrtClient::backButtonCallback,
+                this);
         }
 
         WidgetSettingScreenLock rotationValue = settings.getRotationValue();
@@ -612,36 +606,39 @@ void WrtClient::connectElmCallback()
     }
 }
 
-void WrtClient::setLayout(Evas_Object* newBuffer) {
+void WrtClient::setLayout(Evas_Object* newBuffer)
+{
     LogDebug("add new webkit buffer to window");
     Assert(newBuffer);
 
-    elm_object_part_content_set(m_windowData->m_user_layout, ELM_SWALLOW_CONTENT, newBuffer);
+    elm_object_part_content_set(m_windowData->m_user_layout,
+                                ELM_SWALLOW_CONTENT,
+                                newBuffer);
 
     evas_object_show(newBuffer);
 }
 
-void WrtClient::unsetLayout(Evas_Object* currentBuffer) {
+void WrtClient::unsetLayout(Evas_Object* currentBuffer)
+{
     LogDebug("remove current webkit buffer from window");
     Assert(currentBuffer);
     evas_object_hide(currentBuffer);
 
-    elm_object_part_content_unset(m_windowData->m_user_layout, ELM_SWALLOW_CONTENT);
+    elm_object_part_content_unset(m_windowData->m_user_layout,
+                                  ELM_SWALLOW_CONTENT);
 }
 
 void WrtClient::shutdownStep()
 {
     LogDebug("Closing Wrt connection ...");
 
-    if (m_widget && m_widgetState)
-    {
+    if (m_widget && m_widgetState) {
         m_widgetState = WidgetState_Stopped;
         m_widget->Hide();
         m_widget.reset();
         WRT::CoreModuleSingleton::Instance().Terminate();
     }
-    if (m_initialized)
-    {
+    if (m_initialized) {
         m_initialized = false;
     }
     m_windowData.reset();
@@ -651,23 +648,26 @@ void WrtClient::shutdownStep()
 int WrtClient::languageChangedCallback(void *data)
 {
     LogDebug("Language Changed");
-    if(!data)
+    if (!data) {
         return 0;
+    }
     WrtClient* wrtClient = static_cast<WrtClient*>(data);
-    if(!(wrtClient->m_dao))
+    if (!(wrtClient->m_dao)) {
         return 0;
+    }
 
     // reset function fetches system locales and recreates language tags
     LanguageTagsProviderSingleton::Instance().resetLanguageTags();
     // widget default locales are added to language tags below
     DPL::OptionalString defloc = wrtClient->m_dao->getDefaultlocale();
-    if(!defloc.IsNull())
-    {
-        LanguageTagsProviderSingleton::Instance().addWidgetDefaultLocales(*defloc);
+    if (!defloc.IsNull()) {
+        LanguageTagsProviderSingleton::Instance().addWidgetDefaultLocales(
+            *defloc);
     }
 
     if (wrtClient->m_launched &&
-            wrtClient->m_widgetState != WidgetState_Stopped) {
+        wrtClient->m_widgetState != WidgetState_Stopped)
+    {
         wrtClient->m_widget->ReloadStartPage();
     }
     return 0;
@@ -692,10 +692,9 @@ int main(int argc,
         // set evas backend type
         if (!getenv("ELM_ENGINE")) {
             if (!setenv("ELM_ENGINE", "gl", 1)) {
-                    LogDebug("Enable backend");
+                LogDebug("Enable backend");
             }
-        }
-        else {
+        } else {
             LogDebug("ELM_ENGINE : " << getenv("ELM_ENGINE"));
         }
 
@@ -709,15 +708,15 @@ int main(int argc,
         // This code is to fork a web process without exec.
         std::string tizenId = WrtClient::getTizenIdFromArgument(argc, argv);
 
-        if (!tizenId.empty())
-        {
+        if (!tizenId.empty()) {
             LogDebug("Launching by fork mode");
             // Language env setup
             appcore_set_i18n("wrt-client", NULL);
             ewk_init();
             ewk_set_arguments(argc, argv);
             setenv("WRT_LAUNCHING_PERFORMANCE", "1", 1);
-            s_ewk_context = ewk_context_new_with_injected_bundle_path(BUNDLE_PATH);
+            s_ewk_context = ewk_context_new_with_injected_bundle_path(
+                    BUNDLE_PATH);
         }
 
         // Output on stdout will be flushed after every newline character,
@@ -728,7 +727,6 @@ int main(int argc,
         // the output may not be flushed).
         setlinebuf(stdout);
 
-
         WrtClient app(argc, argv);
 
         ADD_PROFILING_POINT("Before appExec", "point");
old mode 100755 (executable)
new mode 100644 (file)
index 078dbcc..334a603
@@ -33,9 +33,9 @@
 DECLARE_GENERIC_EVENT_0(NextStepEvent)
 
 class WrtClient :
-        public DPL::Application,
-        private DPL::Event::Controller<DPL::TypeListDecl<NextStepEvent>::Type>,
-        public DPL::TaskDecl<WrtClient>
+    public DPL::Application,
+    private DPL::Event::Controller<DPL::TypeListDecl<NextStepEvent>::Type>,
+    public DPL::TaskDecl<WrtClient>
 {
   public:
     WrtClient(int argc,
index 938a7a5..714c4d2 100644 (file)
@@ -63,11 +63,11 @@ static std::unique_ptr<DBConnection> g_dbConnection;
 typedef struct
 {
     char* guid;           /**< the widget's id
-                           (read from its config.xml during installation)*/
+                           (read from its config.xml during installation)*/
     char* name;         /**< the widget's name
-                           (read from its config.xml during installation)*/
+                         * (read from its config.xml during installation)*/
     char* version;      /**< the widget's varsion
-                           (read from its config.xml during installation)*/
+                         * (read from its config.xml during installation)*/
     char* pkg_name;     /**< the widget's pkg name */
 } widget_info;
 
@@ -97,7 +97,7 @@ static bool attachDbConnection()
             g_dbConnection.reset(new DBConnection());
             g_dbConnection->AttachDatabase();
         }
-        Catch (DPL::DB::SqlConnection::Exception::Base) {
+        Catch(DPL::DB::SqlConnection::Exception::Base) {
             LogDebug("Fail to connect DB");
             return FALSE;
         }
@@ -107,10 +107,12 @@ static bool attachDbConnection()
 
 static bool display_widget_info()
 {
-    if(!attachDbConnection()) return FALSE;
+    if (!attachDbConnection()) {
+        return FALSE;
+    }
 
     WidgetDAOReadOnlyList widgetList =
-            WrtDB::WidgetDAOReadOnly::getWidgetList();
+        WrtDB::WidgetDAOReadOnly::getWidgetList();
 
     printf("%3s %32s %16s %64s %16s\n",
            "No", "Name", "Version", "GUID", "Package Name");
@@ -156,7 +158,6 @@ static bool display_widget_info()
 
         info->pkg_name = new_strdup(DPL::ToUTF8String(package_name).c_str());
 
-
         printf("%3i %32s %16s %64s %16s\n",
                number++,
                !info->name ? "[NULL]" : info->name,
@@ -173,21 +174,22 @@ static bool display_widget_info()
 static void print_help(FILE *stream, int /*exit_code*/)
 {
     fprintf(stream, "Usage : %s [ ... ]\n", program);
-    fprintf(stream,
-            "   -h                       --help              Display this usage information.\n"
-            "   -l                       --list              Display installed widgets list\n"
-            "   -s [GUID]or[PkgName]     --start             Launch widget with package name or GUID\n"
-            "   -k [GUID]or[PkgName]     --kill              Kill widget with package name or GUID\n"
-            "   -r [GUID]or[PkgName]     --is-running        Check whether widget is running by package name or GUID,\n"
-            "                                                If widget is running, 0(zero) will be returned.\n"
-            "   -d                       --debug             Activate debug mode\n"
-            "   -t [second]              --timeout           Set timeout of response from widget in debug mode\n"
-            "   -v [1]or[0]              --developer-mode    Set developermode\n"
-            "   -c [1]or[0]              --compliance-mode   Set compliancemode\n"
-            "   -i [imei]                --fake-imei         Set fakeimei\n"
-            "   -m [meid]                --fake-meid         Set fakemeid\n"
-            "    if you emit this option, 5 seconds is set in debug mode\n"
-            );
+    fprintf(
+        stream,
+        "   -h                       --help              Display this usage information.\n"
+        "   -l                       --list              Display installed widgets list\n"
+        "   -s [GUID]or[PkgName]     --start             Launch widget with package name or GUID\n"
+        "   -k [GUID]or[PkgName]     --kill              Kill widget with package name or GUID\n"
+        "   -r [GUID]or[PkgName]     --is-running        Check whether widget is running by package name or GUID,\n"
+        "                                                If widget is running, 0(zero) will be returned.\n"
+        "   -d                       --debug             Activate debug mode\n"
+        "   -t [second]              --timeout           Set timeout of response from widget in debug mode\n"
+        "   -v [1]or[0]              --developer-mode    Set developermode\n"
+        "   -c [1]or[0]              --compliance-mode   Set compliancemode\n"
+        "   -i [imei]                --fake-imei         Set fakeimei\n"
+        "   -m [meid]                --fake-meid         Set fakemeid\n"
+        "    if you emit this option, 5 seconds is set in debug mode\n"
+        );
 }
 
 static void sighandler(int signo, siginfo_t *si, void *data);
@@ -213,18 +215,18 @@ int main(int argc, char* argv[])
         program = argv[0];
 
         static struct option long_options[] = {
-            {"help", no_argument, 0, 'h'},
-            {"list", no_argument, 0, 'l'},
-            {"start", required_argument, 0, 's'},
-            {"kill", required_argument, 0, 'k'},
-            {"is-running", required_argument, 0, 'r'},
-            {"debug", no_argument, 0, 'd'},
-            {"timeout", required_argument, 0, 't'},
-            {"developer-mode", required_argument, 0, 'v'},
-            {"compliance-mode", required_argument, 0, 'c'},
-            {"fake-imei", required_argument, 0, 'i'},
-            {"fake-meid", required_argument, 0, 'm'},
-            {0, 0, 0, 0}
+            { "help", no_argument, 0, 'h' },
+            { "list", no_argument, 0, 'l' },
+            { "start", required_argument, 0, 's' },
+            { "kill", required_argument, 0, 'k' },
+            { "is-running", required_argument, 0, 'r' },
+            { "debug", no_argument, 0, 'd' },
+            { "timeout", required_argument, 0, 't' },
+            { "developer-mode", required_argument, 0, 'v' },
+            { "compliance-mode", required_argument, 0, 'c' },
+            { "fake-imei", required_argument, 0, 'i' },
+            { "fake-meid", required_argument, 0, 'm' },
+            { 0, 0, 0, 0 }
         };
 
         if (argv[1] == NULL) {
@@ -253,15 +255,16 @@ int main(int argc, char* argv[])
 
             switch (next_opt) {
             case 'h':
-                if(!dispHelp){
+                if (!dispHelp) {
                     print_help(stdout, 0);
                     dispHelp = true;
-                 }
+                }
                 break;
 
             case 'l':
-                if(dispList)
+                if (dispList) {
                     break;
+                }
                 if (!display_widget_info()) {
                     printf("Fail to display the list of installed widgets");
                     return -1;
@@ -278,7 +281,7 @@ int main(int argc, char* argv[])
 
             case 't':
                 timeout = atoi(optarg);
-                if (timeout < 0 ) {
+                if (timeout < 0) {
                     timeout = TIMEOUT_DEFAULT;
                 }
                 break;
@@ -316,7 +319,9 @@ int main(int argc, char* argv[])
 
             case 'v':
                 strncpy(temp_arg, optarg, strlen(optarg));
-                if(!attachDbConnection()) return FALSE;
+                if (!attachDbConnection()) {
+                    return FALSE;
+                }
                 if (!strcmp("1", temp_arg)) {
                     WrtDB::GlobalDAO::SetDeveloperMode(true);
                 } else {
@@ -325,8 +330,10 @@ int main(int argc, char* argv[])
                 break;
             case 'c':
                 strncpy(temp_arg, optarg, strlen(optarg));
-                if(!attachDbConnection()) return FALSE;
-                if(!strcmp("1", temp_arg)) {
+                if (!attachDbConnection()) {
+                    return FALSE;
+                }
+                if (!strcmp("1", temp_arg)) {
                     WrtDB::GlobalDAO::setComplianceMode(true);
                 } else {
                     WrtDB::GlobalDAO::setComplianceMode(false);
@@ -334,12 +341,16 @@ int main(int argc, char* argv[])
                 break;
             case 'i':
                 strncpy(temp_arg, optarg, strlen(optarg));
-                if(!attachDbConnection()) return FALSE;
+                if (!attachDbConnection()) {
+                    return FALSE;
+                }
                 WrtDB::GlobalDAO::setComplianceFakeImei(temp_arg);
                 break;
             case 'm':
                 strncpy(temp_arg, optarg, strlen(optarg));
-                if(!attachDbConnection()) return FALSE;
+                if (!attachDbConnection()) {
+                    return FALSE;
+                }
                 WrtDB::GlobalDAO::setComplianceFakeMeid(temp_arg);
                 break;
 
@@ -352,7 +363,7 @@ int main(int argc, char* argv[])
             }
         } while (next_opt != -1);
 
-        if ((op == 's') || (op == 'k') || (op =='r')) {
+        if ((op == 's') || (op == 'k') || (op == 'r')) {
             std::string temp;
 
             if (NULL == g_dbConnection.get()) {
@@ -360,7 +371,7 @@ int main(int argc, char* argv[])
                     g_dbConnection.reset(new DBConnection());
                     g_dbConnection->AttachDatabase();
                 }
-                Catch (DPL::DB::SqlConnection::Exception::Base) {
+                Catch(DPL::DB::SqlConnection::Exception::Base) {
                     LogDebug("Fail to connect DB");
                     return FALSE;
                 }
@@ -370,7 +381,7 @@ int main(int argc, char* argv[])
             std::string normal_arg = DPL::ToUTF8String(*normal_str);
 
             WidgetDAOReadOnlyList widgetList =
-                    WrtDB::WidgetDAOReadOnly::getWidgetList();
+                WrtDB::WidgetDAOReadOnly::getWidgetList();
             FOREACH(dao, widgetList) {
                 WrtDB::WidgetGUID d_guid = (*dao)->getGUID();
                 WrtDB::WidgetPkgName d_pkgname = (*dao)->getPkgName();
@@ -382,7 +393,8 @@ int main(int argc, char* argv[])
                     break;
                 }
                 if (!strcmp(DPL::ToUTF8String(d_pkgname).c_str(),
-                            normal_arg.c_str())) {
+                            normal_arg.c_str()))
+                {
                     WrtDB::WidgetPkgName package_name = (*dao)->getPkgName();
                     temp = DPL::ToUTF8String(package_name);
                     break;
@@ -426,12 +438,12 @@ int main(int argc, char* argv[])
                 gid_t group_list[1];
                 group_list[0] = LOGGING_DEFAULT_GID;
 
-                if(setgroups(sizeof(group_list), group_list) < 0) {
+                if (setgroups(sizeof(group_list), group_list) < 0) {
                     printf("result: %s\n", "failed");
                     return -1;
                 }
 
-                if(setreuid(WEBAPP_DEFAULT_UID, WEBAPP_DEFAULT_GID) < 0) {
+                if (setreuid(WEBAPP_DEFAULT_UID, WEBAPP_DEFAULT_GID) < 0) {
                     printf("result: %s\n", "failed");
                     return -1;
                 }
@@ -545,6 +557,6 @@ static void sighandler(int signo, siginfo_t *si, void* /*data*/)
     } else {
         printf("Not RT signal : %d\n", signo);
     }
-    exit (0);
+    exit(0);
 }
 
index 25e1760..0e950c0 100644 (file)
 
 #include <dlfcn.h>
 #include <glib.h>
-#define PREEXEC_FILE SHARE_PREFIX"/preexec_list.txt"
+#define PREEXEC_FILE SHARE_PREFIX "/preexec_list.txt"
 
 static int preexec_initialized = 0;
 
 GSList *preexec_list = NULL;
 
 typedef struct _preexec_list_t {
-       char *pkg_type;
-       char *so_path;
-       int (*dl_do_pre_exe) (char *, char *);
+    char *pkg_type;
+    char *so_path;
+    int (*dl_do_pre_exe)(char *, char *);
 } preexec_list_t;
 
 static void __preexec_list_free()
 {
-       GSList *iter = NULL;
-       preexec_list_t *type_t;
-
-       for (iter = preexec_list; iter != NULL; iter = g_slist_next(iter)) {
-               type_t = iter->data;
-               if (type_t) {
-                       if (type_t->pkg_type)
-                               free(type_t->pkg_type);
-                       if (type_t->so_path)
-                               free(type_t->so_path);
-                       free(type_t);
-               }
-       }
-       g_slist_free(preexec_list);
-       return;
+    GSList *iter = NULL;
+    preexec_list_t *type_t;
+
+    for (iter = preexec_list; iter != NULL; iter = g_slist_next(iter)) {
+        type_t = iter->data;
+        if (type_t) {
+            if (type_t->pkg_type) {
+                free(type_t->pkg_type);
+            }
+            if (type_t->so_path) {
+                free(type_t->so_path);
+            }
+            free(type_t);
+        }
+    }
+    g_slist_free(preexec_list);
+    return;
 }
 
 static inline void __preexec_init(int argc, char **argv)
 {
-       void *handle = NULL;
-       FILE *preexec_file;
-       char *saveptr = NULL;
-       char line[MAX_LOCAL_BUFSZ] = {0, };
-       char *type = NULL;
-       char *sopath = NULL;
-       char *symbol = NULL;
-       int (*func) (char *, char *) = NULL;
-       preexec_list_t *type_t = NULL;
-
-        // warning: unused parameter
-        argc = argc;
-        argv = argv;
-
-       preexec_file = fopen(PREEXEC_FILE, "rt");
-       if (preexec_file == NULL) {
-               _E("no preexec\n");
-               return;
-       }
-
-       _D("preexec start\n");
-
-       while (fgets(line, MAX_LOCAL_BUFSZ, preexec_file) > (char*)0) {
-               /* Parse each line */
-               if (line[0] == '#' || line[0] == '\0')
-                       continue;
-
-               type = strtok_r(line, ":\f\n\r\t\v ", &saveptr);
-               if (type == NULL)
-                       continue;
-               sopath = strtok_r(NULL, ",\f\n\r\t\v ", &saveptr);
-               if (sopath == NULL)
-                       continue;
-               symbol = strtok_r(NULL, ",\f\n\r\t\v ", &saveptr);
-               if (symbol == NULL)
-                       continue;
-
-               type_t = (preexec_list_t *) calloc(1, sizeof(preexec_list_t));
-               if (type_t == NULL) {
-                       _E("no available memory\n");
-                       __preexec_list_free();
+    void *handle = NULL;
+    FILE *preexec_file;
+    char *saveptr = NULL;
+    char line[MAX_LOCAL_BUFSZ] = { 0, };
+    char *type = NULL;
+    char *sopath = NULL;
+    char *symbol = NULL;
+    int (*func)(char *, char *) = NULL;
+    preexec_list_t *type_t = NULL;
+
+    // warning: unused parameter
+    argc = argc;
+    argv = argv;
+
+    preexec_file = fopen(PREEXEC_FILE, "rt");
+    if (preexec_file == NULL) {
+        _E("no preexec\n");
+        return;
+    }
+
+    _D("preexec start\n");
+
+    while (fgets(line, MAX_LOCAL_BUFSZ, preexec_file) > (char*)0) {
+        /* Parse each line */
+        if (line[0] == '#' || line[0] == '\0') {
+            continue;
+        }
+
+        type = strtok_r(line, ":\f\n\r\t\v ", &saveptr);
+        if (type == NULL) {
+            continue;
+        }
+        sopath = strtok_r(NULL, ",\f\n\r\t\v ", &saveptr);
+        if (sopath == NULL) {
+            continue;
+        }
+        symbol = strtok_r(NULL, ",\f\n\r\t\v ", &saveptr);
+        if (symbol == NULL) {
+            continue;
+        }
+
+        type_t = (preexec_list_t *) calloc(1, sizeof(preexec_list_t));
+        if (type_t == NULL) {
+            _E("no available memory\n");
+            __preexec_list_free();
             fclose(preexec_file);
-                       return;
-               }
-
-               handle = dlopen(sopath, RTLD_NOW);
-               if (handle == NULL) {
-                       free(type_t);
-                       continue;
-               }
-               _D("preexec %s %s# - handle : %x\n", type, sopath, handle);
-
-               func = dlsym(handle, symbol);
-               if (func == NULL) {
-                       _E("failed to get symbol type:%s path:%s\n",
-                          type, sopath);
-                       free(type_t);
-                       dlclose(handle);
-                       handle = NULL;
-                       continue;
-               }
-
-               type_t->pkg_type = strdup(type);
-               if (type_t->pkg_type == NULL) {
-                       _E("no available memory\n");
-                       free(type_t);
-                       __preexec_list_free();
+            return;
+        }
+
+        handle = dlopen(sopath, RTLD_NOW);
+        if (handle == NULL) {
+            free(type_t);
+            continue;
+        }
+        _D("preexec %s %s# - handle : %x\n", type, sopath, handle);
+
+        func = dlsym(handle, symbol);
+        if (func == NULL) {
+            _E("failed to get symbol type:%s path:%s\n",
+               type, sopath);
+            free(type_t);
+            dlclose(handle);
+            handle = NULL;
+            continue;
+        }
+
+        type_t->pkg_type = strdup(type);
+        if (type_t->pkg_type == NULL) {
+            _E("no available memory\n");
+            free(type_t);
+            __preexec_list_free();
             fclose(preexec_file);
-                       return;
-               }
-               type_t->so_path = strdup(sopath);
-               if (type_t->so_path == NULL) {
-                       _E("no available memory\n");
-                       free(type_t->pkg_type);
-                       free(type_t);
-                       __preexec_list_free();
+            return;
+        }
+        type_t->so_path = strdup(sopath);
+        if (type_t->so_path == NULL) {
+            _E("no available memory\n");
+            free(type_t->pkg_type);
+            free(type_t);
+            __preexec_list_free();
             fclose(preexec_file);
-                       return;
-               }
-               type_t->dl_do_pre_exe = func;
+            return;
+        }
+        type_t->dl_do_pre_exe = func;
 
-               preexec_list = g_slist_append(preexec_list, (void *)type_t);
-       }
+        preexec_list = g_slist_append(preexec_list, (void *)type_t);
+    }
 
-       fclose(preexec_file);
-       preexec_initialized = 1;
+    fclose(preexec_file);
+    preexec_initialized = 1;
 }
 
 static inline void __preexec_run(const char *pkg_type, const char *pkg_name,
-                                const char *app_path)
+                                 const char *app_path)
 {
-       GSList *iter = NULL;
-       preexec_list_t *type_t;
-
-       if (!preexec_initialized)
-               return;
-
-       for (iter = preexec_list; iter != NULL; iter = g_slist_next(iter)) {
-               type_t = iter->data;
-               if (type_t) {
-                       if (!strcmp(pkg_type, type_t->pkg_type)) {
-                               if (type_t->dl_do_pre_exe != NULL) {
-                                       type_t->dl_do_pre_exe((char *)pkg_name,
-                                                             (char *)app_path);
-                                       _D("called dl_do_pre_exe() type: %s",
-                                          pkg_type);
-                               } else {
-                                       _E("no symbol for this type: %s",
-                                          pkg_type);
-                               }
-                       }
-               }
-       }
-
+    GSList *iter = NULL;
+    preexec_list_t *type_t;
+
+    if (!preexec_initialized) {
+        return;
+    }
+
+    for (iter = preexec_list; iter != NULL; iter = g_slist_next(iter)) {
+        type_t = iter->data;
+        if (type_t) {
+            if (!strcmp(pkg_type, type_t->pkg_type)) {
+                if (type_t->dl_do_pre_exe != NULL) {
+                    type_t->dl_do_pre_exe((char *)pkg_name,
+                                          (char *)app_path);
+                    _D("called dl_do_pre_exe() type: %s",
+                       pkg_type);
+                } else {
+                    _E("no symbol for this type: %s",
+                       pkg_type);
+                }
+            }
+        }
+    }
 }
 
 #else
 
 static inline void __preexec_init(int argc, char **argv)
-{
-}
+{}
 
 static inline void __preexec_run(const char *pkg_type, const char *pkg_name,
-                                const char *app_path)
-{
-}
+                                 const char *app_path)
+{}
 
 #endif
index 0082437..70bc099 100644 (file)
@@ -14,7 +14,6 @@
  *    limitations under the License.
  */
 
-
 #ifndef __APP_DBUS_H__
 #define __APP_DBUS_H__
 
@@ -24,7 +23,7 @@
 
 #define AUL_DBUS_PATH "/aul/dbus_handler"
 #define AUL_DBUS_SIGNAL_INTERFACE "org.tizen.aul.signal"
-#define AUL_DBUS_APPDEAD_SIGNAL        "app_dead"
-#define AUL_DBUS_APPLAUNCH_SIGNAL      "app_launch"
+#define AUL_DBUS_APPDEAD_SIGNAL "app_dead"
+#define AUL_DBUS_APPLAUNCH_SIGNAL       "app_launch"
 
 #endif
index 044ad8c..4787d87 100644 (file)
@@ -14,7 +14,6 @@
  *    limitations under the License.
  */
 
-
 #ifndef __APP_PKT_H_
 #define __APP_PKT_H_
 
 #include <linux/un.h>
 
 enum app_cmd {
-       APP_START,
-       APP_OPEN,
-       APP_RESUME,
-       APP_RESUME_BY_PID,
-       APP_TERM_BY_PID,
-       APP_RESULT,
-       APP_START_RES,
-       APP_CANCEL,
-       APP_KILL_BY_PID,
-       APP_ADD_HISTORY,
-       APP_RUNNING_INFO,
-       APP_RUNNING_INFO_RESULT,
-       APP_IS_RUNNING,
-       APP_KEY_EVENT,
-       APP_KEY_RESERVE,
-       APP_KEY_RELEASE,
-       APP_STATUS_UPDATE,
-       APP_RELEASED,
-       APP_RUNNING_LIST_UPDATE
+    APP_START,
+    APP_OPEN,
+    APP_RESUME,
+    APP_RESUME_BY_PID,
+    APP_TERM_BY_PID,
+    APP_RESULT,
+    APP_START_RES,
+    APP_CANCEL,
+    APP_KILL_BY_PID,
+    APP_ADD_HISTORY,
+    APP_RUNNING_INFO,
+    APP_RUNNING_INFO_RESULT,
+    APP_IS_RUNNING,
+    APP_KEY_EVENT,
+    APP_KEY_RESERVE,
+    APP_KEY_RELEASE,
+    APP_STATUS_UPDATE,
+    APP_RELEASED,
+    APP_RUNNING_LIST_UPDATE
 };
 
 #define AUL_SOCK_PREFIX "/tmp/alaunch"
@@ -52,9 +51,9 @@ enum app_cmd {
 #define ELOCALLAUNCH_ID 128
 
 typedef struct _app_pkt_t {
-       int cmd;
-       int len;
-       unsigned char data[1];
+    int cmd;
+    int len;
+    unsigned char data[1];
 } app_pkt_t;
 
 int __create_server_sock(int pid);
index e32a589..813d071 100644 (file)
@@ -14,7 +14,6 @@
  *    limitations under the License.
  */
 
-
 #ifndef __AUL_UTIL_H_
 #define __AUL_UTIL_H_
 
 #define MAX_PACKAGE_APP_PATH_SIZE 512
 #define MAX_RUNNING_APP_INFO 512
 
-typedef struct _app_status_info_t{
-       char appid[MAX_PACKAGE_STR_SIZE];
-       char app_path[MAX_PACKAGE_APP_PATH_SIZE];
-       int status;
-       int pid;
+typedef struct _app_status_info_t {
+    char appid[MAX_PACKAGE_STR_SIZE];
+    char app_path[MAX_PACKAGE_APP_PATH_SIZE];
+    int status;
+    int pid;
 } app_status_info_t;
 
 struct amdmgr {
-       struct appinfomgr *af;  /* appinfo manager */
-       struct cginfo *cg;  /* cgroup infomation */
+    struct appinfomgr *af;      /* appinfo manager */
+    struct cginfo *cg;      /* cgroup infomation */
 };
 
 int _add_app_status_info_list(char *appid, int pid);
@@ -42,5 +41,3 @@ int _remove_app_status_info_list(int pid);
 
 #endif
 
-
-
index a31bb5f..7f8c8c5 100644 (file)
  *    limitations under the License.
  */
 
-
 #include <ail.h>
 #include <string.h>
 #include "simple_util.h"
 
-#define MAX_PATH_LEN   1024
+#define MAX_PATH_LEN    1024
 
-#define AUL_APP_INFO_FLD_PKG_NAME              "package"
-#define AUL_APP_INFO_FLD_APP_PATH              "exec"
-#define AUL_APP_INFO_FLD_APP_TYPE              "x_slp_packagetype"
-#define AUL_APP_INFO_FLD_WIDTH                 "x_slp_baselayoutwidth"
-#define AUL_APP_INFO_FLD_HEIGHT                        "x_slp_baselayoutheight"
-#define AUL_APP_INFO_FLD_VERTICAL              "x_slp_ishorizontalscale"
-#define AUL_APP_INFO_FLD_MULTIPLE              "x_slp_multiple"
-#define AUL_APP_INFO_FLD_TASK_MANAGE   "x_slp_taskmanage"
-#define AUL_APP_INFO_FLD_MIMETYPE              "mimetype"
-#define AUL_APP_INFO_FLD_SERVICE               "x_slp_service"
+#define AUL_APP_INFO_FLD_PKG_NAME               "package"
+#define AUL_APP_INFO_FLD_APP_PATH               "exec"
+#define AUL_APP_INFO_FLD_APP_TYPE               "x_slp_packagetype"
+#define AUL_APP_INFO_FLD_WIDTH                  "x_slp_baselayoutwidth"
+#define AUL_APP_INFO_FLD_HEIGHT                 "x_slp_baselayoutheight"
+#define AUL_APP_INFO_FLD_VERTICAL               "x_slp_ishorizontalscale"
+#define AUL_APP_INFO_FLD_MULTIPLE               "x_slp_multiple"
+#define AUL_APP_INFO_FLD_TASK_MANAGE    "x_slp_taskmanage"
+#define AUL_APP_INFO_FLD_MIMETYPE               "mimetype"
+#define AUL_APP_INFO_FLD_SERVICE                "x_slp_service"
 
-#define AUL_RETRIEVE_PKG_NAME                  "package = '?'"
-#define AUL_RETRIEVE_APP_PATH                  "exec = '?'"
-#define AUL_RETRIEVE_MIMETYPE                  "mimetype like '?'"
-#define AUL_RETRIEVE_SERVICE                   "x_slp_service like '?'"
+#define AUL_RETRIEVE_PKG_NAME                   "package = '?'"
+#define AUL_RETRIEVE_APP_PATH                   "exec = '?'"
+#define AUL_RETRIEVE_MIMETYPE                   "mimetype like '?'"
+#define AUL_RETRIEVE_SERVICE                    "x_slp_service like '?'"
 
 typedef struct {
-       char *pkg_name;         /* package */
-       char *app_path;         /* exec */
-       char *original_app_path;        /* exec */
-       char *pkg_type;         /* x_slp_packagetype */
-       char *hwacc;            /* hwacceleration */
+    char *pkg_name;             /* package */
+    char *app_path;             /* exec */
+    char *original_app_path;            /* exec */
+    char *pkg_type;             /* x_slp_packagetype */
+    char *hwacc;                /* hwacceleration */
 } app_info_from_db;
 
 static inline char *_get_pkgname(app_info_from_db *menu_info)
 {
-       if (menu_info->pkg_name == NULL)
-               return NULL;
-       return menu_info->pkg_name;
+    if (menu_info->pkg_name == NULL) {
+        return NULL;
+    }
+    return menu_info->pkg_name;
 }
 
 static inline char *_get_app_path(app_info_from_db *menu_info)
 {
-       int i = 0;
-       int path_len = -1;
-
-       if (menu_info->app_path == NULL)
-               return NULL;
-
-       while (menu_info->app_path[i] != 0) {
-               if (menu_info->app_path[i] == ' '
-                   || menu_info->app_path[i] == '\t') {
-                       path_len = i;
-                       break;
-               }
-               i++;
-       }
-
-       if (path_len == 0) {
-               free(menu_info->app_path);
-               menu_info->app_path = NULL;
-       } else if (path_len > 0) {
-               char *tmp_app_path = malloc(sizeof(char) * (path_len + 1));
-               if(tmp_app_path == NULL)
-                       return NULL;
-               snprintf(tmp_app_path, path_len + 1, "%s", menu_info->app_path);
-               free(menu_info->app_path);
-               menu_info->app_path = tmp_app_path;
-       }
-
-       return menu_info->app_path;
+    int i = 0;
+    int path_len = -1;
+
+    if (menu_info->app_path == NULL) {
+        return NULL;
+    }
+
+    while (menu_info->app_path[i] != 0) {
+        if (menu_info->app_path[i] == ' '
+            || menu_info->app_path[i] == '\t')
+        {
+            path_len = i;
+            break;
+        }
+        i++;
+    }
+
+    if (path_len == 0) {
+        free(menu_info->app_path);
+        menu_info->app_path = NULL;
+    } else if (path_len > 0) {
+        char *tmp_app_path = malloc(sizeof(char) * (path_len + 1));
+        if (tmp_app_path == NULL) {
+            return NULL;
+        }
+        snprintf(tmp_app_path, path_len + 1, "%s", menu_info->app_path);
+        free(menu_info->app_path);
+        menu_info->app_path = tmp_app_path;
+    }
+
+    return menu_info->app_path;
 }
 
 static inline char *_get_original_app_path(app_info_from_db *menu_info)
 {
-       if (menu_info->original_app_path == NULL)
-               return NULL;
-       return menu_info->original_app_path;
+    if (menu_info->original_app_path == NULL) {
+        return NULL;
+    }
+    return menu_info->original_app_path;
 }
 
 static inline void _free_app_info_from_db(app_info_from_db *menu_info)
 {
-       if (menu_info != NULL) {
-               if (menu_info->pkg_name != NULL)
-                       free(menu_info->pkg_name);
-               if (menu_info->app_path != NULL)
-                       free(menu_info->app_path);
-               if (menu_info->original_app_path != NULL)
-                       free(menu_info->original_app_path);
-               if (menu_info->hwacc != NULL)
-                       free(menu_info->hwacc);
-               free(menu_info);
-       }
+    if (menu_info != NULL) {
+        if (menu_info->pkg_name != NULL) {
+            free(menu_info->pkg_name);
+        }
+        if (menu_info->app_path != NULL) {
+            free(menu_info->app_path);
+        }
+        if (menu_info->original_app_path != NULL) {
+            free(menu_info->original_app_path);
+        }
+        if (menu_info->hwacc != NULL) {
+            free(menu_info->hwacc);
+        }
+        free(menu_info);
+    }
 }
 
 static inline app_info_from_db *_get_app_info_from_db_by_pkgname(
-                                                       const char *pkgname)
+    const char *pkgname)
 {
-       app_info_from_db *menu_info;
-       ail_appinfo_h handle;
-       ail_error_e ret;
-       char *str = NULL;
-
-       menu_info = calloc(1, sizeof(app_info_from_db));
-       if (menu_info == NULL) {
-               return NULL;
-       }
-
-       ret = ail_get_appinfo(pkgname, &handle);
-       if (ret != AIL_ERROR_OK) {
-               _free_app_info_from_db(menu_info);
-               return NULL;
-       }
-
-       ret = ail_appinfo_get_str(handle, AIL_PROP_PACKAGE_STR, &str);
-       if (str) {
-               menu_info->pkg_name = strdup(str);      
-               str = NULL;
-       }
-
-       ret = ail_appinfo_get_str(handle, AIL_PROP_EXEC_STR, &str);
-       if (str) {
-               menu_info->app_path = strdup(str);
-               str = NULL;
-       }
-
-       if (menu_info->app_path != NULL)
-               menu_info->original_app_path = strdup(menu_info->app_path);
-
-       ret = ail_appinfo_get_str(handle, AIL_PROP_X_SLP_PACKAGETYPE_STR, &str);
-       if (str) {
-               menu_info->pkg_type = strdup(str);
-               str = NULL;
-       }
-       
-       ret = ail_destroy_appinfo(handle);
-       if (ret != AIL_ERROR_OK) {
-               _E("ail_destroy_appinfo failed");
-       }
-
-       if (!_get_app_path(menu_info)) {
-               _free_app_info_from_db(menu_info);
-               return NULL;
-       }
-
-       return menu_info;
+    app_info_from_db *menu_info;
+    ail_appinfo_h handle;
+    ail_error_e ret;
+    char *str = NULL;
+
+    menu_info = calloc(1, sizeof(app_info_from_db));
+    if (menu_info == NULL) {
+        return NULL;
+    }
+
+    ret = ail_get_appinfo(pkgname, &handle);
+    if (ret != AIL_ERROR_OK) {
+        _free_app_info_from_db(menu_info);
+        return NULL;
+    }
+
+    ret = ail_appinfo_get_str(handle, AIL_PROP_PACKAGE_STR, &str);
+    if (str) {
+        menu_info->pkg_name = strdup(str);
+        str = NULL;
+    }
+
+    ret = ail_appinfo_get_str(handle, AIL_PROP_EXEC_STR, &str);
+    if (str) {
+        menu_info->app_path = strdup(str);
+        str = NULL;
+    }
+
+    if (menu_info->app_path != NULL) {
+        menu_info->original_app_path = strdup(menu_info->app_path);
+    }
+
+    ret = ail_appinfo_get_str(handle, AIL_PROP_X_SLP_PACKAGETYPE_STR, &str);
+    if (str) {
+        menu_info->pkg_type = strdup(str);
+        str = NULL;
+    }
+
+    ret = ail_destroy_appinfo(handle);
+    if (ret != AIL_ERROR_OK) {
+        _E("ail_destroy_appinfo failed");
+    }
+
+    if (!_get_app_path(menu_info)) {
+        _free_app_info_from_db(menu_info);
+        return NULL;
+    }
+
+    return menu_info;
 }
 
-static inline ail_cb_ret_e __appinfo_func(const ail_appinfo_h appinfo, void *user_data)
+static inline ail_cb_ret_e __appinfo_func(const ail_appinfo_h appinfo,
+                                          void *user_data)
 {
-       app_info_from_db *menu_info = (app_info_from_db *)user_data;
-       char *package;
+    app_info_from_db *menu_info = (app_info_from_db *)user_data;
+    char *package;
+
+    ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &package);
 
-       ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &package);
+    menu_info->pkg_name = strdup(package);
 
-       menu_info->pkg_name = strdup(package);
-       
-       return AIL_CB_RET_CANCEL;       /*return AIL_CB_RET_CONTINUE;*/ 
+    return AIL_CB_RET_CANCEL;           /*return AIL_CB_RET_CONTINUE;*/
 }
 
 static inline app_info_from_db *_get_app_info_from_db_by_apppath(
-                                                       const char *apppath)
+    const char *apppath)
 {
-       app_info_from_db *menu_info = NULL;
-       ail_filter_h filter;
-       ail_error_e ret;
-       int count;
-       
-       if (apppath == NULL)
-               return NULL;
-
-       menu_info = calloc(1, sizeof(app_info_from_db));
-       if (menu_info == NULL)
-               return NULL;
-
-       ret = ail_filter_new(&filter);
-       if (ret != AIL_ERROR_OK) {
-               _free_app_info_from_db(menu_info);
-               return NULL;
-       }
-
-       ret = ail_filter_add_str(filter, AIL_PROP_X_SLP_EXE_PATH, apppath);
-       if (ret != AIL_ERROR_OK) {
-               ail_filter_destroy(filter);
-               _free_app_info_from_db(menu_info);
-               return NULL;
-       }
-
-       ret = ail_filter_count_appinfo(filter, &count);
-       if (ret != AIL_ERROR_OK) {
-               ail_filter_destroy(filter);
-               _free_app_info_from_db(menu_info);
-               return NULL;
-       }
-       if (count < 1) {
-               ail_filter_destroy(filter);
-               _free_app_info_from_db(menu_info);
-               return NULL;
-       }
-
-       ail_filter_list_appinfo_foreach(filter, __appinfo_func, (void *)menu_info);
-
-       ail_filter_destroy(filter);
-
-       menu_info->app_path = strdup(apppath);
-       menu_info->original_app_path = strdup(apppath);
-
-       return menu_info;
-       
+    app_info_from_db *menu_info = NULL;
+    ail_filter_h filter;
+    ail_error_e ret;
+    int count;
+
+    if (apppath == NULL) {
+        return NULL;
+    }
+
+    menu_info = calloc(1, sizeof(app_info_from_db));
+    if (menu_info == NULL) {
+        return NULL;
+    }
+
+    ret = ail_filter_new(&filter);
+    if (ret != AIL_ERROR_OK) {
+        _free_app_info_from_db(menu_info);
+        return NULL;
+    }
+
+    ret = ail_filter_add_str(filter, AIL_PROP_X_SLP_EXE_PATH, apppath);
+    if (ret != AIL_ERROR_OK) {
+        ail_filter_destroy(filter);
+        _free_app_info_from_db(menu_info);
+        return NULL;
+    }
+
+    ret = ail_filter_count_appinfo(filter, &count);
+    if (ret != AIL_ERROR_OK) {
+        ail_filter_destroy(filter);
+        _free_app_info_from_db(menu_info);
+        return NULL;
+    }
+    if (count < 1) {
+        ail_filter_destroy(filter);
+        _free_app_info_from_db(menu_info);
+        return NULL;
+    }
+
+    ail_filter_list_appinfo_foreach(filter, __appinfo_func, (void *)menu_info);
+
+    ail_filter_destroy(filter);
+
+    menu_info->app_path = strdup(apppath);
+    menu_info->original_app_path = strdup(apppath);
+
+    return menu_info;
 }
 
index 35b0926..831e086 100644 (file)
@@ -14,7 +14,6 @@
  *    limitations under the License.
  */
 
-
 #ifndef __PERF_H__
 #define __PERF_H__
 
 
 #include <sys/time.h>
 static struct timeval __g_base_time = {
-       .tv_sec = 0,
-       .tv_usec = 0
+    .tv_sec = 0,
+    .tv_usec = 0
 };
 
-#define INIT_PERF(kb)\
-do {\
-       const char *tmp;\
-       struct timeval tv;\
-       tmp = bundle_get_val(kb, AUL_K_STARTTIME);\
-       if (tmp != NULL)\
-               sscanf(tmp, "%ld/%ld", &tv.tv_sec, &tv.tv_usec);\
-       else\
-               gettimeofday(&tv, NULL);\
-       __g_base_time.tv_sec = tv.tv_sec;\
-       __g_base_time.tv_usec = tv.tv_usec;\
-} while (0);
-
-#define PERF(fmt, arg...)\
-do {\
-       struct timeval cur;\
-       struct timeval res;\
-       gettimeofday(&cur, NULL);\
-       if (__g_base_time.tv_sec != 0) {\
-               timersub(&cur, &__g_base_time, &res);\
-               printf("%c[1;31m[%s,%d] %ld sec %ld msec "fmt" %c[0m\n",\
-                       27, __FUNCTION__, __LINE__, \
-                               res.tv_sec, res.tv_usec/1000, ##arg, 27);\
-       } \
-} while (0);
+#define INIT_PERF(kb) \
+    do { \
+        const char *tmp; \
+        struct timeval tv; \
+        tmp = bundle_get_val(kb, AUL_K_STARTTIME); \
+        if (tmp != NULL) { \
+            sscanf(tmp, "%ld/%ld", &tv.tv_sec, &tv.tv_usec); } \
+        else { \
+            gettimeofday(&tv, NULL); } \
+        __g_base_time.tv_sec = tv.tv_sec; \
+        __g_base_time.tv_usec = tv.tv_usec; \
+    } while (0);
+
+#define PERF(fmt, arg ...) \
+    do { \
+        struct timeval cur; \
+        struct timeval res; \
+        gettimeofday(&cur, NULL); \
+        if (__g_base_time.tv_sec != 0) { \
+            timersub(&cur, &__g_base_time, &res); \
+            printf("%c[1;31m[%s,%d] %ld sec %ld msec "fmt " %c[0m\n", \
+                   27, __FUNCTION__, __LINE__, \
+                   res.tv_sec, res.tv_usec / 1000,##arg, 27); \
+        } \
+    } while (0);
 
 #else
 
 #define INIT_PERF(kb)
-#define PERF(fmt, arg...)
+#define PERF(fmt, arg ...)
 
 #endif
 
index 168078d..06d0ccf 100644 (file)
@@ -14,7 +14,6 @@
  *    limitations under the License.
  */
 
-
 #ifndef __SIMPLE_UTIL__
 #define __SIMPLE_UTIL__
 
 #define LOG_TAG "AUL_AMD"
 #endif
 
-
 #define MAX_LOCAL_BUFSZ 128
 #define MAX_PID_STR_BUFSZ 20
 
-#define _E(fmt, arg...) LOGE(fmt, ##arg)
-#define _D(fmt, arg...) LOGD(fmt, ##arg)
+#define _E(fmt, arg ...) LOGE(fmt,##arg)
+#define _D(fmt, arg ...) LOGD(fmt,##arg)
 
-#define retvm_if(expr, val, fmt, arg...) do { \
-       if (expr) { \
-               _E(fmt, ##arg); \
-               _E("(%s) -> %s() return", #expr, __FUNCTION__); \
-               return (val); \
-       } \
+#define retvm_if(expr, val, fmt, arg ...) do { \
+        if (expr) { \
+            _E(fmt,##arg); \
+            _E("(%s) -> %s() return", #expr, __FUNCTION__); \
+            return (val); \
+        } \
 } while (0)
 
 #define retv_if(expr, val) do { \
-       if (expr) { \
-               _E("(%s) -> %s() return", #expr, __FUNCTION__); \
-               return (val); \
-       } \
+        if (expr) { \
+            _E("(%s) -> %s() return", #expr, __FUNCTION__); \
+            return (val); \
+        } \
 } while (0)
 
 int __proc_iter_cmdline(int (*iterfunc)
-                        (const char *dname, const char *cmdline, void *priv),
-                       void *priv);
-int __proc_iter_pgid(int pgid, int (*iterfunc) (int pid, void *priv),
-                    void *priv);
+                        (const char *dname, const char *cmdline, void *priv),
+                        void *priv);
+int __proc_iter_pgid(int pgid, int (*iterfunc)(int pid, void *priv),
+                     void *priv);
 char *__proc_get_cmdline_bypid(int pid);
 
 static inline const char *FILENAME(const char *filename)
 {
-       const char *p;
-       const char *r;
+    const char *p;
+    const char *r;
 
-       if (!filename)
-               return NULL;
+    if (!filename) {
+        return NULL;
+    }
 
-       r = p = filename;
-       while (*p) {
-               if (*p == '/')
-                       r = p + 1;
-               p++;
-       }
+    r = p = filename;
+    while (*p) {
+        if (*p == '/') {
+            r = p + 1;
+        }
+        p++;
+    }
 
-       return r;
+    return r;
 }
 
 #endif
index 3404ea4..52045d4 100644 (file)
  *    limitations under the License.
  */
 
-
 #ifdef DAC_ACTIVATE
 
 #include <privilege-control.h>
 
 #define INHOUSE_UID     5000
-static inline int __set_access(const char* pkg_name, const char* pkg_type, const char* app_path)
+static inline int __set_access(const char* pkg_name,
+                               const char* pkg_type,
+                               const char* app_path)
 {
-       return set_app_privilege(pkg_name, pkg_type, app_path);
+    return set_app_privilege(pkg_name, pkg_type, app_path);
 }
 
 #else
 
-static inline int __set_access(const char* pkg_name, const char* pkg_type, const char* app_path)
+static inline int __set_access(const char* pkg_name,
+                               const char* pkg_type,
+                               const char* app_path)
 {
-       return 0;
+    return 0;
 }
 
 #endif
 
-
index becd61d..a177ff5 100644 (file)
@@ -14,7 +14,6 @@
  *    limitations under the License.
  */
 
-
 #define LAUNCHPAD_LOG
 #define DAC_ACTIVATE
 #define PRELOAD_ACTIVATE
index 98cf202..47ac8e0 100644 (file)
@@ -14,7 +14,6 @@
  *    limitations under the License.
  */
 
-
 #ifdef GL_ACTIVATE
 
 #define USE_ENGINE(engine) setenv("ELM_ENGINE", engine, 1);
index dd73037..b564c1d 100644 (file)
@@ -14,9 +14,8 @@
  *    limitations under the License.
  */
 
-
 /*
- * simple AUL daemon - launchpad 
+ * simple AUL daemon - launchpad
  */
 
 #include <stdio.h>
 
 #define _static_ static inline
 #define POLLFD_MAX 1
-#define SQLITE_FLUSH_MAX       (1048576)       /* (1024*1024) */
-#define AUL_POLL_CNT           15
-#define AUL_PR_NAME                    16
+#define SQLITE_FLUSH_MAX        (1048576)       /* (1024*1024) */
+#define AUL_POLL_CNT            15
+#define AUL_PR_NAME                     16
 #define PATH_APP_ROOT "/opt/usr/apps"
 #define PATH_DATA "/data"
 #define SDK_CODE_COVERAGE "CODE_COVERAGE"
 #define SDK_DYNAMIC_ANALYSIS "DYNAMIC_ANALYSIS"
 #define PATH_DA_SO "/home/developer/sdk_tools/da/da_probe.so"
 
-
 static char *launchpad_cmdline;
 static int initialized = 0;
 
-
 _static_ void __set_oom();
 _static_ void __set_env(app_info_from_db * menu_info, bundle * kb);
 _static_ int __prepare_exec(const char *pkg_name,
-                           const char *app_path, app_info_from_db * menu_info,
-                           bundle * kb);
+                            const char *app_path, app_info_from_db * menu_info,
+                            bundle * kb);
 _static_ int __fake_launch_app(int cmd, int pid, bundle * kb);
 _static_ char **__create_argc_argv(bundle * kb, int *margc);
 _static_ int __normal_fork_exec(int argc, char **argv);
 _static_ void __real_launch(const char *app_path, bundle * kb);
 static inline int __parser(const char *arg, char *out, int out_size);
 _static_ void __modify_bundle(bundle * kb, int caller_pid,
-                           app_info_from_db * menu_info, int cmd);
+                              app_info_from_db * menu_info, int cmd);
 _static_ int __child_raise_win_by_x(int pid, void *priv);
 _static_ int __raise_win_by_x(int pid);
 _static_ int __send_to_sigkill(int pid);
@@ -95,173 +92,181 @@ _static_ int __launchpad_post_init();
 
 extern ail_error_e ail_db_close(void);
 
-
-
 _static_ void __set_oom()
 {
-       char buf[MAX_LOCAL_BUFSZ];
-       FILE *fp;
-
-       /* we should reset oomadj value as default because child 
-       inherits from parent oom_adj*/
-       snprintf(buf, MAX_LOCAL_BUFSZ, "/proc/%d/oom_adj", getpid());
-       fp = fopen(buf, "w");
-       if (fp == NULL)
-               return;
-       fprintf(fp, "%d", -16);
-       fclose(fp);
+    char buf[MAX_LOCAL_BUFSZ];
+    FILE *fp;
+
+    /* we should reset oomadj value as default because child
+     * inherits from parent oom_adj*/
+    snprintf(buf, MAX_LOCAL_BUFSZ, "/proc/%d/oom_adj", getpid());
+    fp = fopen(buf, "w");
+    if (fp == NULL) {
+        return;
+    }
+    fprintf(fp, "%d", -16);
+    fclose(fp);
 }
 
-_static_ void __set_sdk_env(app_info_from_db* menu_info, char* str) {
-       char buf[MAX_LOCAL_BUFSZ];
-       int ret;
-
-       _D("key : %s / value : %s", AUL_K_SDK, str);
-       /* http://gcc.gnu.org/onlinedocs/gcc/Cross_002dprofiling.html*/
-       /* GCOV_PREFIX contains the prefix to add to the absolute paths in the object file. */
-       /*              Prefix can be absolute, or relative. The default is no prefix.  */
-       /* GCOV_PREFIX_STRIP indicates the how many initial directory names */
-       /*              to stripoff the hardwired absolute paths. Default value is 0. */
-       if (strncmp(str, SDK_CODE_COVERAGE, strlen(str)) == 0) {
-               snprintf(buf, MAX_LOCAL_BUFSZ, PATH_APP_ROOT"/%s"PATH_DATA, _get_pkgname(menu_info));
-               ret = setenv("GCOV_PREFIX", buf, 1);
-               _D("GCOV_PREFIX : %d", ret);
-               ret = setenv("GCOV_PREFIX_STRIP", "4096", 1);
-               _D("GCOV_PREFIX_STRIP : %d", ret);
-       } else if (strncmp(str, SDK_DYNAMIC_ANALYSIS, strlen(str)) == 0) {
-               ret = setenv("LD_PRELOAD", PATH_DA_SO, 1);
-               _D("LD_PRELOAD : %d", ret);
-       }
+_static_ void __set_sdk_env(app_info_from_db* menu_info, char* str)
+{
+    char buf[MAX_LOCAL_BUFSZ];
+    int ret;
+
+    _D("key : %s / value : %s", AUL_K_SDK, str);
+    /* http://gcc.gnu.org/onlinedocs/gcc/Cross_002dprofiling.html*/
+    /* GCOV_PREFIX contains the prefix to add to the absolute paths in the
+     *object file. */
+    /*         Prefix can be absolute, or relative. The default is no prefix.
+     * */
+    /* GCOV_PREFIX_STRIP indicates the how many initial directory names */
+    /*         to stripoff the hardwired absolute paths. Default value is 0. */
+    if (strncmp(str, SDK_CODE_COVERAGE, strlen(str)) == 0) {
+        snprintf(buf,
+                 MAX_LOCAL_BUFSZ,
+                 PATH_APP_ROOT "/%s"PATH_DATA,
+                 _get_pkgname(menu_info));
+        ret = setenv("GCOV_PREFIX", buf, 1);
+        _D("GCOV_PREFIX : %d", ret);
+        ret = setenv("GCOV_PREFIX_STRIP", "4096", 1);
+        _D("GCOV_PREFIX_STRIP : %d", ret);
+    } else if (strncmp(str, SDK_DYNAMIC_ANALYSIS, strlen(str)) == 0) {
+        ret = setenv("LD_PRELOAD", PATH_DA_SO, 1);
+        _D("LD_PRELOAD : %d", ret);
+    }
 }
 
-
 _static_ void __set_env(app_info_from_db * menu_info, bundle * kb)
 {
-       const char *str;
-       const char **str_array;
-       int len;
-       int i;
-
-       setenv("PKG_NAME", _get_pkgname(menu_info), 1);
-
-       USE_ENGINE("gl")
-
-       str = bundle_get_val(kb, AUL_K_STARTTIME);
-       if (str != NULL)
-               setenv("APP_START_TIME", str, 1);
-
-       if(bundle_get_type(kb, AUL_K_SDK) & BUNDLE_TYPE_ARRAY) {
-               str_array = bundle_get_str_array(kb, AUL_K_SDK, &len);
-               if(str_array != NULL) {
-                       for (i = 0; i < len; i++) {
-                               _D("index : [%d]", i);
-                               __set_sdk_env(menu_info, (char *)str_array[i]);
-                       }
-               }
-       } else {
-               str = bundle_get_val(kb, AUL_K_SDK);
-               if(str != NULL) {
-                       __set_sdk_env(menu_info, (char *)str);
-               }
-       }
-       if (menu_info->hwacc != NULL)
-               setenv("HWACC", menu_info->hwacc, 1);
+    const char *str;
+    const char **str_array;
+    int len;
+    int i;
+
+    setenv("PKG_NAME", _get_pkgname(menu_info), 1);
+
+    USE_ENGINE("gl")
+
+    str = bundle_get_val(kb, AUL_K_STARTTIME);
+    if (str != NULL) {
+        setenv("APP_START_TIME", str, 1);
+    }
+
+    if (bundle_get_type(kb, AUL_K_SDK) & BUNDLE_TYPE_ARRAY) {
+        str_array = bundle_get_str_array(kb, AUL_K_SDK, &len);
+        if (str_array != NULL) {
+            for (i = 0; i < len; i++) {
+                _D("index : [%d]", i);
+                __set_sdk_env(menu_info, (char *)str_array[i]);
+            }
+        }
+    } else {
+        str = bundle_get_val(kb, AUL_K_SDK);
+        if (str != NULL) {
+            __set_sdk_env(menu_info, (char *)str);
+        }
+    }
+    if (menu_info->hwacc != NULL) {
+        setenv("HWACC", menu_info->hwacc, 1);
+    }
 }
 
 _static_ int __prepare_exec(const char *pkg_name,
-                           const char *app_path, app_info_from_db * menu_info,
-                           bundle * kb)
+                            const char *app_path, app_info_from_db * menu_info,
+                            bundle * kb)
 {
-       char *file_name;
-       char process_name[AUL_PR_NAME];
-
-       /* Set new session ID & new process group ID*/
-       /* In linux, child can set new session ID without check permission */
-       /* TODO : should be add to check permission in the kernel*/
-       setsid();
-
-       __preexec_run(menu_info->pkg_type, pkg_name, app_path);
-
-       /* SET OOM*/
-       __set_oom();
-
-       /* SET PRIVILEGES*/
-       if (__set_access(pkg_name, menu_info->pkg_type, app_path) < 0) {
-                _D("fail to set privileges - check your package's credential\n");
-               return -1;
-       }
-       /* SET DUMPABLE - for coredump*/
-       prctl(PR_SET_DUMPABLE, 1);
-
-       /* SET PROCESS NAME*/
-       if (app_path == NULL) {
-               _D("app_path should not be NULL - check menu db");
-               return -1;
-       }
-       file_name = strrchr(app_path, '/') + 1;
-       if (file_name == NULL) {
-               _D("can't locate file name to execute");
-               return -1;
-       }
-       memset(process_name, '\0', AUL_PR_NAME);
-       snprintf(process_name, AUL_PR_NAME, "%s", file_name);
-       prctl(PR_SET_NAME, process_name);
-
-       /* SET ENVIROMENT*/
-       __set_env(menu_info, kb);
-
-       return 0;
+    char *file_name;
+    char process_name[AUL_PR_NAME];
+
+    /* Set new session ID & new process group ID*/
+    /* In linux, child can set new session ID without check permission */
+    /* TODO : should be add to check permission in the kernel*/
+    setsid();
+
+    __preexec_run(menu_info->pkg_type, pkg_name, app_path);
+
+    /* SET OOM*/
+    __set_oom();
+
+    /* SET PRIVILEGES*/
+    if (__set_access(pkg_name, menu_info->pkg_type, app_path) < 0) {
+        _D("fail to set privileges - check your package's credential\n");
+        return -1;
+    }
+    /* SET DUMPABLE - for coredump*/
+    prctl(PR_SET_DUMPABLE, 1);
+
+    /* SET PROCESS NAME*/
+    if (app_path == NULL) {
+        _D("app_path should not be NULL - check menu db");
+        return -1;
+    }
+    file_name = strrchr(app_path, '/') + 1;
+    if (file_name == NULL) {
+        _D("can't locate file name to execute");
+        return -1;
+    }
+    memset(process_name, '\0', AUL_PR_NAME);
+    snprintf(process_name, AUL_PR_NAME, "%s", file_name);
+    prctl(PR_SET_NAME, process_name);
+
+    /* SET ENVIROMENT*/
+    __set_env(menu_info, kb);
+
+    return 0;
 }
 
 _static_ int __fake_launch_app(int cmd, int pid, bundle * kb)
 {
-       int datalen;
-       int ret;
-       bundle_raw *kb_data;
-
-       bundle_encode(kb, &kb_data, &datalen);
-       if ((ret = __app_send_raw(pid, cmd, kb_data, datalen)) < 0)
-               _E("error request fake launch - error code = %d", ret);
-       free(kb_data);
-       return ret;
+    int datalen;
+    int ret;
+    bundle_raw *kb_data;
+
+    bundle_encode(kb, &kb_data, &datalen);
+    if ((ret = __app_send_raw(pid, cmd, kb_data, datalen)) < 0) {
+        _E("error request fake launch - error code = %d", ret);
+    }
+    free(kb_data);
+    return ret;
 }
 
 _static_ char **__create_argc_argv(bundle * kb, int *margc)
 {
-       char **argv;
-       int argc;
+    char **argv;
+    int argc;
 
-       argc = bundle_export_to_argv(kb, &argv);
+    argc = bundle_export_to_argv(kb, &argv);
 
-       *margc = argc;
-       return argv;
+    *margc = argc;
+    return argv;
 }
 
 _static_ int __normal_fork_exec(int argc, char **argv)
 {
-       _D("start real fork and exec\n");
-
-        // warning: unused parameter
-        argc = argc;
-
-       if (execv(argv[0], argv) < 0) { /* Flawfinder: ignore */
-               if (errno == EACCES)
-                       _E("such a file is no executable - %s", argv[0]);
-               else
-                       _E("unknown executable error - %s", argv[0]);
-               return -1;
-       }
-       /* never reach*/
-       return 0;
+    _D("start real fork and exec\n");
+
+    // warning: unused parameter
+    argc = argc;
+
+    if (execv(argv[0], argv) < 0) {     /* Flawfinder: ignore */
+        if (errno == EACCES) {
+            _E("such a file is no executable - %s", argv[0]);
+        } else {
+            _E("unknown executable error - %s", argv[0]);
+        }
+        return -1;
+    }
+    /* never reach*/
+    return 0;
 }
 
 _static_ void __real_launch(const char *app_path, bundle * kb)
 {
-       int app_argc;
-       char **app_argv;
-       int i;
+    int app_argc;
+    char **app_argv;
+    int i;
 
-       app_argv = __create_argc_argv(kb, &app_argc);
+    app_argv = __create_argc_argv(kb, &app_argc);
 
 #ifndef NATIVE_LAUNCHPAD
     if (__change_cmdline(app_path) < 0) {
@@ -271,21 +276,22 @@ _static_ void __real_launch(const char *app_path, bundle * kb)
 
     app_argv[0] = g_argv[0];
 #else
-       app_argv[0] = strdup(app_path);
+    app_argv[0] = strdup(app_path);
 #endif
 
-       for (i = 0; i < app_argc; i++)
-               _D("input argument %d : %s##", i, app_argv[i]);
+    for (i = 0; i < app_argc; i++) {
+        _D("input argument %d : %s##", i, app_argv[i]);
+    }
 
-       PERF("setup argument done");
-       _E("lock up test log(no error) : setup argument done");
+    PERF("setup argument done");
+    _E("lock up test log(no error) : setup argument done");
 
-       /* Temporary log: launch time checking */
-       LOG(LOG_DEBUG, "LAUNCH", "[%s:Platform:launchpad:done]", app_path);
+    /* Temporary log: launch time checking */
+    LOG(LOG_DEBUG, "LAUNCH", "[%s:Platform:launchpad:done]", app_path);
 
-       __preload_exec(app_argc, app_argv);
+    __preload_exec(app_argc, app_argv);
 
-       __normal_fork_exec(app_argc, app_argv);
+    __normal_fork_exec(app_argc, app_argv);
 }
 
 /*
@@ -297,551 +303,575 @@ _static_ void __real_launch(const char *app_path, bundle * kb)
  */
 static inline int __parser(const char *arg, char *out, int out_size)
 {
-       register int i;
-       int state = 1;
-       char *start_out = out;
-
-       if (arg == NULL || out == NULL) {
-               /* Handles null buffer*/
-               return 0;
-       }
-
-       for (i = 0; out_size > 1; i++) {
-               switch (state) {
-               case 1:
-                       switch (arg[i]) {
-                       case ' ':
-                       case '\t':
-                               state = 5;
-                               break;
-                       case '\0':
-                               state = 7;
-                               break;
-                       case '\"':
-                               state = 2;
-                               break;
-                       case '\\':
-                               state = 4;
-                               break;
-                       default:
-                               *out = arg[i];
-                               out++;
-                               out_size--;
-                               break;
-                       }
-                       break;
-               case 2: /* escape start*/
-                       switch (arg[i]) {
-                       case '\0':
-                               state = 6;
-                               break;
-                       case '\"':
-                               state = 1;
-                               break;
-                       default:
-                               *out = arg[i];
-                               out++;
-                               out_size--;
-                               break;
-                       }
-                       break;
-               case 4: /* character escape*/
-                       if (arg[i] == '\0') {
-                               state = 6;
-                       } else {
-                               *out = arg[i];
-                               out++;
-                               out_size--;
-                               state = 1;
-                       }
-                       break;
-               case 5: /* token*/
-                       if (out != start_out) {
-                               *out = '\0';
-                               out_size--;
-                               return i;
-                       }
-                       i--;
-                       state = 1;
-                       break;
-               case 6:
-                       return -1;      /* error*/
-               case 7: /* terminate*/
-                       *out = '\0';
-                       out_size--;
-                       return 0;
-               default:
-                       state = 6;
-                       break;  /* error*/
-               }
-       }
-
-       if (out_size == 1) {
-               *out = '\0';
-       }
-       /* Buffer overflow*/
-       return -2;
+    register int i;
+    int state = 1;
+    char *start_out = out;
+
+    if (arg == NULL || out == NULL) {
+        /* Handles null buffer*/
+        return 0;
+    }
+
+    for (i = 0; out_size > 1; i++) {
+        switch (state) {
+        case 1:
+            switch (arg[i]) {
+            case ' ':
+            case '\t':
+                state = 5;
+                break;
+            case '\0':
+                state = 7;
+                break;
+            case '\"':
+                state = 2;
+                break;
+            case '\\':
+                state = 4;
+                break;
+            default:
+                *out = arg[i];
+                out++;
+                out_size--;
+                break;
+            }
+            break;
+        case 2:         /* escape start*/
+            switch (arg[i]) {
+            case '\0':
+                state = 6;
+                break;
+            case '\"':
+                state = 1;
+                break;
+            default:
+                *out = arg[i];
+                out++;
+                out_size--;
+                break;
+            }
+            break;
+        case 4:         /* character escape*/
+            if (arg[i] == '\0') {
+                state = 6;
+            } else {
+                *out = arg[i];
+                out++;
+                out_size--;
+                state = 1;
+            }
+            break;
+        case 5:         /* token*/
+            if (out != start_out) {
+                *out = '\0';
+                out_size--;
+                return i;
+            }
+            i--;
+            state = 1;
+            break;
+        case 6:
+            return -1;                  /* error*/
+        case 7:         /* terminate*/
+            *out = '\0';
+            out_size--;
+            return 0;
+        default:
+            state = 6;
+            break;              /* error*/
+        }
+    }
+
+    if (out_size == 1) {
+        *out = '\0';
+    }
+    /* Buffer overflow*/
+    return -2;
 }
 
 _static_ void __modify_bundle(bundle * kb, int caller_pid,
-                           app_info_from_db * menu_info, int cmd)
+                              app_info_from_db * menu_info, int cmd)
 {
-        // warning: unused parameter
-        caller_pid = caller_pid;
-
-       bundle_del(kb, AUL_K_PKG_NAME);
-       bundle_del(kb, AUL_K_EXEC);
-       bundle_del(kb, AUL_K_PACKAGETYPE);
-       bundle_del(kb, AUL_K_HWACC);
-
-       /* Parse app_path to retrieve default bundle*/
-       if (cmd == APP_START || cmd == APP_START_RES || cmd == APP_OPEN || cmd == APP_RESUME) {
-               char *ptr;
-               char exe[MAX_PATH_LEN];
-               int flag;
-
-               ptr = _get_original_app_path(menu_info);
-
-               flag = __parser(ptr, exe, sizeof(exe));
-               if (flag > 0) {
-                       char key[256];
-                       char value[256];
-
-                       ptr += flag;
-                       _D("parsing app_path: EXEC - %s\n", exe);
-
-                       do {
-                               flag = __parser(ptr, key, sizeof(key));
-                               if (flag <= 0)
-                                       break;
-                               ptr += flag;
-
-                               flag = __parser(ptr, value, sizeof(value));
-                               if (flag < 0)
-                                       break;
-                               ptr += flag;
-
-                               /*bundle_del(kb, key);*/
-                               bundle_add(kb, key, value);
-                       } while (flag > 0);
-               } else if (flag == 0) {
-                       _D("parsing app_path: No arguments\n");
-               } else {
-                       _D("parsing app_path: Invalid argument\n");
-               }
-       }
+    // warning: unused parameter
+    caller_pid = caller_pid;
+
+    bundle_del(kb, AUL_K_PKG_NAME);
+    bundle_del(kb, AUL_K_EXEC);
+    bundle_del(kb, AUL_K_PACKAGETYPE);
+    bundle_del(kb, AUL_K_HWACC);
+
+    /* Parse app_path to retrieve default bundle*/
+    if (cmd == APP_START || cmd == APP_START_RES || cmd == APP_OPEN || cmd ==
+        APP_RESUME)
+    {
+        char *ptr;
+        char exe[MAX_PATH_LEN];
+        int flag;
+
+        ptr = _get_original_app_path(menu_info);
+
+        flag = __parser(ptr, exe, sizeof(exe));
+        if (flag > 0) {
+            char key[256];
+            char value[256];
+
+            ptr += flag;
+            _D("parsing app_path: EXEC - %s\n", exe);
+
+            do {
+                flag = __parser(ptr, key, sizeof(key));
+                if (flag <= 0) {
+                    break;
+                }
+                ptr += flag;
+
+                flag = __parser(ptr, value, sizeof(value));
+                if (flag < 0) {
+                    break;
+                }
+                ptr += flag;
+
+                /*bundle_del(kb, key);*/
+                bundle_add(kb, key, value);
+            } while (flag > 0);
+        } else if (flag == 0) {
+            _D("parsing app_path: No arguments\n");
+        } else {
+            _D("parsing app_path: Invalid argument\n");
+        }
+    }
 }
 
 _static_ int __child_raise_win_by_x(int pid, void *priv)
 {
-        // warning: unused parameter
-        priv = priv;
+    // warning: unused parameter
+    priv = priv;
 
-       return x_util_raise_win(pid);
+    return x_util_raise_win(pid);
 }
 
 _static_ int __raise_win_by_x(int pid)
 {
-       int pgid;
-       if (x_util_raise_win(pid) == 0)
-               return 0;
+    int pgid;
+    if (x_util_raise_win(pid) == 0) {
+        return 0;
+    }
 
-       /* support app launched by shell script*/
-       pgid = getpgid(pid);
-       _D("X raise failed. try to find first child & raise it - c:%d p:%d\n",
-          pgid, pid);
+    /* support app launched by shell script*/
+    pgid = getpgid(pid);
+    _D("X raise failed. try to find first child & raise it - c:%d p:%d\n",
+       pgid, pid);
 
-       if (pgid <= 1)
-               return -1;
-       if (__proc_iter_pgid(pgid, __child_raise_win_by_x, NULL) < 0)
-               return -1;
+    if (pgid <= 1) {
+        return -1;
+    }
+    if (__proc_iter_pgid(pgid, __child_raise_win_by_x, NULL) < 0) {
+        return -1;
+    }
 
-       return 0;
+    return 0;
 }
 
 _static_ int __send_to_sigkill(int pid)
 {
-       int pgid;
+    int pgid;
 
-       pgid = getpgid(pid);
-       if (pgid <= 1)
-               return -1;
+    pgid = getpgid(pid);
+    if (pgid <= 1) {
+        return -1;
+    }
 
-       if (killpg(pgid, SIGKILL) < 0)
-               return -1;
+    if (killpg(pgid, SIGKILL) < 0) {
+        return -1;
+    }
 
-       return 0;
+    return 0;
 }
 
 _static_ int __term_app(int pid)
 {
-       int dummy;
-       if (__app_send_raw
-           (pid, APP_TERM_BY_PID, (unsigned char *)&dummy, sizeof(int)) < 0) {
-               _D("terminate packet send error - use SIGKILL");
-               if (__send_to_sigkill(pid) < 0) {
-                       _E("fail to killing - %d\n", pid);
-                       return -1;
-               }
-       }
-       _D("term done\n");
-       return 0;
+    int dummy;
+    if (__app_send_raw
+            (pid, APP_TERM_BY_PID, (unsigned char *)&dummy, sizeof(int)) < 0)
+    {
+        _D("terminate packet send error - use SIGKILL");
+        if (__send_to_sigkill(pid) < 0) {
+            _E("fail to killing - %d\n", pid);
+            return -1;
+        }
+    }
+    _D("term done\n");
+    return 0;
 }
 
 _static_ int __resume_app(int pid)
 {
-       int dummy;
-       int ret;
-       if ((ret =
-            __app_send_raw(pid, APP_RESUME_BY_PID, (unsigned char *)&dummy,
-                           sizeof(int))) < 0) {
-               if (ret == -EAGAIN)
-                       _E("resume packet timeout error");
-               else {
-                       _D("resume packet send error - use raise win");
-                       if (__raise_win_by_x(pid) < 0) {
-                               _E("raise failed - %d resume fail\n", pid);
-                               _E("we will term the app - %d\n", pid);
-                               __send_to_sigkill(pid);
-                               ret = -1;
-                       } else
-                               ret = 0;
-               }
-       }
-       _D("resume done\n");
-       return ret;
+    int dummy;
+    int ret;
+    if ((ret =
+             __app_send_raw(pid, APP_RESUME_BY_PID, (unsigned char *)&dummy,
+                            sizeof(int))) < 0)
+    {
+        if (ret == -EAGAIN) {
+            _E("resume packet timeout error");
+        } else {
+            _D("resume packet send error - use raise win");
+            if (__raise_win_by_x(pid) < 0) {
+                _E("raise failed - %d resume fail\n", pid);
+                _E("we will term the app - %d\n", pid);
+                __send_to_sigkill(pid);
+                ret = -1;
+            } else {
+                ret = 0;
+            }
+        }
+    }
+    _D("resume done\n");
+    return ret;
 }
 
 static int __get_caller_pid(bundle *kb)
 {
-       const char *pid_str;
-       int pid;
+    const char *pid_str;
+    int pid;
 
-       pid_str = bundle_get_val(kb, AUL_K_ORG_CALLER_PID);
-       if(pid_str)
-               goto end;
+    pid_str = bundle_get_val(kb, AUL_K_ORG_CALLER_PID);
+    if (pid_str) {
+        goto end;
+    }
 
-       pid_str = bundle_get_val(kb, AUL_K_CALLER_PID);
-       if (pid_str == NULL)
-               return -1;
+    pid_str = bundle_get_val(kb, AUL_K_CALLER_PID);
+    if (pid_str == NULL) {
+        return -1;
+    }
 
 end:
-       pid = atoi(pid_str);
-       if (pid <= 1)
-               return -1;
+    pid = atoi(pid_str);
+    if (pid <= 1) {
+        return -1;
+    }
 
-       return pid;
+    return pid;
 }
 
 _static_ int __foward_cmd(int cmd, bundle *kb, int cr_pid)
 {
-       int pid;
-       char tmp_pid[MAX_PID_STR_BUFSZ];
-       int datalen;
-       bundle_raw *kb_data;
-       int res;
-
-       if ((pid = __get_caller_pid(kb)) < 0)
-                       return AUL_R_ERROR;
+    int pid;
+    char tmp_pid[MAX_PID_STR_BUFSZ];
+    int datalen;
+    bundle_raw *kb_data;
+    int res;
+
+    if ((pid = __get_caller_pid(kb)) < 0) {
+        return AUL_R_ERROR;
+    }
 
-       snprintf(tmp_pid, MAX_PID_STR_BUFSZ, "%d", cr_pid);
+    snprintf(tmp_pid, MAX_PID_STR_BUFSZ, "%d", cr_pid);
 
-       bundle_add(kb, AUL_K_CALLEE_PID, tmp_pid);
+    bundle_add(kb, AUL_K_CALLEE_PID, tmp_pid);
 
-       bundle_encode(kb, &kb_data, &datalen);
-       if ((res = __app_send_raw(pid, cmd, kb_data, datalen)) < 0)
-               res = AUL_R_ERROR;
+    bundle_encode(kb, &kb_data, &datalen);
+    if ((res = __app_send_raw(pid, cmd, kb_data, datalen)) < 0) {
+        res = AUL_R_ERROR;
+    }
 
-       free(kb_data);
+    free(kb_data);
 
-       return res;
+    return res;
 }
 
 _static_ void __real_send(int clifd, int ret)
 {
-       if (send(clifd, &ret, sizeof(int), MSG_NOSIGNAL) < 0) {
-               if (errno == EPIPE) {
-                       _E("send failed due to EPIPE.\n");
-               }
-               _E("send fail to client");
-       }
-
-       close(clifd);
+    if (send(clifd, &ret, sizeof(int), MSG_NOSIGNAL) < 0) {
+        if (errno == EPIPE) {
+            _E("send failed due to EPIPE.\n");
+        }
+        _E("send fail to client");
+    }
+
+    close(clifd);
 }
 
 _static_ void __send_result_to_caller(int clifd, int ret)
 {
-       char *cmdline;
-       int wait_count;
-       int cmdline_changed = 0;
-       int cmdline_exist = 0;
-
-       if (clifd == -1)
-               return;
-
-       if (ret <= 1) {
-               __real_send(clifd, ret);
-               return;
-       }
-       /* check normally was launched?*/
-       wait_count = 1;
-       do {
-               cmdline = __proc_get_cmdline_bypid(ret);
-               if (cmdline == NULL) {
-                       _E("error founded when being launched with %d", ret);
-
-               } else if (strcmp(cmdline, launchpad_cmdline)) {
-                       free(cmdline);
-                       cmdline_changed = 1;
-                       break;
-               } else {
-                       cmdline_exist = 1;
-                       free(cmdline);
-               }
-
-               _D("-- now wait to change cmdline --");
-               usleep(50 * 1000);      /* 50ms sleep*/
-               wait_count++;
-       } while (wait_count <= 20);     /* max 50*20ms will be sleep*/
-
-       if ((!cmdline_exist) && (!cmdline_changed)) {
-               __real_send(clifd, -1); /* abnormally launched*/
-               return;
-       }
-
-       if (!cmdline_changed)
-               _E("process launched, but cmdline not changed");
-
-       __real_send(clifd, ret);
-       return;
+    char *cmdline;
+    int wait_count;
+    int cmdline_changed = 0;
+    int cmdline_exist = 0;
+
+    if (clifd == -1) {
+        return;
+    }
+
+    if (ret <= 1) {
+        __real_send(clifd, ret);
+        return;
+    }
+    /* check normally was launched?*/
+    wait_count = 1;
+    do {
+        cmdline = __proc_get_cmdline_bypid(ret);
+        if (cmdline == NULL) {
+            _E("error founded when being launched with %d", ret);
+        } else if (strcmp(cmdline, launchpad_cmdline)) {
+            free(cmdline);
+            cmdline_changed = 1;
+            break;
+        } else {
+            cmdline_exist = 1;
+            free(cmdline);
+        }
+
+        _D("-- now wait to change cmdline --");
+        usleep(50 * 1000);              /* 50ms sleep*/
+        wait_count++;
+    } while (wait_count <= 20);         /* max 50*20ms will be sleep*/
+
+    if ((!cmdline_exist) && (!cmdline_changed)) {
+        __real_send(clifd, -1);         /* abnormally launched*/
+        return;
+    }
+
+    if (!cmdline_changed) {
+        _E("process launched, but cmdline not changed");
+    }
+
+    __real_send(clifd, ret);
+    return;
 }
 
 static app_info_from_db *_get_app_info_from_bundle_by_pkgname(
-                                                       const char *pkgname, bundle *kb)
+    const char *pkgname, bundle *kb)
 {
-       app_info_from_db *menu_info;
-
-       menu_info = calloc(1, sizeof(app_info_from_db));
-       if (menu_info == NULL) {
-               return NULL;
-       }
-
-       menu_info->pkg_name = strdup(pkgname);
-       menu_info->app_path = strdup(bundle_get_val(kb, AUL_K_EXEC));
-       if (menu_info->app_path != NULL)
-               menu_info->original_app_path = strdup(menu_info->app_path);
-       menu_info->pkg_type = strdup(bundle_get_val(kb, AUL_K_PACKAGETYPE));
-       menu_info->hwacc = strdup(bundle_get_val(kb, AUL_K_HWACC));
-
-       if (!_get_app_path(menu_info)) {
-               _free_app_info_from_db(menu_info);
-               return NULL;
-       }
-
-       return menu_info;
+    app_info_from_db *menu_info;
+
+    menu_info = calloc(1, sizeof(app_info_from_db));
+    if (menu_info == NULL) {
+        return NULL;
+    }
+
+    menu_info->pkg_name = strdup(pkgname);
+    menu_info->app_path = strdup(bundle_get_val(kb, AUL_K_EXEC));
+    if (menu_info->app_path != NULL) {
+        menu_info->original_app_path = strdup(menu_info->app_path);
+    }
+    menu_info->pkg_type = strdup(bundle_get_val(kb, AUL_K_PACKAGETYPE));
+    menu_info->hwacc = strdup(bundle_get_val(kb, AUL_K_HWACC));
+
+    if (!_get_app_path(menu_info)) {
+        _free_app_info_from_db(menu_info);
+        return NULL;
+    }
+
+    return menu_info;
 }
 
 _static_ void __launchpad_main_loop(int main_fd)
 {
-       bundle *kb = NULL;
-       app_pkt_t *pkt = NULL;
-       app_info_from_db *menu_info = NULL;
-
-       const char *pkg_name = NULL;
-       const char *app_path = NULL;
-       int pid = -1;
-       int clifd = -1;
-       struct ucred cr;
-       int is_real_launch = 0;
-
-       char sock_path[UNIX_PATH_MAX] = {0,};
-
-       pkt = __app_recv_raw(main_fd, &clifd, &cr);
-       if (!pkt) {
-               _D("packet is NULL");
-               goto end;
-       }
-
-       kb = bundle_decode(pkt->data, pkt->len);
-       if (!kb) {
-               _D("bundle decode error");
-               goto end;
-       }
-
-       INIT_PERF(kb);
-       PERF("packet processing start");
-
-       pkg_name = bundle_get_val(kb, AUL_K_PKG_NAME);
-       _D("pkg name : %s\n", pkg_name);
-
-       menu_info = _get_app_info_from_bundle_by_pkgname(pkg_name, kb);
-       if (menu_info == NULL) {
-               _D("such pkg no found");
-               goto end;
-       }
-
-       app_path = _get_app_path(menu_info);
-       if(app_path == NULL) {
-               _E("app_path is NULL");
-               goto end;
-       }
-       if (app_path[0] != '/') {
-               _D("app_path is not absolute path");
-               goto end;
-       }
-
-       __modify_bundle(kb, cr.pid, menu_info, pkt->cmd);
-       pkg_name = _get_pkgname(menu_info);
-
-       PERF("get package information & modify bundle done");
-
-       {
-               pid = fork();
-               if (pid == 0) {
-                       PERF("fork done");
-                       _E("lock up test log(no error) : fork done");
-
-                       close(clifd);
-                       close(main_fd);
-                       __signal_unset_sigchld();
-                       __signal_fini();
-
-                       snprintf(sock_path, UNIX_PATH_MAX, "%s/%d", AUL_SOCK_PREFIX, getpid());
-                       unlink(sock_path);
-
-                       PERF("prepare exec - first done");
-                       _E("lock up test log(no error) : prepare exec - first done");
-
-                       if (__prepare_exec(pkg_name, app_path,
-                                          menu_info, kb) < 0) {
-                               _E("preparing work fail to launch - "
-                                  "can not launch %s\n", pkg_name);
-                               exit(-1);
-                       }
-
-                       PERF("prepare exec - second done");
-                       _E("lock up test log(no error) : prepare exec - second done");
-
-                       __real_launch(app_path, kb);
-
-                       exit(-1);
-               }
-               _D("==> real launch pid : %d %s\n", pid, app_path);
-               is_real_launch = 1;
-       }
-
- end:
-       __send_result_to_caller(clifd, pid);
-
-       if (pid > 0) {
-               if (is_real_launch) {
-                       /*TODO: retry*/
-                       __signal_block_sigchld();
-                       __send_app_launch_signal(pid);
-                       __signal_unblock_sigchld();
-               }
-       }
-
-       if (menu_info != NULL)
-               _free_app_info_from_db(menu_info);
-
-       if (kb != NULL)
-               bundle_free(kb);
-       if (pkt != NULL)
-               free(pkt);
-
-       /* Active Flusing for Daemon */
-       if (initialized > AUL_POLL_CNT) {
-               sqlite3_release_memory(SQLITE_FLUSH_MAX);
-               malloc_trim(0);
-               initialized = 1;
-       }
+    bundle *kb = NULL;
+    app_pkt_t *pkt = NULL;
+    app_info_from_db *menu_info = NULL;
+
+    const char *pkg_name = NULL;
+    const char *app_path = NULL;
+    int pid = -1;
+    int clifd = -1;
+    struct ucred cr;
+    int is_real_launch = 0;
+
+    char sock_path[UNIX_PATH_MAX] = { 0, };
+
+    pkt = __app_recv_raw(main_fd, &clifd, &cr);
+    if (!pkt) {
+        _D("packet is NULL");
+        goto end;
+    }
+
+    kb = bundle_decode(pkt->data, pkt->len);
+    if (!kb) {
+        _D("bundle decode error");
+        goto end;
+    }
+
+    INIT_PERF(kb);
+    PERF("packet processing start");
+
+    pkg_name = bundle_get_val(kb, AUL_K_PKG_NAME);
+    _D("pkg name : %s\n", pkg_name);
+
+    menu_info = _get_app_info_from_bundle_by_pkgname(pkg_name, kb);
+    if (menu_info == NULL) {
+        _D("such pkg no found");
+        goto end;
+    }
+
+    app_path = _get_app_path(menu_info);
+    if (app_path == NULL) {
+        _E("app_path is NULL");
+        goto end;
+    }
+    if (app_path[0] != '/') {
+        _D("app_path is not absolute path");
+        goto end;
+    }
 
+    __modify_bundle(kb, cr.pid, menu_info, pkt->cmd);
+    pkg_name = _get_pkgname(menu_info);
+
+    PERF("get package information & modify bundle done");
+
+    {
+        pid = fork();
+        if (pid == 0) {
+            PERF("fork done");
+            _E("lock up test log(no error) : fork done");
+
+            close(clifd);
+            close(main_fd);
+            __signal_unset_sigchld();
+            __signal_fini();
+
+            snprintf(sock_path, UNIX_PATH_MAX, "%s/%d", AUL_SOCK_PREFIX, getpid());
+            unlink(sock_path);
+
+            PERF("prepare exec - first done");
+            _E("lock up test log(no error) : prepare exec - first done");
+
+            if (__prepare_exec(pkg_name, app_path,
+                               menu_info, kb) < 0)
+            {
+                _E("preparing work fail to launch - "
+                   "can not launch %s\n", pkg_name);
+                exit(-1);
+            }
+
+            PERF("prepare exec - second done");
+            _E("lock up test log(no error) : prepare exec - second done");
+
+            __real_launch(app_path, kb);
+
+            exit(-1);
+        }
+        _D("==> real launch pid : %d %s\n", pid, app_path);
+        is_real_launch = 1;
+    }
+
+end:
+    __send_result_to_caller(clifd, pid);
+
+    if (pid > 0) {
+        if (is_real_launch) {
+            /*TODO: retry*/
+            __signal_block_sigchld();
+            __send_app_launch_signal(pid);
+            __signal_unblock_sigchld();
+        }
+    }
+
+    if (menu_info != NULL) {
+        _free_app_info_from_db(menu_info);
+    }
+
+    if (kb != NULL) {
+        bundle_free(kb);
+    }
+    if (pkt != NULL) {
+        free(pkt);
+    }
+
+    /* Active Flusing for Daemon */
+    if (initialized > AUL_POLL_CNT) {
+        sqlite3_release_memory(SQLITE_FLUSH_MAX);
+        malloc_trim(0);
+        initialized = 1;
+    }
 }
 
 _static_ int __launchpad_pre_init(int argc, char **argv)
 {
-       int fd;
+    int fd;
 
-       /* signal init*/
-       __signal_init();
+    /* signal init*/
+    __signal_init();
 
-       /* get my(launchpad) command line*/
-       launchpad_cmdline = __proc_get_cmdline_bypid(getpid());
-       if (launchpad_cmdline == NULL) {
-               _E("launchpad cmdline fail to get");
-               return -1;
-       }
-       _D("launchpad cmdline = %s", launchpad_cmdline);
+    /* get my(launchpad) command line*/
+    launchpad_cmdline = __proc_get_cmdline_bypid(getpid());
+    if (launchpad_cmdline == NULL) {
+        _E("launchpad cmdline fail to get");
+        return -1;
+    }
+    _D("launchpad cmdline = %s", launchpad_cmdline);
 
-       /* create launchpad sock        */
-       fd = __create_server_sock(WRT_LAUNCHPAD_PID);
-       if (fd < 0) {
-               _E("server sock error");
-               return -1;
-       }
+    /* create launchpad sock        */
+    fd = __create_server_sock(WRT_LAUNCHPAD_PID);
+    if (fd < 0) {
+        _E("server sock error");
+        return -1;
+    }
 
-       __preload_init(argc, argv);
+    __preload_init(argc, argv);
 
     __preload_init_for_wrt();
 
-       __preexec_init(argc, argv);
+    __preexec_init(argc, argv);
 
-       return fd;
+    return fd;
 }
 
 _static_ int __launchpad_post_init()
 {
-       /* Setting this as a global variable to keep track 
-       of launchpad poll cnt */
-       /* static int initialized = 0;*/
+    /* Setting this as a global variable to keep track
+     * of launchpad poll cnt */
+    /* static int initialized = 0;*/
 
-       if (initialized) {
-               initialized++;
-               return 0;
-       }
+    if (initialized) {
+        initialized++;
+        return 0;
+    }
 
-       if (__signal_set_sigchld() < 0)
-               return -1;
+    if (__signal_set_sigchld() < 0) {
+        return -1;
+    }
 
-       initialized++;
+    initialized++;
 
-       return 0;
+    return 0;
 }
 
 int main(int argc, char **argv)
 {
-       int main_fd;
-       struct pollfd pfds[POLLFD_MAX];
-       int i;
-
-       /* init without concerning X & EFL*/
-       main_fd = __launchpad_pre_init(argc, argv);
-       if (main_fd < 0) {
-               _E("launchpad pre init failed");
-               exit(-1);
-       }
-
-       pfds[0].fd = main_fd;
-       pfds[0].events = POLLIN;
-       pfds[0].revents = 0;
-
-       while (1) {
-               if (poll(pfds, POLLFD_MAX, -1) < 0)
-                       continue;
-
-               /* init with concerning X & EFL (because of booting 
-               sequence problem)*/
-               if (__launchpad_post_init() < 0) {
-                       _E("launcpad post init failed");
-                       exit(-1);
-               }
-
-               for (i = 0; i < POLLFD_MAX; i++) {
-                       if ((pfds[i].revents & POLLIN) != 0) {
-                               __launchpad_main_loop(pfds[i].fd);
-                       }
-               }
-       }
+    int main_fd;
+    struct pollfd pfds[POLLFD_MAX];
+    int i;
+
+    /* init without concerning X & EFL*/
+    main_fd = __launchpad_pre_init(argc, argv);
+    if (main_fd < 0) {
+        _E("launchpad pre init failed");
+        exit(-1);
+    }
+
+    pfds[0].fd = main_fd;
+    pfds[0].events = POLLIN;
+    pfds[0].revents = 0;
+
+    while (1) {
+        if (poll(pfds, POLLFD_MAX, -1) < 0) {
+            continue;
+        }
+
+        /* init with concerning X & EFL (because of booting
+         * sequence problem)*/
+        if (__launchpad_post_init() < 0) {
+            _E("launcpad post init failed");
+            exit(-1);
+        }
+
+        for (i = 0; i < POLLFD_MAX; i++) {
+            if ((pfds[i].revents & POLLIN) != 0) {
+                __launchpad_main_loop(pfds[i].fd);
+            }
+        }
+    }
 }
 
index b9d35fb..d1e0214 100644 (file)
@@ -14,7 +14,6 @@
  *    limitations under the License.
  */
 
-
 #include <pthread.h>
 #include "app_signal.h"
 
@@ -24,230 +23,242 @@ sigset_t oldmask;
 
 static inline void __socket_garbage_collector()
 {
-       DIR *dp;
-       struct dirent *dentry;
-       char tmp[MAX_LOCAL_BUFSZ];
-
-       dp = opendir(AUL_SOCK_PREFIX);
-       if (dp == NULL)
-               return;
-
-       while ((dentry = readdir(dp)) != NULL) {
-               if (!isdigit(dentry->d_name[0]))
-                       continue;
-
-               snprintf(tmp, MAX_LOCAL_BUFSZ, "/proc/%s", dentry->d_name);
-               if (access(tmp, F_OK) < 0) {    /* Flawfinder: ignore */
-                       snprintf(tmp, MAX_LOCAL_BUFSZ, "%s/%s", AUL_SOCK_PREFIX,
-                                dentry->d_name);
-                       unlink(tmp);
-                       continue;
-               }
-       }
-       closedir(dp);
+    DIR *dp;
+    struct dirent *dentry;
+    char tmp[MAX_LOCAL_BUFSZ];
+
+    dp = opendir(AUL_SOCK_PREFIX);
+    if (dp == NULL) {
+        return;
+    }
+
+    while ((dentry = readdir(dp)) != NULL) {
+        if (!isdigit(dentry->d_name[0])) {
+            continue;
+        }
+
+        snprintf(tmp, MAX_LOCAL_BUFSZ, "/proc/%s", dentry->d_name);
+        if (access(tmp, F_OK) < 0) {            /* Flawfinder: ignore */
+            snprintf(tmp, MAX_LOCAL_BUFSZ, "%s/%s", AUL_SOCK_PREFIX,
+                     dentry->d_name);
+            unlink(tmp);
+            continue;
+        }
+    }
+    closedir(dp);
 }
 
 static inline int __send_app_dead_signal(int dead_pid)
 {
-       DBusMessage *message;
+    DBusMessage *message;
 
-       if (bus == NULL)
-               return -1;
+    if (bus == NULL) {
+        return -1;
+    }
 
-       message = dbus_message_new_signal(AUL_DBUS_PATH,
-                                         AUL_DBUS_SIGNAL_INTERFACE,
-                                         AUL_DBUS_APPDEAD_SIGNAL);
+    message = dbus_message_new_signal(AUL_DBUS_PATH,
+                                      AUL_DBUS_SIGNAL_INTERFACE,
+                                      AUL_DBUS_APPDEAD_SIGNAL);
 
-       if (dbus_message_append_args(message,
-                                    DBUS_TYPE_UINT32, &dead_pid,
-                                    DBUS_TYPE_INVALID) == FALSE) {
-               _E("Failed to load data error");
-               return -1;
-       }
+    if (dbus_message_append_args(message,
+                                 DBUS_TYPE_UINT32, &dead_pid,
+                                 DBUS_TYPE_INVALID) == FALSE)
+    {
+        _E("Failed to load data error");
+        return -1;
+    }
 
-       if (dbus_connection_send(bus, message, NULL) == FALSE) {
-               _E("dbus send error");
-               return -1;
-       }
+    if (dbus_connection_send(bus, message, NULL) == FALSE) {
+        _E("dbus send error");
+        return -1;
+    }
 
-       dbus_connection_flush(bus);
-       dbus_message_unref(message);
+    dbus_connection_flush(bus);
+    dbus_message_unref(message);
 
-       _D("send dead signal done\n");
+    _D("send dead signal done\n");
 
-       return 0;
+    return 0;
 }
 
 static inline int __send_app_launch_signal(int launch_pid)
 {
-       DBusMessage *message;
+    DBusMessage *message;
 
-       if (bus == NULL)
-               return -1;
+    if (bus == NULL) {
+        return -1;
+    }
 
-       message = dbus_message_new_signal(AUL_DBUS_PATH,
-                                         AUL_DBUS_SIGNAL_INTERFACE,
-                                         AUL_DBUS_APPLAUNCH_SIGNAL);
+    message = dbus_message_new_signal(AUL_DBUS_PATH,
+                                      AUL_DBUS_SIGNAL_INTERFACE,
+                                      AUL_DBUS_APPLAUNCH_SIGNAL);
 
-       if (dbus_message_append_args(message,
-                                    DBUS_TYPE_UINT32, &launch_pid,
-                                    DBUS_TYPE_INVALID) == FALSE) {
-               _E("Failed to load data error");
-               return -1;
-       }
+    if (dbus_message_append_args(message,
+                                 DBUS_TYPE_UINT32, &launch_pid,
+                                 DBUS_TYPE_INVALID) == FALSE)
+    {
+        _E("Failed to load data error");
+        return -1;
+    }
 
-       if (dbus_connection_send(bus, message, NULL) == FALSE) {
-               _E("dbus send error");
-               return -1;
-       }
+    if (dbus_connection_send(bus, message, NULL) == FALSE) {
+        _E("dbus send error");
+        return -1;
+    }
 
-       dbus_connection_flush(bus);
-       dbus_message_unref(message);
+    dbus_connection_flush(bus);
+    dbus_message_unref(message);
 
-       _D("send launch signal done\n");
+    _D("send launch signal done\n");
 
-       return 0;
+    return 0;
 }
 
 static int __sigchild_action(void *data)
 {
-       pid_t dead_pid;
-       char buf[MAX_LOCAL_BUFSZ];
+    pid_t dead_pid;
+    char buf[MAX_LOCAL_BUFSZ];
 
-       dead_pid = (pid_t) data;
-       if (dead_pid <= 0)
-               goto end;
+    dead_pid = (pid_t) data;
+    if (dead_pid <= 0) {
+        goto end;
+    }
 
-       __send_app_dead_signal(dead_pid);
+    __send_app_dead_signal(dead_pid);
 
-       snprintf(buf, MAX_LOCAL_BUFSZ, "%s/%d", AUL_SOCK_PREFIX, dead_pid);
-       unlink(buf);
+    snprintf(buf, MAX_LOCAL_BUFSZ, "%s/%d", AUL_SOCK_PREFIX, dead_pid);
+    unlink(buf);
 
-       __socket_garbage_collector();
- end:
-       return 0;
+    __socket_garbage_collector();
+end:
+    return 0;
 }
 
 static void __launchpad_sig_child(int signo, siginfo_t *info, void *data)
 {
-       int status;
-       pid_t child_pid;
-       pid_t child_pgid;
+    int status;
+    pid_t child_pid;
+    pid_t child_pgid;
 
-        // warning: unused parameter
-        signo = signo;
-        data = data;
+    // warning: unused parameter
+    signo = signo;
+    data = data;
 
-       child_pgid = getpgid(info->si_pid);
-       _D("dead_pid = %d pgid = %d", info->si_pid, child_pgid);
+    child_pgid = getpgid(info->si_pid);
+    _D("dead_pid = %d pgid = %d", info->si_pid, child_pgid);
 
-       while ((child_pid = waitpid(-1, &status, WNOHANG)) > 0) {
-               if (child_pid == child_pgid)
-                       killpg(child_pgid, SIGKILL);
-               __sigchild_action((void *)child_pid);
-       }
+    while ((child_pid = waitpid(-1, &status, WNOHANG)) > 0) {
+        if (child_pid == child_pgid) {
+            killpg(child_pgid, SIGKILL);
+        }
+        __sigchild_action((void *)child_pid);
+    }
 
-       return;
+    return;
 }
 
 static inline int __signal_init(void)
 {
-       int i;
-       for (i = 0; i < _NSIG; i++) {
-               switch (i) {
-                       /* controlled by sys-assert package*/
-               case SIGQUIT:
-               case SIGILL:
-               case SIGABRT:
-               case SIGBUS:
-               case SIGFPE:
-               case SIGSEGV:
-               case SIGPIPE:
-                       break;
-               default:
-                       signal(i, SIG_DFL);
-                       break;
-               }
-       }
-
-       return 0;
+    int i;
+    for (i = 0; i < _NSIG; i++) {
+        switch (i) {
+        /* controlled by sys-assert package*/
+        case SIGQUIT:
+        case SIGILL:
+        case SIGABRT:
+        case SIGBUS:
+        case SIGFPE:
+        case SIGSEGV:
+        case SIGPIPE:
+            break;
+        default:
+            signal(i, SIG_DFL);
+            break;
+        }
+    }
+
+    return 0;
 }
 
 static inline int __signal_set_sigchld(void)
 {
-       struct sigaction act;
-       DBusError error;
-
-       dbus_error_init(&error);
-       dbus_threads_init_default();
-       bus = dbus_bus_get_private(DBUS_BUS_SYSTEM, &error);
-       if (!bus) {
-               _E("Failed to connect to the D-BUS daemon: %s", error.message);
-               dbus_error_free(&error);
-               return -1;
-       }
-       /* TODO: if process stop mechanism is included, 
-       should be modified (SA_NOCLDSTOP)*/
-       act.sa_handler = NULL;
-       act.sa_sigaction = __launchpad_sig_child;
-       sigemptyset(&act.sa_mask);
-       act.sa_flags = SA_NOCLDSTOP | SA_SIGINFO;
-
-       if (sigaction(SIGCHLD, &act, &old_sigchild) < 0)
-               return -1;
-
-       return 0;
+    struct sigaction act;
+    DBusError error;
+
+    dbus_error_init(&error);
+    dbus_threads_init_default();
+    bus = dbus_bus_get_private(DBUS_BUS_SYSTEM, &error);
+    if (!bus) {
+        _E("Failed to connect to the D-BUS daemon: %s", error.message);
+        dbus_error_free(&error);
+        return -1;
+    }
+    /* TODO: if process stop mechanism is included,
+     * should be modified (SA_NOCLDSTOP)*/
+    act.sa_handler = NULL;
+    act.sa_sigaction = __launchpad_sig_child;
+    sigemptyset(&act.sa_mask);
+    act.sa_flags = SA_NOCLDSTOP | SA_SIGINFO;
+
+    if (sigaction(SIGCHLD, &act, &old_sigchild) < 0) {
+        return -1;
+    }
+
+    return 0;
 }
 
 static inline int __signal_unset_sigchld(void)
 {
-       struct sigaction dummy;
+    struct sigaction dummy;
 
-       if (bus == NULL)
-               return 0;
+    if (bus == NULL) {
+        return 0;
+    }
 
-       dbus_connection_close(bus);
-       if (sigaction(SIGCHLD, &old_sigchild, &dummy) < 0)
-               return -1;
+    dbus_connection_close(bus);
+    if (sigaction(SIGCHLD, &old_sigchild, &dummy) < 0) {
+        return -1;
+    }
 
-       return 0;
+    return 0;
 }
 
 static inline int __signal_block_sigchld(void)
 {
-       sigset_t newmask;
+    sigset_t newmask;
 
-       sigemptyset(&newmask);
-       sigaddset(&newmask, SIGCHLD);
+    sigemptyset(&newmask);
+    sigaddset(&newmask, SIGCHLD);
 
-       if (sigprocmask(SIG_BLOCK, &newmask, &oldmask) < 0) {
-               _E("SIG_BLOCK error");
-               return -1;
-       }
+    if (sigprocmask(SIG_BLOCK, &newmask, &oldmask) < 0) {
+        _E("SIG_BLOCK error");
+        return -1;
+    }
 
-       _D("SIGCHLD blocked");
+    _D("SIGCHLD blocked");
 
-       return 0;
+    return 0;
 }
 
 static inline int __signal_unblock_sigchld(void)
 {
-       if(sigprocmask(SIG_SETMASK, &oldmask, NULL) < 0) {
-               _E("SIG_SETMASK error");
-               return -1;
-       }
+    if (sigprocmask(SIG_SETMASK, &oldmask, NULL) < 0) {
+        _E("SIG_SETMASK error");
+        return -1;
+    }
 
-       _D("SIGCHLD unblocked");
-       return 0;
+    _D("SIGCHLD unblocked");
+    return 0;
 }
 
 static inline int __signal_fini(void)
 {
 #ifndef PRELOAD_ACTIVATE
-       int i;
-       for (i = 0; i < _NSIG; i++)
-               signal(i, SIG_DFL);
+    int i;
+    for (i = 0; i < _NSIG; i++) {
+        signal(i, SIG_DFL);
+    }
 #endif
-       return 0;
+    return 0;
 }
 
index b871dae..a527888 100644 (file)
@@ -14,7 +14,6 @@
  *    limitations under the License.
  */
 
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -27,8 +26,7 @@
 #include "simple_util.h"
 
 static Atom a_pid;
-static int (*x_old_error) (Display *, XErrorEvent *);
-
+static int (*x_old_error)(Display *, XErrorEvent *);
 
 static pid_t __get_win_pid(Display *d, Window win);
 static int __find_win(Display *d, Window *win, pid_t pid);
@@ -37,162 +35,172 @@ static int __cb_x_error(Display *disp, XErrorEvent *ev);
 
 static pid_t __get_win_pid(Display *d, Window win)
 {
-       int r;
-       pid_t pid;
+    int r;
+    pid_t pid;
 
-       Atom a_type;
-       int format;
-       unsigned long nitems;
-       unsigned long bytes_after;
-       unsigned char *prop_ret;
+    Atom a_type;
+    int format;
+    unsigned long nitems;
+    unsigned long bytes_after;
+    unsigned char *prop_ret;
 
-       retv_if(d == NULL || !a_pid, -1);
+    retv_if(d == NULL || !a_pid, -1);
 
-       prop_ret = NULL;
-       r = XGetWindowProperty(d, win, a_pid, 0, 1, False, XA_CARDINAL,
-                       &a_type, &format, &nitems, &bytes_after, &prop_ret);
-       if (r != Success || prop_ret == NULL)
-               return -1;
+    prop_ret = NULL;
+    r = XGetWindowProperty(d, win, a_pid, 0, 1, False, XA_CARDINAL,
+                           &a_type, &format, &nitems, &bytes_after, &prop_ret);
+    if (r != Success || prop_ret == NULL) {
+        return -1;
+    }
 
-       if (a_type == XA_CARDINAL && format == 32)
-               pid = *(unsigned long *)prop_ret;
-       else
-               pid = -1;
+    if (a_type == XA_CARDINAL && format == 32) {
+        pid = *(unsigned long *)prop_ret;
+    } else {
+        pid = -1;
+    }
 
-       XFree(prop_ret);
+    XFree(prop_ret);
 
-       return pid;
+    return pid;
 }
 
 static int __find_win(Display *d, Window *win, pid_t pid)
 {
-       int r;
-       pid_t p;
-       unsigned int n;
-       Window root, parent, *child;
-
-       p = __get_win_pid(d, *win);
-       if (p == pid)
-               return 1;
-
-       r = XQueryTree(d, *win, &root, &parent, &child, &n);
-       if (r) {
-               int i;
-               int found = 0;
-
-               for (i = 0; i < n; i++) {
-                       found = __find_win(d, &child[i], pid);
-                       if (found) {
-                               *win = child[i];
-                               break;
-                       }
-               }
-               XFree(child);
-
-               if (found)
-                       return 1;
-       }
-
-       return 0;
+    int r;
+    pid_t p;
+    unsigned int n;
+    Window root, parent, *child;
+
+    p = __get_win_pid(d, *win);
+    if (p == pid) {
+        return 1;
+    }
+
+    r = XQueryTree(d, *win, &root, &parent, &child, &n);
+    if (r) {
+        int i;
+        int found = 0;
+
+        for (i = 0; i < n; i++) {
+            found = __find_win(d, &child[i], pid);
+            if (found) {
+                *win = child[i];
+                break;
+            }
+        }
+        XFree(child);
+
+        if (found) {
+            return 1;
+        }
+    }
+
+    return 0;
 }
 
 static int __raise_win(Display *d, Window win)
 {
-       XWindowAttributes attr;
-       attr.map_state = IsUnmapped;
+    XWindowAttributes attr;
+    attr.map_state = IsUnmapped;
 
-       XMapRaised(d, win);
+    XMapRaised(d, win);
 
-       XGetWindowAttributes(d, win, &attr);
+    XGetWindowAttributes(d, win, &attr);
 
-       if (attr.map_state == IsUnmapped)
-               _D("unmapped");
-       else if (attr.map_state == IsUnviewable)
-               _D("unviewable");
-       else if (attr.map_state == IsViewable)
-               _D("viewable");
+    if (attr.map_state == IsUnmapped) {
+        _D("unmapped");
+    } else if (attr.map_state == IsUnviewable) {
+        _D("unviewable");
+    } else if (attr.map_state == IsViewable) {
+        _D("viewable");
+    }
 
-       retv_if(attr.map_state != IsViewable, -1);
+    retv_if(attr.map_state != IsViewable, -1);
 
-       XSetInputFocus(d, win, RevertToPointerRoot, CurrentTime);
+    XSetInputFocus(d, win, RevertToPointerRoot, CurrentTime);
 
-       return 0;
+    return 0;
 }
 
 int x_util_raise_win(pid_t pid)
 {
-       int r;
-       int found;
-       Display *d;
-       Window win;
+    int r;
+    int found;
+    Display *d;
+    Window win;
 
-       if (pid < 1)
-               return -1;
+    if (pid < 1) {
+        return -1;
+    }
 
-       r = kill(pid, 0);
-       if (r == -1)
-               return -1;
+    r = kill(pid, 0);
+    if (r == -1) {
+        return -1;
+    }
 
-       d = XOpenDisplay(NULL);
-       retv_if(d == NULL, -1);
+    d = XOpenDisplay(NULL);
+    retv_if(d == NULL, -1);
 
-       win = XDefaultRootWindow(d);
+    win = XDefaultRootWindow(d);
 
-       if (!a_pid)
-               a_pid = XInternAtom(d, "X_CLIENT_PID", True);
+    if (!a_pid) {
+        a_pid = XInternAtom(d, "X_CLIENT_PID", True);
+    }
 
-       found = __find_win(d, &win, pid);
-       if (!found) {
-               XCloseDisplay(d);
-               _E("cannot found window with pid - %d", pid);
-               return -1;
-       }
+    found = __find_win(d, &win, pid);
+    if (!found) {
+        XCloseDisplay(d);
+        _E("cannot found window with pid - %d", pid);
+        return -1;
+    }
 
-       r = __raise_win(d, win);
-       if (r < 0)
-               _E("fail to raise win");
+    r = __raise_win(d, win);
+    if (r < 0) {
+        _E("fail to raise win");
+    }
 
-       XCloseDisplay(d);
+    XCloseDisplay(d);
 
-       return r;
+    return r;
 }
 
 int x_util_get_default_size(double *w, double *h)
 {
-       Display *d;
-       int screen_num;
+    Display *d;
+    int screen_num;
 
-       d = XOpenDisplay(NULL);
-       if (d == NULL)
-               return -1;
+    d = XOpenDisplay(NULL);
+    if (d == NULL) {
+        return -1;
+    }
 
-       screen_num = DefaultScreen(d);
+    screen_num = DefaultScreen(d);
 
-       *w = DisplayWidth(d, screen_num);
-       *h = DisplayHeight(d, screen_num);
+    *w = DisplayWidth(d, screen_num);
+    *h = DisplayHeight(d, screen_num);
 
-       _D("Root Width = %lf, Height = %lf\n", *w, *h);
+    _D("Root Width = %lf, Height = %lf\n", *w, *h);
 
-       XCloseDisplay(d);
+    XCloseDisplay(d);
 
-       return 0;
+    return 0;
 }
 
 static int __cb_x_error(Display *disp, XErrorEvent *ev)
 {
-       _E("X error received - Error Code = %d", ev->error_code);
-       return 0;
+    _E("X error received - Error Code = %d", ev->error_code);
+    return 0;
 }
 
 int x_util_init()
 {
-       x_old_error = XSetErrorHandler(__cb_x_error);
-       return 0;
+    x_old_error = XSetErrorHandler(__cb_x_error);
+    return 0;
 }
 
 int x_util_fini()
 {
-       XSetErrorHandler(x_old_error);
-       return 0;
+    XSetErrorHandler(x_old_error);
+    return 0;
 }
 
index 21c27bc..7c13032 100644 (file)
@@ -14,7 +14,6 @@
  *    limitations under the License.
  */
 
-
 #ifndef __UTIL_X_H_
 #define __UTIL_X_H_
 
index 800caa8..fb5fcb7 100644 (file)
  *    limitations under the License.
  */
 
-
 #ifdef PRELOAD_ACTIVATE
 
 #include <dlfcn.h>
-#define PRELOAD_FILE        SHARE_PREFIX"/preload_list.txt"
-#define PRELOAD_FILE_WRT    SHARE_PREFIX"/preload_list_wrt.txt"
+#define PRELOAD_FILE        SHARE_PREFIX "/preload_list.txt"
+#define PRELOAD_FILE_WRT    SHARE_PREFIX "/preload_list_wrt.txt"
 
 #define EFL_PREINIT_FUNC    "elm_quicklaunch_init"
 #define EFL_SHUTDOWN_FUNC   "elm_quicklaunch_shutdown"
@@ -29,112 +28,116 @@ static int g_argc;
 static char **g_argv;
 static size_t max_cmdline_size = 0;
 
-static int (*dl_einit) () = NULL;
-static int (*dl_efini) () = NULL;
+static int (*dl_einit)() = NULL;
+static int (*dl_efini)() = NULL;
 
 static inline void __preload_init(int argc, char **argv)
 {
-        void *handle = NULL;
-        char soname[MAX_LOCAL_BUFSZ] = {0, };
-        FILE *preload_list;
-        int (*func)() = NULL;
-        int i;
-
-        g_argc = argc;
-        g_argv = argv;
-        for (i = 0; i < argc; i++) {
-                max_cmdline_size += (strlen(argv[i]) + 1);
-        }
-        _D("max_cmdline_size = %d", max_cmdline_size);
+    void *handle = NULL;
+    char soname[MAX_LOCAL_BUFSZ] = { 0, };
+    FILE *preload_list;
+    int (*func)() = NULL;
+    int i;
+
+    g_argc = argc;
+    g_argv = argv;
+    for (i = 0; i < argc; i++) {
+        max_cmdline_size += (strlen(argv[i]) + 1);
+    }
+    _D("max_cmdline_size = %d", max_cmdline_size);
+
+    preload_list = fopen(PRELOAD_FILE, "rt");
+    if (preload_list == NULL) {
+        _E("no preload\n");
+        return;
+    }
 
-        preload_list = fopen(PRELOAD_FILE, "rt");
-        if (preload_list == NULL) {
-                _E("no preload\n");
-                return;
+    while (fgets(soname, MAX_LOCAL_BUFSZ, preload_list) > (char*)0) {
+        soname[MAX_LOCAL_BUFSZ - 1] = 0;
+        handle = dlopen(soname, RTLD_NOW);
+        if (handle == NULL) {
+            continue;
         }
+        _D("preload %s# - handle : %x\n", soname, handle);
 
-        while (fgets(soname, MAX_LOCAL_BUFSZ, preload_list) > (char*)0) {
-                soname[MAX_LOCAL_BUFSZ-1] = 0;
-                handle = dlopen(soname, RTLD_NOW);
-                if (handle == NULL)
-                        continue;
-                _D("preload %s# - handle : %x\n", soname, handle);
-
-                func = dlsym(handle, EFL_PREINIT_FUNC);
-                if (func != NULL) {
-                        _D("get pre-initialization function\n");
-                        dl_einit = func;
-                        func = dlsym(handle, EFL_SHUTDOWN_FUNC);
-                        if (func != NULL) {
-                                _D("get shutdown function\n");
-                                dl_efini = func;
-                        }
-                }
+        func = dlsym(handle, EFL_PREINIT_FUNC);
+        if (func != NULL) {
+            _D("get pre-initialization function\n");
+            dl_einit = func;
+            func = dlsym(handle, EFL_SHUTDOWN_FUNC);
+            if (func != NULL) {
+                _D("get shutdown function\n");
+                dl_efini = func;
+            }
         }
+    }
 
-        fclose(preload_list);
-        preload_initialized = 1;
+    fclose(preload_list);
+    preload_initialized = 1;
 }
 
 static inline int preinit_init()
 {
-        if (dl_einit != NULL)
-                dl_einit(0, NULL);
-        _D("pre-initialzation on");
-        return 0;
+    if (dl_einit != NULL) {
+        dl_einit(0, NULL);
+    }
+    _D("pre-initialzation on");
+    return 0;
 }
 
 static inline int preinit_fini()
 {
-        if (dl_efini != NULL)
-                dl_efini();
-        _D("pre-initialization off");
-        return 0;
+    if (dl_efini != NULL) {
+        dl_efini();
+    }
+    _D("pre-initialization off");
+    return 0;
 }
 
 /* TODO : how to set cmdline gracefully ?? */
 static inline int __change_cmdline(char *cmdline)
 {
-        if (strlen(cmdline) > max_cmdline_size + 1) {
-                _E("cmdline exceed max size : %d", max_cmdline_size);
-                return -1;
-        }
+    if (strlen(cmdline) > max_cmdline_size + 1) {
+        _E("cmdline exceed max size : %d", max_cmdline_size);
+        return -1;
+    }
 
-        memset(g_argv[0], '\0', max_cmdline_size);
-        snprintf(g_argv[0], max_cmdline_size, "%s", cmdline);
+    memset(g_argv[0], '\0', max_cmdline_size);
+    snprintf(g_argv[0], max_cmdline_size, "%s", cmdline);
 
-        return 0;
+    return 0;
 }
 
 static inline void __preload_exec(int argc, char **argv)
 {
-        void *handle = NULL;
-        int (*dl_main) (int, char **);
+    void *handle = NULL;
+    int (*dl_main)(int, char **);
 
-        if (!preload_initialized)
-                return;
+    if (!preload_initialized) {
+        return;
+    }
 
-        handle = dlopen(argv[0], RTLD_LAZY | RTLD_GLOBAL);
-        if (handle == NULL) {
-                return;
-        }
+    handle = dlopen(argv[0], RTLD_LAZY | RTLD_GLOBAL);
+    if (handle == NULL) {
+        return;
+    }
 
-        dl_main = dlsym(handle, "main");
-        if (dl_main != NULL) {
+    dl_main = dlsym(handle, "main");
+    if (dl_main != NULL) {
 #ifndef NATIVE_LAUNCHPAD
         /* do nothing */
 #else
-                if (__change_cmdline(argv[0]) < 0) {
-                        _E("change cmdline fail");
-                        return;
-                }
-#endif
-                dl_main(argc, argv);
-        } else {
-                _E("dlsym not founded. bad preloaded app - check fpie pie");
+        if (__change_cmdline(argv[0]) < 0) {
+            _E("change cmdline fail");
+            return;
         }
+#endif
+        dl_main(argc, argv);
+    } else {
+        _E("dlsym not founded. bad preloaded app - check fpie pie");
+    }
 
-        exit(0);
+    exit(0);
 }
 
 static int g_dlopen_size = 5;
@@ -147,7 +150,8 @@ static inline int __preload_save_dlopen_handle(void *handle)
         return 1;
     }
     if (g_dlopen_count == g_dlopen_size || !g_dlopen_handle_list) {
-        void** tmp = realloc(g_dlopen_handle_list, 2 * g_dlopen_size * sizeof(void *));
+        void** tmp =
+            realloc(g_dlopen_handle_list, 2 * g_dlopen_size * sizeof(void *));
         if (NULL == tmp) {
             _E("out of memory\n");
             dlclose(handle);
@@ -163,10 +167,10 @@ static inline int __preload_save_dlopen_handle(void *handle)
 static inline void __preload_fini_for_wrt()
 {
     int i = 0;
-    if (!g_dlopen_handle_list)
+    if (!g_dlopen_handle_list) {
         return;
-    for (i = 0; i < g_dlopen_count; ++i)
-    {
+    }
+    for (i = 0; i < g_dlopen_count; ++i) {
         void *handle = g_dlopen_handle_list[i];
         if (handle) {
             if (0 != dlclose(handle)) {
@@ -197,11 +201,13 @@ static inline void __preload_init_for_wrt()
 
     while (fgets(soname, MAX_LOCAL_BUFSZ, preload_list) != NULL) {
         size_t len = strnlen(soname, MAX_LOCAL_BUFSZ);
-        if (len > 0)
+        if (len > 0) {
             soname[len - 1] = '\0';
-        handle = dlopen(soname, RTLD_NOW|RTLD_GLOBAL);
-        if (handle == NULL)
+        }
+        handle = dlopen(soname, RTLD_NOW | RTLD_GLOBAL);
+        if (handle == NULL) {
             continue;
+        }
         if (0 != __preload_save_dlopen_handle(handle)) {
             _E("Cannot save handle, no more preloads");
             break;
index 44bb556..4d55622 100644 (file)
@@ -14,7 +14,6 @@
  *    limitations under the License.
  */
 
-
 #include <sys/types.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include "app_sock.h"
 #include "simple_util.h"
 
-static int __connect_client_sock(int sockfd, const struct sockaddr *saptr, socklen_t salen,
-                  int nsec);
-
+static int __connect_client_sock(int sockfd,
+                                 const struct sockaddr *saptr,
+                                 socklen_t salen,
+                                 int nsec);
 
 static inline void __set_sock_option(int fd, int cli)
 {
-       int size;
-       struct timeval tv = { 3, 200 * 1000 };  /*  3.2 sec */
-
-       size = AUL_SOCK_MAXBUFF;
-       setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &size, sizeof(size));
-       setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &size, sizeof(size));
-       if (cli)
-               setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
+    int size;
+    struct timeval tv = { 3, 200 * 1000 };      /*  3.2 sec */
+
+    size = AUL_SOCK_MAXBUFF;
+    setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &size, sizeof(size));
+    setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &size, sizeof(size));
+    if (cli) {
+        setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
+    }
 }
 
 int __create_server_sock(int pid)
 {
-       struct sockaddr_un saddr;
-       struct sockaddr_un p_saddr;
-       int fd;
-       mode_t orig_mask;
-
-       /* Create basedir for our sockets */
-       orig_mask = umask(0);
-       (void) mkdir(AUL_SOCK_PREFIX, S_IRWXU | S_IRWXG | S_IRWXO | S_ISVTX);
-       umask(orig_mask);
-
-       fd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
-       /*  support above version 2.6.27*/
-       if (fd < 0) {
-               if (errno == EINVAL) {
-                       fd = socket(AF_UNIX, SOCK_STREAM, 0);
-                       if (fd < 0) {
-                               _E("second chance - socket create error");
-                               return -1;
-                       }
-               } else {
-                       _E("socket error");
-                       return -1;
-               }
-       }
-
-       bzero(&saddr, sizeof(saddr));
-       saddr.sun_family = AF_UNIX;
-       snprintf(saddr.sun_path, UNIX_PATH_MAX, "%s/%d", AUL_SOCK_PREFIX, pid);
-       unlink(saddr.sun_path);
-
-       /* labeling to socket for SMACK */
-       if(getuid() == 0) {     // this is meaningful iff current user is ROOT
-               if(smack_fsetlabel(fd, "@", SMACK_LABEL_IPOUT) != 0) {
-                       /* in case of unsupported filesystem on 'socket' */
-                       /* or permission error by using 'emulator', bypass*/
-                       if((errno != EOPNOTSUPP) && (errno != EPERM)) {
-                               _E("labeling to socket(IPOUT) error");
+    struct sockaddr_un saddr;
+    struct sockaddr_un p_saddr;
+    int fd;
+    mode_t orig_mask;
+
+    /* Create basedir for our sockets */
+    orig_mask = umask(0);
+    (void) mkdir(AUL_SOCK_PREFIX, S_IRWXU | S_IRWXG | S_IRWXO | S_ISVTX);
+    umask(orig_mask);
+
+    fd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
+    /*  support above version 2.6.27*/
+    if (fd < 0) {
+        if (errno == EINVAL) {
+            fd = socket(AF_UNIX, SOCK_STREAM, 0);
+            if (fd < 0) {
+                _E("second chance - socket create error");
+                return -1;
+            }
+        } else {
+            _E("socket error");
+            return -1;
+        }
+    }
+
+    bzero(&saddr, sizeof(saddr));
+    saddr.sun_family = AF_UNIX;
+    snprintf(saddr.sun_path, UNIX_PATH_MAX, "%s/%d", AUL_SOCK_PREFIX, pid);
+    unlink(saddr.sun_path);
+
+    /* labeling to socket for SMACK */
+    if (getuid() == 0) {        // this is meaningful iff current user is ROOT
+        if (smack_fsetlabel(fd, "@", SMACK_LABEL_IPOUT) != 0) {
+            /* in case of unsupported filesystem on 'socket' */
+            /* or permission error by using 'emulator', bypass*/
+            if ((errno != EOPNOTSUPP) && (errno != EPERM)) {
+                _E("labeling to socket(IPOUT) error");
                 close(fd);
-                               return -1;
-                       }
-               }
-               if(smack_fsetlabel(fd, "*", SMACK_LABEL_IPIN) != 0) {
-                       /* in case of unsupported filesystem on 'socket' */
-                       /* or permission error by using 'emulator', bypass*/
-                       if((errno != EOPNOTSUPP) && (errno != EPERM)) {
-                               _E("labeling to socket(IPIN) error");
+                return -1;
+            }
+        }
+        if (smack_fsetlabel(fd, "*", SMACK_LABEL_IPIN) != 0) {
+            /* in case of unsupported filesystem on 'socket' */
+            /* or permission error by using 'emulator', bypass*/
+            if ((errno != EOPNOTSUPP) && (errno != EPERM)) {
+                _E("labeling to socket(IPIN) error");
                 close(fd);
-                               return -1;
-                       }
-               }
-       }
+                return -1;
+            }
+        }
+    }
+
+    if (bind(fd, (struct sockaddr *)&saddr, sizeof(saddr)) < 0) {
+        _E("bind error");
+        close(fd);
+        return -1;
+    }
 
-       if (bind(fd, (struct sockaddr *)&saddr, sizeof(saddr)) < 0) {
-               _E("bind error");
+    if (chmod(saddr.sun_path, (S_IRWXU | S_IRWXG | S_IRWXO)) < 0) {
+        /* Flawfinder: ignore*/
+        _E("failed to change the socket permission");
         close(fd);
-               return -1;
-       }
+        return -1;
+    }
 
-       if (chmod(saddr.sun_path, (S_IRWXU | S_IRWXG | S_IRWXO)) < 0) {
-               /* Flawfinder: ignore*/
-               _E("failed to change the socket permission");
+    __set_sock_option(fd, 0);
+
+    if (listen(fd, 10) == -1) {
+        _E("listen error");
         close(fd);
-               return -1;
-       }
-
-       __set_sock_option(fd, 0);
-
-       if (listen(fd, 10) == -1) {
-               _E("listen error");
-               close(fd);
-               return -1;
-       }
-
-       /* support app launched by shell script */
-       if (pid != WRT_LAUNCHPAD_PID) {
-               int pgid;
-               pgid = getpgid(pid);
-               if (pgid > 1) {
-                       snprintf(p_saddr.sun_path, UNIX_PATH_MAX, "%s/%d",
-                                AUL_SOCK_PREFIX, pgid);
-                       if (link(saddr.sun_path, p_saddr.sun_path) < 0) {
-                               if (errno == EEXIST)
-                                       _D("pg path - already exists");
-                               else
-                                       _E("pg path - unknown create error");
-                       }
-               }
-       }
-
-       return fd;
+        return -1;
+    }
+
+    /* support app launched by shell script */
+    if (pid != WRT_LAUNCHPAD_PID) {
+        int pgid;
+        pgid = getpgid(pid);
+        if (pgid > 1) {
+            snprintf(p_saddr.sun_path, UNIX_PATH_MAX, "%s/%d",
+                     AUL_SOCK_PREFIX, pgid);
+            if (link(saddr.sun_path, p_saddr.sun_path) < 0) {
+                if (errno == EEXIST) {
+                    _D("pg path - already exists");
+                } else {
+                    _E("pg path - unknown create error");
+                }
+            }
+        }
+    }
+
+    return fd;
 }
 
 int __create_client_sock(int pid)
 {
-       int fd = -1;
-       struct sockaddr_un saddr = { 0, };
-       int retry = 1;
-       int ret = -1;
-
-       fd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);    
-       /*  support above version 2.6.27*/
-       if (fd < 0) {
-               if (errno == EINVAL) {
-                       fd = socket(AF_UNIX, SOCK_STREAM, 0);
-                       if (fd < 0) {
-                               _E("second chance - socket create error");
-                               return -1;
-                       }
-               } else {
-                       _E("socket error");
-                       return -1;
-               }
-       }
-
-       saddr.sun_family = AF_UNIX;
-       snprintf(saddr.sun_path, UNIX_PATH_MAX, "%s/%d", AUL_SOCK_PREFIX, pid);
- retry_con:
-       ret = __connect_client_sock(fd, (struct sockaddr *)&saddr, sizeof(saddr),
-                       100 * 1000);
-       if (ret < -1) {
-               _E("maybe peer not launched or peer daed\n");
-               if (retry > 0) {
-                       usleep(100 * 1000);
-                       retry--;
-                       goto retry_con;
-               }
-       }
-       if (ret < 0) {
-               close(fd);
-               return -1;
-       }
-
-       __set_sock_option(fd, 1);
-
-       return fd;
+    int fd = -1;
+    struct sockaddr_un saddr = { 0, };
+    int retry = 1;
+    int ret = -1;
+
+    fd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
+    /*  support above version 2.6.27*/
+    if (fd < 0) {
+        if (errno == EINVAL) {
+            fd = socket(AF_UNIX, SOCK_STREAM, 0);
+            if (fd < 0) {
+                _E("second chance - socket create error");
+                return -1;
+            }
+        } else {
+            _E("socket error");
+            return -1;
+        }
+    }
+
+    saddr.sun_family = AF_UNIX;
+    snprintf(saddr.sun_path, UNIX_PATH_MAX, "%s/%d", AUL_SOCK_PREFIX, pid);
+retry_con:
+    ret = __connect_client_sock(fd, (struct sockaddr *)&saddr, sizeof(saddr),
+                                100 * 1000);
+    if (ret < -1) {
+        _E("maybe peer not launched or peer daed\n");
+        if (retry > 0) {
+            usleep(100 * 1000);
+            retry--;
+            goto retry_con;
+        }
+    }
+    if (ret < 0) {
+        close(fd);
+        return -1;
+    }
+
+    __set_sock_option(fd, 1);
+
+    return fd;
 }
 
-static int __connect_client_sock(int fd, const struct sockaddr *saptr, socklen_t salen,
-                  int nsec)
+static int __connect_client_sock(int fd,
+                                 const struct sockaddr *saptr,
+                                 socklen_t salen,
+                                 int nsec)
 {
-       int flags;
-       int ret;
-       int error;
-       socklen_t len;
-       fd_set readfds;
-       fd_set writefds;
-       struct timeval timeout;
-
-       flags = fcntl(fd, F_GETFL, 0);
-       fcntl(fd, F_SETFL, flags | O_NONBLOCK);
-
-       error = 0;
-       if ((ret = connect(fd, (struct sockaddr *)saptr, salen)) < 0) {
-               if (errno != EAGAIN && errno != EINPROGRESS) {
-                       fcntl(fd, F_SETFL, flags);      
-                       return (-2);
-               }
-       }
-
-       /* Do whatever we want while the connect is taking place. */
-       if (ret == 0)
-               goto done;      /* connect completed immediately */
-
-       FD_ZERO(&readfds);
-       FD_SET(fd, &readfds);
-       writefds = readfds;
-       timeout.tv_sec = 0;
-       timeout.tv_usec = nsec;
-
-       if ((ret = select(fd + 1, &readfds, &writefds, NULL, 
-                       nsec ? &timeout : NULL)) == 0) {
-               close(fd);      /* timeout */
-               errno = ETIMEDOUT;
-               return (-1);
-       }
-
-       if (FD_ISSET(fd, &readfds) || FD_ISSET(fd, &writefds)) {
-               len = sizeof(error);
-               if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0)
-                       return (-1);    /* Solaris pending error */
-       } else
-               return (-1);    /* select error: sockfd not set*/
-
- done:
-       (void) fcntl(fd, F_SETFL, flags);
-       if (error) {
-               close(fd);
-               errno = error;
-               return (-1);
-       }
-       return (0);
+    int flags;
+    int ret;
+    int error;
+    socklen_t len;
+    fd_set readfds;
+    fd_set writefds;
+    struct timeval timeout;
+
+    flags = fcntl(fd, F_GETFL, 0);
+    fcntl(fd, F_SETFL, flags | O_NONBLOCK);
+
+    error = 0;
+    if ((ret = connect(fd, (struct sockaddr *)saptr, salen)) < 0) {
+        if (errno != EAGAIN && errno != EINPROGRESS) {
+            fcntl(fd, F_SETFL, flags);
+            return (-2);
+        }
+    }
+
+    /* Do whatever we want while the connect is taking place. */
+    if (ret == 0) {
+        goto done;              /* connect completed immediately */
+    }
+    FD_ZERO(&readfds);
+    FD_SET(fd, &readfds);
+    writefds = readfds;
+    timeout.tv_sec = 0;
+    timeout.tv_usec = nsec;
+
+    if ((ret = select(fd + 1, &readfds, &writefds, NULL,
+                      nsec ? &timeout : NULL)) == 0)
+    {
+        close(fd);              /* timeout */
+        errno = ETIMEDOUT;
+        return (-1);
+    }
+
+    if (FD_ISSET(fd, &readfds) || FD_ISSET(fd, &writefds)) {
+        len = sizeof(error);
+        if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {
+            return (-1);                /* Solaris pending error */
+        }
+    } else {
+        return (-1);            /* select error: sockfd not set*/
+    }
+done:
+    (void) fcntl(fd, F_SETFL, flags);
+    if (error) {
+        close(fd);
+        errno = error;
+        return (-1);
+    }
+    return (0);
 }
 
 /**
@@ -243,164 +249,171 @@ static int __connect_client_sock(int fd, const struct sockaddr *saptr, socklen_t
  */
 int __app_send_raw(int pid, int cmd, unsigned char *kb_data, int datalen)
 {
-       int fd;
-       int len;
-       int res = 0;
-       app_pkt_t *pkt = NULL;
-
-       if (kb_data == NULL || datalen > AUL_SOCK_MAXBUFF - 8) {
-               _E("keybundle error\n");
-               return -EINVAL;
-       }
-
-       fd = __create_client_sock(pid);
-       if (fd < 0)
-               return -ECOMM;
-
-       pkt = (app_pkt_t *) malloc(sizeof(char) * AUL_SOCK_MAXBUFF);
-       if (NULL == pkt) {
-               _E("Malloc Failed!");
-               return -ENOMEM;
-       }
-       memset(pkt, 0, AUL_SOCK_MAXBUFF);
-
-       pkt->cmd = cmd;
-       pkt->len = datalen;
-       memcpy(pkt->data, kb_data, datalen);
-
-       if ((len = send(fd, pkt, datalen + 8, 0)) != datalen + 8) {
-               _E("sendto() failed - %d %d (errno %d)", len, datalen + 8, errno);
-               if (errno == EPIPE) {
-                       _E("pid:%d, fd:%d\n", pid, fd);
-               }
-               close(fd);
-               if (pkt) {
-                       free(pkt);
-                       pkt = NULL;
-               }
-               return -ECOMM;
-       }
-       if (pkt) {
-               free(pkt);
-               pkt = NULL;
-       }
-
-       len = recv(fd, &res, sizeof(int), 0);
-       if (len == -1) {
-               if (errno == EAGAIN) {
-                       _E("recv timeout \n");
-                       res = -EAGAIN;
-               } else {
-                       _E("recv error\n");
-                       res = -ECOMM;
-               }
-       }
-       close(fd);
-
-       return res;
+    int fd;
+    int len;
+    int res = 0;
+    app_pkt_t *pkt = NULL;
+
+    if (kb_data == NULL || datalen > AUL_SOCK_MAXBUFF - 8) {
+        _E("keybundle error\n");
+        return -EINVAL;
+    }
+
+    fd = __create_client_sock(pid);
+    if (fd < 0) {
+        return -ECOMM;
+    }
+
+    pkt = (app_pkt_t *) malloc(sizeof(char) * AUL_SOCK_MAXBUFF);
+    if (NULL == pkt) {
+        _E("Malloc Failed!");
+        return -ENOMEM;
+    }
+    memset(pkt, 0, AUL_SOCK_MAXBUFF);
+
+    pkt->cmd = cmd;
+    pkt->len = datalen;
+    memcpy(pkt->data, kb_data, datalen);
+
+    if ((len = send(fd, pkt, datalen + 8, 0)) != datalen + 8) {
+        _E("sendto() failed - %d %d (errno %d)", len, datalen + 8, errno);
+        if (errno == EPIPE) {
+            _E("pid:%d, fd:%d\n", pid, fd);
+        }
+        close(fd);
+        if (pkt) {
+            free(pkt);
+            pkt = NULL;
+        }
+        return -ECOMM;
+    }
+    if (pkt) {
+        free(pkt);
+        pkt = NULL;
+    }
+
+    len = recv(fd, &res, sizeof(int), 0);
+    if (len == -1) {
+        if (errno == EAGAIN) {
+            _E("recv timeout \n");
+            res = -EAGAIN;
+        } else {
+            _E("recv error\n");
+            res = -ECOMM;
+        }
+    }
+    close(fd);
+
+    return res;
 }
 
 app_pkt_t *__app_recv_raw(int fd, int *clifd, struct ucred *cr)
 {
-       int len;
-       struct sockaddr_un aul_addr = { 0, };
-       int sun_size;
-       app_pkt_t *pkt = NULL;
-       int cl = sizeof(struct ucred);
-
-       sun_size = sizeof(struct sockaddr_un);
-
-       if ((*clifd = accept(fd, (struct sockaddr *)&aul_addr,
-                            (socklen_t *) &sun_size)) == -1) {
-               if (errno != EINTR)
-                       _E("accept error");
-               return NULL;
-       }
-
-       if (getsockopt(*clifd, SOL_SOCKET, SO_PEERCRED, cr,
-                      (socklen_t *) &cl) < 0) {
-               _E("peer information error");
-               close(*clifd);
-               return NULL;
-       }
-
-       pkt = (app_pkt_t *) malloc(sizeof(char) * AUL_SOCK_MAXBUFF);
-       if(pkt == NULL) {
-               close(*clifd);
-               return NULL;
-       }
-       memset(pkt, 0, AUL_SOCK_MAXBUFF);
-
-       __set_sock_option(*clifd, 1);
-
- retry_recv:
-       /* receive single packet from socket */
-       len = recv(*clifd, pkt, AUL_SOCK_MAXBUFF, 0);
-       if (len < 0)
-               if (errno == EINTR)
-                       goto retry_recv;
-
-       if ((len < 8) || (len != (pkt->len + 8))) {
-               _E("recv error %d %d", len, pkt->len);
-               free(pkt);
-               close(*clifd);
-               return NULL;
-       }
-
-       return pkt;
+    int len;
+    struct sockaddr_un aul_addr = { 0, };
+    int sun_size;
+    app_pkt_t *pkt = NULL;
+    int cl = sizeof(struct ucred);
+
+    sun_size = sizeof(struct sockaddr_un);
+
+    if ((*clifd = accept(fd, (struct sockaddr *)&aul_addr,
+                         (socklen_t *) &sun_size)) == -1)
+    {
+        if (errno != EINTR) {
+            _E("accept error");
+        }
+        return NULL;
+    }
+
+    if (getsockopt(*clifd, SOL_SOCKET, SO_PEERCRED, cr,
+                   (socklen_t *) &cl) < 0)
+    {
+        _E("peer information error");
+        close(*clifd);
+        return NULL;
+    }
+
+    pkt = (app_pkt_t *) malloc(sizeof(char) * AUL_SOCK_MAXBUFF);
+    if (pkt == NULL) {
+        close(*clifd);
+        return NULL;
+    }
+    memset(pkt, 0, AUL_SOCK_MAXBUFF);
+
+    __set_sock_option(*clifd, 1);
+
+retry_recv:
+    /* receive single packet from socket */
+    len = recv(*clifd, pkt, AUL_SOCK_MAXBUFF, 0);
+    if (len < 0) {
+        if (errno == EINTR) {
+            goto retry_recv;
+        }
+    }
+
+    if ((len < 8) || (len != (pkt->len + 8))) {
+        _E("recv error %d %d", len, pkt->len);
+        free(pkt);
+        close(*clifd);
+        return NULL;
+    }
+
+    return pkt;
 }
 
 app_pkt_t *__app_send_cmd_with_result(int pid, int cmd)
 {
-       int fd;
-       int len;
-       app_pkt_t *pkt = NULL;
-
-       fd = __create_client_sock(pid);
-       if (fd < 0)
-               return NULL;
-
-       pkt = (app_pkt_t *) malloc(sizeof(char) * AUL_SOCK_MAXBUFF);
-       if (NULL == pkt) {
-               _E("Malloc Failed!");
-               return NULL;
-       }
-       memset(pkt, 0, AUL_SOCK_MAXBUFF);
-
-       pkt->cmd = cmd;
-       pkt->len = 0;
-
-       if ((len = send(fd, pkt, 8, 0)) != 8) {
-               _E("sendto() failed - %d", len);
-               if (errno == EPIPE) {
-                       _E("pid:%d, fd:%d\n", pid, fd);
-               }
-               close(fd);
-
-               free(pkt);
-               return NULL;
-       }
+    int fd;
+    int len;
+    app_pkt_t *pkt = NULL;
+
+    fd = __create_client_sock(pid);
+    if (fd < 0) {
+        return NULL;
+    }
+
+    pkt = (app_pkt_t *) malloc(sizeof(char) * AUL_SOCK_MAXBUFF);
+    if (NULL == pkt) {
+        _E("Malloc Failed!");
+        return NULL;
+    }
+    memset(pkt, 0, AUL_SOCK_MAXBUFF);
+
+    pkt->cmd = cmd;
+    pkt->len = 0;
+
+    if ((len = send(fd, pkt, 8, 0)) != 8) {
+        _E("sendto() failed - %d", len);
+        if (errno == EPIPE) {
+            _E("pid:%d, fd:%d\n", pid, fd);
+        }
+        close(fd);
+
+        free(pkt);
+        return NULL;
+    }
 
 retry_recv:
-       /* receive single packet from socket */
-       len = recv(fd, pkt, AUL_SOCK_MAXBUFF, 0);
-       if (len == -1) {
-               if (errno == EAGAIN) {
-                       _E("recv timeout \n");
-                       free(pkt);
-                       return NULL;
-               } else if (errno == EINTR) {
-                       goto retry_recv;
-               } else {
-                       _E("recv error %s\n", strerror(errno));
-                       free(pkt);
-                       return NULL;
-               }
-       } else
-               _D("recv result  = %d", len);
-       close(fd);
-
-       return pkt;
+    /* receive single packet from socket */
+    len = recv(fd, pkt, AUL_SOCK_MAXBUFF, 0);
+    if (len == -1) {
+        if (errno == EAGAIN) {
+            _E("recv timeout \n");
+            free(pkt);
+            return NULL;
+        } else if (errno == EINTR) {
+            goto retry_recv;
+        } else {
+            _E("recv error %s\n", strerror(errno));
+            free(pkt);
+            return NULL;
+        }
+    } else {
+        _D("recv result  = %d", len);
+    }
+    close(fd);
+
+    return pkt;
 }
 
-
index c4cf4d8..4342efb 100644 (file)
@@ -14,7 +14,6 @@
  *    limitations under the License.
  */
 
-
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <stdio.h>
 #include "simple_util.h"
 
-#define BINSH_NAME     "/bin/sh"
-#define BINSH_SIZE     7
-
-#define PROC_STAT_GID_POS      5
+#define BINSH_NAME      "/bin/sh"
+#define BINSH_SIZE      7
 
+#define PROC_STAT_GID_POS       5
 
 static inline int __read_proc(const char *path, char *buf, int size);
 static inline int __find_pid_by_cmdline(const char *dname,
-                                     const char *cmdline, void *priv);
+                                        const char *cmdline, void *priv);
 static inline int __get_pgid_from_stat(int pid);
 
-
 static inline int __read_proc(const char *path, char *buf, int size)
 {
-       int fd;
-       int ret;
+    int fd;
+    int ret;
 
-       if (buf == NULL || path == NULL)
-               return -1;
+    if (buf == NULL || path == NULL) {
+        return -1;
+    }
 
-       fd = open(path, O_RDONLY);
-       if (fd < 0)
-               return -1;
+    fd = open(path, O_RDONLY);
+    if (fd < 0) {
+        return -1;
+    }
 
-       ret = read(fd, buf, size - 1);
-       if (ret <= 0) {
-               close(fd);
-               return -1;
-       } else
-               buf[ret] = 0;
+    ret = read(fd, buf, size - 1);
+    if (ret <= 0) {
+        close(fd);
+        return -1;
+    } else {
+        buf[ret] = 0;
+    }
 
-       close(fd);
+    close(fd);
 
-       return ret;
+    return ret;
 }
 
 static inline int __find_pid_by_cmdline(const char *dname,
-                                     const char *cmdline, void *priv)
+                                        const char *cmdline, void *priv)
 {
-       char *apppath;
-       int pid = 0;
-
-       apppath = (char *)priv;
-       if (strncmp(cmdline, apppath, MAX_LOCAL_BUFSZ-1) == 0) {
-               pid = atoi(dname);
-               if (pid != getpgid(pid))
-                       pid = 0;
-       }
-
-       return pid;
+    char *apppath;
+    int pid = 0;
+
+    apppath = (char *)priv;
+    if (strncmp(cmdline, apppath, MAX_LOCAL_BUFSZ - 1) == 0) {
+        pid = atoi(dname);
+        if (pid != getpgid(pid)) {
+            pid = 0;
+        }
+    }
+
+    return pid;
 }
 
 int __proc_iter_cmdline(
-       int (*iterfunc)(const char *dname, const char *cmdline, void *priv),
-                   void *priv)
+    int (*iterfunc)(const char *dname, const char *cmdline, void *priv),
+    void *priv)
 {
-       DIR *dp;
-       struct dirent *dentry;
-       int pid;
-       int ret;
-       char buf[MAX_LOCAL_BUFSZ];
-
-       dp = opendir("/proc");
-       if (dp == NULL) {
-               return -1;
-       }
-
-       if (iterfunc == NULL)
-               iterfunc = __find_pid_by_cmdline;
-
-       while ((dentry = readdir(dp)) != NULL) {
-               if (!isdigit(dentry->d_name[0]))
-                       continue;
-
-               snprintf(buf, sizeof(buf), "/proc/%s/cmdline", dentry->d_name);
-               ret = __read_proc(buf, buf, sizeof(buf));
-               if (ret <= 0)
-                       continue;
-
-               /* support app launched by shell script*/
-               if (strncmp(buf, BINSH_NAME, BINSH_SIZE) == 0)
-                       pid =
-                           iterfunc(dentry->d_name, &buf[BINSH_SIZE + 1],
-                                    priv);
-               else
-                       pid = iterfunc(dentry->d_name, buf, priv);
-
-               if (pid > 0) {
-                       closedir(dp);
-                       return pid;
-               }
-       }
-
-       closedir(dp);
-       return -1;
+    DIR *dp;
+    struct dirent *dentry;
+    int pid;
+    int ret;
+    char buf[MAX_LOCAL_BUFSZ];
+
+    dp = opendir("/proc");
+    if (dp == NULL) {
+        return -1;
+    }
+
+    if (iterfunc == NULL) {
+        iterfunc = __find_pid_by_cmdline;
+    }
+
+    while ((dentry = readdir(dp)) != NULL) {
+        if (!isdigit(dentry->d_name[0])) {
+            continue;
+        }
+
+        snprintf(buf, sizeof(buf), "/proc/%s/cmdline", dentry->d_name);
+        ret = __read_proc(buf, buf, sizeof(buf));
+        if (ret <= 0) {
+            continue;
+        }
+
+        /* support app launched by shell script*/
+        if (strncmp(buf, BINSH_NAME, BINSH_SIZE) == 0) {
+            pid =
+                iterfunc(dentry->d_name, &buf[BINSH_SIZE + 1],
+                         priv);
+        } else {
+            pid = iterfunc(dentry->d_name, buf, priv);
+        }
+
+        if (pid > 0) {
+            closedir(dp);
+            return pid;
+        }
+    }
+
+    closedir(dp);
+    return -1;
 }
 
 char *__proc_get_cmdline_bypid(int pid)
 {
-       char buf[MAX_LOCAL_BUFSZ];
-       int ret;
-
-       snprintf(buf, sizeof(buf), "/proc/%d/cmdline", pid);
-       ret = __read_proc(buf, buf, sizeof(buf));
-       if (ret <= 0)
-               return NULL;
-
-       /* support app launched by shell script*/
-       if (strncmp(buf, BINSH_NAME, BINSH_SIZE) == 0)
-               return strdup(&buf[BINSH_SIZE + 1]);
-       else
-               return strdup(buf);
+    char buf[MAX_LOCAL_BUFSZ];
+    int ret;
+
+    snprintf(buf, sizeof(buf), "/proc/%d/cmdline", pid);
+    ret = __read_proc(buf, buf, sizeof(buf));
+    if (ret <= 0) {
+        return NULL;
+    }
+
+    /* support app launched by shell script*/
+    if (strncmp(buf, BINSH_NAME, BINSH_SIZE) == 0) {
+        return strdup(&buf[BINSH_SIZE + 1]);
+    } else {
+        return strdup(buf);
+    }
 }
 
 static inline int __get_pgid_from_stat(int pid)
 {
-       char buf[MAX_LOCAL_BUFSZ];
-       char *str;
-       int ret;
-       int i;
-       int count = 0;
-
-       if (pid <= 1)
-               return -1;
-
-       snprintf(buf, sizeof(buf), "/proc/%d/stat", pid);
-       ret = __read_proc(buf, buf, sizeof(buf));
-       if (ret < 0)
-               return -1;
-
-       for (i = 0; i < (ret - 1); i++) {
-               if (buf[i] == ' ') {
-                       count++;
-                       if (count == PROC_STAT_GID_POS - 1)
-                               str = &(buf[i + 1]);
-                       else if (count == PROC_STAT_GID_POS) {
-                               buf[i] = 0;
-                               break;
-                       }
-               }
-       }
-
-       if (count == PROC_STAT_GID_POS)
-               pid = atoi(str);
-       else
-               pid = -1;
-
-       return pid;
+    char buf[MAX_LOCAL_BUFSZ];
+    char *str;
+    int ret;
+    int i;
+    int count = 0;
+
+    if (pid <= 1) {
+        return -1;
+    }
+
+    snprintf(buf, sizeof(buf), "/proc/%d/stat", pid);
+    ret = __read_proc(buf, buf, sizeof(buf));
+    if (ret < 0) {
+        return -1;
+    }
+
+    for (i = 0; i < (ret - 1); i++) {
+        if (buf[i] == ' ') {
+            count++;
+            if (count == PROC_STAT_GID_POS - 1) {
+                str = &(buf[i + 1]);
+            } else if (count == PROC_STAT_GID_POS) {
+                buf[i] = 0;
+                break;
+            }
+        }
+    }
+
+    if (count == PROC_STAT_GID_POS) {
+        pid = atoi(str);
+    } else {
+        pid = -1;
+    }
+
+    return pid;
 }
 
-int __proc_iter_pgid(int pgid, int (*iterfunc) (int pid, void *priv),
-                    void *priv)
+int __proc_iter_pgid(int pgid, int (*iterfunc)(int pid, void *priv),
+                     void *priv)
 {
-       DIR *dp;
-       struct dirent *dentry;
-       int _pgid;
-       int ret = -1;
-
-       dp = opendir("/proc");
-       if (dp == NULL) {
-               return -1;
-       }
-
-       while ((dentry = readdir(dp)) != NULL) {
-               if (!isdigit(dentry->d_name[0]))
-                       continue;
-
-               _pgid = __get_pgid_from_stat(atoi(dentry->d_name));
-               if (pgid == _pgid) {
-                       ret = iterfunc(atoi(dentry->d_name), priv);
-                       if (ret >= 0)
-                               break;
-               }
-       }
-
-       closedir(dp);
-       return ret;
+    DIR *dp;
+    struct dirent *dentry;
+    int _pgid;
+    int ret = -1;
+
+    dp = opendir("/proc");
+    if (dp == NULL) {
+        return -1;
+    }
+
+    while ((dentry = readdir(dp)) != NULL) {
+        if (!isdigit(dentry->d_name[0])) {
+            continue;
+        }
+
+        _pgid = __get_pgid_from_stat(atoi(dentry->d_name));
+        if (pgid == _pgid) {
+            ret = iterfunc(atoi(dentry->d_name), priv);
+            if (ret >= 0) {
+                break;
+            }
+        }
+    }
+
+    closedir(dp);
+    return ret;
 }
 
diff --git a/uncrustify.cfg b/uncrustify.cfg
new file mode 100644 (file)
index 0000000..2bf1d96
--- /dev/null
@@ -0,0 +1,170 @@
+indent_align_string=true\r
+indent_braces=false\r
+indent_braces_no_func=false\r
+indent_brace_parent=false\r
+indent_namespace=false\r
+indent_extern=false\r
+indent_class=true\r
+indent_class_colon=false\r
+indent_else_if=false\r
+indent_func_call_param=false\r
+indent_func_def_param=false\r
+indent_func_proto_param=false\r
+indent_func_class_param=false\r
+indent_func_ctor_var_param=false\r
+indent_template_param=false\r
+indent_func_param_double=false\r
+indent_relative_single_line_comments=false\r
+indent_col1_comment=true\r
+indent_access_spec_body=false\r
+indent_paren_nl=false\r
+indent_comma_paren=false\r
+indent_bool_paren=false\r
+indent_square_nl=false\r
+indent_preserve_sql=false\r
+indent_align_assign=false\r
+sp_balance_nested_parens=false\r
+align_keep_tabs=false\r
+align_with_tabs=false\r
+align_on_tabstop=false\r
+align_number_left=false\r
+align_func_params=false\r
+align_same_func_call_params=false\r
+align_var_def_colon=false\r
+align_var_def_attribute=false\r
+align_var_def_inline=false\r
+align_right_cmt_mix=false\r
+align_on_operator=false\r
+align_mix_var_proto=false\r
+align_single_line_func=false\r
+align_single_line_brace=false\r
+align_nl_cont=false\r
+align_left_shift=true\r
+nl_collapse_empty_body=true\r
+nl_assign_leave_one_liners=false\r
+nl_class_leave_one_liners=false\r
+nl_enum_leave_one_liners=false\r
+nl_getset_leave_one_liners=false\r
+nl_func_leave_one_liners=false\r
+nl_if_leave_one_liners=false\r
+nl_multi_line_cond=true\r
+nl_multi_line_define=false\r
+nl_before_case=false\r
+nl_after_case=false\r
+nl_after_return=false\r
+nl_after_semicolon=true\r
+nl_after_brace_open=false\r
+nl_after_brace_open_cmt=false\r
+nl_after_vbrace_open=false\r
+nl_after_brace_close=false\r
+nl_define_macro=false\r
+nl_squeeze_ifdef=false\r
+nl_ds_struct_enum_cmt=false\r
+nl_ds_struct_enum_close_brace=false\r
+nl_create_if_one_liner=false\r
+nl_create_for_one_liner=false\r
+nl_create_while_one_liner=false\r
+ls_for_split_full=true\r
+ls_func_split_full=true\r
+nl_after_multiline_comment=false\r
+eat_blanks_after_open_brace=true\r
+eat_blanks_before_close_brace=true\r
+mod_pawn_semicolon=false\r
+mod_full_paren_if_bool=false\r
+mod_remove_extra_semicolon=true\r
+mod_sort_import=false\r
+mod_sort_using=false\r
+mod_sort_include=false\r
+mod_move_case_break=false\r
+mod_remove_empty_return=false\r
+cmt_indent_multi=true\r
+cmt_c_group=false\r
+cmt_c_nl_start=false\r
+cmt_c_nl_end=false\r
+cmt_cpp_group=false\r
+cmt_cpp_nl_start=false\r
+cmt_cpp_nl_end=false\r
+cmt_cpp_to_c=false\r
+cmt_star_cont=true\r
+cmt_multi_check_last=true\r
+cmt_insert_before_preproc=false\r
+pp_indent_at_level=false\r
+pp_region_indent_code=false\r
+pp_if_indent_code=false\r
+pp_define_at_level=false\r
+indent_columns=4\r
+indent_member=4\r
+indent_access_spec=-2\r
+code_width=80\r
+nl_max=2\r
+nl_before_access_spec=2\r
+cmt_width=80\r
+indent_with_tabs=0\r
+sp_arith=force\r
+sp_assign=force\r
+sp_enum_assign=force\r
+sp_pp_concat=remove\r
+sp_pp_stringify=remove\r
+sp_bool=force\r
+sp_compare=force\r
+sp_paren_brace=force\r
+sp_angle_paren=remove\r
+sp_before_sparen=force\r
+sp_inside_sparen=remove\r
+sp_after_sparen=force\r
+sp_sparen_brace=force\r
+sp_before_semi=remove\r
+sp_after_semi_for_empty=remove\r
+sp_before_square=remove\r
+sp_before_squares=remove\r
+sp_inside_square=remove\r
+sp_after_comma=force\r
+sp_before_comma=remove\r
+sp_after_class_colon=force\r
+sp_before_class_colon=force\r
+sp_before_case_colon=remove\r
+sp_inside_braces=add\r
+sp_inside_fparens=remove\r
+sp_inside_fparen=remove\r
+sp_func_call_paren=remove\r
+sp_func_class_paren=remove\r
+sp_else_brace=force\r
+sp_brace_else=force\r
+sp_catch_brace=force\r
+sp_brace_catch=force\r
+sp_try_brace=force\r
+sp_before_dc=remove\r
+sp_after_dc=remove\r
+sp_not=remove\r
+sp_inv=remove\r
+sp_addr=remove\r
+sp_member=remove\r
+sp_deref=remove\r
+sp_sign=remove\r
+sp_incdec=remove\r
+sp_cond_colon=force\r
+sp_cond_question=force\r
+sp_case_label=force\r
+nl_assign_brace=remove\r
+nl_if_brace=remove\r
+nl_brace_else=remove\r
+nl_elseif_brace=remove\r
+nl_else_brace=remove\r
+nl_else_if=remove\r
+nl_try_brace=remove\r
+nl_for_brace=remove\r
+nl_catch_brace=remove\r
+nl_brace_catch=remove\r
+nl_while_brace=remove\r
+nl_do_brace=remove\r
+nl_brace_while=remove\r
+nl_switch_brace=remove\r
+nl_namespace_brace=remove\r
+nl_class_brace=force\r
+nl_fdef_brace=force\r
+pos_class_comma=trail\r
+pos_class_colon=trail\r
+mod_full_brace_do=add\r
+mod_full_brace_for=add\r
+mod_full_brace_if=add\r
+mod_full_brace_while=add\r
diff --git a/uncrustify.sh b/uncrustify.sh
new file mode 100755 (executable)
index 0000000..f1edae0
--- /dev/null
@@ -0,0 +1 @@
+uncrustify -c uncrustify.cfg --no-backup `find . -regex "\(.*\.cpp\|.*\.h\|.*\.c\|.*\.cc\)" | grep -v "orm.h\|orm_generator.h"`