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