wrt_launchpad_daemon system::share rwx--
wrt_launchpad_daemon system::homedir rwx--
wrt_launchpad_daemon device::app_logging -w---
-wrt_launchpad_daemon xorg -w---
+wrt_launchpad_daemon xorg rw---
wrt_launchpad_daemon webkit2-efl rwxa-
+wrt_launchpad_daemon sys-assert::core rwxat
}
}
part {
+ name: "elm.swallow.progress";
+ scale: 1;
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ fixed: 0 1;
+ rel1 { relative: 0.0 0.0; }
+ rel2 { relative: 1.0 0.0; }
+ align: 0.5 0.0;
+ }
+ description {
+ state: "visible" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ part {
name: "elm.swallow.backward";
type: SWALLOW;
mouse_events: 1;
transition: DECELERATE 0.5;
target: "elm.swallow.comboboxPicker";
}
+ program { name: "show,progress";
+ signal: "show,progress,signal";
+ action: STATE_SET "visible" 0.0;
+ target: "elm.swallow.progress";
+ }
+ program { name: "hide,progress";
+ signal: "hide,progress,signal";
+ action: STATE_SET "default" 0.0;
+ target: "elm.swallow.progress";
+ }
}//end of programs
}//end of group
-#git:framework/web/wrt wrt_0.8.198.3
+#git:framework/web/wrt
Name: wrt
Summary: web runtime
-Version: 0.8.198.3
+Version: 0.8.213
Release: 1
Group: Development/Libraries
License: Apache License, Version 2.0
BuildRequires: pkgconfig(capi-web-url-download)
BuildRequires: pkgconfig(wrt-plugin-loading)
BuildRequires: pkgconfig(wrt-plugin-js-overlay)
-BuildRequires: pkgconfig(dpl-encryption)
BuildRequires: pkgconfig(wrt-popup-wrt-runner)
BuildRequires: pkgconfig(wrt-popup-ace-runner)
BuildRequires: pkgconfig(sysman)
-BuildRequires: pkgconfig(osp-appfw)
BuildRequires: pkgconfig(app2sd)
BuildRequires: pkgconfig(capi-system-system-settings)
-BuildRequires: osp-appfw-internal-devel
-Requires: osp-appfw
+BuildRequires: libss-client-devel
+Requires: libss-client
## wrt-launchpad-daemon #######################################################
BuildRequires: pkgconfig(app-checker)
#include <widget_deserialize_model.h>
#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
#include <dpl/wrt-dao-ro/global_dao_read_only.h>
-#include "webkit/injected-bundle/plugin_module_support.h"
#include <EWebKit2.h>
typedef DPL::Singleton<CoreModule> CoreModuleSingleton;
} /* namespace WRT */
-#endif /* CORE_MODULE_H_ */
+#endif /* CORE_MODULE_H_ */
\ No newline at end of file
#include <i_view_module.h>
#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
#include <dpl/wrt-dao-ro/widget_dao_types.h>
-#include <dpl/wrt-dao-ro/vconf_config.h>
#include <dpl/utils/wrt_global_settings.h>
#include "ewk_context_manager.h"
dao.getPrivateLocalStoragePath().c_str());
// memory saving mode
- int result;
- vconf_get_int(
- WrtDB::VconfConfig::GetVconfKeyMemorySavingMode(
- DPL::FromUTF8String(m_appId)).c_str(), &result);
-
- ewk_context_memory_saving_mode_set(
- m_ewkContext,
- static_cast<WrtDB::SettingsType>(result) ==
- WrtDB::SETTINGS_TYPE_ON ? EINA_TRUE : EINA_FALSE);
+ //ewk_context_memory_saving_mode_set(
+ // m_ewkContext,
+ // static_cast<WrtDB::SettingsType>(result) ==
+ // WrtDB::SETTINGS_TYPE_ON ? EINA_TRUE : EINA_FALSE);
ewk_context_tizen_extensible_api_set(
m_ewkContext,
#include <appcore-common.h>
#include <profiling_util.h>
#include <signal.h>
-#include "webkit/injected-bundle/plugin_module_support.h"
#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
#include <runnable_widget_object_state.h>
#include <wrt_ocsp_api.h>
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;
+const char* const MESSAGE_NAME_INITIALIZE = "ToInjectedBundle::INIT";
+const char* const MESSAGE_NAME_SHUTDOWN = "ToInjectedBundle::SHUTDOWN";
} // namespace anonymous
namespace WRT {
Ewk_Context* context = m_ewkContextManager->getEwkContext();
// plugin init
- PluginModuleSupport::init(context, DPL::ToUTF8String(m_widgetModel->TizenId));
+ ewk_context_message_post_to_injected_bundle(
+ context,
+ MESSAGE_NAME_INITIALIZE,
+ DPL::ToUTF8String(m_widgetModel->TizenId).c_str());
// view init
if(!m_view->createWebView(context, window)) {
LogDebug("");
if(m_ewkContextManager)
{
- PluginModuleSupport::shutdown(m_ewkContextManager->getEwkContext());
+ ewk_context_message_post_to_injected_bundle(
+ m_ewkContextManager->getEwkContext(),
+ MESSAGE_NAME_SHUTDOWN,
+ DPL::ToUTF8String(m_widgetModel->TizenId).c_str());
}
else
{
#include <Evas.h>
namespace WRT {
+typedef DPL::FastDelegate0<void> ProgressStartedCB;
typedef DPL::FastDelegate2<Evas_Object*, double, void> ProgressCB;
typedef DPL::FastDelegate0<void> ProgressFinishCB;
typedef DPL::FastDelegate1<Evas_Object*, void> LoadStartCB;
typedef DPL::FastDelegate1<Evas_Object*, void> BufferUnsetCB;
typedef DPL::FastDelegate1<Evas_Object*, void> BufferSetCB;
typedef DPL::FastDelegate1<bool, void> ToggleFullscreenCB;
+typedef DPL::FastDelegate1<bool, void> EditorclientImeCB;
struct UserDelegates {
+ ProgressStartedCB progressStarted;
ProgressCB progress;
ProgressFinishCB progressFinish;
LoadStartCB loadStart;
BufferUnsetCB bufferUnset;
BufferSetCB bufferSet;
ToggleFullscreenCB toggleFullscreen;
+ EditorclientImeCB editorClientIme;
};
typedef std::shared_ptr<UserDelegates> UserDelegatesPtr;
IMPLEMENT_SINGLETON(PrepareExternalStorage)
-PrepareExternalStorage::PrepareExternalStorage() : m_handle(NULL) {
+PrepareExternalStorage::PrepareExternalStorage() :
+ m_handle(NULL),
+ m_pkdIdStr("") {
}
PrepareExternalStorage::~PrepareExternalStorage()
Deinitialize();
}
-void PrepareExternalStorage::Initialize(DPL::String pkgId)
+void PrepareExternalStorage::Initialize(const DPL::String &pkgId)
{
- if (NULL == m_pkgId) {
- std::string pkdIdStr = DPL::ToUTF8String(pkgId);
- const char* id = pkdIdStr.c_str();
+ m_pkdIdStr = DPL::ToUTF8String(pkgId);
+ const char* id = m_pkdIdStr.c_str();
- m_pkgId = (char*)calloc(1, strlen(id) + 1);
- snprintf(m_pkgId, strlen(id), "%s", id);
-
- if (APP2EXT_SD_CARD == app2ext_get_app_location(
- pkdIdStr.c_str())
- && (NULL == m_handle))
- {
- m_handle = app2ext_init(APP2EXT_SD_CARD);
- if (m_handle) {
- int ret = m_handle->interface.enable(m_pkgId);
- if ( 0 < ret) {
- LogError("app2ext enable failed : " << ret);
- } else {
- LogDebug("app2ext enable success");
- }
+ if (APP2EXT_SD_CARD == app2ext_get_app_location(id) && (NULL == m_handle))
+ {
+ m_handle = app2ext_init(APP2EXT_SD_CARD);
+ if (m_handle) {
+ int ret = m_handle->interface.enable(id);
+ if (0 < ret) {
+ LogError("app2ext enable failed : " << ret);
} else {
- LogError("app2ext init failed");
+ LogDebug("app2ext enable success");
}
+ } else {
+ LogError("app2ext init failed");
}
}
}
void PrepareExternalStorage::Deinitialize()
{
if (NULL != m_handle) {
- if ( 0 < m_handle->interface.disable(m_pkgId)) {
+ if (0 < m_handle->interface.disable(m_pkdIdStr.c_str())) {
LogError("app2ext disable failed");
}
- free(m_pkgId);
m_handle = NULL;
}
}
class PrepareExternalStorage {
public:
- void Initialize(DPL::String pkgId);
+ void Initialize(const DPL::String &pkgId);
void Deinitialize();
private:
virtual ~PrepareExternalStorage();
app2ext_handle* m_handle;
- char* m_pkgId;
+ std::string m_pkdIdStr;
};
typedef DPL::Singleton<PrepareExternalStorage> PrepareExternalStorageSingleton;
m_BackButtonPresence(BackButton_Disable),
m_ContextMenu(ContextMenu_Enable),
m_Encryption(Encryption_Disable),
- m_BackgroundSupport(BackgroundSupport_Disable)
+ m_BackgroundSupport(BackgroundSupport_Disable),
+ m_ProgressbarPresence(ProgressBar_Disable)
{}
WidgetSettingList::WidgetSettingList(WrtDB::WidgetSettings &widgetSettings)
m_ContextMenu = ContextMenu_Enable;
m_Encryption = Encryption_Disable;
m_BackgroundSupport = BackgroundSupport_Disable;
+ m_ProgressbarPresence = ProgressBar_Disable;
FOREACH(it, widgetSettings)
{
if (!userAgent.IsNull()) {
m_UserAgent = DPL::ToUTF8String(*userAgent);
}
+ } else if (name == SETTING_NAME_PROGRESSBAR_PRESENCE) {
+ if (value == SETTING_VALUE_PROGRESSBAR_PRESENCE_ENABLE) {
+ m_ProgressbarPresence = ProgressBar_Enable;
+ } else if (value == SETTING_VALUE_PROGRESSBAR_PRESENCE_DISABLE) {
+ m_ProgressbarPresence = ProgressBar_Disable;
+ } else {
+ LogError("Invalid progressbar-presence value!! [" <<
+ value << "]");
+ m_ProgressbarPresence = ProgressBar_Disable;
+ }
} else {
LogError("Invalid setting name!! [" << name << "]");
}
}
- LogDebug("m_RotationLock: " << m_RotationLock);
- LogDebug("m_IndicatorPresence: " << m_IndicatorPresence);
- LogDebug("m_BackButtonPresence: " << m_BackButtonPresence);
- LogDebug("m_ContextMenu: " << m_ContextMenu);
- LogDebug("m_Encryption: " << m_Encryption);
- LogDebug("m_BackgroundSupport: " << m_BackgroundSupport);
+
}
WidgetSettingScreenLock WidgetSettingList::getRotationValue() const
{
+ LogDebug("m_RotationLock: " << m_RotationLock);
+
return m_RotationLock;
}
WidgetSettingIndicatorPresence WidgetSettingList::getIndicatorPresence() const
{
+ LogDebug("m_IndicatorPresence: " << m_IndicatorPresence);
+
return m_IndicatorPresence;
}
WidgetSettingBackButtonPresence WidgetSettingList::getBackButtonPresence()
const
{
+ LogDebug("m_BackButtonPresence: " << m_BackButtonPresence);
+
return m_BackButtonPresence;
}
WidgetSettingContextMenu WidgetSettingList::getContextMenu() const
{
+ LogDebug("m_ContextMenu: " << m_ContextMenu);
+
return m_ContextMenu;
}
WidgetSettingEncryption WidgetSettingList::getEncryption() const
{
+ LogDebug("m_Encryption: " << m_Encryption);
+
return m_Encryption;
}
WidgetSettingBackgroundSupport WidgetSettingList::getBackgroundSupport() const
{
+ LogDebug("m_BackgroundSupport: " << m_BackgroundSupport);
+
return m_BackgroundSupport;
}
bool WidgetSettingList::isEncrypted() const
{
+ LogDebug("m_Encryption: " << m_Encryption);
+
if (m_Encryption == Encryption_Enable) {
return true;
}
std::string WidgetSettingList::getUserAgent() const
{
+ LogDebug("m_UserAgent: " << m_UserAgent);
+
return m_UserAgent;
}
+WidgetSettingProgressBarPresence WidgetSettingList::getProgressBarPresence() const
+{
+ LogDebug("m_ProgressbarPresence: " << m_ProgressbarPresence);
+
+ return m_ProgressbarPresence;
+}
+
bool WidgetSettingList::operator ==(const WidgetSettingList& other) const
{
return m_RotationLock == other.m_RotationLock &&
m_ContextMenu == other.m_ContextMenu &&
m_Encryption == other.m_Encryption &&
m_BackgroundSupport == other.m_BackgroundSupport &&
- m_UserAgent == other.m_UserAgent;
+ m_UserAgent == other.m_UserAgent &&
+ m_ProgressbarPresence == other.m_ProgressbarPresence;
}
#define WRT_SRC_DOMAIN_WIDGET_DATA_TYPES_H_
#include <list>
+#include <memory>
#include <dpl/utils/warp_iri.h>
#include <dpl/utils/widget_version.h>
L"background-support";
static const DPL::String SETTING_NAME_USER_AGENT =
L"user-agent";
+static const DPL::String SETTING_NAME_PROGRESSBAR_PRESENCE =
+ L"progressbar-presence";
static const DPL::String SETTING_VALUE_ENABLE =
L"enable";
static const DPL::String SETTING_VALUE_DISABLE =
L"enable";
static const DPL::String SETTING_VALUE_ENCRYPTION_DISABLE =
L"disable";
+static const DPL::String SETTING_VALUE_PROGRESSBAR_PRESENCE_ENABLE =
+ L"enable";
+static const DPL::String SETTING_VALUE_PROGRESSBAR_PRESENCE_DISABLE =
+ L"disable";
enum WidgetSettingScreenLock
{
BackgroundSupport_Disable /* Default */
};
+enum WidgetSettingProgressBarPresence
+{
+ ProgressBar_Enable,
+ ProgressBar_Disable /* Default */
+};
+
class WidgetSettingList
{
public:
std::string getUserAgent() const;
+ WidgetSettingProgressBarPresence getProgressBarPresence() const;
+
bool operator ==(const WidgetSettingList& other) const;
private:
WidgetSettingContextMenu m_ContextMenu;
WidgetSettingEncryption m_Encryption;
WidgetSettingBackgroundSupport m_BackgroundSupport;
+ WidgetSettingProgressBarPresence m_ProgressbarPresence;
std::string m_UserAgent;
};
+typedef std::shared_ptr<WidgetSettingList> WidgetSettingListPtr;
namespace OrientationAngle {
namespace W3C {
const int PRIMARY = 270;
const int SECONDARY = 90;
} // namespace Landscape
+const int UNLOCK = -1;
} // namespace Window
} // namespace OrientationAngle
#include "widget_model.h"
#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
+#include <dpl/wrt-dao-ro/widget_config.h>
#include <dpl/log/log.h>
#include <dpl/optional_typedefs.h>
// to apply widget default locales instead of calling localizeWidgetModel()
#include <dpl/localization/LanguageTagsProvider.h>
namespace Domain {
+std::string getTimestamp()
+{
+ struct timeval tv;
+ char buff[128];
+
+ gettimeofday(&tv, NULL);
+ sprintf(buff, "%lf", (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0f);
+ LogInfo("timestamp: " << buff);
+ return std::string(buff);
+}
+
std::shared_ptr<WidgetModel> deserializeWidgetModel(const std::string& tizenId,
DPL::OptionalUInt appControlIndex)
{
if (WrtDB::WidgetDAOReadOnly::isWidgetInstalled(dplTizenId)) {
LogDebug("Widget installed - creating model");
model.reset(new WidgetModel(tizenId));
- model->AppControlIndex.Set(appControlIndex);
WrtDB::WidgetDAOReadOnly dao(dplTizenId);
+ DPL::String pkgId = dao.getTizenPkgId();
+ model->PersistentStoragePath.Set(
+ DPL::FromUTF8String(
+ WrtDB::WidgetConfig::GetWidgetPersistentStoragePath(pkgId)));
+ model->TemporaryStoragePath.Set(
+ DPL::FromUTF8String(
+ WrtDB::WidgetConfig::GetWidgetTemporaryStoragePath(pkgId)));
+
+ model->AppControlIndex.Set(appControlIndex);
+
DPL::Optional<DPL::String> defloc = model->defaultlocale.Get();
if (!defloc.IsNull()) {
LanguageTagsProviderSingleton::Instance().addWidgetDefaultLocales(
#include <widget_model.h>
#include <dpl/sstream.h>
#include <dpl/event/model_bind_to_dao.h>
-#include <dpl/wrt-dao-ro/global_config.h>
-#include <dpl/wrt-dao-ro/widget_config.h>
#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
#include <dpl/utils/folder_size.h>
InstallPath(
this,
&BindToWidgetDAO<DPL::String, &WidgetDAOReadOnly::getFullPath>::Get),
- PersistentStoragePath(this,
- DPL::FromUTF8String(
- WidgetConfig::GetWidgetPersistentStoragePath(
- this->TizenId))
- ),
- // use of multiple widget model
- TemporaryStoragePath(this,
- DPL::FromUTF8String(
- WidgetConfig::GetWidgetTemporaryStoragePath(
- this->TizenId + getTimestamp()))
- ),
+ PersistentStoragePath(this),
+ TemporaryStoragePath(this),
defaultlocale(
this,
&BindToWidgetDAO<DPL::OptionalString,
SettingList(this),
AppControlList(this),
AppControlIndex(this),
- SecurityModelVersion(this,
- &BindToWidgetDAO<WidgetSecurityModelVersion,
- &WidgetDAOReadOnly::getSecurityModelVersion>::Get)
+ SecurityModelVersion(this, &BindToWidgetDAO<WidgetSecurityModelVersion, &WidgetDAOReadOnly::getSecurityModelVersion>::Get),
+ SecurePopupUsage(this, &BindToWidgetDAO<SettingsType, &WidgetDAOReadOnly::getSecurityPopupUsage>::Get),
+ GeolocationUsage(this, &BindToWidgetDAO<SettingsType, &WidgetDAOReadOnly::getGeolocationUsage>::Get),
+ WebNotificationUsage(this, &BindToWidgetDAO<SettingsType, &WidgetDAOReadOnly::getWebNotificationUsage>::Get),
+ WebStorageUsage(this, &BindToWidgetDAO<SettingsType, &WidgetDAOReadOnly::getWebDatabaseUsage>::Get)
{}
DPL::String WidgetModel::getTizenId() const
{
return TizenId;
}
-
-DPL::String WidgetModel::getTimestamp()
-{
- struct timeval tv;
- char buff[128];
-
- gettimeofday(&tv, NULL);
- sprintf(buff, "%lf", (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0f);
- LogInfo("timestamp: " << buff);
- DPL::String timeString = DPL::FromUTF8String(std::string(buff));
- return timeString;
-}
*
* 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> 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> TemporaryStoragePath;
/**
* @brief Widget defaultlocale
DPL::Event::PropertyReadOnly,
DPL::Event::PropertyStorageDynamicCached> SecurityModelVersion;
+ DPL::Event::Property<WrtDB::SettingsType,
+ DPL::Event::PropertyReadOnly,
+ DPL::Event::PropertyStorageDynamicCached> SecurePopupUsage;
+ DPL::Event::Property<WrtDB::SettingsType,
+ DPL::Event::PropertyReadOnly,
+ DPL::Event::PropertyStorageDynamicCached> GeolocationUsage;
+ DPL::Event::Property<WrtDB::SettingsType,
+ DPL::Event::PropertyReadOnly,
+ DPL::Event::PropertyStorageDynamicCached> WebNotificationUsage;
+ DPL::Event::Property<WrtDB::SettingsType,
+ DPL::Event::PropertyReadOnly,
+ DPL::Event::PropertyStorageDynamicCached> WebStorageUsage;
+
WidgetModel(const std::string &tizenId);
private:
- // Custom read write delegates
- static DPL::String getTimestamp();
-
DPL::String getTizenId() const;
};
${PROJECT_SOURCE_DIR}/src/view/common/evas_object.cpp
${PROJECT_SOURCE_DIR}/src/view/common/scheme.cpp
${PROJECT_SOURCE_DIR}/src/view/common/scheme_action_map.cpp
- ${PROJECT_SOURCE_DIR}/src/view/common/youtubehd.cpp
${PROJECT_SOURCE_DIR}/src/view/common/view_logic_apps_support.cpp
${PROJECT_SOURCE_DIR}/src/view/common/view_logic_custom_header_support.cpp
${PROJECT_SOURCE_DIR}/src/view/common/view_logic_security_support.cpp
${PROJECT_SOURCE_DIR}/src/view/common/view_logic_security_origin_support.cpp
${PROJECT_SOURCE_DIR}/src/view/common/view_logic_storage_support.cpp
${PROJECT_SOURCE_DIR}/src/view/common/view_logic_uri_support.cpp
- ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_user_agent_support.cpp
${PROJECT_SOURCE_DIR}/src/view/common/view_logic_vibration_support.cpp
${PROJECT_SOURCE_DIR}/src/view/common/view_logic_certificate_support.cpp
)
#include <app.h>
#include <app_manager.h>
#include <download.h>
-#include <youtubehd.h>
#include <dpl/singleton_impl.h>
#include <appsvc.h>
const char * const SERVICE_EXTRA_DATA_KEY_PATH = "path";
const char * const SERVICE_EXTRA_DATA_KEY_COOKIE = "cookie";
-const char * const SCHEME_TYPE_YOUTUBE = "vnd.youtube";
const char * const SCHEME_TYPE_RTSP = "rtsp";
const char * const SCHEME_TYPE_HTML5_VIDEO = "html5video";
}
-ApplicationLauncher::ApplicationLauncher()
-{}
+ApplicationLauncher::ApplicationLauncher() :
+ m_windowHandle(0)
+{
+}
ApplicationLauncher::~ApplicationLauncher()
{}
const ApplicationLauncherEvents::LaunchApplicationByAppService &event)
{
int result;
- bundle *args = event.GetArg0();
- appsvc_res_fn responseCallback = event.GetArg1();
+ service_h serviceHandle = event.GetArg0();
+ service_reply_cb responseCallback = event.GetArg1();
void *userData = event.GetArg2();
- result = appsvc_run_service(args, 0, responseCallback, userData);
- if (result < 0) {
+ if (m_windowHandle) {
+ service_set_window(serviceHandle, m_windowHandle);
+ }
+
+ result = service_send_launch_request(serviceHandle, responseCallback, userData);
+ if (result != SERVICE_ERROR_NONE) {
LogError("Failed to run AppService : " << result);
}
+ service_destroy(serviceHandle);
}
void ApplicationLauncher::OnEventReceived(
}
}
+ if (m_windowHandle) {
+ service_set_window(serviceHandle, m_windowHandle);
+ }
+
//launch service
ret = service_send_launch_request(serviceHandle, NULL, NULL);
if (SERVICE_ERROR_NONE != ret) {
}
LogDebug("scheme: " << scheme);
- if (SCHEME_TYPE_YOUTUBE == scheme) {
- YouTubeHD *youtube = new YouTubeHD(m_tizenId);
- url = youtube->getYouTubeHD(uri.c_str());
- delete youtube;
- } else if (SCHEME_TYPE_RTSP == scheme ||
- (SCHEME_TYPE_HTML5_VIDEO == scheme))
+ if (SCHEME_TYPE_RTSP == scheme ||
+ SCHEME_TYPE_HTML5_VIDEO == scheme)
{
url = uri.c_str();
} else {
return;
}
+ // set window handle when available
+ if (m_windowHandle) {
+ service_set_window(serviceHandle, m_windowHandle);
+ }
+
//launch service
ret = service_send_launch_request(serviceHandle, NULL, NULL);
if (SERVICE_ERROR_NONE != ret) {
LogDebug("tizen id: " << tizenId);
m_tizenId = tizenId;
}
+
+void ApplicationLauncher::setWindowHandle(unsigned windowHandle)
+{
+ m_windowHandle = windowHandle;
+}
#include <dpl/singleton.h>
#include <dpl/wrt-dao-ro/wrt_db_types.h>
-#include <appsvc.h>
-#include <bundle.h>
+#include <appfw/app_service.h>
namespace ApplicationLauncherEvents {
DECLARE_GENERIC_EVENT_3(LaunchApplicationByAppService,
- bundle *,
- appsvc_res_fn,
+ service_h,
+ service_reply_cb,
void*)
DECLARE_GENERIC_EVENT_4(LaunchApplicationByPkgname,
std::string,
ApplicationLauncher();
virtual ~ApplicationLauncher();
void setWidgetTizenId(const std::string& tizenId);
+ void setWindowHandle(unsigned windowHandle);
protected:
virtual void OnEventReceived(
private:
std::string m_tizenId;
+ unsigned m_windowHandle;
};
typedef DPL::Singleton<ApplicationLauncher> ApplicationLauncherSingleton;
--- /dev/null
+/*
+ * 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 message_support.h
+ * @author Lukasz Wrzosek (l.wrzosek@samsung.com)
+ * @author Yunchan Cho (yunchan.cho@samsung.com)
+ * @brief definition of messages between UI Process and Injected bundle
+ */
+#ifndef WRT_SRC_VIEW_COMMON_MESSAGE_SUPPORT_H_
+#define WRT_SRC_VIEW_COMMON_MESSAGE_SUPPORT_H_
+
+namespace Message {
+
+namespace ToInjectedBundle {
+const char * const INIT = "ToInjectedBundle::INIT";
+const char * const START = "ToInjectedBundle::START";
+const char * const SHUTDOWN = "ToInjectedBundle::SHUTDOWN";
+const char * const SET_CUSTOM_PROPERTIES =
+ "ToInjectedBundle::SET_CUSTOM_PROPERTIES";
+const char * const DISPATCH_JS_EVENT = "ToInjectedBundle::DISPATCH_JS_EVENT";
+const char * const SET_XWINDOW_HANDLE =
+ "ToInjectedBundle::SET_XWINDOW_HANDLE";
+} // namespace ToInectedBundle
+
+namespace ToUIProcess {
+const char * const BLOCKED_URL = "ToUIProcess::BLOCKED_URL";
+#ifdef MULTIPROCESS_SERVICE_SUPPORT_INLINE
+const char * const SEND_WEBPROCESS_PID = "ToUIProcess::SEND_WEBPROCESS_PID";
+#endif
+} // namespace ToUIProcess
+
+namespace TizenScheme {
+const char * const GET_WINDOW_HANDLE = "tizen://getWindowHandle";
+} // namespace ToUIProcess
+
+} //namespace BundleMessages
+
+#endif // WRT_SRC_VIEW_COMMON_MESSAGE_SUPPORT_H_
const char * const type2name[Scheme::COUNT] = {
"file",
"sms",
+ "smsto",
"mmsto",
"mailto",
"data",
#ifdef APP_SCHEME_ENABLED
"app",
#endif
- "vnd.youtube",
"rtsp"
};
INVALID = -1,
FILE = 0,
SMS,
+ SMSTO,
MMSTO,
MAILTO,
DATA,
#ifdef APP_SCHEME_ENABLED
APP,
#endif
- YOUTUBE,
RTSP,
COUNT
* Struct defining an appsvc operation and a list of scheme conversions used to
* fill in additional appsvc data.
*/
-struct AppSvcOperation {
+struct ServiceOperation {
const char* operation;
bool needUri;
std::list<AppSvcConversion> conversions;
};
-typedef std::map<Scheme::Type, AppSvcOperation> AppSvcOperationMap;
+typedef std::map<Scheme::Type, ServiceOperation> ServiceOperationMap;
// 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_SMSTO = "smsto:([^&]+).*";
+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()
+ServiceOperationMap initializeAppSvcOperations()
{
- AppSvcOperationMap ret;
+ ServiceOperationMap ret;
// FILE, HTTP & HTTPS
- AppSvcOperation viewOp;
- viewOp.operation = APPSVC_OPERATION_VIEW;
+ ServiceOperation viewOp;
+ viewOp.operation = SERVICE_OPERATION_VIEW;
viewOp.needUri = true;
// no additional data
ret.insert(std::make_pair(Scheme::FILE, viewOp));
ret.insert(std::make_pair(Scheme::HTTPS, viewOp));
// SMS
- AppSvcOperation smsOp;
- smsOp.operation = APPSVC_OPERATION_SEND_TEXT;
+ ServiceOperation smsOp;
+ smsOp.operation = SERVICE_OPERATION_COMPOSE;
smsOp.needUri = false;
- smsOp.conversions.push_back(AppSvcConversion(APPSVC_DATA_TO, REGEX_SMS));
- smsOp.conversions.push_back(AppSvcConversion(APPSVC_DATA_TEXT, REGEX_BODY));
+ smsOp.conversions.push_back(AppSvcConversion(SERVICE_DATA_TO, REGEX_SMS));
+ smsOp.conversions.push_back(AppSvcConversion(SERVICE_DATA_TEXT, REGEX_BODY));
ret.insert(std::make_pair(Scheme::SMS, smsOp));
+ // SMSTO
+ ServiceOperation smstoOp;
+ smstoOp.operation = SERVICE_OPERATION_COMPOSE;
+ smstoOp.needUri = false;
+ smstoOp.conversions.push_back(AppSvcConversion(SERVICE_DATA_TO, REGEX_SMSTO));
+ smstoOp.conversions.push_back(AppSvcConversion(SERVICE_DATA_TEXT, REGEX_BODY));
+ ret.insert(std::make_pair(Scheme::SMSTO, smstoOp));
+
+
// MMSTO & MAILTO
- AppSvcOperation sendOp;
- sendOp.operation = APPSVC_OPERATION_SEND;
+ ServiceOperation sendOp;
+ sendOp.operation = SERVICE_OPERATION_COMPOSE;
sendOp.needUri = true;
- sendOp.conversions.push_back(AppSvcConversion(APPSVC_DATA_TO, REGEX_MMSTO));
- 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(SERVICE_DATA_TO, REGEX_MMSTO));
+ sendOp.conversions.push_back(AppSvcConversion(SERVICE_DATA_TO, REGEX_MAILTO));
+ sendOp.conversions.push_back(AppSvcConversion(SERVICE_DATA_CC, REGEX_CC));
sendOp.conversions.push_back(
- AppSvcConversion(APPSVC_DATA_BCC, REGEX_BCC));
+ AppSvcConversion(SERVICE_DATA_BCC, REGEX_BCC));
sendOp.conversions.push_back(
- AppSvcConversion(APPSVC_DATA_SUBJECT, REGEX_SUBJECT));
+ AppSvcConversion(SERVICE_DATA_SUBJECT, REGEX_SUBJECT));
sendOp.conversions.push_back(
- AppSvcConversion(APPSVC_DATA_TEXT, REGEX_BODY));
+ AppSvcConversion(SERVICE_DATA_TEXT, REGEX_BODY));
ret.insert(std::make_pair(Scheme::MMSTO, sendOp));
ret.insert(std::make_pair(Scheme::MAILTO, sendOp));
// TODO what about DATA?
// TEL
- AppSvcOperation telOp;
- telOp.operation = APPSVC_OPERATION_CALL;
+ ServiceOperation telOp;
+ telOp.operation = SERVICE_OPERATION_CALL;
telOp.needUri = true;
ret.insert(std::make_pair(Scheme::TEL, telOp));
return ret;
}
-AppSvcOperationMap g_appSvcOperationMap = initializeAppSvcOperations();
+ServiceOperationMap g_serviceOperationMap = initializeAppSvcOperations();
} // namespace
namespace SchemeActionMap {
// case of unknown scheme, send to app-control
// This is temporary soultion. "invalid" scheme should be handled by
// scheme map data
- bundle* bundleData = bundle_create();
- appsvc_set_operation(bundleData, APPSVC_OPERATION_VIEW);
- appsvc_set_uri(bundleData, uri);
- CONTROLLER_POST_EVENT(
- ApplicationLauncher,
- ApplicationLauncherEvents::LaunchApplicationByAppService(
- bundleData,
- NULL,
- NULL));
+
+ // create service
+ service_h serviceHandle = NULL;
+ if (SERVICE_ERROR_NONE != service_create(&serviceHandle)) {
+ service_set_operation(serviceHandle, SERVICE_OPERATION_VIEW);
+ service_set_uri(serviceHandle, uri);
+ CONTROLLER_POST_EVENT(
+ ApplicationLauncher,
+ ApplicationLauncherEvents::LaunchApplicationByAppService(
+ serviceHandle,
+ NULL,
+ NULL));
+ }
return false;
}
case URI_ACTION_APPSVC:
{
// find AppSvcOperation for given scheme type
- auto it = g_appSvcOperationMap.find(type);
- if (it == g_appSvcOperationMap.end()) {
+ auto it = g_serviceOperationMap.find(type);
+ if (it == g_serviceOperationMap.end()) {
LogError("No entry for scheme: " << name);
return false;
}
// prepare appsvc bundle
- bundle* bundleData = bundle_create();
+ service_h serviceHandle = NULL;
+ service_create(&serviceHandle);
LogDebug("appsvc operation " << it->second.operation);
- appsvc_set_operation(bundleData, it->second.operation);
+ service_set_operation(serviceHandle, it->second.operation);
if (it->second.needUri) {
- appsvc_set_uri(bundleData, uri);
+ service_set_uri(serviceHandle, uri);
}
// this is safe as there are no other threads
// convert scheme text to appsvc format
while (cit->regex->Consume(&input, &match)) {
LogInfo("Adding apssvc data: " << cit->key << " " << match);
- appsvc_add_data(bundleData, cit->key, match.c_str());
+ service_add_extra_data(serviceHandle, cit->key, match.c_str());
}
}
CONTROLLER_POST_EVENT(
ApplicationLauncher,
ApplicationLauncherEvents::LaunchApplicationByAppService(
- bundleData,
+ serviceHandle,
NULL,
NULL));
break;
#ifdef APP_SCHEME_ENABLED
{ URI_ACTION_WRT, URI_ACTION_WRT, URI_ACTION_WRT }, // APP
#endif
- { URI_ACTION_VIDEO, URI_ACTION_VIDEO, URI_ACTION_VIDEO }, // YOUTUBE
{ URI_ACTION_VIDEO, URI_ACTION_VIDEO, URI_ACTION_VIDEO } // RTSP
};
#ifdef APP_SCHEME_ENABLED
{ URI_ACTION_WRT, URI_ACTION_WRT, URI_ACTION_APPSVC }, // APP
#endif
- { URI_ACTION_VIDEO, URI_ACTION_VIDEO, URI_ACTION_VIDEO }, // YOUTUBE
{ URI_ACTION_VIDEO, URI_ACTION_VIDEO, URI_ACTION_VIDEO } // RTSP
};
}
return false;
}
- bundle *args = NULL;
- args = bundle_create();
- void *userData = NULL;
- appsvc_res_fn responseCallback = NULL;
+ service_h serviceHandle = NULL;
+ service_create(&serviceHandle);
// ignore case match of string of mime type
// if needed, define appsvc response callback
if (!strcasecmp(mimeType.c_str(), HTTP_STREAMING_APPLE_MIMETYPE) ||
!strcasecmp(mimeType.c_str(), HTTP_STREAMING_MPEG_MIMETYPE))
{
- appsvc_set_operation(args, APPSVC_OPERATION_VIEW);
- appsvc_set_mime(args, mimeType.c_str());
- appsvc_set_uri(args, uri.c_str());
+ service_set_operation(serviceHandle, SERVICE_OPERATION_VIEW);
+ service_set_mime(serviceHandle, mimeType.c_str());
+ service_set_uri(serviceHandle, uri.c_str());
} else if (!strcasecmp(mimeType.c_str(), "video/mp4") ||
!strcasecmp(mimeType.c_str(), "vidoe/3gp"))
{
"null"));
} else {
LogInfo("Not Supported MIME type in WRT");
- bundle_free(args);
+ service_destroy(serviceHandle);
return false;
}
CONTROLLER_POST_EVENT(
ApplicationLauncher,
ApplicationLauncherEvents::LaunchApplicationByAppService(
- args,
- responseCallback,
- userData));
+ serviceHandle,
+ NULL,
+ NULL));
return true;
}
return false;
}
std::ofstream out(dest);
- if (in.is_open() == false) {
+ if (out.is_open() == false) {
LogError("Fail to open output file");
return false;
}
"AppsSupport has to be deinitialized prior destroying!");
}
- void initialize(WidgetModel *widgetModel)
+ void initialize(WidgetModel *widgetModel, unsigned windowHandle)
{
Assert(!m_initialized && "Already initialized!");
ApplicationLauncherSingleton::Instance().Touch();
ApplicationLauncherSingleton::Instance().setWidgetTizenId(
DPL::ToUTF8String(m_widgetModel->TizenId));
+ ApplicationLauncherSingleton::Instance().setWindowHandle(windowHandle);
LogDebug("Initialized");
m_initialized = true;
AppsSupport::~AppsSupport()
{}
-void AppsSupport::initialize(WidgetModel *widgetModel)
+void AppsSupport::initialize(WidgetModel *widgetModel, unsigned windowHandle)
{
- m_impl->initialize(widgetModel);
+ m_impl->initialize(widgetModel, windowHandle);
}
void AppsSupport::deinitialize()
AppsSupport();
virtual ~AppsSupport();
- void initialize(WidgetModel *);
+ void initialize(WidgetModel *, unsigned);
void deinitialize();
void html5VideoRequest(void* event_info);
void downloadRequest(
#include <memory>\r
#include <Evas.h>\r
#include <Elementary.h>\r
-#include <vconf.h>\r
#include <dpl/log/log.h>\r
#include <dpl/assert.h>\r
#include <dpl/wrt-dao-ro/common_dao_types.h>\r
-#include <dpl/wrt-dao-ro/vconf_config.h>\r
#include <wrt-commons/certificate-dao/certificate_dao.h>\r
#include <widget_model.h>\r
\r
#include <memory>
#include <Evas.h>
#include <Elementary.h>
-#include <vconf.h>
#include <dpl/log/log.h>
#include <dpl/assert.h>
#include <dpl/wrt-dao-ro/common_dao_types.h>
-#include <dpl/wrt-dao-ro/vconf_config.h>
#include <wrt-commons/security-origin-dao/security_origin_dao.h>
#include <widget_model.h>
}
return m_securityOriginDAO.get();
}
-
- WrtDB::SettingsType isNeedPermissionCheck(
- WrtDB::Feature feature)
- {
- using namespace SecurityOriginDB;
- using namespace WrtDB;
- std::string key;
- if (feature == FEATURE_GEOLOCATION) {
- key = WrtDB::VconfConfig::GetVconfKeyGeolocationUsage(
- m_model->TizenId);
- } else if (feature == FEATURE_WEB_NOTIFICATION) {
- key = WrtDB::VconfConfig::GetVconfKeyWebNotificationUsage(
- m_model->TizenId);
- } else if (feature == FEATURE_WEB_DATABASE) {
- key = WrtDB::VconfConfig::GetVconfKeyWebDatabaseUsage(
- m_model->TizenId);
- } else {
- Assert("Wrong feature argument is input");
- }
-
- int value = 0;
- vconf_get_int(key.c_str(), &value);
- LogDebug(key << " = " << value);
- WrtDB::SettingsType ret = static_cast<WrtDB::SettingsType>(value);
-
- return ret;
- }
};
SecurityOriginSupport::SecurityOriginSupport(WidgetModel* widgetModel) :
return m_impl->getSecurityOriginDAO();
}
-WrtDB::SettingsType SecurityOriginSupport::isNeedPermissionCheck(
- WrtDB::Feature feature)
-{
- return m_impl->isNeedPermissionCheck(feature);
-}
-
Evas_Object* SecurityOriginSupportUtil::createPopup(
Evas_Object* window,
const char* bodyText,
SecurityOriginSupport(WidgetModel* widgetModel);
virtual ~SecurityOriginSupport();
SecurityOriginDB::SecurityOriginDAO* getSecurityOriginDAO();
- WrtDB::SettingsType isNeedPermissionCheck(
- WrtDB::Feature feature);
private:
std::unique_ptr<SecurityOriginSupportImplementation> m_impl;
#include "view_logic_storage_support.h"
#include <string>
+#include <ftw.h>
+
#include <dpl/assert.h>
#include <dpl/exception.h>
#include <dpl/log/log.h>
namespace StorageSupport {
namespace { //anonymous
const mode_t TEMPORARY_STORAGE_MODE = 0700;
+static bool rootDirectory = true;
+
+static int removeFile(const char* path, const struct stat* /*sb*/, int tflag)
+{
+ if (path == NULL) {
+ LogError("Wrong input path");
+ }
+ LogDebug(path);
+ std::string inputPath = path;
+
+ if (rootDirectory) {
+ LogDebug("Skip root directory");
+ rootDirectory = false;
+ return 0;
+ }
+
+ if (tflag == FTW_F || tflag == FTW_D) {
+ if (!WrtUtilRemove(inputPath)) {
+ LogError("Fail to remove");
+ }
+ } else if (tflag == FTW_DNR) {
+ LogError("This is directory which can't be read");
+ } else if (tflag == FTW_NS) {
+ LogError("Unknow error");
+ }
+
+ return 0;
+}
+
+bool removeDirectory(const char* path)
+{
+ rootDirectory = true;
+ if (ftw(path, removeFile, 20) != 0) {
+ return false;
+ }
+ return true;
+}
}
void initializeStorage(WidgetModel *widgetModel)
// create temporary storage
std::string path =
DPL::ToUTF8String(widgetModel->TemporaryStoragePath.Get());
- if (!WrtUtilMakeDir(path, TEMPORARY_STORAGE_MODE)) {
- ThrowMsg(DPL::CommonException::InternalError,
- "Fail to initialize temporary storage");
+ if (!WrtUtilDirExists(path)) {
+ if (!WrtUtilMakeDir(path, TEMPORARY_STORAGE_MODE)) {
+ ThrowMsg(DPL::CommonException::InternalError,
+ "Fail to initialize temporary storage");
+ }
}
}
LogDebug("deinitializeStorage");
Assert(widgetModel && "Passed widgetModel is NULL!");
- // remove temporary storage
+ // clean-up temporary storage
std::string path =
DPL::ToUTF8String(widgetModel->TemporaryStoragePath.Get());
- if (!WrtUtilRemove(path)) {
- ThrowMsg(DPL::CommonException::InternalError,
- "Fail to deinitialize temporary storage");
+ if (!removeDirectory(path.c_str())) {
+ LogError("Fail to deinitialize temporary storage");
}
}
} // namespace StorageSupport
+++ /dev/null
-/*
- * 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 view_logic_user_agent_support.cpp
- * @author Jaroslaw Osmanski (j.osmanski@samsung.com)
- * @brief Implementation file of UserAgent API used by ViewLogic
- */
-
-#include "view_logic_user_agent_support.h"
-
-#include <vconf.h>
-#include <vconf-keys.h>
-
-#include <string>
-#include <dpl/log/log.h>
-#include <dpl/wrt-dao-ro/global_dao_read_only.h>
-
-namespace {
-// TODO: remove this after ua is fixed...
-const std::string USERAGENT_KEY = VCONFKEY_BROWSER_BROWSER_USER_AGENT;
-const std::string SYSTEM_USER_AGENT = "System user agent";
-};
-
-namespace ViewModule {
-namespace UserAgentSupport {
-std::string getUserAgentFromVconf()
-{
- using namespace WrtDB;
- char* vconfValue = vconf_get_str(USERAGENT_KEY.c_str());
- std::string userAgentName;
-
- if (!vconfValue) {
- userAgentName = "Tizen";
- } else {
- userAgentName = vconfValue;
- }
-
- free(vconfValue);
-
- LogDebug("userAgentName: " << userAgentName);
- std::string userAgent;
-
- if (userAgentName == SYSTEM_USER_AGENT) {
- /* do nothing */
- } else {
- DPL::String value =
- GlobalDAOReadOnly::GetUserAgentValue(DPL::FromUTF8String(
- userAgentName));
- userAgent = DPL::ToUTF8String(value);
- LogDebug("value : " << value);
- }
- LogDebug("UA:[" << userAgentName << "] UA string:[" << userAgent << "]");
-
-
- return userAgent;
-}
-} // namespace ViewModule
-} // namespace UserAgentSupport
${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_authentication_challenge_support.cpp
${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_certificate_confirm_support.cpp
${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_geolocation_support.cpp
+ ${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_message_support.cpp
+ ${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_orientation_support.cpp
${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_scheme_support.cpp
${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_service_support.cpp
${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_usermedia_support.cpp
${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_web_notification_support.cpp
${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_web_storage_support.cpp
- ${PROJECT_SOURCE_DIR}/src/view/webkit/injected-bundle/plugin_module_support.cpp
${VIEW_MODULE_SOURCES}
)
dpl-efl
dpl-utils-efl
dpl-wrt-dao-ro
- dpl-encryption
ewebkit2
- vconf
- osp-appfw
libprivilege-control
libiri
libpcrecpp
+ wrt-plugins-ipc-message
+ wrt-dispatch-event
REQUIRED
)
SET(INJECTED_BUNDLE_SOURCES
${PROJECT_SOURCE_DIR}/src/view/webkit/injected-bundle/wrt-injected-bundle.cpp
${PROJECT_SOURCE_DIR}/src/view/webkit/injected-bundle/injected_bundle_uri_handling.cpp
+ ${PROJECT_SOURCE_DIR}/src/view/webkit/injected-bundle/injected_bundle_decryption_support.cpp
${PROJECT_SOURCE_DIR}/src/view/webkit/injected-bundle/page_global_context_container.cpp
${PROJECT_SOURCE_DIR}/src/view/common/scheme.cpp
)
)
# for encryption
-TARGET_LINK_LIBRARIES(${TARGET_INJECTED_BUNDLE_LIB} -L/usr/lib/osp -losp-appfw)
+TARGET_LINK_LIBRARIES(${TARGET_INJECTED_BUNDLE_LIB} "-lss-client")
SET_TARGET_PROPERTIES(${TARGET_INJECTED_BUNDLE_LIB} PROPERTIES
VERSION ${PROJECT_VERSION}
--- /dev/null
+/*
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * @file injected_bundle_decryption_support.cpp
+ * @author Jihoon Chung (jihoon.chung@samsung.com)
+ * @version 1.0
+ */
+
+#include "injected_bundle_decryption_support.h"
+
+#include <memory>
+#include <set>
+#include <string>
+#include <sys/stat.h>
+#include <ss_manager.h>
+#include <openssl/sha.h>
+#include <openssl/hmac.h>
+#include <openssl/evp.h>
+#include <openssl/bio.h>
+#include <openssl/buffer.h>
+
+#include <dpl/log/log.h>
+#include <dpl/assert.h>
+#include <dpl/string.h>
+#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
+#include <dpl/wrt-dao-ro/global_config.h>
+#include <dpl/utils/mime_type_utils.h>
+
+namespace InjectedBundle {
+namespace {
+const char * const SCHEME_FILE_SLASH = "file://";
+const char * const DATA_STRING = "data:";
+const char * const BASE64_STRING = ";base64,";
+const char QUESTION_MARK = '?';
+const char ASTERISK_MARK = '#';
+}
+
+//Implementation class
+class DecryptionSupportImplementation
+{
+ private:
+ bool m_initialized;
+
+ WrtDB::TizenAppId m_appId;
+ WrtDB::EncryptedFileList m_encryptedFiles;
+ bool m_isEncrypted;
+ std::set<WrtDB::EncryptedFileInfo>::iterator m_targetIt;
+ bool m_isPreload;
+
+
+ std::string getFilePath(const std::string& url)
+ {
+ std::string filePath = url;
+
+ size_t pos = filePath.find_first_not_of(SCHEME_FILE_SLASH);
+ if (pos != std::string::npos) {
+ filePath = filePath.substr(pos - 1);
+ }
+
+ pos = filePath.find_first_of(ASTERISK_MARK);
+ if (pos != std::string::npos) {
+ filePath = filePath.substr(0, pos);
+ }
+
+ pos = filePath.find_first_of(QUESTION_MARK);
+ if (pos != std::string::npos) {
+ filePath = filePath.substr(0, pos);
+ }
+
+ return filePath;
+ }
+
+ int ssmDecrypt(const std::string pkgId, const char* inBuf, int inSize, char** outBuf, int* outSize)
+ {
+ if (m_isPreload) {
+ return ssm_decrypt_preloaded_application(inBuf, inSize, outBuf,
+ outSize);
+ } else {
+ return ssm_decrypt(pkgId.c_str(), pkgId.length(), inBuf, inSize, outBuf, outSize);
+ }
+ }
+
+ std::string doDecrypt(std::string filePath, int size)
+ {
+ struct stat buf;
+ if (0 == stat(filePath.c_str(), &buf)) {
+ const std::size_t fileSize = buf.st_size;
+ std::unique_ptr<unsigned char[]> inChunk;
+
+ FILE* fp = fopen(filePath.c_str(), "rb");
+ if (NULL == fp) {
+ LogDebug("Couldnot open file : " << filePath);
+ return std::string();
+ }
+
+ std::unique_ptr<unsigned char[]> DecryptedString(new unsigned
+ char[fileSize]);
+ std::string pkgid(DPL::ToUTF8String(m_appId));
+
+ int writeCount = 0;
+ do {
+ unsigned char getDecSize[4];
+ memset(getDecSize, 0x00, sizeof(getDecSize));
+
+ size_t readSize = fread(getDecSize, sizeof(unsigned char), sizeof(getDecSize), fp);
+ if (0 != readSize) {
+ unsigned int readBufSize = 0;
+ std::istringstream(std::string((char*)getDecSize)) >> readBufSize;
+ inChunk.reset(new unsigned char[readBufSize]);
+
+ size_t decReadSize = fread(inChunk.get(), sizeof(unsigned char), readBufSize, fp);
+
+ if (0 != decReadSize) {
+ char *outChunk = NULL;
+ int outSize = 0;
+ if (0 != ssmDecrypt(pkgid, (char*)inChunk.get(), (int)decReadSize, &outChunk, &outSize))
+ {
+ LogError("Failed to get decrypted resource");
+ fclose(fp);
+ return std::string();
+ }
+ memcpy(DecryptedString.get() + writeCount, outChunk, outSize);
+ writeCount += outSize;
+ }
+ }
+ } while( 0 == std::feof(fp));
+ fclose(fp);
+ memset(DecryptedString.get() + size, '\n', fileSize - size);
+ LogDebug("resource need to encoding base64");
+ BIO *bmem, *b64;
+ BUF_MEM *bptr;
+
+ b64 = BIO_new(BIO_f_base64());
+ bmem = BIO_new(BIO_s_mem());
+ b64 = BIO_push(b64, bmem);
+ BIO_write(b64, DecryptedString.get(), fileSize);
+ BIO_flush(b64);
+ BIO_get_mem_ptr(b64, &bptr);
+
+ std::string base64Enc((char *)bptr->data, bptr->length - 1);
+ BIO_free_all(b64);
+
+ return base64Enc;
+ }
+ return std::string();
+ }
+
+ public:
+ DecryptionSupportImplementation() :
+ m_initialized(false),
+ m_isEncrypted(false),
+ m_isPreload(false)
+ {
+ }
+
+ void initialize(WrtDB::TizenAppId appId)
+ {
+ LogInfo("initialize");
+
+ m_appId = appId;
+ WrtDB::WidgetDAOReadOnly dao(m_appId);
+ dao.getEncryptedFileList(m_encryptedFiles);
+ if (!m_encryptedFiles.empty()) {
+ m_isEncrypted = true;
+ LogDebug("encrypted application");
+ }
+
+ std::string installedPath =
+ DPL::ToUTF8String(*dao.getWidgetInstalledPath());
+ std::string preloadPath(WrtDB::GlobalConfig::GetUserPreloadedWidgetPath());
+ if (0 == installedPath.compare(0, preloadPath.length(), preloadPath)) {
+ m_isPreload = true;
+ LogDebug("preload application");
+ }
+
+ m_initialized = true;
+ }
+
+ void deinitialize(void)
+ {
+ LogInfo("deinitialize");
+
+ m_encryptedFiles.clear();
+ m_targetIt = m_encryptedFiles.end();
+ m_isEncrypted = false;
+ m_appId = DPL::String(L"");
+ m_initialized = false;
+ }
+
+ bool isNeedDecryption(std::string url)
+ {
+ if (!m_initialized) {
+ LogInfo("not initialize");
+ return false;
+ }
+
+ if (0 != strncmp(url.c_str(), SCHEME_FILE_SLASH, strlen(SCHEME_FILE_SLASH))) {
+ return false;
+ }
+
+ std::set<WrtDB::EncryptedFileInfo>::iterator it;
+ WrtDB::EncryptedFileInfo info;
+ std::string filePath = getFilePath(url);
+ info.fileName = DPL::FromUTF8String(filePath);
+ if (m_encryptedFiles.end() != (it = m_encryptedFiles.find(info))) {
+ LogDebug(" info file name : " << it->fileName);
+ LogDebug(" info file size : " << it->fileSize);
+ m_targetIt = it;
+ return true;
+ }
+ return false;
+ }
+
+ std::string decryptResource(std::string url)
+ {
+ if (!m_initialized) {
+ LogInfo("not initialize");
+ return std::string();
+ }
+
+ std::string filePath = getFilePath(url);
+ if (filePath != DPL::ToUTF8String(m_targetIt->fileName)) {
+ if (!isNeedDecryption(filePath)) {
+ return std::string();
+ }
+ }
+
+ std::string decryptString =
+ doDecrypt(DPL::ToUTF8String(m_targetIt->fileName),
+ m_targetIt->fileSize);
+ if (!decryptString.empty()) {
+ std::string destString = DATA_STRING;
+
+ std::string mimeString =
+ DPL::ToUTF8String(
+ MimeTypeUtils::identifyFileMimeType(
+ DPL::FromUTF8String(url)));
+
+ destString += mimeString;
+ destString += BASE64_STRING;
+
+ decryptString.insert(0, destString);
+ }
+ return decryptString;
+ }
+};
+
+DecryptionSupport::DecryptionSupport() :
+ m_impl(new DecryptionSupportImplementation)
+{
+}
+
+DecryptionSupport::~DecryptionSupport()
+{
+}
+
+void DecryptionSupport::initialize(WrtDB::TizenAppId appId)
+{
+ m_impl->initialize(appId);
+}
+
+void DecryptionSupport::deinitialize(void)
+{
+ m_impl->deinitialize();
+}
+
+bool DecryptionSupport::isNeedDecryption(std::string url)
+{
+ return m_impl->isNeedDecryption(url);
+}
+
+std::string DecryptionSupport::decryptResource(std::string url)
+{
+ return m_impl->decryptResource(url);
+}
+} // namespace InjectedBundle
--- /dev/null
+/*
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file injected_bundle_decryption_support.h
+ * @author Jihoon Chung (jihoon.chung@samsung.com)
+ * @version 1.0
+ */
+#ifndef INJECTED_BUNDLE_DECRYPTION_SUPPORT_H_
+#define INJECTED_BUNDLE_DECRYPTION_SUPPORT_H_
+
+#include <memory>
+#include <string>
+#include <dpl/wrt-dao-ro/common_dao_types.h>
+
+namespace InjectedBundle {
+class DecryptionSupportImplementation;
+
+class DecryptionSupport
+{
+ public:
+ DecryptionSupport();
+ virtual ~DecryptionSupport();
+ void initialize(WrtDB::TizenAppId appId);
+ void deinitialize(void);
+ bool isNeedDecryption(std::string url);
+ std::string decryptResource(std::string url);
+
+ private:
+ std::unique_ptr<DecryptionSupportImplementation> m_impl;
+};
+} // namespace InjectedBundle
+
+#endif // INJECTED_BUNDLE_DECRYPTION_SUPPORT_H_
#include <WKString.h>
#include <WKType.h>
-
namespace {
char const * const SCHEME_TYPE_FILE = "file";
char const * const SCHEME_TYPE_WIDGET = "widget";
WrtDB::WidgetAccessInfoList widgetAccessInfoList;
dao.getWidgetAccessInfo(widgetAccessInfoList);
+ // temporary solution for libiri parsing error
+ // This code will be removed
+ std::string urlstr = url;
+ size_t pos = urlstr.find_first_of("#?");
+ if (pos != std::string::npos) {
+ urlstr = urlstr.substr(0, pos);
+ }
+
return (static_cast<WidgetAccessList>(widgetAccessInfoList)).isRequiredIRI(
- DPL::FromUTF8String(std::string(url)));
+ DPL::FromUTF8String(urlstr));
}
bool checkWhitelist(const char *url)
} // namespace (anonymous)
namespace InjectedBundleURIHandling {
+bool processURI(const std::string& inputURI,
+ const DPL::String& tizenId,
+ WrtDB::WidgetSecurityModelVersion version)
+{
+ if (version == WrtDB::WidgetSecurityModelVersion::WIDGET_SECURITY_MODEL_V1)
+ {
+ if (!checkWARP(inputURI.c_str(), tizenId))
+ {
+ LogWarning("Request was blocked by WARP: " << inputURI);
+
+ return false;
+ }
+ }
+
+// disable for performance
+#if 0
+ if (!preventSymlink(uri)) {
+ LogWarning("Request for symlink is invalid: " << uri);
+ return false;
+ }
+#endif
+
+ return true;
+}
+
bool processURI(const DPL::String& inputURI,
const DPL::String& tizenId,
WrtDB::WidgetSecurityModelVersion version)
}
}
- if (!checkACE(uri.c_str(), true, tizenId)) {
- LogWarning("Request was blocked by ACE: " << uri);
- return false;
- }
-
+// disable for performance
+#if 0
if (!preventSymlink(uri)) {
LogWarning("Request for symlink is invalid: " << uri);
return false;
}
+#endif
return true;
}
#endif
}
- if (!checkACE(uri.c_str(), true, tizenId)) {
- LogWarning("Request was blocked by ACE: " << uri);
- return false;
- }
-
+// disable for performance
+#if 0
if (!preventSymlink(uri)) {
LogWarning("Request for symlink is invalid: " << uri);
return false;
}
+#endif
return true;
}
return true;
}
+std::string localizeURI(const std::string& inputURI, const std::string& tizenId)
+{
+ if (inputURI.compare(0, strlen(SCHEME_TYPE_WIDGET), SCHEME_TYPE_WIDGET) &&
+ inputURI.compare(0, strlen(SCHEME_TYPE_FILE), SCHEME_TYPE_FILE) &&
+ inputURI.compare(0, strlen(SCHEME_TYPE_APP), SCHEME_TYPE_APP))
+ {
+ return inputURI;
+ }
+
+ std::string localizedURI = W3CFileLocalization::getFilePathInWidgetPackageFromUrl(tizenId, inputURI);
+
+ if (localizedURI.empty())
+ {
+ return inputURI;
+ }
+ else
+ {
+ return std::string("file://") + localizedURI;
+ }
+}
DPL::OptionalString localizeURI(const DPL::String& inputURI,
const DPL::String& tizenId)
if (found.IsNull()) {
// In this case, path doesn't need to localize. return input uri
LogDebug("Path not found within current locale in current widget");
+
return DPL::OptionalString(inputURI);
} else {
DPL::String uri(L"file://" + *found);
bool processURI(const DPL::String& inputURI,
const DPL::String& tizenId,
WrtDB::WidgetSecurityModelVersion m_securityModelVersion);
+bool processURI(const std::string& inputURI,
+ const DPL::String& tizenId,
+ WrtDB::WidgetSecurityModelVersion version);
bool processMainResource(const DPL::String& inputURI,
const DPL::String& tizenId,
WrtDB::WidgetSecurityModelVersion m_securityModelVersion);
bool processURIForPlugin(const char* url);
DPL::OptionalString localizeURI(const DPL::String& inputURI,
const DPL::String& tizenId);
+std::string localizeURI(const std::string& inputURI, const std::string& tizenId);
}
#endif // INJECTED_BUNDLE_URI_HANDLING_H_
+++ /dev/null
-/*
- * 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 messages_names.h
- * @author Lukasz Wrzosek (l.wrzosek@samsung.com)
- * @author Yunchan Cho (yunchan.cho@samsung.com)
- * @brief definition of messages for bunlde IPC.
- */
-
-namespace BundleMessages {
-const char * const INIT = "PluginModule::init";
-
-const char * const START = "PluginModule::start";
-const char * const SHUTDOWN = "PluginModule::shutdown";
-const char * const SET_CUSTOM_PROPERTIES =
- "PluginModule::setCustomProperties";
-const char * const DISPATCH_JAVASCRIPT_EVENT =
- "PluginModule::dispatchJavaScriptEvent";
-} //namespace BundleMessages
-
#include <string>
#include <cstdio>
#include <sstream>
-#include <sys/stat.h>
#include <set>
-#include <openssl/sha.h>
-#include <openssl/hmac.h>
-#include <openssl/evp.h>
-#include <openssl/bio.h>
-#include <openssl/buffer.h>
+#include <memory>
#include <dpl/log/log.h>
#include <dpl/foreach.h>
#include <dpl/wrt-dao-ro/global_config.h>
#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
#include <dpl/wrt-dao-ro/common_dao_types.h>
-#include <dpl/utils/mime_type_utils.h>
#include <dpl/localization/LanguageTagsProvider.h>
#include <dpl/event/main_event_dispatcher.h>
-#include <FBaseByteBuffer.h>
-#include <security/FSecCrypto_TrustZoneService.h>
#include <wrt_plugin_module.h>
#include <profiling_util.h>
-#include <vconf.h>
#include <appcore-efl.h>
-#include "messages_names.h"
+#include <message_support.h>
#include <scheme.h>
#include <scheme_action_map_type.h>
#include <scheme_action_map_data.h>
#include <js_overlay_types.h>
+#include <dispatch_event_support.h>
+#include <plugins-ipc-message/ipc_message_support.h>
-#include <sys/time.h>
#include <sys/resource.h>
#include <privilege-control.h>
// URI localization on WebProcess side
#include "injected_bundle_uri_handling.h"
-extern "C" {
-void InitWebAppInfo(const char* appId, const char* rootPath);
-}
+#include "injected_bundle_decryption_support.h"
namespace {
-const char * const uriBlockedMessageName = "uri_blocked_msg";
-#ifdef MULTIPROCESS_SERVICE_SUPPORT_INLINE
-const char * const webProcessPidMessageName = "web_process_pid_msg";
-#endif
const char * const SCHEME_HTTP = "http";
const char * const SCHEME_HTTPS = "https";
const char * const SCHEME_FILE = "file";
const char * const SCHEME_FILE_SLASH = "file://";
const char * const SCHEME_BOX_SLASH = "box://";
-const char * const DATA_STRING = "data:";
-const char * const BASE64_STRING = ";base64,";
const char * const BLANK_PAGE_URL = "about:blank";
const char * const HTML_MIME = "text/html";
const char * const PHP_MIME = "application/x-php";
#ifdef CORS_WHITELISTING_ENABLED
const char * const warpAllowProtocolsForWildcard[] = { "http", "https" };
#endif
-
-static bool m_initWebApp = false;
-
-Tizen::Base::ByteBuffer *DecryptChunkByTrustZone(
- Tizen::Base::ByteBuffer *appInfo,
- const unsigned char *inBuffer,
- int inBufSize)
-{
- using namespace Tizen::Base;
-
- if (!m_initWebApp) {
- char* pAppId = null;
- pAppId = (char*)calloc(appInfo->GetRemaining()+1, 1);
- memcpy(pAppId, appInfo->GetPointer(), appInfo->GetRemaining());
-
- InitWebAppInfo(pAppId, "");
- free (pAppId);
- m_initWebApp = true;
- }
-
- Tizen::Security::Crypto::_TrustZoneService* pInstance;
- pInstance = Tizen::Security::Crypto::_TrustZoneService::GetInstance();
-
- ByteBuffer pBuf;
- pBuf.Construct(inBufSize);
- const byte *pByte = reinterpret_cast<const byte*>(inBuffer);
-
- if (pBuf.SetArray(pByte, 0, inBufSize) != E_SUCCESS) {
- LogDebug("Couldnot set pBuf");
- return NULL;
- }
-
- pBuf.Flip();
-
- return pInstance->_TrustZoneService::DecryptN(*appInfo, pBuf);
-}
-
}
Bundle::Bundle(WKBundleRef bundle) :
m_encodedBundle(""),
m_theme(""),
m_willRemoveContext(NULL),
- m_encrypted(false),
m_widgetType(WrtDB::APP_TYPE_UNKNOWN),
m_securityModelVersion(
WrtDB::WidgetSecurityModelVersion::WIDGET_SECURITY_MODEL_V1),
- m_initialized(false)
+ m_initialized(false),
+ m_decryptionSupport(new InjectedBundle::DecryptionSupport())
{
LOG_PROFILE_START("Bundle attachToThread");
WrtDB::WrtDatabase::attachToThreadRO();
willSendRequestForFrameCallback, /* willSendRequestForFrame */
0, /* didReceiveResponseForResource */
0, /* didReceiveContentLengthForResource */
- didFinishLoadForResourceCallback, /* didFinishLoadForResource */
+ 0, /* didFinishLoadForResource */
0, /* didFailLoadForResource */
0, /* shouldCacheResponse */
0, /* shouldUseCredentialStorage */
{
LogDebug("got message type: " << toString(messageName).c_str());
if (WKStringIsEqualToUTF8CString(messageName,
- BundleMessages::START))
+ Message::ToInjectedBundle::START))
{
if (!messageBody || WKStringGetTypeID() != WKGetTypeID(messageBody)) {
LogError("Wrong message format received, ignoring");
return;
}
- auto msgString = toString(static_cast<WKStringRef>(messageBody));
+ std::string msgString =
+ toString(static_cast<WKStringRef>(messageBody));
LogDebug("Got message text: " << msgString);
LogDebug("loading Page : " << m_pagesList.back() <<
" loading JSContext : " <<
ssMsg >> argScale;
ssMsg >> argEncodedBundle;
ssMsg >> argTheme;
- ssMsg >> m_encrypted;
- LogWarning("m_encrypted : " << m_encrypted);
// ** Language tags setting completed **
fixWKMessageArgs(argScale, argEncodedBundle, argTheme);
} else if (WKStringIsEqualToUTF8CString(messageName,
- BundleMessages::SHUTDOWN))
+ Message::ToInjectedBundle::SHUTDOWN))
{
LogDebug("shutdown plugins");
}
}
else if (WKStringIsEqualToUTF8CString(messageName,
- BundleMessages::SET_CUSTOM_PROPERTIES))
+ Message::ToInjectedBundle::SET_CUSTOM_PROPERTIES))
{
LogDebug("reset custom properties of window objects");
// set information from ui process
- auto msgString = toString(static_cast<WKStringRef>(messageBody));
+ std::string msgString =
+ toString(static_cast<WKStringRef>(messageBody));
std::string argScale;
std::string argEncodedBundle;
}
} else if (WKStringIsEqualToUTF8CString(
messageName,
- BundleMessages::DISPATCH_JAVASCRIPT_EVENT))
+ Message::ToInjectedBundle::DISPATCH_JS_EVENT))
{
LogDebug("dispatch javascript event to created frames");
+ using namespace WrtPlugins::W3C;
+
// set information from ui process
- auto text = toString(static_cast<WKStringRef>(messageBody));
+ std::string text = toString(static_cast<WKStringRef>(messageBody));
int eventType;
- void *args = NULL;
+ SoftKeyboardChangeArgs softKeyboardArgs;
+
std::stringstream ss(text);
ss >> eventType;
- using namespace WrtPlugins::W3C;
- // set arguments to be sent to js handler of this custom event
- if (eventType == SoftKeyboardChangeCustomEvent) {
- args = new SoftKeyboardChangeArgs;
- ss >> static_cast<SoftKeyboardChangeArgs *>(args)->state;
- ss >> static_cast<SoftKeyboardChangeArgs *>(args)->width;
- ss >> static_cast<SoftKeyboardChangeArgs *>(args)->height;
+ if (eventType == SoftKeyboardChangeCustomEvent)
+ {
+ ss >> softKeyboardArgs.state;
+ ss >> softKeyboardArgs.width;
+ ss >> softKeyboardArgs.height;
}
//apply for each context
PageGlobalContextContainer::const_iterator it = m_pageGlobalContext.begin();
- for (; it != m_pageGlobalContext.end(); ++it) {
- PluginModule::dispatchJavaScriptEvent(
- it->second,
- static_cast<WrtPlugins::W3C::CustomEventType>(eventType),
- args);
- }
- if (args) {
- delete static_cast<SoftKeyboardChangeArgs *>(args);
+ for (; it != m_pageGlobalContext.end(); ++it)
+ {
+ if (eventType == SoftKeyboardChangeCustomEvent)
+ {
+ DispatchEventSupport::dispatchSoftKeyboardChangeEvent(it->second,
+ softKeyboardArgs.state,
+ softKeyboardArgs.width,
+ softKeyboardArgs.height);
+ }
}
} else if (WKStringIsEqualToUTF8CString(
messageName,
- BundleMessages::INIT))
+ Message::ToInjectedBundle::INIT))
{
- LogDebug("initializing plugins");
-
- if (!m_initialized)
- {
- auto msgString = toString(static_cast<WKStringRef>(messageBody));
+ LogDebug("initialize");
+ if (!m_initialized) {
+ std::string msgString = toString(static_cast<WKStringRef>(messageBody));
m_widgetTizenId = DPL::FromASCIIString(msgString);
-
WrtDB::WidgetDAOReadOnly dao(m_widgetTizenId);
// process pool - set app_privilige
- if (UID_ROOT == getuid())
- {
+ if (UID_ROOT == getuid()) {
using namespace WrtDB::GlobalConfig;
std::string appPath;
#ifdef CORS_WHITELISTING_ENABLED
bypassCORSforWARPAccessList(dao);
#endif
+ m_decryptionSupport->initialize(m_widgetTizenId);
m_initialized = true;
- }
- else
- {
+ } else {
LogDebug("already initalized");
}
+ } else if (WKStringIsEqualToUTF8CString(
+ messageName,
+ Message::ToInjectedBundle::SET_XWINDOW_HANDLE))
+ {
+ std::string msgString =
+ toString(static_cast<WKStringRef>(messageBody));
+ LogDebug("set x window handle [" << msgString << "]");
+ IPCMessageSupport::setXwindowHandle(atoi(msgString.c_str()));
}
}
WKURLResponseRef /*response*/,
const void *clientInfo)
{
- LogDebug("willSendRequestForFrameCallback called");
Bundle* This = static_cast<Bundle*>(const_cast<void*>(clientInfo));
- return This->willSendRequestForFrame(request);
+ WKURLRequestRef ret = This->willSendRequestForFrame(request);
+
+ return ret;
}
void Bundle::didStartProvisionalLoadForFrameCallback(
WKURLRequestRef Bundle::willSendRequestForFrame(WKURLRequestRef request)
{
- LogDebug("willSendReq got " << toString(request).c_str());
- WKURLRef url = WKURLRequestCopyURL(request);
- WKStringRef urlStr = WKURLCopyString(url);
+ static bool logEnable = (getenv("WRT_WILL_SEND_REQUEST_LOG_ENABLE") != NULL);
- DPL::String dplurl = DPL::FromUTF8String(toString(urlStr));
- WKRelease(urlStr);
+ WKURLRef wkUrl = WKURLRequestCopyURL(request);
+ WKStringRef wkStr = WKURLCopyString(wkUrl);
- DPL::Optional<DPL::String> localizedUrl =
- InjectedBundleURIHandling::localizeURI(dplurl, m_widgetTizenId);
- bool ret =
- InjectedBundleURIHandling::processURI(*localizedUrl,
- m_widgetTizenId,
- m_securityModelVersion);
+ std::string stdUrl = Bundle::toString(wkStr);
+ std::string localizedUrl;
- if (!ret) {
- LogDebug("Not permitted resource: " << *localizedUrl);
+ WKRelease(wkStr);
+ WKRelease(wkUrl);
+
+ if (logEnable){ LogDebug("willSendRequestForFrame : " << stdUrl); }
+
+ localizedUrl = InjectedBundleURIHandling::localizeURI(stdUrl, DPL::ToUTF8String(m_widgetTizenId));
+ bool ret = InjectedBundleURIHandling::processURI(localizedUrl, m_widgetTizenId, m_securityModelVersion);
+
+ if (!ret)
+ {
+ LogDebug("Not permitted resource: " << localizedUrl);
return NULL;
}
- LogDebug("URI processing result: " << *localizedUrl);
- std::string tmpUrlStr = DPL::ToUTF8String(*localizedUrl);
- WKURLRef tmpUrl = WKURLCreateWithUTF8CString(tmpUrlStr.c_str());
- std::string scheme = toString(WKURLCopyScheme(url)); //scheme of original request
- WKRelease(url);
+ // log disabled for performance
+ //LogDebug("URI processing result: " << result);
+ std::string scheme = localizedUrl.substr(0, localizedUrl.find_first_of(':'));
#ifdef APP_SCHEME_ENABLED
- if(scheme == SCHEME_FILE) {
- LogError("File schema blocked for: " << dplurl);
+ if (scheme == SCHEME_FILE)
+ {
+ LogError("File schema blocked for: " << stdUrl);
return NULL;
}
#endif
// external scheme also need to send message to UI process for
// checking roaming and security
- if (scheme == SCHEME_HTTP || scheme == SCHEME_HTTPS) {
- LogDebug("external scheme return original WKURLRequestRef");
- WKRelease(tmpUrl);
+
+ if (scheme == SCHEME_HTTP || scheme == SCHEME_HTTPS)
+ {
+ if (logEnable){ LogDebug("external scheme return original WKURLRequestRef"); }
WKRetain(request);
+
return request;
- } else {
- std::string checkUrl = toString(tmpUrl);
-
- if (m_encrypted) {
- int getFileSize;
- if (isEncryptedResource(checkUrl, getFileSize)) {
- std::string decryptString = DecryptResource(checkUrl,
- getFileSize);
- if (!decryptString.empty()) {
- std::string destString = DATA_STRING;
-
- std::string mimeString =
- DPL::ToUTF8String(
- MimeTypeUtils::identifyFileMimeType(
- DPL::FromUTF8String(checkUrl)));
-
- destString += mimeString;
- destString += BASE64_STRING;
-
- decryptString.insert(0, destString);
-
- WKURLRef destUrl =
- WKURLCreateWithUTF8CString(decryptString.c_str());
-
- WKURLRequestRef req = WKURLRequestCreateWithWKURL(
- destUrl);
- WKRelease(destUrl);
- LogDebug("return value " << decryptString << "]]");
- return req;
- }
- }
+ }
+ else
+ {
+ std::string checkUrl = localizedUrl;
+
+ if (m_decryptionSupport->isNeedDecryption(checkUrl))
+ {
+ std::string decryptString =
+ m_decryptionSupport->decryptResource(checkUrl);
+
+ if (logEnable){ LogDebug("return value : " << decryptString ); }
+
+ WKURLRef destUrl =
+ WKURLCreateWithUTF8CString(decryptString.c_str());
+ WKURLRequestRef req = WKURLRequestCreateWithWKURL(destUrl);
+ WKRelease(destUrl);
+
+ return req;
}
- WKURLRequestRef req = WKURLRequestCreateWithWKURL(tmpUrl);
- WKRelease(tmpUrl);
- LogDebug("return value " << toString(req).c_str());
- return req;
}
+
+ WKURLRef newUrl = WKURLCreateWithUTF8CString(localizedUrl.c_str());
+ WKURLRequestRef req = WKURLRequestCreateWithWKURL(newUrl);
+ WKRelease(newUrl);
+
+ if (logEnable){ LogDebug("return value : " << localizedUrl); }
+
+ return req;
}
WKBundlePagePolicyAction Bundle::decidePolicyForAction(
// Send information about blocked URI to UIProcess
WKStringRef urlStr = WKStringCreateWithUTF8CString(blockedUrl.c_str());
WKTypeRef retVal = NULL;
- WKStringRef blockMessage = WKStringCreateWithUTF8CString(uriBlockedMessageName);
+ WKStringRef blockMessage =
+ WKStringCreateWithUTF8CString(Message::ToUIProcess::BLOCKED_URL);
WKBundlePostSynchronousMessage(m_bundle, blockMessage, urlStr, &retVal);
WKRelease(urlStr);
WKRelease(retVal);
std::string Bundle::toString(WKStringRef str)
{
- if (WKStringIsEmpty(str)) {
- return std::string();
+ if (WKStringIsEmpty(str))
+ {
+ return "";
+ }
+ else
+ {
+ size_t size = WKStringGetMaximumUTF8CStringSize(str);
+
+ char buffer[size + 1];
+ WKStringGetUTF8CString(str, buffer, sizeof(buffer));
+
+ return buffer;
}
- size_t size = WKStringGetMaximumUTF8CStringSize(str);
- char buffer[size + 1];
- WKStringGetUTF8CString(str, buffer, size + 1);
- return buffer;
}
std::string Bundle::toString(WKURLRef url)
return str;
}
-bool Bundle::isEncryptedResource(std::string Url, int &size)
-{
- if (m_encryptedFiles.empty()) {
- WrtDB::WidgetDAOReadOnly(m_widgetTizenId).
- getEncryptedFileList(m_encryptedFiles);
- }
-
- std::set<WrtDB::EncryptedFileInfo>::iterator it;
- WrtDB::EncryptedFileInfo info;
- std::string filePath;
-
- if (0 != strncmp(Url.c_str(), SCHEME_FILE_SLASH, strlen(SCHEME_FILE_SLASH))) {
- return false;
- }
-
- filePath = Url.substr(strlen(SCHEME_FILE_SLASH));
- info.fileName = DPL::FromUTF8String(filePath);
-
- if (m_encryptedFiles.end() != (it = m_encryptedFiles.find(info)))
- {
- LogDebug(" info file name : " << it->fileName);
- LogDebug(" info file size : " << it->fileSize);
- size = it->fileSize;
- return true;
- }
- return false;
-}
-
-std::string Bundle::DecryptResource(std::string resource, int size)
-{
- std::string filePath;
-
- size_t pos = resource.find_first_not_of(SCHEME_FILE_SLASH);
- if (std::string::npos != pos) {
- filePath = resource.substr(pos - 1);
- }
-
- struct stat buf;
- if (0 == stat(filePath.c_str(), &buf)) {
- const std::size_t fileSize = buf.st_size;
- std::unique_ptr<unsigned char[]> inChunk;
-
- FILE* fp = fopen(filePath.c_str(), "rb");
- if (NULL == fp) {
- LogDebug("Couldnot open file : " << filePath);
- return std::string();
- }
-
- std::unique_ptr<unsigned char[]> DecryptedString(new unsigned
- char[fileSize]);
- std::string pkgid(DPL::ToUTF8String(m_widgetTizenId));
-
- using namespace Tizen::Base;
- const byte *b_pkgid = reinterpret_cast<const byte*>(pkgid.c_str());
- ByteBuffer appInfo;
- appInfo.Construct(pkgid.length());
- if (appInfo.SetArray(b_pkgid, 0, pkgid.length()) != E_SUCCESS) {
- LogDebug("Couldnot set appInfo");
- fclose(fp);
- return std::string();
- }
- appInfo.Flip();
-
- int writeCount = 0;
- do {
- unsigned char getDecSize[4];
- memset(getDecSize, 0x00, sizeof(getDecSize));
-
- size_t readSize = fread(getDecSize, sizeof(unsigned char),
- sizeof(getDecSize), fp);
- if (0 != readSize) {
- int readBufSize = 0;
- std::istringstream(std::string((char*)getDecSize)) >> readBufSize;
- inChunk.reset(new unsigned char[readBufSize]);
-
- size_t decReadSize = fread(inChunk.get(), sizeof(unsigned char),
- readBufSize, fp);
- if (0 != decReadSize) {
- ByteBuffer *getBuffer =
- DecryptChunkByTrustZone(&appInfo, inChunk.get(),
- decReadSize);
- memcpy(DecryptedString.get() + writeCount,
- getBuffer->GetPointer(), getBuffer->GetRemaining());
- writeCount += getBuffer->GetRemaining();
- getBuffer->Reset();
- }
- }
-
- } while( 0 == std::feof(fp));
- fclose(fp);
-
- memset(DecryptedString.get() + size, '\n', fileSize - size);
- LogDebug("resource need to encoding base64");
- BIO *bmem, *b64;
- BUF_MEM *bptr;
-
- b64 = BIO_new(BIO_f_base64());
- bmem = BIO_new(BIO_s_mem());
- b64 = BIO_push(b64, bmem);
- BIO_write(b64, DecryptedString.get(), fileSize);
- BIO_flush(b64);
- BIO_get_mem_ptr(b64, &bptr);
-
- std::string base64Enc((char *)bptr->data, bptr->length - 1);
- BIO_free_all(b64);
-
- return base64Enc;
- }
- return std::string();
-}
-
#ifdef MULTIPROCESS_SERVICE_SUPPORT_INLINE
void Bundle::sendWebProcessPid()
{
strPid << getpid();
WKStringRef pidStr = WKStringCreateWithUTF8CString(strPid.str().c_str());
WKTypeRef retVal = NULL;
- WKStringRef message = WKStringCreateWithUTF8CString(webProcessPidMessageName);
+ WKStringRef message =
+ WKStringCreateWithUTF8CString(
+ Message::ToUIProcess::SEND_WEBPROCESS_PID);
WKBundlePostSynchronousMessage(m_bundle, message, pidStr, &retVal);
WKRelease(pidStr);
WKRelease(retVal);
{
setpriority(PRIO_PROCESS, 0, DEFAULT_PRIORITY);
}
+ IPCMessageSupport::setWKBundleRef(bundle);
}
}
#define WRT_SRC_VIEW_WEBKIT_WRT_INJECTED_BUNDLE_H_
#include <map>
+#include <memory>
#include <set>
#include <list>
#include <string>
WK_EXPORT void WKBundleInitialize(WKBundleRef bundle, WKTypeRef);
}
+namespace InjectedBundle {
+class DecryptionSupport;
+}
+
class Bundle
{
public:
std::string m_theme;
std::set<JSGlobalContextRef> m_loadedContext;
JSGlobalContextRef m_willRemoveContext;
- bool m_encrypted;
- WrtDB::EncryptedFileList m_encryptedFiles;
WrtDB::WidgetType m_widgetType;
WrtDB::WidgetSecurityModelVersion m_securityModelVersion;
bool m_initialized;
+ std::unique_ptr<InjectedBundle::DecryptionSupport> m_decryptionSupport;
+
// WKBundlePageResourceLoadClient callback
static WKURLRequestRef willSendRequestForFrameCallback(
WKBundlePageRef,
WKTypeRef* userData);
// basic
- static std::string toString(WKStringRef str);
- static std::string toString(WKURLRef url);
- static std::string toString(WKURLRequestRef req);
- static std::string toString(WKErrorRef err);
+ inline static std::string toString(WKStringRef str);
+ inline static std::string toString(WKURLRef url);
+ inline static std::string toString(WKURLRequestRef req);
+ inline static std::string toString(WKErrorRef err);
static std::string getScheme(std::string uri);
bool isEncryptedResource(std::string Url, int &size);
#include <widget_model.h>
#include <system_settings.h>
#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
-#include <dpl/wrt-dao-ro/vconf_config.h>
#include <dpl/utils/wrt_global_settings.h>
#include <common/application_data.h>
#include <common/application_launcher.h>
+#include <common/message_support.h>
#include <common/scheme.h>
#include <common/view_logic_apps_support.h>
#include <common/view_logic_certificate_support.h>
#include <common/view_logic_storage_support.h>
#include <common/view_logic_uri_support.h>
-#include <common/view_logic_user_agent_support.h>
#include <common/view_logic_vibration_support.h>
#include <view_logic_authentication_challenge_support.h>
#include <view_logic_certificate_confirm_support.h>
#include <view_logic_geolocation_support.h>
+#include <view_logic_message_support.h>
+#include <view_logic_orientation_support.h>
#include <view_logic_scheme_support.h>
#include <view_logic_usermedia_support.h>
#include <view_logic_web_notification_support.h>
#include <view_logic_web_storage_support.h>
-#include "injected-bundle/plugin_module_support.h"
#include <EWebKit2.h>
#include <dpl/localization/w3c_file_localization.h>
#endif
namespace {
-const char * const uriBlockedMessageName = "uri_blocked_msg";
-#ifdef MULTIPROCESS_SERVICE_SUPPORT_INLINE
-const char * const webProcessPidMessageName = "web_process_pid_msg";
-#endif
-
// IME State value
const char * const IME_STATE_ON = "on";
const char * const IME_STATE_OFF = "off";
{ "load,started", &ViewLogic::loadStartedCallback },
{ "load,finished", &ViewLogic::loadFinishedCallback },
{ "title,changed", &ViewLogic::titleChangedCallback },
+ { "load,progress,started", &ViewLogic::loadProgressStartedCallback },
{ "load,progress", &ViewLogic::loadProgressCallback },
{ "load,progress,finished", &ViewLogic::loadProgressFinishedCallback },
{ "process,crashed", &ViewLogic::processCrashedCallback },
{ "authentication,challenge",
&ViewLogic::authenticationChallengeRequestCallback },
{ "frame,rendered",
- &ViewLogic::viewFrameRenderedCallback }
+ &ViewLogic::viewFrameRenderedCallback },
+ { "mediacontrol,rotate,horizontal",
+ &ViewLogic::mediacontrolRotateHorizontal },
+ { "mediacontrol,rotate,vertical",
+ &ViewLogic::mediacontrolRotateVertical },
+ { "mediacontrol,rotate,exit",
+ &ViewLogic::mediacontrolRotateExit }
};
ViewLogic::ViewLogic() :
m_imeHeight(0),
m_isBackgroundReload(false),
m_isBackgroundSupport(false),
+ m_rotateAngle(0),
m_appsSupport(new ViewModule::AppsSupport()),
m_vibrationSupport(new ViewModule::VibrationSupport())
{
m_window = window;
Evas* canvas = evas_object_evas_get(m_window);
- return createEwkView(canvas);
+
+ if (!createEwkView(canvas)) {
+ return false;
+ }
+
+ elm_access_object_register(m_currentEwkView, window);
+ return true;
}
#ifdef MULTIPROCESS_SERVICE_SUPPORT_INLINE
prepareEwkView(m_currentEwkView);
ADD_PROFILING_POINT("prepareEwkView", "stop");
initializePluginLoading();
+ initializeXwindowHandle();
}
void ViewLogic::showWidget()
void ViewLogic::fireJavascriptEvent(int event, void* data)
{
- PluginModuleSupport::dispatchJavaScriptEvent(
+ ViewLogicMessageSupport::dispatchJavaScriptEvent(
m_ewkContext,
static_cast<WrtPlugins::W3C::CustomEventType>(event),
data);
{
LogDebug("didReceiveSynchronousMessage called");
Assert(name);
- Assert(returnData);
LogDebug("received : " << name);
- std::string result;
- if (!strcmp(name, uriBlockedMessageName)) {
+
+ if (!strcmp(name, Message::ToUIProcess::BLOCKED_URL)) {
// Currently WebProcess informs obly about blocked
// URI - URI localization and security chekcs are
// done by WebProcess itself (see: wrt-injected-bundle.cpp
requestUrlBlocked(std::string(body));
}
#ifdef MULTIPROCESS_SERVICE_SUPPORT_INLINE
- else if (!strcmp(name, webProcessPidMessageName)) {
+ else if (!strcmp(name, Message::ToUIProcess::SEND_WEBPROCESS_PID)) {
std::stringstream ss(body);
unsigned int pid = 0;
ss >> pid;
pid);
}
#endif
-
- *returnData = strdup(result.c_str());
+ else if (!strcmp(name, Message::TizenScheme::GET_WINDOW_HANDLE)) {
+ if (m_window) {
+ Ecore_X_Window handle = elm_win_xwindow_get(m_window);
+ if (handle != 0) {
+ std::stringstream ss;
+ ss << handle;
+ std::string ret = ss.str();
+ if (returnData) {
+ *returnData = strdup(ret.c_str());
+ }
+ } else {
+ LogInfo("X window isn't exist");
+ }
+ }
+ }
}
void ViewLogic::downloadData(const char* url)
m_schemeSupport.reset(new SchemeSupport(m_model->Type.Get().appType));
ViewModule::StorageSupport::initializeStorage(m_model);
- m_appsSupport->initialize(m_model);
+ m_appsSupport->initialize(m_model, elm_win_xwindow_get(m_window));
m_securityOriginSupport.reset(new ViewModule::SecurityOriginSupport(m_model));
m_certificateSupport.reset(new ViewModule::CertificateSupport(m_model));
m_vibrationSupport->initialize();
void ViewLogic::initializePluginLoading()
{
// inform wrt information for plugin loading to web process
- PluginModuleSupport::start(
+ ViewLogicMessageSupport::start(
m_ewkContext,
m_model->TizenId,
elm_config_scale_get(),
ApplicationDataSingleton::Instance().getEncodedBundle(),
- m_theme.c_str(),
- m_model->SettingList.Get().isEncrypted());
+ m_theme.c_str());
+}
+
+void ViewLogic::initializeXwindowHandle()
+{
+ if (m_window) {
+ unsigned int handle = elm_win_xwindow_get(m_window);
+ ViewLogicMessageSupport::setXwindowHandle(
+ m_ewkContext,
+ handle);
+ }
}
void ViewLogic::ewkClientInit(Evas_Object *wkView)
// set user agent
std::string customUserAgent = m_model->SettingList.Get().getUserAgent();
if (customUserAgent.empty()) {
- auto userAgentString =
- ViewModule::UserAgentSupport::getUserAgentFromVconf();
- if (!userAgentString.empty()) {
- LogDebug("Setting user agent as: " << userAgentString);
- ewk_view_user_agent_set(wkView, userAgentString.c_str());
- }
- else
- {
- ewk_view_user_agent_set(wkView, NULL);
- LogDebug("Setting user agent as: default");
-
- std::string defaultUA = ewk_view_user_agent_get(wkView);
- LogDebug("webkit's UA: " << defaultUA);
- }
+ LogDebug("Setting user agent as: default");
+ ewk_view_user_agent_set(wkView, NULL);
+ std::string defaultUA = ewk_view_user_agent_get(wkView);
+ LogDebug("webkit's UA: " << defaultUA);
} else {
LogDebug("Setting custom user agent as: " << customUserAgent);
ewk_view_user_agent_set(wkView, customUserAgent.c_str());
LogDebug("loadStartedCallback called");
Assert(data);
ViewLogic* This = static_cast<ViewLogic*>(data);
- evas_object_focus_set(This->m_currentEwkView, EINA_TRUE);
// call loadFinish callback to wrt-client
if (!This->m_cbs->loadStart.empty()) {
LogDebug("loadFinishedCallback called");
Assert(data);
ViewLogic* This = static_cast<ViewLogic*>(data);
+ evas_object_focus_set(This->m_currentEwkView, EINA_TRUE);
// Fill id/password
const char* url = ewk_view_url_get(This->m_currentEwkView);
// set only encoded bundle
double scale = elm_config_scale_get();
- PluginModuleSupport::setCustomProperties(
+ ViewLogicMessageSupport::setCustomProperties(
This->m_ewkContext,
&scale,
ApplicationDataSingleton::Instance().getEncodedBundle());
- // check if 'appsevice' event is registed at the current frames.
- // If so, dispatch the event to frames.
- PluginModuleSupport::dispatchJavaScriptEvent(
- This->m_ewkContext,
- WrtPlugins::W3C::ServiceCustomEvent,
- NULL);
// In this case, widget is reloaded in the background.
// After finished load, bundle should disconnent callback.
}
}
+void ViewLogic::loadProgressStartedCallback(
+ void* data,
+ Evas_Object* /*obj*/,
+ void* /*eventInfo*/)
+{
+ LogDebug("loadProgressStartedCallback called");
+ Assert(data);
+ ViewLogic* This = static_cast<ViewLogic*>(data);
+ if (!This->m_cbs->progressStarted.empty()) {
+ This->m_cbs->progressStarted();
+ }
+}
+
+
void ViewLogic::loadProgressCallback(
void* data,
Evas_Object* obj,
Ewk_Geolocation_Permission_Request* permissionRequest =
static_cast<Ewk_Geolocation_Permission_Request*>(eventInfo);
- if (This->m_securityOriginSupport->isNeedPermissionCheck(
- WrtDB::FEATURE_GEOLOCATION)
- == WrtDB::SETTINGS_TYPE_OFF)
- {
+ if (This->m_model->GeolocationUsage.Get() == WrtDB::SETTINGS_TYPE_OFF) {
ewk_geolocation_permission_request_set(permissionRequest, EINA_FALSE);
return;
}
ViewModule::GeolocationSupport::geolocationPermissionRequest(
- This->m_window,
+ This->m_currentEwkView,
This->m_securityOriginSupport->getSecurityOriginDAO(),
eventInfo);
}
LogDebug("notificationPermissionRequestCallback called");
Assert(data);
ViewLogic* This = static_cast<ViewLogic*>(data);
- if (This->m_securityOriginSupport->isNeedPermissionCheck(
- WrtDB::FEATURE_WEB_NOTIFICATION)
- == WrtDB::SETTINGS_TYPE_OFF)
- {
+ if (This->m_model->WebNotificationUsage.Get() == WrtDB::SETTINGS_TYPE_OFF) {
Ewk_Notification_Permission_Request* request =
static_cast<Ewk_Notification_Permission_Request*>(eventInfo);
ewk_notification_permission_request_set(
Assert(eventInfo);
ViewModule::WebNotification::webNotificationPermissionRequest(
- This->m_window,
+ This->m_currentEwkView,
This->m_securityOriginSupport->getSecurityOriginDAO(),
eventInfo);
return;
// EWK Orientation Callback
Eina_Bool ViewLogic::orientationLockCallback(
Evas_Object* obj,
- Eina_Bool /*needLock*/,
+ Eina_Bool needLock,
int orientation,
void* data)
{
LogDebug("orientationLockCallback called");
Assert(data);
ViewLogic* This = static_cast<ViewLogic*>(data);
+ This->m_rotateAngle = orientation;
- if (orientation & EWK_SCREEN_ORIENTATION_PORTRAIT_PRIMARY) {
- LogDebug("orientation is portrait-primary");
- elm_win_wm_rotation_preferred_rotation_set(
- This->m_window,
- OrientationAngle::Window::Portrait::PRIMARY);
- ewk_view_orientation_send(obj, OrientationAngle::W3C::Portrait::PRIMARY);
- } else if (orientation & EWK_SCREEN_ORIENTATION_LANDSCAPE_PRIMARY) {
- LogDebug("orientation is landscape-primary");
- elm_win_wm_rotation_preferred_rotation_set(
+ if (needLock == EINA_TRUE) {
+ // Screen.lockOrientation
+ ViewModule::OrientationSupport::setOrientation(
This->m_window,
- OrientationAngle::Window::Landscape::PRIMARY);
- ewk_view_orientation_send(
obj,
- OrientationAngle::W3C::Landscape::PRIMARY);
- } else if (orientation & EWK_SCREEN_ORIENTATION_PORTRAIT_SECONDARY) {
- LogDebug("orientation is portrait-secondary");
- elm_win_wm_rotation_preferred_rotation_set(
- This->m_window,
- OrientationAngle::Window::Portrait::SECONDARY);
- ewk_view_orientation_send(
- obj,
- OrientationAngle::W3C::Portrait::SECONDARY);
- } else if (orientation & EWK_SCREEN_ORIENTATION_LANDSCAPE_SECONDARY) {
- LogDebug("orientation is landscape-secondary");
- elm_win_wm_rotation_preferred_rotation_set(
- This->m_window,
- OrientationAngle::Window::Landscape::SECONDARY);
- ewk_view_orientation_send(
- obj,
- OrientationAngle::W3C::Landscape::SECONDARY);
+ orientation);
} else {
- LogDebug("Wrong orientation is set");
- return EINA_FALSE;
+ // Screen.unlockOrientation
+ if (This->m_model->SettingList.Get().getRotationValue() ==
+ Screen_AutoRotation)
+ {
+ elm_win_wm_rotation_preferred_rotation_set(
+ This->m_window,
+ OrientationAngle::Window::UNLOCK);
+ This->m_rotateAngle = 0;
+ }
}
return EINA_TRUE;
}
This->fireJavascriptEvent(
static_cast<int>(SoftKeyboardChangeCustomEvent),
&args);
+
+ if (!This->m_cbs->editorClientIme.empty()) {
+ This->m_cbs->editorClientIme(true);
+ }
}
void ViewLogic::imeClosedCallback(
using namespace WrtPlugins::W3C;
SoftKeyboardChangeArgs args;
args.state = IME_STATE_OFF;
-
This->fireJavascriptEvent(
static_cast<int>(SoftKeyboardChangeCustomEvent),
&args);
+ if (!This->m_cbs->editorClientIme.empty()) {
+ This->m_cbs->editorClientIme(false);
+ }
}
void ViewLogic::usermediaPermissionRequestCallback(
Assert(data);
ViewLogic* This = static_cast<ViewLogic*>(data);
ViewModule::UsermediaSupport::usermediaPermissionRequest(
- This->m_window,
+ This->m_currentEwkView,
This->m_securityOriginSupport->getSecurityOriginDAO(),
eventInfo);
}
ViewLogic* This = static_cast<ViewLogic*>(data);
Assert(obj);
- if (This->m_securityOriginSupport->isNeedPermissionCheck(
- WrtDB::FEATURE_WEB_DATABASE) ==
- WrtDB::SETTINGS_TYPE_OFF)
- {
+ if (This->m_model->WebStorageUsage.Get() == WrtDB::SETTINGS_TYPE_OFF) {
ewk_view_exceeded_database_quota_reply(obj, EINA_FALSE);
return EINA_TRUE;
}
ViewModule::WebStorageSupport::createPermissionRequest(
- This->m_window,
+ This->m_currentEwkView,
This->m_securityOriginSupport->getSecurityOriginDAO(),
obj,
origin,
ViewLogic* This = static_cast<ViewLogic*>(data);
Assert(obj);
- if (This->m_securityOriginSupport->isNeedPermissionCheck(
- WrtDB::FEATURE_WEB_DATABASE) ==
- WrtDB::SETTINGS_TYPE_OFF)
- {
- ewk_view_exceeded_database_quota_reply(obj, EINA_FALSE);
+ if (This->m_model->WebStorageUsage.Get() == WrtDB::SETTINGS_TYPE_OFF) {
+ ewk_view_exceeded_indexed_database_quota_reply(obj, EINA_FALSE);
return EINA_TRUE;
}
ViewModule::WebStorageSupport::createPermissionRequest(
- This->m_window,
+ This->m_currentEwkView,
This->m_securityOriginSupport->getSecurityOriginDAO(),
obj,
origin,
ViewLogic* This = static_cast<ViewLogic*>(data);
Assert(obj);
- if (This->m_securityOriginSupport->isNeedPermissionCheck(
- WrtDB::FEATURE_WEB_DATABASE) ==
- WrtDB::SETTINGS_TYPE_OFF)
- {
- ewk_view_exceeded_database_quota_reply(obj, EINA_FALSE);
+
+ if (This->m_model->WebStorageUsage.Get() == WrtDB::SETTINGS_TYPE_OFF) {
+ ewk_view_exceeded_local_file_system_quota_reply(obj, EINA_FALSE);
return EINA_TRUE;
}
ViewModule::WebStorageSupport::createPermissionRequest(
- This->m_window,
+ This->m_currentEwkView,
This->m_securityOriginSupport->getSecurityOriginDAO(),
obj,
origin,
ViewLogic* This = static_cast<ViewLogic*>(data);
Assert(eventInfo);
ViewModule::CertificateConfirmSupport::certificatePermissionRequest(
- This->m_window,
+ This->m_currentEwkView,
This->m_certificateSupport->getCertificateDAO(),
eventInfo);
}
LogInfo("enter");
}
+void ViewLogic::mediacontrolRotateHorizontal(void* data,
+ Evas_Object* obj,
+ void* /*eventInfo*/)
+{
+ LogInfo("mediacontrolRotateHorizontal called");
+ Assert(data);
+ Assert(obj);
+ ViewLogic* This = static_cast<ViewLogic*>(data);
+ ViewModule::OrientationSupport::setOrientation(
+ This->m_window,
+ obj,
+ ViewModule::OrientationSupport::Mode::LANDSCAPE_PRIMARY);
+}
+
+void ViewLogic::mediacontrolRotateVertical(void* data,
+ Evas_Object* obj,
+ void* /*eventInfo*/)
+{
+ LogInfo("mediacontrolRotateVertical called");
+ Assert(data);
+ Assert(obj);
+ ViewLogic* This = static_cast<ViewLogic*>(data);
+ ViewModule::OrientationSupport::setOrientation(
+ This->m_window,
+ obj,
+ ViewModule::OrientationSupport::Mode::PORTRAIT_PRIMARY);
+}
+
+void ViewLogic::mediacontrolRotateExit(void* data,
+ Evas_Object* obj,
+ void* /*eventInfo*/)
+{
+ LogInfo("mediacontrolRotateExit called");
+ Assert(data);
+ Assert(obj);
+ ViewLogic* This = static_cast<ViewLogic*>(data);
+ if (This->m_rotateAngle == 0) {
+ // application hasn't call orientation lock
+ WidgetSettingScreenLock screenLock =
+ This->m_model->SettingList.Get().getRotationValue();
+ if (screenLock == Screen_Portrait) {
+ ViewModule::OrientationSupport::setOrientation(
+ This->m_window,
+ obj,
+ ViewModule::OrientationSupport::Mode::PORTRAIT_PRIMARY);
+ } else if (screenLock == Screen_Landscape) {
+ ViewModule::OrientationSupport::setOrientation(
+ This->m_window,
+ obj,
+ ViewModule::OrientationSupport::Mode::LANDSCAPE_PRIMARY);
+ } else if (screenLock == Screen_AutoRotation) {
+ elm_win_wm_rotation_preferred_rotation_set(
+ This->m_window,
+ OrientationAngle::Window::UNLOCK);
+ }
+ } else {
+ // Restore previous orientation
+ ViewModule::OrientationSupport::setOrientation(
+ This->m_window,
+ obj,
+ This->m_rotateAngle);
+ }
+}
+
void ViewLogic::requestUrlBlocked(const std::string& blockedUrl)
{
LogInfo("enter");
// block this page and open it in browser
LogDebug("Request was blocked : " << blockedUrl);
- bundle* bundleData = bundle_create();
- appsvc_set_operation(bundleData, APPSVC_OPERATION_VIEW);
- appsvc_set_uri(bundleData, blockedUrl.c_str());
+ service_h serviceHandle = NULL;
+ service_create(&serviceHandle);
+ service_set_operation(serviceHandle, SERVICE_OPERATION_VIEW);
+ service_set_uri(serviceHandle, blockedUrl.c_str());
CONTROLLER_POST_EVENT(
ApplicationLauncher,
ApplicationLauncherEvents::LaunchApplicationByAppService(
- bundleData,
+ serviceHandle,
NULL,
NULL));
-
// set block url. This is used on load finished callback
m_blockedUri = blockedUrl;
}
private:
void initializeSupport();
void initializePluginLoading();
+ void initializeXwindowHandle();
// EwkView operations
void ewkClientInit(Evas_Object *wkView);
void* data,
Evas_Object* obj,
void* eventInfo);
+ static void loadProgressStartedCallback(
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo);
static void loadProgressCallback(
void* data,
Evas_Object* obj,
Evas_Object* obj,
void* eventInfo);
+ static void mediacontrolRotateHorizontal(void* data,
+ Evas_Object* obj,
+ void* eventInfo);
+ static void mediacontrolRotateVertical(void* data,
+ Evas_Object* obj,
+ void* eventInfo);
+ static void mediacontrolRotateExit(void* data,
+ Evas_Object* obj,
+ void* eventInfo);
+
#ifdef MULTIPROCESS_SERVICE_SUPPORT_INLINE
static int appServiceCallerIsKilled(void *data);
#endif
size_t m_imeHeight;
bool m_isBackgroundReload;
bool m_isBackgroundSupport;
+ int m_rotateAngle;
std::unique_ptr<SchemeSupport> m_schemeSupport;
std::unique_ptr<ViewModule::AppsSupport> m_appsSupport;
* limitations under the License.
*/
/**
- * @file plugin_module_support.cpp
+ * @file view_logic_message_support.cpp
* @author Lukasz Wrzosek (l.wrzosek@samsung.com)
* @author Yunchan Cho (yunchan.cho@samsung.com)
- * @brief Plugin module support for Webkit2 - implementation.
+ * @brief View logic message support - implementation
*/
-#include "plugin_module_support.h"
-#include "messages_names.h"
+#include "view_logic_message_support.h"
#include <sstream>
#include <EWebKit2.h>
-#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
+#include <common/message_support.h>
#include <js_overlay_types.h>
-namespace PluginModuleSupport {
+namespace ViewLogicMessageSupport {
void init(Ewk_Context* ewkContext, const std::string& tizenId)
{
- const char* name = BundleMessages::INIT;
+ const char* name = Message::ToInjectedBundle::INIT;
const char* msg = tizenId.c_str();
ewk_context_message_post_to_injected_bundle(ewkContext, name, msg);
const DPL::String& tizenId,
double scale,
const char *encodedBundle,
- const char *theme,
- bool encrypted)
+ const char *theme)
{
std::stringstream ssMsg;
}
if (theme) {
- ssMsg << "_" << theme << " ";
+ ssMsg << "_" << theme;
} else {
- ssMsg << "null" << " ";
+ ssMsg << "null";
}
- ssMsg << encrypted;
-
std::string msgString = ssMsg.str();
const char* msg = msgString.c_str();
- const char* name = BundleMessages::START;
+ const char* name = Message::ToInjectedBundle::START;
ewk_context_message_post_to_injected_bundle(ewkContext, name, msg);
}
void shutdown(Ewk_Context* ewkContext)
{
- const char* name = BundleMessages::SHUTDOWN;
+ const char* name = Message::ToInjectedBundle::SHUTDOWN;
ewk_context_message_post_to_injected_bundle(ewkContext, name, name);
}
std::string msgString = ssMsg.str();
const char* msg = msgString.c_str();
- const char* name = BundleMessages::SET_CUSTOM_PROPERTIES;
+ const char* name = Message::ToInjectedBundle::SET_CUSTOM_PROPERTIES;
ewk_context_message_post_to_injected_bundle(ewkContext, name, msg);
}
std::string msgString = str.str();
const char* msg = msgString.c_str();
- const char* name = BundleMessages::DISPATCH_JAVASCRIPT_EVENT;
+ const char* name = Message::ToInjectedBundle::DISPATCH_JS_EVENT;
ewk_context_message_post_to_injected_bundle(ewkContext, name, msg);
}
-} //namespace PluginModuleSupport
+void setXwindowHandle(Ewk_Context* ewkContext, const unsigned int handle)
+{
+ const char* name = Message::ToInjectedBundle::SET_XWINDOW_HANDLE;
+ std::stringstream ssMsg;
+ ssMsg << handle;
+ std::string msgString = ssMsg.str();
+ const char* msg = msgString.c_str();
+
+ ewk_context_message_post_to_injected_bundle(ewkContext, name, msg);
+}
+} // namespace ViewLogicMessageSupport
\ No newline at end of file
* limitations under the License.
*/
/**
- * @file plugin_module_support.h
+ * @file view_logic_message_support.h
* @author Lukasz Wrzosek (l.wrzosek@samsung.com)
* @author Yunchan Cho (yunchan.cho@samsung.com)
- * @brief Plugin module support for Webkit2 - declaration.
+ * @brief View logic message support - declaration
*/
-#ifndef WRT_SRC_VIEW_WEBKIT2_PLUGIN_MODULE_SUPPORT_H_
-#define WRT_SRC_VIEW_WEBKIT2_PLUGIN_MODULE_SUPPORT_H_
+#ifndef VIEW_LOGIC_MESSAGE_SUPPORT_H_
+#define VIEW_LOGIC_MESSAGE_SUPPORT_H_
#include <EWebKit2.h>
#include <dpl/string.h>
#include <js_overlay_types.h>
-namespace PluginModuleSupport {
+namespace ViewLogicMessageSupport {
void init(Ewk_Context* ewkContext,
const std::string& tizenId);
void start(Ewk_Context* ewkContext,
const DPL::String& tizenId,
double scale,
const char *encodedBundle,
- const char *theme,
- bool encrypted);
+ const char *theme);
void shutdown(Ewk_Context* ewkContext);
void setCustomProperties(
Ewk_Context* ewkContext,
Ewk_Context* ewkContext,
WrtPlugins::W3C::CustomEventType eventType,
void* data);
-} // namespace PluginModuleSupport
+void setXwindowHandle(Ewk_Context* ewkContext, const unsigned int handle);
+} // namespace ViewLogicMessageSupport
-#endif /* WRT_SRC_VIEW_WEBKIT2_PLUGIN_MODULE_SUPPORT_H_ */
+#endif // VIEW_LOGIC_MESSAGE_SUPPORT_H_
\ No newline at end of file
--- /dev/null
+/*
+ * 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 view_logic_orientation_support.cpp
+ * @author Jihoon Chung (jihoon.chung@samsung.com)
+ * @version 1.0
+ */
+
+ #include "view_logic_orientation_support.h"
+
+#include <dpl/log/log.h>
+#include <widget_data_types.h>
+
+#include <EWebKit2.h>
+
+namespace ViewModule {
+
+void OrientationSupport::setOrientation(Evas_Object* window,
+ Evas_Object* ewk,
+ Mode orientation)
+{
+ LogInfo("setOrientation called");
+ if (orientation == Mode::PORTRAIT_PRIMARY) {
+ LogDebug("orientation is portrait-primary");
+ elm_win_wm_rotation_preferred_rotation_set(
+ window,
+ OrientationAngle::Window::Portrait::PRIMARY);
+ ewk_view_orientation_send(
+ ewk,
+ OrientationAngle::W3C::Portrait::PRIMARY);
+ } else if (orientation == Mode::LANDSCAPE_PRIMARY) {
+ LogDebug("orientation is landscape-primary");
+ elm_win_wm_rotation_preferred_rotation_set(
+ window,
+ OrientationAngle::Window::Landscape::PRIMARY);
+ ewk_view_orientation_send(
+ ewk,
+ OrientationAngle::W3C::Landscape::PRIMARY);
+ } else if (orientation == Mode::PORTRAIT_SECONDARY) {
+ LogDebug("orientation is portrait-secondary");
+ elm_win_wm_rotation_preferred_rotation_set(
+ window,
+ OrientationAngle::Window::Portrait::SECONDARY);
+ ewk_view_orientation_send(
+ ewk,
+ OrientationAngle::W3C::Portrait::SECONDARY);
+ } else if (orientation == Mode::LANDSCAPE_SECONDARY) {
+ LogDebug("orientation is landscape-secondary");
+ elm_win_wm_rotation_preferred_rotation_set(
+ window,
+ OrientationAngle::Window::Landscape::SECONDARY);
+ ewk_view_orientation_send(
+ ewk,
+ OrientationAngle::W3C::Landscape::SECONDARY);
+ } else {
+ LogDebug("Wrong orientation value is passed");
+ return;
+ }
+}
+
+void OrientationSupport::setOrientation(Evas_Object* window,
+ Evas_Object* ewk,
+ int ewkOrientation)
+{
+ LogInfo("setOrientation called");
+ Mode orientation;
+ if (ewkOrientation & EWK_SCREEN_ORIENTATION_PORTRAIT_PRIMARY) {
+ orientation = Mode::PORTRAIT_PRIMARY;
+ } else if (ewkOrientation & EWK_SCREEN_ORIENTATION_LANDSCAPE_PRIMARY) {
+ orientation = Mode::LANDSCAPE_PRIMARY;
+ } else if (ewkOrientation & EWK_SCREEN_ORIENTATION_PORTRAIT_SECONDARY) {
+ orientation = Mode::PORTRAIT_SECONDARY;
+ } else if (ewkOrientation & EWK_SCREEN_ORIENTATION_LANDSCAPE_SECONDARY) {
+ orientation = Mode::LANDSCAPE_SECONDARY;
+ } else {
+ LogDebug("Wrong orientation value is passed");
+ return;
+ }
+ setOrientation(window, ewk, orientation);
+}
+} // ViewModule
\ No newline at end of file
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- * @file view_logic_user_agent_support.h
- * @author Jaroslaw Osmanski (j.osmanski@samsung.com)
- * @brief Header file of UserAgentSupport API used by ViewLogic
+/*
+ * @file view_logic_orientation_support.h
+ * @author Jihoon Chung (jihoon.chung@samsung.com)
+ * @version 1.0
*/
-#ifndef VIEW_LOGIC_USER_AGENT_SUPPORT_H_
-#define VIEW_LOGIC_USER_AGENT_SUPPORT_H_
+#ifndef VIEW_LOGIC_ORIENTATION_SUPPORT_H_
+#define VIEW_LOGIC_ORIENTATION_SUPPORT_H_
-#include <string>
+#include <Elementary.h>
namespace ViewModule {
-namespace UserAgentSupport {
-std::string getUserAgentFromVconf();
-} // namespace UserAgentSupport
+namespace OrientationSupport {
+enum class Mode {
+PORTRAIT_PRIMARY = 0,
+LANDSCAPE_PRIMARY,
+PORTRAIT_SECONDARY,
+LANDSCAPE_SECONDARY
+};
+void setOrientation(Evas_Object* window,
+ Evas_Object* ewk,
+ Mode orientation);
+void setOrientation(Evas_Object* window,
+ Evas_Object* ewk,
+ int ewkOrientation);
+} // namespace OrientationSupport
} // namespace ViewModule
-#endif /* VIEW_LOGIC_USER_AGENT_SUPPORT_H_ */
+#endif // VIEW_LOGIC_ORIENTATION_SUPPORT_H_
\ No newline at end of file
LogDebug("enter");
Evas_Coord x, y, w, h;
evas_object_geometry_get(parent, &x, &y, &w, &h);
-
m_splashScreen = elm_icon_add(parent);
-
evas_object_resize(m_splashScreen, w, h);
- evas_object_image_fill_set(m_splashScreen, 0, 0, w, h);
}
SplashScreenSupport::~SplashScreenSupport()
char const* const ELM_STATE_SHOW_CONTENT = "elm,state,show,content";
char const* const ELM_SWALLOW_CONTENT = "elm.swallow.content";
char const* const ELM_SWALLOW_BACKWARD = "elm.swallow.backward";
+char const* const ELM_SWALLOW_PROGRESS = "elm.swallow.progress";
+char const* const ELM_STATE_TOOLBAR_INSTANT_OPEN = "elm,state,toolbar,instant_open";
+char const* const ELM_STATE_TOOLBAR_INSTANT_CLOSE = "elm,state,toolbar,instant_close";
const char *ELM_EVENT_PROFILE_CHANGED = "profile,changed";
char const* const INTERNAL_LAYOUT = "internal_layout";
char const* const FLOATBACKWARD_BUTTON_STYLE = "wrt/backward";
const std::string DESKTOP_PROFILE("desktop");
+const int PROGRESS_H = 7;
} // anonymous namespace
WindowData::WindowData(unsigned long pid, bool manualInit) :
m_win(NULL),
- m_naviBackButton(NULL),
+ m_naviframeBackButton(NULL),
m_initialized(false)
{
m_win = createWindow(pid);
evas_object_show(m_platform_layout);
m_navigation = createNavigationBar(m_platform_layout);
evas_object_show(m_navigation);
+ m_naviframeBackButton = createNaviframeBackbutton(m_navigation);
m_user_layout = createUserLayout(m_navigation);
evas_object_show(m_user_layout);
+ m_progressbar = createProgressBar(m_win, m_user_layout);
+ evas_object_show(m_progressbar);
UG_INIT_EFL(m_win, UG_OPT_INDICATOR_ENABLE);
m_initialized = true;
}
}
+void WindowData::toggleToolbar(bool enable)
+{
+ LogDebug("toolbar = " << (enable ? "enable" : "disable"));
+ Elm_Object_Item* naviIt = elm_naviframe_top_item_get(m_navigation);
+ if (enable) {
+ elm_object_item_signal_emit(naviIt, ELM_STATE_TOOLBAR_INSTANT_OPEN, "");
+ } else {
+ elm_object_item_signal_emit(naviIt, ELM_STATE_TOOLBAR_INSTANT_CLOSE, "");
+ }
+}
+
+bool WindowData::isFullscreen()
+{
+ return m_fullscreen;
+}
+
void WindowData::setViewMode(
bool fullscreen,
bool backbutton)
toggleIndicator(m_fullscreen);
if (backbutton) {
- createFloatBackButton();
+ // This code will be deprecated by naviframe back button
+ // createFloatBackButton();
}
}
return navigation;
}
+Evas_Object* WindowData::createNaviframeBackbutton(Evas_Object* parent)
+{
+ Assert(parent != NULL && "Parent for naviframe backbutton is null");
+ Evas_Object* object = elm_button_add(parent);
+ elm_object_style_set(object, "naviframe/end_btn/default");
+ return object;
+}
+
Evas_Object* WindowData::createUserLayout(Evas_Object* parent)
{
Assert(parent != NULL && "Parent for User Layout is null");
/* Evas_Object *obj */
parent,
/* const char *title_label */
- "",
- /* Evas_Object *prev_btn */
NULL,
+ /* Evas_Object *prev_btn */
+ m_naviframeBackButton,
/* Evas_Object *next_btn */
NULL,
/* Evas_Object *content */
/* const char *item_style */
NULL);
ADD_PROFILING_POINT("elm_naviframe_item_push", "stop");
-
elm_naviframe_item_title_visible_set(naviIt, EINA_FALSE);
return layout;
}
+Evas_Object* WindowData::createProgressBar(Evas_Object* window, Evas_Object* parent)
+{
+ Assert(parent != NULL && "Parent is null");
+ Evas_Object* progressbar = evas_object_rectangle_add(evas_object_evas_get(window));
+ evas_object_color_set(progressbar, 91, 166, 255, 255);
+ elm_object_part_content_set(parent, ELM_SWALLOW_PROGRESS, progressbar);
+ evas_object_resize(progressbar, 0, 0);
+ return progressbar;
+}
+
void WindowData::setDesktopIcon()
{
// set window icon
elm_win_icon_object_set(m_win, icon);
}
-void WindowData::addNaviBackButtonCallback(
- 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)
+void WindowData::addNaviframeItemPopCallback(
+ NaviframePopCallbackType callback,
+ void* data)
{
- Assert(m_naviBackButton != NULL && "m_naviBackButton is null");
- return evas_object_smart_callback_del(m_naviBackButton, event, callBack);
+ Assert(m_navigation != NULL && "m_navigation is null");
+ Elm_Object_Item* naviIt = elm_naviframe_top_item_get(m_navigation);
+ elm_naviframe_item_pop_cb_set(naviIt, callback, data);
}
void WindowData::addFloatBackButtonCallback(
{
LogDebug(__PRETTY_FUNCTION__);
- static bool alreadyFullscreen = false;
-
- if (alreadyFullscreen == fullscreen) {
+ if (m_fullscreen == fullscreen) {
// window is in fullscreen mode and fullscreen mode is requested, or
// window is not in fullscreen and a request is made to exit fullscreen
// In these two situations we don't have to do anything here.
return;
}
-
- if (!m_fullscreen) { //If ViewMode is not fullscreen, toggle indicator
- toggleIndicator(fullscreen);
- }
-
- alreadyFullscreen = !alreadyFullscreen;
+ toggleIndicator(fullscreen);
+ m_fullscreen = fullscreen;
}
void WindowData::winProfileChangedCallback(void *data,
}
}
+void WindowData::updateProgress(double value)
+{
+ int x, y, w, h;
+ evas_object_geometry_get(m_user_layout, &x, &y, &w, &h);
+ evas_object_resize(m_progressbar,
+ static_cast<int>(w * value),
+ static_cast<int>(PROGRESS_H * elm_config_scale_get()));
+}
void* data, Evas_Object* obj, void* event_info);
typedef void (*EvasCallbackType)(
void* data, Evas* evas, Evas_Object* obj, void* event_info);
+ typedef void (*NaviframePopCallbackType)(
+ void* data, Elm_Object_Item* it);
struct EventWithFunction
{
void init();
void setEvasObjectForLayout(Evas_Object* evas_object);
void unsetEvasObjectForLayout();
- void addNaviBackButtonCallback(
- const char* event,
- CallbackType callback,
- const void* data);
- void* delNaviBackButtonCallback(
- const char* event,
- CallbackType callBack);
+ void addNaviframeItemPopCallback(
+ NaviframePopCallbackType callback,
+ void* data);
void addFloatBackButtonCallback(
const char* event,
CallbackType callback,
bool backbutton);
void toggleFullscreen(bool fullscreen);
+ void toggleToolbar(bool enable);
+ bool isFullscreen();
static void winProfileChangedCallback(void *data,
Evas_Object * obj,
void *event_info);
+ void updateProgress(double value);
protected:
Evas_Object* m_conformant;
Evas_Object* m_platform_layout;
Evas_Object* m_navigation;
- Evas_Object* m_naviBackButton;
+ Evas_Object* m_naviframeBackButton;
Evas_Object* m_floatBackButton;
+ Evas_Object* m_progressbar;
bool m_fullscreen;
bool m_initialized;
Evas_Object* createWindow(unsigned long pid);
+ Evas_Object* createConformant(Evas_Object* parent);
Evas_Object* createPlatformLayout(Evas_Object* parent);
Evas_Object* createNavigationBar(Evas_Object* parent);
+ Evas_Object* createNaviframeBackbutton(Evas_Object* parent);
Evas_Object* createUserLayout(Evas_Object* parent);
- Evas_Object* createConformant(Evas_Object* parent);
+ Evas_Object* createProgressBar(Evas_Object* window, Evas_Object* parent);
void alignProgressPosition();
void toggleIndicator(bool fullscreen);
#include <EWebKit2.h>
#include <dpl/localization/w3c_file_localization.h>
#include <dpl/localization/LanguageTagsProvider.h>
-#include "webkit/injected-bundle/plugin_module_support.h"
#include <popup-runner/PopupInvoker.h>
#include <prepare_external_storage.h>
#include <vconf.h>
// window signal callback
const char *EDJE_SHOW_BACKWARD_SIGNAL = "show,backward,signal";
+const char *EDJE_SHOW_PROGRESS_SIGNAL = "show,progress,signal";
+const char *EDJE_HIDE_PROGRESS_SIGNAL = "hide,progress,signal";
const std::string VIEWMODE_TYPE_FULLSCREEN = "fullscreen";
const std::string VIEWMODE_TYPE_MAXIMIZED = "maximized";
char const* const ELM_SWALLOW_CONTENT = "elm.swallow.content";
const char* const BUNDLE_PATH = "/usr/lib/libwrt-injected-bundle.so";
const char* const caCertPath = "/opt/usr/share/certs/ca-certificate.crt";
+const char* const MESSAGE_NAME_INITIALIZE = "ToInjectedBundle::INIT";
// process pool
const char* const DUMMY_PROCESS_PATH = "/usr/bin/wrt_launchpad_daemon_candidate";
// env
const char* const HOME = "HOME";
const char* const APP_HOME_PATH = "/opt/home/app";
+const char* const ROOT_HOME_PATH = "/opt/home/root";
WrtClient::WrtClient(int argc, char **argv) :
Application(argc, argv, "wrt-client", false),
SwitchToStep(&WrtClient::shutdownStep);
}
- // ecore_event_jobs are processed sequentially without concession to
- // 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);
+ DPL::Event::ControllerEventHandler<NextStepEvent>::PostEvent(NextStepEvent());
}
void WrtClient::loadFinishCallback(Evas_Object* webview)
delete debug;
}
+void WrtClient::progressStartedCallback()
+{
+ if (m_settingList->getProgressBarPresence() == ProgressBar_Enable) {
+ m_windowData->emitSignalForUserLayout(EDJE_SHOW_PROGRESS_SIGNAL, "");
+ m_windowData->updateProgress(0);
+ }
+}
+
+void WrtClient::loadProgressCallback(Evas_Object* /*webview*/, double value)
+{
+ m_windowData->updateProgress(value);
+}
+
void WrtClient::progressFinishCallback()
{
- m_splashScreen->stopSplashScreen();
+ if (m_splashScreen->createSplashScreen(m_dao->getSplashImgSrc())) {
+ m_splashScreen->stopSplashScreen();
+ }
+ if (m_settingList->getProgressBarPresence() == ProgressBar_Enable) {
+ m_windowData->emitSignalForUserLayout(EDJE_HIDE_PROGRESS_SIGNAL, "");
+ }
}
void WrtClient::webkitExitCallback()
NextStepEvent());
}
+void WrtClient::toggleFullscreenCallback(bool fullscreen)
+{
+ LogError("toggleFullscreen");
+
+ if (fullscreen) {
+ m_windowData->toggleFullscreen(true);
+ if (m_settingList->getBackButtonPresence() == BackButton_Enable) {
+ m_windowData->toggleToolbar(false);
+ }
+ } else {
+ m_windowData->toggleFullscreen(false);
+ if (m_settingList->getBackButtonPresence() == BackButton_Enable) {
+ m_windowData->toggleToolbar(true);
+ }
+ }
+}
+
+void WrtClient::imeChangedCallback(bool open)
+{
+ LogError("imeChangedCallback");
+ if (m_settingList->getBackButtonPresence() == BackButton_Enable &&
+ m_windowData->isFullscreen())
+ {
+ m_windowData->toggleToolbar(open);
+ }
+}
+
void WrtClient::launchStep()
{
ADD_PROFILING_POINT("launchStep", "start");
}
m_dao.reset(new WrtDB::WidgetDAOReadOnly(DPL::FromASCIIString(m_tizenId)));
+ WrtDB::WidgetSettings widgetSettings;
+ m_dao->getWidgetSettings(widgetSettings);
+ m_settingList.reset(new WidgetSettingList(widgetSettings));
+
DPL::Optional<DPL::String> defloc = m_dao->getDefaultlocale();
if (!defloc.IsNull()) {
LanguageTagsProviderSingleton::Instance().addWidgetDefaultLocales(
new SplashScreenSupport(m_windowData->m_win));
if (m_splashScreen->createSplashScreen(m_dao->getSplashImgSrc())) {
m_splashScreen->startSplashScreen();
- cbs->progressFinish = DPL::MakeDelegate(
- this,
- &WrtClient::
- progressFinishCallback);
}
ADD_PROFILING_POINT("Create splash screen", "stop");
DPL::OptionalString startUrl = W3CFileLocalization::getStartFile(m_dao);
//you can't show window with splash screen before PrepareView
//ewk_view_add_with_context() in viewLogic breaks window
-
m_windowData->init();
+ m_windowData->toggleToolbar(
+ m_settingList->getBackButtonPresence() == BackButton_Enable);
WrtDB::WidgetLocalizedInfo localizedInfo =
W3CFileLocalization::getLocalizedInfo(m_dao);
LogInfo("Widget launch accepted. Entering running state");
m_widgetState = WidgetState_Running;
+ cbs->progressStarted = DPL::MakeDelegate(this, &WrtClient::progressStartedCallback);
+ cbs->progress = DPL::MakeDelegate(this, &WrtClient::loadProgressCallback);
+ cbs->progressFinish = DPL::MakeDelegate(this, &WrtClient::progressFinishCallback);
cbs->loadFinish = DPL::MakeDelegate(this, &WrtClient::loadFinishCallback);
cbs->bufferSet = DPL::MakeDelegate(this, &WrtClient::setLayout);
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(this, &WrtClient::toggleFullscreenCallback);
+ cbs->editorClientIme = DPL::MakeDelegate(this, &WrtClient::imeChangedCallback);
m_widget->SetUserDelegates(cbs);
m_widget->Show();
-
m_windowData->emitSignalForUserLayout(EDJE_SHOW_BACKWARD_SIGNAL, "");
ADD_PROFILING_POINT("launchStep", "stop");
auto windowModes = m_dao->getWindowModes();
bool fullscreen = false;
bool backbutton = false;
- if (m_dao->getWidgetType().appType == WrtDB::APP_TYPE_TIZENWEBAPP) {
- WrtDB::WidgetSettings widgetSettings;
- m_dao->getWidgetSettings(widgetSettings);
- WidgetSettingList settings(widgetSettings);
- backbutton =
- (settings.getBackButtonPresence() == BackButton_Enable);
- }
+ backbutton = (m_settingList->getBackButtonPresence() == BackButton_Enable);
FOREACH(it, windowModes)
{
Assert(data);
WrtClient* This = static_cast<WrtClient*>(data);
+ This->m_widget->Backward();
+}
+
+void WrtClient::naviframeBackButtonCallback(void* data,
+ Elm_Object_Item* it)
+{
+ LogInfo("BackButtonCallback");
+ Assert(data);
+ WrtClient* This = static_cast<WrtClient*>(data);
This->m_widget->Backward();
}
Assert(m_windowData);
Assert(m_dao);
- WrtDB::WidgetSettings widgetSettings;
- m_dao->getWidgetSettings(widgetSettings);
- WidgetSettingList settings(widgetSettings);
- WidgetSettingScreenLock rotationValue = settings.getRotationValue();
+ WidgetSettingScreenLock rotationValue = m_settingList->getRotationValue();
if (rotationValue == Screen_Portrait) {
elm_win_wm_rotation_preferred_rotation_set(
m_windowData->m_win,
Assert(m_windowData);
Assert(m_dao);
- WrtDB::WidgetSettings widgetSettings;
- m_dao->getWidgetSettings(widgetSettings);
- WidgetSettingList settings(widgetSettings);
- WidgetSettingScreenLock rotationValue = settings.getRotationValue();
+ WidgetSettingScreenLock rotationValue = m_settingList->getRotationValue();
if (rotationValue == Screen_AutoRotation) {
LogInfo("Nothing to do");
}
Assert(m_widget);
Assert(m_dao);
- WrtDB::WidgetSettings widgetSettings;
- m_dao->getWidgetSettings(widgetSettings);
- WidgetSettingList settings(widgetSettings);
- WidgetSettingScreenLock rotationValue = settings.getRotationValue();
+ WidgetSettingScreenLock rotationValue = m_settingList->getRotationValue();
if (rotationValue == Screen_Portrait) {
ewk_view_orientation_send(
m_widget->GetCurrentWebview(),
{
Assert(m_windowData);
Assert(m_dao);
- WrtDB::WidgetSettings widgetSettings;
- m_dao->getWidgetSettings(widgetSettings);
- WidgetSettingList settings(widgetSettings);
- if (settings.getBackButtonPresence() == BackButton_Enable) {
- m_windowData->addFloatBackButtonCallback(
- "clicked",
- &WrtClient::backButtonCallback,
+
+ if (m_settingList->getBackButtonPresence() == BackButton_Enable) {
+ m_windowData->addNaviframeItemPopCallback(
+ WrtClient::naviframeBackButtonCallback,
this);
}
}
sprintf(argv[0], "%s ",
DUMMY_PROCESS_PATH);
+ // Set 'root' home directory
+ setenv(HOME, ROOT_HOME_PATH, 1);
+
LogInfo("Prepare ewk_context");
appcore_set_i18n("wrt-client", NULL);
ewk_set_arguments(argc, argv);
vconf_ignore_key_changed(VCONFKEY_LANGSET, vconf_changed_handler);
std::string tizenId = WrtClient::getTizenIdFromArgument(argc, argv);
- PluginModuleSupport::init(s_preparedEwkContext, tizenId);
+ ewk_context_message_post_to_injected_bundle(
+ s_preparedEwkContext,
+ MESSAGE_NAME_INITIALIZE,
+ tizenId.c_str());
}
else
{
}
// plugin init
- PluginModuleSupport::init(s_preparedEwkContext, tizenId);
-
+ ewk_context_message_post_to_injected_bundle(
+ s_preparedEwkContext,
+ MESSAGE_NAME_INITIALIZE,
+ tizenId.c_str());
}
}
static void backButtonCallback(void* data,
Evas_Object* obj,
void* event_info);
+ static void naviframeBackButtonCallback(void* data,
+ Elm_Object_Item* it);
+
// Low Memory Callback
static int appcoreLowMemoryCallback(void* data);
void shutdownStep();
static int languageChangedCallback(void *data);
void loadFinishCallback(Evas_Object* webview);
+ void progressStartedCallback();
+ void loadProgressCallback(Evas_Object* webview, double value);
void progressFinishCallback();
void webkitExitCallback();
void webCrashCallback();
+ void toggleFullscreenCallback(bool fullscreen);
+ void imeChangedCallback(bool open);
void setLayout(Evas_Object* newBuffer);
void unsetLayout(Evas_Object* currentBuffer);
ReturnStatus::Type m_returnStatus;
WRT::RunnableWidgetObjectPtr m_widget;
WrtDB::WidgetDAOReadOnlyPtr m_dao;
+ WidgetSettingListPtr m_settingList;
WidgetState m_widgetState;
std::unique_ptr<WindowData> m_windowData;
std::unique_ptr<SplashScreenSupport> m_splashScreen;
export WRT_PROCESS_POOL_DISABLE=ON
+#export WRT_WILL_SEND_REQUEST_LOG_ENABLE=ON
+#export WRT_LOAD_PLUGINS_LOG_ENABLE=ON
wrt_launchpad_daemon system::share rwx
wrt_launchpad_daemon system::homedir rwx
wrt_launchpad_daemon device::app_logging w
-wrt_launchpad_daemon xorg w
+wrt_launchpad_daemon xorg rw
wrt_launchpad_daemon webkit2-efl rwxa
+wrt_launchpad_daemon sys-assert::core rwxat