From: Przemyslaw Ciezkowski Date: Wed, 31 Oct 2012 10:45:36 +0000 (+0100) Subject: [Engine] Replace widget handle with tizen id in widgetModel X-Git-Tag: 2.1b_release~22^2~215 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=536841d29217d755d43b5386ec0a32fdf164e2b4;p=platform%2Fframework%2Fweb%2Fwrt.git [Engine] Replace widget handle with tizen id in widgetModel [Issue#] LINUXNGWAP-427 [Problem] Widget handle should not be exposed in widgetModel. [Cause] N/A [Solution] Replaced. [Verification] Run any widget. Change-Id: I9fac55513ea58307443fa545582ae86075678715 --- diff --git a/src/api_new/runnable_widget_object.cpp b/src/api_new/runnable_widget_object.cpp index b22ef6b..fe0b38c 100644 --- a/src/api_new/runnable_widget_object.cpp +++ b/src/api_new/runnable_widget_object.cpp @@ -89,7 +89,7 @@ RunnableWidgetObject::RunnableWidgetObject(WidgetModelPtr &model, Ewk_Context* c // Set privilege by tizen id // this code prevent that widget launch with "root" permission, // when developers launch by command in the shell - set_privilege(DPL::ToUTF8String(m_widgetModel->TizenId.Get()).c_str()); + set_privilege(DPL::ToUTF8String(m_widgetModel->TizenId).c_str()); } } @@ -104,7 +104,7 @@ bool RunnableWidgetObject::CheckBeforeLaunch() // here the pkg name is already known; we don't struggle to move it // near the start of main() because we don't know yet if this will // stay in this process at all: it may be moved to AUL altogether - set_process_config(DPL::ToUTF8String(widgetModel->TizenId.Get()).c_str()); + set_process_config(DPL::ToUTF8String(widgetModel->TizenId).c_str()); #endif // Inform view controller about new widget model displaying @@ -182,7 +182,7 @@ void RunnableWidgetObject::Suspend() { } #ifndef DEPRECATED_SETTING_STRING else { - WrtDB::WidgetDAOReadOnly dao(m_widgetModel->TizenId.Get()); + WrtDB::WidgetDAOReadOnly dao(m_widgetModel->TizenId); WrtDB::PropertyDAOReadOnly::WidgetPropertyValue bgEnableValue = dao.getPropertyValue(DPL::String(BACKGROUND_ENABLED)); diff --git a/src/domain/widget_model.cpp b/src/domain/widget_model.cpp index 5b29c82..4d20ab9 100644 --- a/src/domain/widget_model.cpp +++ b/src/domain/widget_model.cpp @@ -34,24 +34,25 @@ template struct BindToWidgetDAO : DPL::Event::BindToDAO { }; -template +template struct BindToWidgetDAOStatic : DPL::Event::BindToDAO_Static { }; WidgetModel::WidgetModel(const std::string &tizenId) : + TizenId(DPL::FromASCIIString(tizenId)), Handle(this, WidgetDAOReadOnly::getHandle(DPL::FromASCIIString(tizenId))), Type(this, &BindToWidgetDAO::Get), @@ -70,13 +71,13 @@ WidgetModel::WidgetModel(const std::string &tizenId) : PersistentStoragePath(this, DPL::FromUTF8String( WidgetConfig::GetWidgetPersistentStoragePath( - readTizenId(this))) + this->TizenId)) ), // use of multiple widget model TemporaryStoragePath(this, DPL::FromUTF8String( WidgetConfig::GetWidgetTemporaryStoragePath( - readTizenId(this) + getTimestamp())) + this->TizenId + getTimestamp())) ), GUID( this, @@ -105,7 +106,6 @@ WidgetModel::WidgetModel(const std::string &tizenId) : this, &BindToWidgetDAO::Get), - TizenId(this, &WidgetModel::readTizenId), //localized, so not binded Standard(this, &WidgetModel::readStandard), ApplicationStorage(this, &WidgetModel::getApplicationStorage), @@ -134,16 +134,16 @@ WidgetModel::WidgetModel(const std::string &tizenId) : { } -WidgetHandle WidgetModel::getHandle() const +DPL::String WidgetModel::getTizenId() const { - return Handle.Get(); + return TizenId; } WidgetStorageSize WidgetModel::getApplicationStorage(DPL::Event::Model *model) { Assert(model); WidgetModel *widgetModel = static_cast(model); - WidgetDAOReadOnly widgetDao(widgetModel->Handle.Get()); + WidgetDAOReadOnly widgetDao(widgetModel->TizenId); const DPL::String installPath = widgetDao.getPath(); const DPL::String persistentPath = @@ -183,17 +183,6 @@ WidgetStorageSize WidgetModel::getApplicationStorage(DPL::Event::Model *model) return WidgetStorageSize(appSize, persistanceSize + temporarySize); } -DPL::String WidgetModel::readTizenId(DPL::Event::Model *model) -{ - WidgetModel *widgetModel = static_cast(model); - DPL::OptionalString tizenId = - WidgetDAOReadOnly(widgetModel->Handle.Get()).getPkgname(); - - Assert(!!tizenId && "tizen id shouldn't be NULL"); - DPL::String id = *tizenId; - return id; -} - namespace { //anonymous const float FLOAT_WAC20_REPRESENTATION = 2.0; } //namespace anonymous @@ -203,7 +192,7 @@ WidgetStandard WidgetModel::readStandard(DPL::Event::Model *model) WidgetModel *widgetModel = static_cast(model); DPL::OptionalString minWacVersionString = - WidgetDAOReadOnly(widgetModel->Handle.Get()).getMinimumWacVersion(); + WidgetDAOReadOnly(widgetModel->TizenId).getMinimumWacVersion(); if (!minWacVersionString) { return WidgetStandard_Unknown; @@ -227,7 +216,7 @@ OptionalWidgetVersion WidgetModel::readVersion(DPL::Event::Model *model) WidgetModel *widgetModel = static_cast(model); DPL::OptionalString optionalVersionString = - WidgetDAOReadOnly(widgetModel->Handle.Get()).getVersion(); + WidgetDAOReadOnly(widgetModel->TizenId).getVersion(); if (!optionalVersionString) { return OptionalWidgetVersion(); diff --git a/src/domain/widget_model.h b/src/domain/widget_model.h index bd5d504..ce817d9 100644 --- a/src/domain/widget_model.h +++ b/src/domain/widget_model.h @@ -47,6 +47,11 @@ class WidgetModel : public DPL::Event::Model public: /** + * @brief Tizen id + */ + DPL::String TizenId; + + /** * @brief Widget handle * * Note: This is a readonly property @@ -181,13 +186,6 @@ class WidgetModel : public DPL::Event::Model DPL::Event::PropertyStorageDynamic> WindowModes; /** - * @brief Package name - */ - DPL::Event::Property TizenId; - - /** * @brief Minimum of the WAC Engine Standard required to run widget. */ DPL::Event::PropertyTizenId.Get())); + DPL::ToUTF8String(m_widgetModel->TizenId)); LogDebug("Initialized"); m_initialized = true; diff --git a/src/view/webkit/view_logic.cpp b/src/view/webkit/view_logic.cpp index d5b5f08..cffe1b3 100644 --- a/src/view/webkit/view_logic.cpp +++ b/src/view/webkit/view_logic.cpp @@ -453,7 +453,7 @@ void ViewLogic::finalizeEwkContext() void ViewLogic::initializeSupport() { // set local stroage database path - WrtDB::WidgetDAOReadOnly dao(m_model->TizenId.Get()); + WrtDB::WidgetDAOReadOnly dao(m_model->TizenId); ewk_context_web_storage_path_set(m_ewkContext, dao.getPrivateLocalStoragePath().c_str()); m_schemeSupport.reset(new SchemeSupport(m_model->Type.Get().appType)); @@ -463,7 +463,7 @@ void ViewLogic::initializeSupport() // temp // m_vibrationSupport->initialize(); - ViewModule::GeolocationSupport::Webkit2::initialize(m_model->TizenId.Get()); + ViewModule::GeolocationSupport::Webkit2::initialize(m_model->TizenId); ViewModule::GeolocationSupport::Webkit2:: adjustGeolocationModuleState(m_currentEwkView); } @@ -473,7 +473,7 @@ void ViewLogic::initializePluginLoading() // inform wrt information for plugin loading to web process PluginModuleSupport::start( m_ewkContext, - m_model->TizenId.Get(), + m_model->TizenId, elm_config_scale_get(), ApplicationDataSingleton::Instance().getEncodedBundle(), m_theme.c_str(), @@ -483,7 +483,7 @@ void ViewLogic::initializePluginLoading() void ViewLogic::ewkClientInit(Evas_Object *wkView) { Assert(NULL != wkView && "ewk_view not created at this point"); ViewModule::GeolocationSupport::Webkit2:: - initialize(m_model->TizenId.Get()); + initialize(m_model->TizenId); // WKPageLoaderClient evas_object_smart_callback_add(