From: Tomasz Iwanek Date: Tue, 27 Nov 2012 13:39:46 +0000 (+0100) Subject: GlobalLogic moved to api_new X-Git-Tag: 2.1b_release~22^2~165 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fa62203e80a27dce5b12e5b7418f0dab762f8782;p=platform%2Fframework%2Fweb%2Fwrt.git GlobalLogic moved to api_new [Issue#] LINUXNGWAP-561 [Bug] Global logic should be moved to core module [Cause] N/A [Solution] N/A [Verification] Install and run any widget. Signed-off-by: Iwanek Tomasz Change-Id: I610c9975c449dea96185697372e60b00202e956f --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c72db16..29f071b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -27,7 +27,6 @@ SET(WRT_SRC_DIR ) SET(WRT_CORE_BASE_SOURCES - ${WRT_SRC_DIR}/domain/global_context.cpp ${WRT_SRC_DIR}/domain/widget_data_types.cpp ${WRT_SRC_DIR}/domain/widget_deserialize_model.cpp ${WRT_SRC_DIR}/domain/localization_setting.cpp @@ -37,16 +36,9 @@ SET(WRT_CORE_BASE_SOURCES SET(WRT_CORE_INCLUDES ${WRT_SRC_DIR}/plugin-service - ${WRT_SRC_DIR}/common - ${WRT_SRC_DIR}/utils - ${WRT_SRC_DIR}/orm - ${WRT_SRC_DIR}/configuration ${WRT_SRC_DIR}/domain - ${WRT_SRC_DIR}/localization ${WRT_SRC_DIR}/profiling - ${WRT_SRC_DIR}/global_logic - ${WRT_SRC_DIR}/ui - ${WRT_SRC_DIR}/smack + ${WRT_SRC_DIR}/popup-process ${WRT_SRC_DIR}/view ) diff --git a/src/api_new/CMakeLists.txt b/src/api_new/CMakeLists.txt index 603d8c0..2aa2a27 100644 --- a/src/api_new/CMakeLists.txt +++ b/src/api_new/CMakeLists.txt @@ -28,6 +28,7 @@ PKG_CHECK_MODULES(CORE_MODULE_DEP wrt-plugin-js-overlay dpl-efl security-wrt-ocsp + wrt-popup-wrt-runner REQUIRED ) diff --git a/src/api_new/core_module.cpp b/src/api_new/core_module.cpp index 346006c..f678720 100644 --- a/src/api_new/core_module.cpp +++ b/src/api_new/core_module.cpp @@ -25,7 +25,6 @@ #include "runnable_widget_object.h" #include #include -#include #include #include #include @@ -35,9 +34,11 @@ #include #include #include +#include #include + IMPLEMENT_SINGLETON(WRT::CoreModule) namespace { //Anonymous @@ -138,8 +139,6 @@ public: EWK_COOKIE_JAR_ACCEPT_ALWAYS); ADD_PROFILING_POINT("WebProcess fork", "stop"); - GlobalContext::TouchArchitecture(); - ADD_PROFILING_POINT("attach databases", "start"); MainThreadSingleton::Instance().AttachDatabases(); ADD_PROFILING_POINT("attach databases", "stop"); @@ -187,6 +186,43 @@ public: } } + CoreModule::NetworkAccessMode homeNetworkAccess() + { + switch (WrtDB::GlobalDAOReadOnly::GetHomeNetworkDataUsage()) { + case WrtDB::GlobalDAOReadOnly::NEVER_CONNECT: + return CoreModule::NEVER_CONNECT; + case WrtDB::GlobalDAOReadOnly::ALWAYS_ASK: + return CoreModule::ALWAYS_ASK; + case WrtDB::GlobalDAOReadOnly::CONNECT_AUTOMATICALLY: + return CoreModule::CONNECT_AUTOMATICALLY; + default: + break; + } + LogWarning("using default value"); + return CoreModule::ALWAYS_ASK; + } + + CoreModule::NetworkAccessMode roamingNetworkAccess() + { + switch (WrtDB::GlobalDAOReadOnly::GetRoamingDataUsage()) { + case WrtDB::GlobalDAOReadOnly::NEVER_CONNECT: + return CoreModule::NEVER_CONNECT; + case WrtDB::GlobalDAOReadOnly::ALWAYS_ASK: + return CoreModule::ALWAYS_ASK; + case WrtDB::GlobalDAOReadOnly::CONNECT_AUTOMATICALLY: + return CoreModule::CONNECT_AUTOMATICALLY; + default: + break; + } + LogWarning("using default value"); + return CoreModule::ALWAYS_ASK; + } + + bool developerMode() + { + return WrtDB::GlobalDAOReadOnly::GetDeveloperMode(); + } + private: bool m_initialized; Ewk_Context* m_ewkContext; @@ -216,4 +252,19 @@ RunnableWidgetObjectPtr CoreModule::getRunnableWidgetObject( return m_impl->getRunnableWidgetObject(tizenId); } +CoreModule::NetworkAccessMode CoreModule::homeNetworkAccess() +{ + return m_impl->homeNetworkAccess(); +} + +CoreModule::NetworkAccessMode CoreModule::roamingNetworkAccess() +{ + return m_impl->roamingNetworkAccess(); +} + +bool CoreModule::developerMode() +{ + return m_impl->developerMode(); +} + } /* namespace WRT */ diff --git a/src/api_new/core_module.h b/src/api_new/core_module.h index fae27a9..85d9802 100644 --- a/src/api_new/core_module.h +++ b/src/api_new/core_module.h @@ -37,6 +37,16 @@ class CoreModule { public: /** + * Network access mode enum. + */ + enum NetworkAccessMode + { + NEVER_CONNECT, + ALWAYS_ASK, + CONNECT_AUTOMATICALLY + }; + + /** * Initialize needed by WRT components (database etc). * Will not throw exception. elm_init() is NOT called in this function. * You MUST call it before running widget. @@ -57,6 +67,22 @@ class CoreModule */ RunnableWidgetObjectPtr getRunnableWidgetObject( const std::string& tizenId); + /** + * Gets from database global property of homeNetworkAccess + * @return homeNetworkAccess value + */ + NetworkAccessMode homeNetworkAccess(); + /** + * Gets from database global property of roamingNetworkAccess + * @return roamingNetworkAccess value + */ + NetworkAccessMode roamingNetworkAccess(); + /** + * Returns actual value of developer mode. + * @return is developer mode on + */ + bool developerMode(); + private: CoreModule(); ~CoreModule(); diff --git a/src/api_new/runnable_widget_object.cpp b/src/api_new/runnable_widget_object.cpp index dedf7e5..088274d 100644 --- a/src/api_new/runnable_widget_object.cpp +++ b/src/api_new/runnable_widget_object.cpp @@ -23,7 +23,6 @@ #include #include #include -#include "global_logic.h" #include #include #include @@ -46,7 +45,6 @@ const unsigned int UID_ROOT = 0; } // namespace anonymous - namespace WRT { RunnableWidgetObject::RunnableWidgetObject(WidgetModelPtr &model, Ewk_Context* context) : diff --git a/src/api_new/runnable_widget_object.h b/src/api_new/runnable_widget_object.h index e35952f..49f028e 100644 --- a/src/api_new/runnable_widget_object.h +++ b/src/api_new/runnable_widget_object.h @@ -34,7 +34,6 @@ class StateChange; #include #include -#include #include #include #include "i_runnable_widget_object.h" diff --git a/src/domain/common_error.h b/src/domain/common_error.h deleted file mode 100644 index 586a337..0000000 --- a/src/domain/common_error.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file common_error.h - * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com) - * @version 1.0 - * @brief Header file for common error definitions - */ -#ifndef COMMON_ERROR_H -#define COMMON_ERROR_H - -namespace CommonError { -enum Type -{ - WrtSuccess, ///< Success - - HandleNotFound, ///< Widget handle was not found - AlreadyRunning, ///< Widget is already running - AlreadyStopped, ///< Widget is already stopped - InvalidLanguage, ///< Widget is invalid in current locales - StillAuthorizing, ///< Widget is still autorizing and has not yet finished it - EarlyKilled, ///< Widget was early killed during launch - AccessDenied, ///< Access denied from ACE - CertificateRevoked, ///< Some certificate was revoked. - /// Widget is not allowed to run. - DatabaseFailure, ///< Wrong database version - NoPath, ///< Required path does not exist - - Unknown ///< Temporary error. Try to not use this. -}; -} - -#endif // COMMON_ERROR_H diff --git a/src/domain/global_context.cpp b/src/domain/global_context.cpp deleted file mode 100644 index 27ffc00..0000000 --- a/src/domain/global_context.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file global_context.cpp - * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com) - * @version 1.0 - * @brief Implementation file for global context - */ -#include -#include - -namespace GlobalContext { - -void TouchArchitecture() -{ - // Touch all WebRuntime controllers - // Remember to always add here new singletons! - GlobalLogicSingleton::Instance().GetGlobalModel(); - // Start UI process rpc server -} -} // namespace GlobalContext diff --git a/src/domain/global_context.h b/src/domain/global_context.h deleted file mode 100644 index 547ba72..0000000 --- a/src/domain/global_context.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file global_context.h - * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com) - * @version 1.0 - * @brief Header file for global contect - */ -#ifndef GLOBAL_CONTEXT_H -#define GLOBAL_CONTEXT_H - -namespace GlobalContext { - -void Initialize(); - -void Finalize(); - -/** - * Touch all singletons to inherit default context - */ -void TouchArchitecture(); -} // namespace GlobalContext - -#endif // GLOBAL_CONTEXT_H diff --git a/src/global_logic/global_logic.cpp b/src/global_logic/global_logic.cpp deleted file mode 100644 index e5dd879..0000000 --- a/src/global_logic/global_logic.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file global_logic.cpp - * @author Lukasz Marek (l.marek@samgsung.com) - * @version - * @brief - */ - -#include "global_logic.h" - -#include -IMPLEMENT_SINGLETON(GlobalLogic) - -GlobalLogic::GlobalLogic() -{ -} - -GlobalLogic::~GlobalLogic() -{ -} - -GlobalModel* GlobalLogic::GetGlobalModel() const -{ - FREE_LOGIC_LOCK - static GlobalModel globalLogic; - return &globalLogic; -} diff --git a/src/global_logic/global_logic.h b/src/global_logic/global_logic.h deleted file mode 100644 index 604c965..0000000 --- a/src/global_logic/global_logic.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file global_logic.h - * @author Lukasz Marek (l.marek@samgsung.com) - * @version - * @brief - */ - -#include - -#include -#include - -class GlobalLogic : public FreeLogic -{ - public: - GlobalModel* GetGlobalModel() const; - - private: - GlobalLogic(); - ~GlobalLogic(); - - friend class DPL::Singleton; -}; - -typedef DPL::Singleton GlobalLogicSingleton; diff --git a/src/global_logic/global_model.cpp b/src/global_logic/global_model.cpp deleted file mode 100644 index f9c703c..0000000 --- a/src/global_logic/global_model.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @file global_model.cpp - * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com) - */ -#include "global_model.h" -#include - -using namespace WrtDB; - -GlobalModel::GlobalModel() : - HomeNetworkAccess(this, - & GlobalModel::HomeNetworkAccessReadProperty), - RoamingNetworkAccess(this, - & GlobalModel::RoamingNetworkAccessReadProperty), - DeveloperMode(this, - static_cast::ReadDelegateType> - (& GlobalModel::ReadDeveloperMode)) -{ -} - -GlobalModel::NetworkAccessMode GlobalModel::HomeNetworkAccessReadProperty( - DPL::Event::Model* /*model*/) -{ - switch (GlobalDAOReadOnly::GetHomeNetworkDataUsage()) { - case GlobalDAOReadOnly::NEVER_CONNECT: - return GlobalModel::NEVER_CONNECT; - case GlobalDAOReadOnly::ALWAYS_ASK: - return GlobalModel::ALWAYS_ASK; - case GlobalDAOReadOnly::CONNECT_AUTOMATICALLY: - return GlobalModel::CONNECT_AUTOMATICALLY; - default: - break; - } - LogWarning("using default value"); - return GlobalModel::ALWAYS_ASK; -} - -GlobalModel::NetworkAccessMode GlobalModel::RoamingNetworkAccessReadProperty( - DPL::Event::Model* /*model*/) -{ - switch (GlobalDAOReadOnly::GetRoamingDataUsage()) { - case GlobalDAOReadOnly::NEVER_CONNECT: - return GlobalModel::NEVER_CONNECT; - case GlobalDAOReadOnly::ALWAYS_ASK: - return GlobalModel::ALWAYS_ASK; - case GlobalDAOReadOnly::CONNECT_AUTOMATICALLY: - return GlobalModel::CONNECT_AUTOMATICALLY; - default: - break; - } - LogWarning("using default value"); - return GlobalModel::ALWAYS_ASK; -} - -bool GlobalModel::ReadDeveloperMode(DPL::Event::Model */*model*/) -{ - return GlobalDAOReadOnly::GetDeveloperMode(); -} diff --git a/src/global_logic/global_model.h b/src/global_logic/global_model.h deleted file mode 100644 index 065ca3b..0000000 --- a/src/global_logic/global_model.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @file global_model.h - * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com) - */ -#ifndef WRT_COMMON_GLOBAL_MODEL_H_ -#define WRT_COMMON_GLOBAL_MODEL_H_ - -#include -#include -#include -#include -#include - -class GlobalModel : public DPL::Event::Model -{ - public: - - /** - * Network access mode enum. - */ - enum NetworkAccessMode - { - NEVER_CONNECT, - ALWAYS_ASK, - CONNECT_AUTOMATICALLY - }; - - DPL::Event::Property HomeNetworkAccess; - - DPL::Event::Property RoamingNetworkAccess; - - DPL::Event::Property DeveloperMode; - - GlobalModel(); - - private: - // Custom read write delegates - static NetworkAccessMode HomeNetworkAccessReadProperty(DPL::Event::Model *model); - - static NetworkAccessMode RoamingNetworkAccessReadProperty(DPL::Event::Model *model); - - static bool ReadDeveloperMode(DPL::Event::Model *model); -}; - -#endif // WRT_COMMON_GLOBAL_MODEL_H_ diff --git a/src/utils/DESCRIPTION b/src/utils/DESCRIPTION deleted file mode 100644 index ff8cc40..0000000 --- a/src/utils/DESCRIPTION +++ /dev/null @@ -1 +0,0 @@ -General purpose utilities diff --git a/src/utils/FreeLogic.h b/src/utils/FreeLogic.h deleted file mode 100644 index 4383236..0000000 --- a/src/utils/FreeLogic.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file FreeLogic.h - * @author Piotr Kozbial (p.kozbial@samsung.com) - * @version 1.0 - * @brief Common base for Free Logic classes - */ - -#ifndef WRT_UTILS_FREELOGIC_H_ -#define WRT_UTILS_FREELOGIC_H_ - -#include -#include - -/* - * This is the base class for any "Free Logic" class. - * - * A Free Logic is a bit like a Logic, but the difference is - * that a Logic is always coupled with a controller and so - * it is assigned to a single thread, while a Free Logic - * doesn't have a controller, so it doesn't have a designated - * thread. - * - * A Free Logic's public interface may be directly called - * from any thread. For this to be safe, every Free Logic must - * adhere to the following constraints: - * - * 1. Every (no matter how trivial) public API function must - * start with locking the mutex using the following macro: - * - * FREE_LOGIC_LOCK - * - * 2. A Free Logic cannot contact other Logics, that is, - * it cannot POST events to controllers and it cannot - * call methods of other FreeLogics. - * - * 3. A Free Logic cannot emit or receive any events. - * - * 4. A Free Logic cannot do blocking system calls. - * - * 5. A Free Logic cannot use any synchronization - * mechanisms (except the default lock, as described - * above). - */ -class FreeLogic : private DPL::Noncopyable -{ - protected: - mutable DPL::Mutex _freeLogicMutex; -}; - -#define FREE_LOGIC_LOCK \ - DPL::Mutex::ScopedLock _freeLogicLock(&_freeLogicMutex); - -#endif // WRT_UTILS_FREELOGIC_H_ - diff --git a/src/view/webkit/CMakeLists.txt b/src/view/webkit/CMakeLists.txt index 2940d3e..90c0f32 100644 --- a/src/view/webkit/CMakeLists.txt +++ b/src/view/webkit/CMakeLists.txt @@ -40,8 +40,6 @@ PKG_CHECK_MODULES(SYS_VIEW_MODULE_DEP ) SET(VIEW_MODULE_SOURCES - ${PROJECT_SOURCE_DIR}/src/global_logic/global_logic.cpp #TODO this should be moved to separate module - ${PROJECT_SOURCE_DIR}/src/global_logic/global_model.cpp #TODO this should be moved to separate module ${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic.cpp ${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_filesystem_support.cpp ${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_scheme_support.cpp diff --git a/src/wrt-client/wrt-client.cpp b/src/wrt-client/wrt-client.cpp index 8ca5f02..addf2c4 100644 --- a/src/wrt-client/wrt-client.cpp +++ b/src/wrt-client/wrt-client.cpp @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -251,9 +250,7 @@ bool WrtClient::checkDebugMode(SDKDebugData* debugData) // every launched widgets as debug mode can use it. if (m_dao->getWidgetType().appType == WrtDB::APP_TYPE_WAC20) { - bool developerMode = - GlobalLogicSingleton::Instance().GetGlobalModel() - ->DeveloperMode.Get(); + 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(); @@ -309,8 +306,7 @@ bool WrtClient::checkWACTestCertififedWidget() // Developer Mode. bool developerWidget = m_dao->isTestWidget(); - bool developerMode = - GlobalLogicSingleton::Instance().GetGlobalModel()->DeveloperMode.Get(); + bool developerMode = WRT::CoreModuleSingleton::Instance().developerMode(); LogDebug("Is WAC test widget: " << developerWidget); LogDebug("Is developer Mode: " << developerMode);