--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>osp-web</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.tizen.nativecpp.apichecker.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.tizen.nativecpp.apichecker.core.tizenCppNature</nature>
+ </natures>
+</projectDescription>
--- /dev/null
+Jaegyu Jung <pang at samsung dot com>
+Kyungeun Park <kyung-eun.park at samsung dot com>
+Seongjun Yim <se201.yim at samsung dot com>
+Hyun Lee <hyunn.lee at samsung dot com>
+Hyunseok Yang <hs0219.yang at samsung dot com>
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/cmake_build_tmp/output)
+ADD_SUBDIRECTORY(src/controls/js-bridge-plugin-deprecated)
+ADD_SUBDIRECTORY(src/controls/js-bridge-plugin-tizen)
+
+SET (this_target osp-web)
+
+INCLUDE_DIRECTORIES(
+ inc
+ src
+ src/controls
+ src/controls/inc
+
+ /usr/include/appfw
+ /usr/include/glib-2.0
+ /usr/lib/glib-2.0/include
+ /usr/include/curl
+ /usr/include/dbus-1.0
+ /usr/lib/dbus-1.0/include
+ /usr/include/e_dbus-1
+ /usr/include/ecore-1
+ /usr/include/edje-1
+ /usr/include/eet-1
+ /usr/include/efreet-1
+ /usr/include/eina-1
+ /usr/include/eina-1/eina
+ /usr/include/elementary-1
+ /usr/include/ethumb-1
+ /usr/include/evas-1
+ /usr/include/ewebkit2-0
+ /usr/include/ewebkit2-0/WebKit2
+ /usr/include/libsoup-2.4
+ /usr/include/network
+ /usr/include/osp
+ /usr/include/osp/app
+ /usr/include/osp/base
+ /usr/include/osp/io
+ /usr/include/osp/net
+ /usr/include/osp/security
+ /usr/include/osp/system
+ /usr/include/osp/graphics
+ /usr/include/osp/content
+ /usr/include/osp/ui
+ /usr/include/web
+ /usr/include/vconf
+ /usr/include/media-content
+ )
+
+SET (${this_target}_SOURCE_FILES
+ src/FWebHistoryItem.cpp
+ src/FWeb_HistoryItemImpl.cpp
+ src/FWebWebHistory.cpp
+ src/FWeb_WebHistoryImpl.cpp
+ src/FWebBookmarkItem.cpp
+ src/FWeb_BookmarkItemImpl.cpp
+ src/FWebWebBookmark.cpp
+ src/FWeb_WebBookmarkImpl.cpp
+ src/controls/FWebCtrlWeb.cpp
+ src/controls/FWebCtrl_WebImpl.cpp
+ src/controls/FWebCtrl_AuthConfirmPopup.cpp
+ src/controls/FWebCtrl_Web.cpp
+ src/controls/FWebCtrl_EflWebkit.cpp
+ src/controls/FWebCtrl_WebEventArg.cpp
+ src/controls/FWebCtrl_WebEvent.cpp
+ src/controls/FWebCtrlPageNavigationList.cpp
+ src/controls/FWebCtrl_PageNavigationListImpl.cpp
+ src/controls/FWebCtrlWebSetting.cpp
+ src/controls/FWebCtrl_WebSettingImpl.cpp
+ src/controls/FWebCtrlHitElementResult.cpp
+ src/controls/FWebCtrl_HitElementResultImpl.cpp
+ src/controls/FWebCtrl_SelectBox.cpp
+ src/controls/FWebCtrlAuthenticationChallenge.cpp
+ src/controls/FWebCtrl_AuthenticationChallengeImpl.cpp
+ src/controls/FWebCtrl_WebMaker.cpp
+ src/controls/FWebCtrl_AppControlListener.cpp
+ src/controls/FWebCtrl_WebPresenter.cpp
+ src/controls/FWebCtrl_PromptPopup.cpp
+ src/controls/FWebCtrl_Utility.cpp
+ src/controls/FWebCtrl_GestureState.cpp
+ src/controls/FWebCtrl_WebDataHandler.cpp
+ src/controls/FWebCtrlGeolocationPermissionManager.cpp
+ src/controls/FWebCtrl_GeolocationPermissionManagerImpl.cpp
+ src/controls/FWebCtrl_InputPickerPopup.cpp
+ src/controls/FWebCtrl_UserConfirmPopup.cpp
+ src/controls/FWebCtrl_WebPopup.cpp
+ src/controls/FWebCtrl_CertificateConfirmPopup.cpp
+ src/controls/FWebCtrlWebStorageManager.cpp
+ src/controls/FWebCtrl_WebStorageManagerImpl.cpp
+ src/controls/FWebCtrl_WebNotification.cpp
+ src/controls/FWebCtrl_WebNotificationHandler.cpp
+ src/controls/FWebCtrl_FormDataWindow.cpp
+ src/controls/FWebCtrl_WebManager.cpp
+)
+## Add Definitions
+ADD_DEFINITIONS(${OSP_DEFINITIONS} -D_MODEL_RES_WVGA)
+
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wall" )
+
+## SET C COMPILER FLAGS
+SET(CMAKE_C_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## SET CPP COMPILER FLAGS
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
+SET(CMAKE_CXX_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## Create Library
+ADD_LIBRARY (${this_target} SHARED ${${this_target}_SOURCE_FILES})
+
+## SET LINKER FLAGS
+SET(CMAKE_SHARED_LINKER_FLAGS -Wl,--no-undefined)
+
+TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib/osp -losp-appfw" )
+TARGET_LINK_LIBRARIES(${this_target} "-losp-content" )
+TARGET_LINK_LIBRARIES(${this_target} "-losp-json" )
+TARGET_LINK_LIBRARIES(${this_target} "-losp-uifw" )
+TARGET_LINK_LIBRARIES(${this_target} "-losp-image" )
+TARGET_LINK_LIBRARIES(${this_target} "-losp-media" )
+TARGET_LINK_LIBRARIES(${this_target} "-losp-net" )
+TARGET_LINK_LIBRARIES(${this_target} "-lecore" )
+TARGET_LINK_LIBRARIES(${this_target} "-lecore_x" )
+TARGET_LINK_LIBRARIES(${this_target} "-lecore_imf" )
+TARGET_LINK_LIBRARIES(${this_target} "-lecore_imf_evas" )
+TARGET_LINK_LIBRARIES(${this_target} "-lelementary" )
+TARGET_LINK_LIBRARIES(${this_target} "-levas" )
+TARGET_LINK_LIBRARIES(${this_target} "-leina" )
+TARGET_LINK_LIBRARIES(${this_target} "-lewebkit2" )
+TARGET_LINK_LIBRARIES(${this_target} "-lcapi-web-favorites" )
+TARGET_LINK_LIBRARIES(${this_target} "-lcapi-network-connection" )
+TARGET_LINK_LIBRARIES(${this_target} "-lcapi-content-media-content")
+TARGET_LINK_LIBRARIES(${this_target} "-lpthread" )
+TARGET_LINK_LIBRARIES(${this_target} "-lvconf" )
+
+SET_TARGET_PROPERTIES(${this_target}
+ PROPERTIES
+ VERSION ${FULLVER}
+ SOVERSION ${MAJORVER}
+ CLEAN_DIRECT_OUTPUT 1
+ )
+
+ADD_CUSTOM_COMMAND(TARGET ${this_target}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy ${LIBRARY_OUTPUT_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX} ${LIBRARY_OUTPUT_PATH}/debug/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX}.${FULLVER}
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX}.${FULLVER} ${LIBRARY_OUTPUT_PATH}/debug/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX}.${MAJORVER}
+ COMMAND ${CMAKE_STRIP} --strip-unneeded ${LIBRARY_OUTPUT_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX}
+ COMMENT "strip ${this_target}"
+ )
+
+INSTALL(DIRECTORY ${LIBRARY_OUTPUT_PATH}/ DESTINATION lib/osp
+ FILES_MATCHING PATTERN "libosp-*"
+ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
+ GROUP_EXECUTE GROUP_READ
+ WORLD_EXECUTE WORLD_READ)
+INSTALL(DIRECTORY ${LIBRARY_OUTPUT_PATH}/ DESTINATION lib/osp/browser-plugin
+ FILES_MATCHING PATTERN "libweb-*"
+ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
+ GROUP_EXECUTE GROUP_READ
+ WORLD_EXECUTE WORLD_READ)
+
+INSTALL(DIRECTORY ${LIBRARY_OUTPUT_PATH}/debug/ DESTINATION lib/osp/debug
+ FILES_MATCHING PATTERN "libosp-*"
+ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
+ GROUP_EXECUTE GROUP_READ
+ WORLD_EXECUTE WORLD_READ)
+INSTALL(DIRECTORY ${LIBRARY_OUTPUT_PATH}/debug/ DESTINATION lib/osp/browser-plugin/debug
+ FILES_MATCHING PATTERN "libweb-*"
+ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
+ GROUP_EXECUTE GROUP_READ
+ WORLD_EXECUTE WORLD_READ)
+
+
+INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/inc/ DESTINATION include/osp FILES_MATCHING PATTERN "*.h")
+INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/src/controls/inc/ DESTINATION include/osp/web/controls FILES_MATCHING PATTERN "*.h")
+
+# pkgconfig file
+CONFIGURE_FILE(${this_target}.pc.in ${CMAKE_SOURCE_DIR}/${this_target}.pc @ONLY)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/${this_target}.pc DESTINATION lib/pkgconfig)
+
--- /dev/null
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ 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.
+
+ 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,
+ 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 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 in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) 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
+
+ (d) 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.
+
+ 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 Apache License to your work.
+
+ To apply the Apache 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 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.
--- /dev/null
+Copyright (c) Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Apache License, Version 2.
+Please, see the LICENSE file for Apache License terms and conditions.
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWeb.h
+ * @brief This is the header file for the %Web namespace.
+ *
+ * This header file contains the declarations and descriptions of the %Web namespace.
+ */
+#ifndef _FWEB_H_
+#define _FWEB_H_
+
+#include <FWebHistoryItem.h>
+#include <FWebWebHistory.h>
+#include <FWebBookmarkItem.h>
+#include <FWebWebBookmark.h>
+
+//Controls namespace
+#include <FWebControls.h>
+
+//Json namespace
+#include <FWebJson.h>
+
+/**
+ * @namespace Tizen::Web
+ * @brief This namespace contains classes to manage the history data.
+ * @since 2.0
+ *
+ * @remarks @b Header @b %file: @b \#include @b <FWeb.h> @n
+ * @b Library : @b osp-web
+ *
+ *
+ * The %Web namespace contains classes and interfaces for browsing, tracking browsing history, downloading %Web content, and manipulating JSON documents.
+ * @n
+ * For more information on the %Web namespace features, see <a href="../org.tizen.native.appprogramming/html/guide/web/web_browsers_and_web_content.htm">Web Guide</a>.
+ *
+ * The following diagram illustrates the relationships between the classes belonging to the %Web namespace.
+ *
+ * @image html web_namespace_classdiagram.png
+ *
+ *
+ *
+ */
+namespace Tizen { namespace Web
+{
+
+}} // Tizen::Web
+#endif
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebBookmarkItem.h
+ * @brief This is the header file for the %BookmarkItem class.
+ *
+ * This header file contains the declarations of the %BookmarkItem class.
+ */
+
+#ifndef _FWEB_BOOKMARK_ITEM_H_
+#define _FWEB_BOOKMARK_ITEM_H_
+
+#include <FBaseString.h>
+
+namespace Tizen { namespace Graphics
+{
+class Bitmap;
+}} // Tizen::Graphics
+
+namespace Tizen { namespace Web
+{
+class _BookmarkItemImpl;
+
+/**
+ * A unique ID. This ID is unique within a local storage only. @n
+ * @c RecordId is assigned by the local storage when a record is saved to the storage.
+ *
+ *
+ * @since 2.1
+ */
+typedef int RecordId;
+
+/**
+ * The root folder ID. @n
+ * In fact, it is a symbolic value because the root folder record does not exist physically.
+ *
+ * @since 2.1
+ */
+const RecordId ROOT_FOLDER_ID = -1;
+
+/**
+* @class BookmarkItem
+* @brief This class is used for accessing a bookmark item stored in the %WebBookmark class.
+*
+* @since 2.1
+*
+* @final This class is not intended for extension.
+*
+* The %BookmarkItem class provides access to the WebBookmark class.
+* Each item contains the title, the URL of a page, the item type, and the parent folder ID.
+*/
+class _OSP_EXPORT_ BookmarkItem
+ : public Tizen::Base::Object
+{
+public:
+
+ /**
+ * Copying of objects using this copy constructor is allowed.
+ * This is the copy constructor for the %BookmarkItem class. @n
+ * It creates an instance of %BookmarkItem with the values of the specified instance.
+ *
+ * @since 2.1
+ *
+ * @param[in] rhs An instance of %BookmarkItem to copy
+ */
+ BookmarkItem(const BookmarkItem& rhs);
+
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.1
+ */
+ virtual ~BookmarkItem(void);
+
+ /**
+ * Gets the title from the current bookmark item.
+ *
+ * @since 2.1
+ *
+ * @return The title of the current bookmark item
+ */
+ Tizen::Base::String GetTitle(void) const;
+
+ /**
+ * Gets the URL from the current bookmark item.
+ *
+ * @since 2.1
+ *
+ * @return The URL of the current bookmark item @n
+ * If the item type is folder, this method returns an empty string.
+ * @see IsFolder()
+ */
+ Tizen::Base::String GetUrl(void) const;
+
+ /**
+ * Gets the favicon image from the current bookmark item.
+ *
+ * @since 2.1
+ *
+ * @return The image
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ Tizen::Graphics::Bitmap* GetFaviconN(void) const;
+
+ /**
+ * Gets the parent folder ID of the current bookmark item.
+ *
+ * @since 2.1
+ *
+ * @return The parent folder ID of the current bookmark item @n
+ * If the current bookmark item is the one at the topmost level, this method returns ::ROOT_FOLDER_ID.
+ */
+ RecordId GetParentFolderId(void) const;
+
+ /**
+ * Checks whether the type of the current bookmark item is folder or not.
+ *
+ * @since 2.1
+ *
+ * @return @c true if the type of the current bookmark item is folder, @n
+ * else @c false
+ */
+ bool IsFolder(void) const;
+
+ /**
+ * Gets the hash value of the current instance.
+ *
+ * @since 2.1
+ *
+ * @return The hash value of the current instance
+ */
+ virtual int GetHashCode(void) const;
+
+ /**
+ * Compares two instances of the %BookmarkItem class.
+ *
+ * @since 2.1
+ *
+ * @return @c true if the two instances match, or if and only if the two instances contain the same elements, @n
+ * else @c false
+ * @param[in] obj The object to compare with the current instance
+ * @see Tizen::Base::Object::Equals()
+ */
+ virtual bool Equals(const Tizen::Base::Object& obj) const;
+
+ /**
+ * Copying of objects using this copy assignment operator is allowed.
+ *
+ * @since 2.1
+ *
+ * @param[in] rhs An instance of the %BookmarkItem class to assign
+ */
+ BookmarkItem& operator =(const BookmarkItem& rhs);
+
+private:
+ //
+ // This default constructor is intentionally declared as private to implement the Singleton semantic
+ //
+ // @remarks This constructor is hidden.
+ //
+ BookmarkItem(void);
+
+private:
+ _BookmarkItemImpl* __pBookmarkItemImpl;
+
+ friend class _BookmarkItemImpl;
+
+ friend class _WebBookmarkImpl;
+};
+
+}}
+#endif // _FWEB_BOOKMARK_ITEM_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebControls.h
+ * @brief This is the header file for the %Controls namespace.
+ *
+ * This header file contains the declarations and descriptions of the %Controls namespace.
+ */
+#ifndef _FWEB_CONTROLS_H_
+#define _FWEB_CONTROLS_H_
+
+#include <FWebCtrlAuthenticationChallenge.h>
+#include <FWebCtrlHitElementResult.h>
+#include <FWebCtrlGeolocationPermissionManager.h>
+#include <FWebCtrlIJavaScriptBridge.h>
+#include <FWebCtrlILoadingListener.h>
+#include <FWebCtrlITextSearchListener.h>
+#include <FWebCtrlIWebDownloadListener.h>
+#include <FWebCtrlIWebKeypadEventListener.h>
+#include <FWebCtrlIWebUiEventListener.h>
+#include <FWebCtrlIWebUiEventListenerF.h>
+#include <FWebCtrlPageNavigationList.h>
+#include <FWebCtrlWeb.h>
+#include <FWebCtrlWebSetting.h>
+#include <FWebCtrlWebStorageManager.h>
+
+/**
+ * @namespace Tizen::Web::Controls
+ * @brief This namespace contains classes and interfaces to interact with the browser engine.
+ * @since 2.0
+ *
+ * @remarks @b Header @b %file: @b \#include @b <FWeb.h> @n
+ * @b Library : @b osp-web
+ *
+ * The %Controls namespace allows you to embed the %Web browser as a control within an application, upload and download content, and retrieve the HyperText Markup Language (HTML) element and history details.
+ *
+ * For more information on the %Controls namespace features, see <a href="../org.tizen.native.appprogramming/html/guide/web/controls_namespace.htm">Web Controls Guide</a>.
+ *
+ * The following diagram illustrates the relationships between the classes belonging to the %Controls namespace.
+ *
+ * @image html web_controls_namespace_classdiagram.png
+ *
+ */
+namespace Tizen { namespace Web { namespace Controls
+{
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CONTROLS_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrlAuthenticationChallenge.h
+ * @brief This is the header file for the %AuthenticationChallenge class.
+ *
+ * This header file contains the declarations of the %AuthenticationChallenge class.
+ */
+
+#ifndef _FWEB_CTRL_AUTHENTICATION_CHALLENGE_H_
+#define _FWEB_CTRL_AUTHENTICATION_CHALLENGE_H_
+
+#include <FBaseDataType.h>
+#include <FBaseObject.h>
+#include <FBaseString.h>
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+/**
+ *
+ * @class AuthenticationChallenge
+ * @brief This class handles the HyperText Transfer Protocol (HTTP) authentication requests.
+ *
+ * @since 2.0
+ *
+ * The %AuthenticationChallenge class sends the user ID and password to the server requesting user authentication.
+ * @n
+ * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/web/controls_namespace.htm">Web Controls Guide</a>.
+ */
+class _OSP_EXPORT_ AuthenticationChallenge
+ : public Tizen::Base::Object
+{
+public:
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.0
+ */
+ virtual ~AuthenticationChallenge(void);
+
+ /**
+ * Sends the user ID and password to the host.
+ *
+ * @since 2.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.service
+ *
+ * @param[in] userId The user ID for authentication
+ * @param[in] password The password for authentication
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method. @b Since: @b 2.1
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ void Process(const UserId& userId, const Tizen::Base::String& password);
+
+ /**
+ * Cancels the authentication request.
+ *
+ * @since 2.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.service
+ *
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method. @b Since: @b 2.1
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ void Cancel(void);
+
+private :
+ //
+ // This is the constructor for the %AuthenticationChallenge class.
+ //
+ // @remarks This constructor is hidden.
+ //
+ AuthenticationChallenge(void);
+
+private:
+ friend class _WebImpl;
+ friend class _AuthenticationChallengeImpl;
+ class _AuthenticationChallengeImpl* __pAuthenticationChallengeImpl;
+}; // AuthenticationChallenge
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_AUTHENTICATION_CHALLENGE_H_
--- /dev/null
+// Open Service Platform\r
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FWebCtrlGeolocationPermissionManager.h\r
+ * @brief This is the header file for the %GeolocationPermissionManager class.\r
+ *\r
+ * This header file contains the declarations of the %GeolocationPermissionManager class.\r
+ *\r
+ */\r
+#ifndef _FWEB_CTRL_GEOLOCATION_PERMISSION_MANAGER_H_\r
+#define _FWEB_CTRL_GEOLOCATION_PERMISSION_MANAGER_H_\r
+\r
+#include <unique_ptr.h>\r
+#include <FBaseString.h>\r
+\r
+namespace Tizen { namespace Base { namespace Collection\r
+{\r
+class IList;\r
+}}} // Tizen::Base::Collection\r
+\r
+namespace Tizen { namespace Web { namespace Controls\r
+{\r
+\r
+class _GeolocationPermissionManagerImpl;\r
+\r
+/**\r
+ * @class GeolocationPermissionManager\r
+ * @brief This class provides methods to manage geolocation permissions.\r
+ *\r
+ * @since 2.0\r
+ *\r
+ * The %GeolocationPermissionManager class provides methods to manage geolocation permissions decided by a user from origins using html5 JavaScript geolocation APIs. @n\r
+ * Origin consists of the scheme, host, and port.\r
+ */\r
+\r
+class _OSP_EXPORT_ GeolocationPermissionManager\r
+ : public Tizen::Base::Object\r
+{ \r
+public:\r
+\r
+ /**\r
+ * Gets the origin list stored at the geolocation database.\r
+ *\r
+ * @since 2.0\r
+ * @privlevel platform\r
+ * @privilege %http://tizen.org/privilege/geolocationpermission.read\r
+ *\r
+ * @return A pointer to Tizen::Base::Collection::IList that contains the origin(Tizen::Base::String) list, @n\r
+ * else @c null if no geolocation permission data exists\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.\r
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
+ * @remarks The specific error code can be accessed using the GetLastResult() method.\r
+ */\r
+ Tizen::Base::Collection::IList* GetOriginListN(void) const;\r
+\r
+ /**\r
+ * Checks whether geolocation permission is allowed or not for the specified @c origin.\r
+ *\r
+ * @since 2.0\r
+ * @privlevel platform\r
+ * @privilege %http://tizen.org/privilege/geolocationpermission.read\r
+ *\r
+ * @return @c true if geolocation permission is allowed, @n\r
+ * else @c false\r
+ * @param[in] origin The origin\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_DATA_NOT_FOUND There is no permission data for the specified @c origin.\r
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.\r
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
+ * @remarks The specific error code can be accessed using the GetLastResult() method.\r
+ */\r
+ bool IsPermissionAllowed(const Tizen::Base::String& origin) const;\r
+\r
+ /**\r
+ * Removes the geolocation data for the specified @c origin.\r
+ *\r
+ * @since 2.0\r
+ * @privlevel platform\r
+ * @privilege %http://tizen.org/privilege/geolocationpermission.write\r
+ *\r
+ * @return An error code\r
+ * @param[in] origin The origin\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_DATA_NOT_FOUND There is no permission data for the specified @c origin.\r
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.\r
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
+ * @see RemoveAll()\r
+ */\r
+ result Remove(const Tizen::Base::String& origin);\r
+\r
+ /**\r
+ * Removes all the elements from the list.\r
+ * \r
+ * @since 2.0\r
+ * @privlevel platform\r
+ * @privilege %http://tizen.org/privilege/geolocationpermission.write\r
+ *\r
+ * @return An error code\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.\r
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
+ * @see Remove()\r
+ */\r
+ result RemoveAll(void);\r
+\r
+ /**\r
+ * Gets a geolocation permission manager instance.\r
+ *\r
+ * @since 2.0\r
+ *\r
+ * @return A pointer to the %GeolocationPermissionManager instance, @n\r
+ * else @c null if it fails\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_OUT_OF_MEMORY The memory is insufficient.\r
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.\r
+ * @remarks The specific error code can be accessed using the GetLastResult() method.\r
+ */\r
+ static GeolocationPermissionManager* GetInstance(void);\r
+\r
+private:\r
+ //\r
+ // This default constructor is intentionally declared as private to implement the Singleton semantic.\r
+ //\r
+ // @remarks This constructor is hidden.\r
+ //\r
+ GeolocationPermissionManager(void);\r
+\r
+ //\r
+ // This destructor is intentionally declared as private to implement the Singleton semantic.\r
+ //\r
+ // @remarks This destructor is hidden.\r
+ //\r
+ virtual ~GeolocationPermissionManager(void);\r
+\r
+ //\r
+ // Initializes this instance of the %Web control with the specified parameters.\r
+ //\r
+ // @since 2.0\r
+ //\r
+ // @return An error code\r
+ //\r
+ result Construct(void);\r
+\r
+ //\r
+ // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.\r
+ //\r
+ // @param[in] rhs The instance of the % GeolocationPermissionManager class to copy from\r
+ // @remarks This constructor is hidden.\r
+ //\r
+ GeolocationPermissionManager(const GeolocationPermissionManager& rhs);\r
+\r
+ //\r
+ // Initializes the geolocation permission manager instance.\r
+ //\r
+ // @since 2.0\r
+ //\r
+ static void InitGeolocationPermissionManager(void);\r
+\r
+ //\r
+ // Destroys the geolocation permission manager instance.\r
+ //\r
+ // @since 2.0\r
+ //\r
+ static void DestroyGeolocationPermissionManager(void);\r
+\r
+ //\r
+ // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.\r
+ //\r
+ // @param[in] rhs An instance of % GeolocationPermissionManager to assign from\r
+ // @remarks This operator is hidden.\r
+ //\r
+ GeolocationPermissionManager& operator=(const GeolocationPermissionManager& rhs);\r
+\r
+private:\r
+\r
+ _GeolocationPermissionManagerImpl* __pGeolocationPermissionManagerImpl;\r
+\r
+ static GeolocationPermissionManager* __pInstance;\r
+\r
+ friend class _GeolocationPermissionManagerImpl;\r
+\r
+ friend struct std::default_delete<GeolocationPermissionManager>;\r
+}; // GeolocationPermissionManager\r
+\r
+}}} // Tizen::Web::Controls\r
+\r
+#endif // _FWEB_CTRL_GEOLOCATION_PERMISSION_MANAGER_H_\r
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrlHitElementResult.h
+ * @brief This is the header file for the %HitElementResult class.
+ *
+ * This header file contains the declarations of the %HitElementResult class.
+ */
+#ifndef _FWEB_CTRL_HIT_ELEMENT_RESULT_H_
+#define _FWEB_CTRL_HIT_ELEMENT_RESULT_H_
+
+#include <FBaseColIMap.h>
+#include <FBaseObject.h>
+#include <FBaseString.h>
+
+namespace Tizen { namespace Graphics
+{
+class Bitmap;
+}} // Tizen::Graphics
+
+namespace Tizen { namespace Web { namespace Controls
+{
+class _HitElementResultImpl;
+}}} // Tizen::Web::Controls
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+/**
+ * @class HitElementResult
+ * @brief This class provides methods to retrieve information from the HyperText Markup Language (HTML) element, pointed by the x and y coordinates.
+ *
+ * @since 2.0
+ *
+ * The %HitElementResult class provides methods to retrieve information such as tag name, attributes and content from the HTML element.
+ * @n
+ * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/web/controls_namespace.htm">Web Controls Guide</a>.
+ *
+ */
+class _OSP_EXPORT_ HitElementResult
+ : public Tizen::Base::Object
+{
+
+public:
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.0
+ */
+ virtual ~HitElementResult(void);
+
+ /**
+ * Gets the tag name of an element.
+ *
+ * @since 2.0
+ *
+ * @return The tag name of the element
+ */
+ Tizen::Base::String GetTagName(void) const;
+
+ /**
+ * Gets the value of the specified attribute.
+ *
+ * @since 2.0
+ *
+ * @return The value of the specified attribute
+ * @param[in] attributeName The name of the attribute
+ */
+ Tizen::Base::String GetAttributeValue(const Tizen::Base::String& attributeName) const;
+
+ /**
+ * Gets the content of an element.
+ *
+ * @since 2.0
+ *
+ * @return The content of the element
+ */
+ Tizen::Base::String GetContent(void) const;
+
+ /**
+ * Gets the Uniform Resource Locator (URL) linked to the element.
+ *
+ * @since 2.0
+ *
+ * @return The URL linked to the element
+ */
+ Tizen::Base::String GetUrl(void) const;
+
+ /**
+ * Gets the image if the element is an image element.
+ *
+ * @since 2.0
+ *
+ * @return The image
+ */
+ const Tizen::Graphics::Bitmap* GetImage(void) const;
+
+ /**
+ * Checks whether the element is an image element.
+ *
+ * @since 2.0
+ *
+ * @return @c true if the element is an image element, @n
+ * else @c false
+ */
+ bool HasImage(void) const;
+
+ /**
+ * Checks whether the element has a URL linked to it.
+ *
+ * @since 2.0
+ *
+ * @return @c true if there is a URL linked to the element, @n
+ * else @c false
+ */
+ bool HasUrl(void) const;
+
+private:
+ //
+ // This constructor is intentionally declared as private so that only the platform can create an instance.
+ //
+ // @remarks This constructor is hidden.
+ //
+ HitElementResult(void);
+
+ //
+ // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @param[in] element The instance of the %HitElementResult class to copy from
+ // @remarks This constructor is hidden.
+ //
+ HitElementResult(const HitElementResult& element);
+
+ //
+ // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @param[in] source The instance of the %HitElementResult class to assign from
+ // @remarks This operator is hidden.
+ //
+ HitElementResult& operator =(const HitElementResult& source);
+
+private:
+ _HitElementResultImpl* __pHitElementResultImpl;
+
+ friend class _HitElementResultImpl;
+
+ friend class _WebImpl;
+}; // HitElementResult
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_HIT_ELEMENT_RESULT_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrlIJavaScriptBridge.h
+ * @brief This is the header file for the %IJavaScriptBridge interface.
+ *
+ * This header file contains the declarations of the %IJavaScriptBridge interface.
+ */
+#ifndef _FWEB_CTRL_IJAVA_SCRIPT_BRIDGE_H_
+#define _FWEB_CTRL_IJAVA_SCRIPT_BRIDGE_H_
+
+#include <FBaseString.h>
+
+namespace Tizen { namespace Web { namespace Json
+{
+class IJsonValue;
+}}} // Tizen::Web::Json
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+/**
+ * @interface IJavaScriptBridge
+ * @brief This interface provides a communication channel between JavaScript and a native object.
+ *
+ * @since 2.0
+ *
+ * The %IJavaScriptBridge interface provides a communication channel between JavaScript and a native object.
+ *
+ * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/web/controls_namespace.htm">Web Controls Guide</a>.
+ *
+ */
+class _OSP_EXPORT_ IJavaScriptBridge
+{
+public:
+ /**
+ * This polymorphic destructor should be overridden if required. @n
+ * This way, the destructors of the derived classes are called when the destructor of this interface is called.
+ *
+ * @since 2.0
+ */
+ virtual ~IJavaScriptBridge(void) {}
+
+ /**
+ * Called asynchronously on an invocation request from JavaScript through the requestToNative() method.
+ *
+ * @since 2.0
+ *
+ * @param[in] pArg The parameters delivered by JavaScript
+ */
+ virtual void HandleJavaScriptRequestN(Tizen::Web::Json::IJsonValue* pArg) = 0;
+
+ /**
+ * Gets the name of %IJavaScriptBridge to identify each %IJavaScriptBridge.
+ *
+ * @since 2.0
+ *
+ * @return The name of %IJavaScriptBridge
+ */
+ virtual Tizen::Base::String GetName(void) = 0;
+
+protected:
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // Gets the Impl instance.
+ //
+ // @since 2.0
+ //
+ virtual void IJavaScriptBridge_Reserved1(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // Gets the Impl instance.
+ //
+ // @since 2.0
+ //
+ virtual void IJavaScriptBridge_Reserved2(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // Gets the Impl instance.
+ //
+ // @since 2.0
+ //
+ virtual void IJavaScriptBridge_Reserved3(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // Gets the Impl instance.
+ //
+ // @since 2.0
+ //
+ virtual void IJavaScriptBridge_Reserved4(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // Gets the Impl instance.
+ //
+ // @since 2.0
+ //
+ virtual void IJavaScriptBridge_Reserved5(void) {}
+
+}; // IJavaScriptBridge
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_IJAVA_SCRIPT_BRIDGE_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrlILoadingListener.h
+ * @brief This is the header file for the %ILoadingListener interface.
+ *
+ * This header file contains the declarations of the %ILoadingListener interface.
+ */
+#ifndef _FWEB_CTRL_ILOADING_LISTENER_H_
+#define _FWEB_CTRL_ILOADING_LISTENER_H_
+
+#include <FBaseRtIEventListener.h>
+#include <FBaseString.h>
+
+namespace Tizen { namespace Graphics
+{
+class Bitmap;
+}} // Tizen::Graphics
+
+namespace Tizen { namespace Net { namespace Http
+{
+class HttpHeader;
+}}} // Tizen::Neb::Http
+
+namespace Tizen { namespace Web { namespace Controls
+{
+class AuthenticationChallenge;
+}}} // Tizen::Web::Controls
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+/**
+ * @enum WebNavigationType
+ *
+ * Defines the type of %Web navigation.
+ *
+ * @since 2.0
+ */
+enum WebNavigationType
+{
+ WEB_NAVIGATION_LINK_CLICKED, /**< The clicking of a link on the page */
+ WEB_NAVIGATION_FORM_SUBMITTED, /**< The submission of a form */
+ WEB_NAVIGATION_BACKFORWARD, /**< The back and forward navigation */
+ WEB_NAVIGATION_RELOAD, /**< The reloading of the page */
+ WEB_NAVIGATION_FORM_RESUBMITTED, /**< The resubmission of the form */
+ WEB_NAVIGATION_OTHER /**< A navigation other than any of the above */
+};
+
+/**
+ * @enum LoadingErrorType
+ *
+ * Defines the types of loading errors.
+ *
+ * @since 2.0
+ */
+enum LoadingErrorType
+{
+ WEB_ERROR_UNKNOWN, /**< An unknown error */
+ WEB_REQUEST_TIMEOUT, /**< The request timeout */
+ WEB_NO_CONNECTION, /**< The network is not in service */
+ WEB_MIME_NOT_SUPPORTED, /**< The content type is not supported */
+ WEB_BAD_URL, /**< The URL is invalid */
+ WEB_HTTP_RESPONSE, /**< The hypertext transfer protocol (HTTP) response */
+ WEB_OUT_OF_MEMORY, /**< The memory is not enough to load the page */
+ WEB_FILE_ACCESS_FAILED, /**< The file access has failed */
+ WEB_REQUEST_MAX_EXCEEDED, /**< The request has failed because the total number of requests have exceeded the maximum limit */
+ WEB_INVALID_CERTIFICATE /**< The hypertext transfer protocol secure (HTTPS) request has failed due to an invalid certificate or CA */
+};
+
+/**
+ * @enum DecisionPolicy
+ *
+ * Defines the decision policy.
+ *
+ * @since 2.0
+ */
+enum DecisionPolicy
+{
+ WEB_DECISION_DOWNLOAD, /**< The download policy */
+ WEB_DECISION_CONTINUE, /**< The usage policy */
+ WEB_DECISION_IGNORE, /**< The ignore policy */
+};
+
+/**
+ * @interface ILoadingListener
+ * @brief This interface is for receiving the events that occur during the loading of data.
+ *
+ * @since 2.0
+ *
+ * The %ILoadingListener interface receives the events that occur during the loading of data.
+ * To listen to the events that occur during a data loading operation, implement this listener. If there is no
+ * registered load event listener, the browser engine handles these events according to its own settings.
+ * @n
+ * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/web/controls_namespace.htm">Web Controls Guide</a>.
+ */
+class _OSP_EXPORT_ ILoadingListener
+ : public virtual Tizen::Base::Runtime::IEventListener
+{
+public:
+ /**
+ * This polymorphic destructor should be overridden if required. @n
+ * This way, the destructors of the derived classes are called when the destructor of this interface is called.
+ *
+ * @since 2.0
+ */
+ virtual ~ILoadingListener(void) {}
+
+ /**
+ * Called when an authentication is requested.
+ *
+ * @since 2.0
+ *
+ * @return @c true if the ownership is taken by the application, @n
+ * else @c false, and a default dialog for the ID and password is displayed @n
+ * If this method returns @c true, the application must delete the AuthenticationChallenge instance.
+ * @param[in] host The host requiring the authentication
+ * @param[in] realm The description to help save the user credentials for future visits
+ * @param[in] authentication The handler to send a user response to the server that requested the authentication
+ */
+ virtual bool OnHttpAuthenticationRequestedN(const Tizen::Base::String& host, const Tizen::Base::String& realm, const Tizen::Web::Controls::AuthenticationChallenge& authentication) = 0;
+
+ /**
+ * Called when the authentication request is cancelled.
+ *
+ * @since 2.0
+ */
+ virtual void OnHttpAuthenticationCanceled(void) = 0;
+
+ /**
+ * Called when the loading operation starts.
+ *
+ * @since 2.0
+ */
+ virtual void OnLoadingStarted(void) = 0;
+
+ /**
+ * Called when the loading operation is cancelled.
+ *
+ * @since 2.0
+ */
+ virtual void OnLoadingCanceled(void) = 0;
+
+ /**
+ * Called when the loading operation fails.
+ *
+ * @since 2.0
+ *
+ * @param[in] error The error that occurs during loading
+ * @param[in] reason The reason for the loading failure:
+ * - @c WEB_HTTP_RESPONSE: The HTTP state code such as "404"
+ * - @c WEB_MIME_NOT_SUPPORTED: The Multipurpose Internet Mail Extensions (MIME) type such as "application/rdf+xml" is not supported.
+ * - @c WEB_BAD_URL: The URL is incorrect.
+ */
+ virtual void OnLoadingErrorOccurred(LoadingErrorType error, const Tizen::Base::String& reason) = 0;
+
+ /**
+ * Called when the loading operation is completed.
+ *
+ * @since 2.0
+ */
+ virtual void OnLoadingCompleted(void) = 0;
+
+ /**
+ * Called when the loading progress for the current page is requested. @n
+ * The progress rate is displayed as a percentage.
+ *
+ * @since 2.0
+ *
+ * @param[in] progress The progress rate ranging from [@c 0 to @c 100]
+ */
+ virtual void OnEstimatedProgress(int progress) = 0;
+
+ /**
+ * Called when the title of the new page is received.
+ *
+ * @since 2.0
+ */
+ virtual void OnPageTitleReceived(const Tizen::Base::String& title) = 0;
+
+ /**
+ * Called to notify an application of the URL to be requested. @n
+ * If an application wants to handle the URL, it must return @c true. If an application returns @c false, the request of the URL continues with the
+ * browser engine.
+ *
+ * @since 2.0
+ *
+ * @return @c true if the application handles the URL after the request is cancelled in the browser engine, @n
+ * else @c false if the browser engine proceeds with the requested URL
+ * @param[in] url The URL that is requested
+ * @param[in] type The type that indicates how the URL is triggered
+ */
+ virtual bool OnLoadingRequested(const Tizen::Base::String& url, WebNavigationType type) = 0;
+
+ /**
+ * Called to notify an application of the content type of the data to be downloaded. @n
+ * - To handle data by itself, the application must return @c WEB_DECISION_DOWNLOAD. The data is routed to IWebDownloadListener to be downloaded incrementally. @n
+ * - If an application returns @c WEB_DECISION_CONTINUE, the browser engine continues the downloading and tries to parse the data. @n
+ * - If an application returns @c WEB_DECISION_IGNORE, the browser engine cancels the downloading of the data.
+ *
+ * @since 2.0
+ *
+ * @return A value of the enumerator DecisionPolicy
+ * @param[in] mime The content type of the data that is downloaded
+ * @param[in] httpHeader The HTTP header string
+ */
+ virtual DecisionPolicy OnWebDataReceived(const Tizen::Base::String& mime, const Tizen::Net::Http::HttpHeader& httpHeader) = 0;
+
+ /**
+ * Called when the favicon of the new page is received. @n
+ * If this callback is received once, an application can get the favicon by using Tizen::Web::Controls::Web::GetFaviconN().
+ *
+ * @since 2.1
+ *
+ * @param[in] favicon The favicon image
+ */
+ virtual void OnFaviconReceived(const Tizen::Graphics::Bitmap& favicon) {}
+
+protected:
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // Gets the Impl instance.
+ //
+ // @since 2.0
+ //
+ virtual void ILoadingListener_Reserved1(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // Gets the Impl instance.
+ //
+ // @since 2.0
+ //
+ virtual void ILoadingListener_Reserved2(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // Gets the Impl instance.
+ //
+ // @since 2.0
+ //
+ virtual void ILoadingListener_Reserved3(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // Gets the Impl instance.
+ //
+ // @since 2.0
+ //
+ virtual void ILoadingListener_Reserved4(void) {}
+
+}; // ILoadingListener
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_ILOADING_LISTENER_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrlITextSearchListener.h
+ * @brief This is the header file for the %ITextSearchListener interface.
+ *
+ * This header file contains the declarations of the %ITextSearchListener interface.
+ */
+#ifndef _FWEB_CTRL_ITEXT_SEARCH_LISTENER_H_
+#define _FWEB_CTRL_ITEXT_SEARCH_LISTENER_H_
+
+#include <FBaseRtIEventListener.h>
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+/**
+ * @interface ITextSearchListener
+ * @brief This interface is for receiving the result of the search operation made by asynchronous methods.
+ *
+ * @since 2.0
+ *
+ * The %ITextSearchListener interface receives the result of the search operation made by asynchronous methods.
+ */
+class _OSP_EXPORT_ ITextSearchListener
+ : public virtual Tizen::Base::Runtime::IEventListener
+
+{
+
+public:
+
+ /**
+ * This polymorphic destructor should be overridden if required. @n
+ * This way, the destructors of the derived classes are called when the destructor of this interface is called.
+ *
+ * @since 2.0
+ */
+ virtual ~ITextSearchListener(void) {}
+
+ /**
+ * Called when the text is found.
+ *
+ * @since 2.0
+ *
+ * @param[in] totalCount The total count of the matches
+ * @param[in] currentOrdinal The ordinal of the currently selected match @n
+ * If there is no match, it is set to zero.
+ */
+ virtual void OnTextFound(int totalCount, int currentOrdinal) = 0;
+
+protected:
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // Gets the Impl instance.
+ //
+ // @since 2.0
+ //
+ virtual void ITextSearchListener_Reserved1(void) {};
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // Gets the Impl instance.
+ //
+ // @since 2.0
+ //
+ virtual void ITextSearchListener_Reserved2(void) {};
+};
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_ITEXT_SEARCH_LISTENER_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrlIWebDownloadListener.h
+ * @brief This is the header file for the %IWebDownloadListener interface.
+ *
+ * This header file contains the declarations of the %IWebDownloadListener interface.
+ */
+#ifndef _FWEB_CTRL_IWEB_DOWNLOAD_LISTENER_H_
+#define _FWEB_CTRL_IWEB_DOWNLOAD_LISTENER_H_
+
+#include <FBaseByteBuffer.h>
+#include <FBaseRtIEventListener.h>
+#include <FWebCtrlILoadingListener.h>
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+/**
+ * @interface IWebDownloadListener
+ * @brief This interface downloads data from the internet.
+ *
+ * @since 2.0
+ *
+ * The %IWebDownloadListener interface downloads data from the internet.
+ * An application receives content from a network incrementally
+ * when it decides to download the content after checking the Multipurpose Internet Mail Extensions (MIME).
+ * This is useful when the content is not supported by the framework itself and the application wants to handle it.
+ * @n
+ * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/web/controls_namespace.htm">Web Controls Guide</a>.
+ *
+ * The following examples demonstrate how to use the %IWebDownloadListener interface.
+ * @code
+ * #include <FWeb.h>
+ * #include <FUiControls.h>
+ *
+ * using namespace Tizen::Web;
+ * using namespace Tizen::Ui::Controls;
+ *
+ * // Adds a Web control to the parent container
+ * result
+ * WebSample::CreateControl(Form* pParentForm)
+ * {
+ * result r = E_SUCCESS;
+ *
+ * pWeb = new Web();
+ * r = pWeb->Construct( pParentForm->GetClientAreaBounds());
+ * r = pParentForm->AddControl(pWeb);
+ *
+ * // Sets a loading listener and a Web downloading listener
+ * pWeb->SetDownloadListener(pMyDownloadListener);
+ * pWeb->SetLoadingListener(pMyLoadingListener);
+ *
+ * return r;
+ * }
+ * @endcode
+ *
+ * As soon as the first chunk of data is received, OnWebDataReceived() is fired with the MIME type.
+ * If you want to download the data, return @c WEB_DECISION_DOWNLOAD.
+ *
+ * @code
+ * DecisionPolicy
+ * MyLoadingListener::OnWebDataReceived(const Tizen::Base::String& mime, const Tizen::Net::Http::HttpHeader& header)
+ * {
+ * return WEB_DECISION_DOWNLOAD;
+ * }
+ * @endcode
+ *
+ * Then, the data is routed to OnWebChunkedDataReceived().
+ *
+ * @code
+ * void
+ * MyDownloadListener::OnWebChunkedDataReceived(Tizen::Base::ByteBuffer& chunk)
+ * {
+ * // ....
+ * }
+ * @endcode
+ */
+class _OSP_EXPORT_ IWebDownloadListener
+ : public virtual Tizen::Base::Runtime::IEventListener
+{
+public:
+ /**
+ * This polymorphic destructor should be overridden if required. @n
+ * This way, the destructors of the derived classes are called when the destructor of this interface is called.
+ *
+ * @since 2.0
+ */
+ virtual ~IWebDownloadListener(void) {}
+
+ /**
+ * Called when the HyperText Transfer Protocol (HTTP) protocol receives the next chunked data.
+ *
+ * @since 2.0
+ *
+ * @param[in] chunk The chunked data
+ * @remarks The received data size is less than the capacity of the specified Tizen::Base::ByteBuffer by @c 1.
+ */
+ virtual void OnWebChunkedDataReceived(const Tizen::Base::ByteBuffer& chunk) = 0;
+
+ /**
+ * Called when the downloading of the content is completed.
+ *
+ * @since 2.0
+ */
+ virtual void OnWebDataDownloadCompleted(void) = 0;
+
+ /**
+ * Called when an error occurs while downloading content.
+ *
+ * @since 2.0
+ *
+ * @param[in] error The type of error that occurs while downloading data
+ */
+ virtual void OnWebDownloadFailed(LoadingErrorType error) = 0;
+
+protected:
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // Gets the Impl instance.
+ //
+ // @since 2.0
+ //
+ virtual void IWebDownloadListener_Reserved1(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // Gets the Impl instance.
+ //
+ // @since 2.0
+ //
+ virtual void IWebDownloadListener_Reserved2(void) {}
+
+}; // IWebDownloadListener
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_IWEB_DOWNLOAD_LISTENER_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrlIWebKeypadEventListener.h
+ * @brief This is the header file for the %IWebKeypadEventListener interface.
+ *
+ * This header file contains the declarations of the %IWebKeypadEventListener interface.
+ */
+#ifndef _FWEB_CTRL_IWEB_KEYPAD_EVENT_LISTENER_H_
+#define _FWEB_CTRL_IWEB_KEYPAD_EVENT_LISTENER_H_
+
+#include <FBaseRtIEventListener.h>
+
+namespace Tizen { namespace Web { namespace Controls
+{
+class Web;
+}}} // Tizen::Web::Controls
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+/**
+ * @interface IWebKeypadEventListener
+ * @brief This interface provides a listener for keypad events invoked by the <textarea> or <input> tag, which has "text" or "password" value as its attribute.
+ *
+ * @since 2.0
+ *
+ * The %IWebKeypadEventListener interface provides a listener for keypad events invoked by the <textarea> or <input> tag, which has "text" or "password" value as its attribute.
+ * It also enables the implementer class to receive the overlay keypad related events.
+ */
+class _OSP_EXPORT_ IWebKeypadEventListener
+ : public virtual Tizen::Base::Runtime::IEventListener
+{
+public:
+ /**
+ * This polymorphic destructor should be overridden if required. @n
+ * This way, the destructors of the derived classes are called when the destructor of this interface is called.
+ *
+ * @since 2.0
+ */
+ virtual ~IWebKeypadEventListener(void) {}
+
+ /**
+ * Called when the keypad is about to be shown on the screen.
+ *
+ * @since 2.0
+ *
+ * @param[in] source The source of the event
+ */
+ virtual void OnWebKeypadWillOpen(Tizen::Web::Controls::Web& source) = 0;
+
+ /**
+ * Called when the keypad is shown on the screen.
+ *
+ * @since 2.0
+ *
+ * @param[in] source The source of the event
+ * @remarks When the overlay keypad appears on the screen, the current Form's
+ * area is adjusted to account for the space that is taken up by the overlay keypad.
+ * @see Tizen::Ui::Controls::Form::GetClientAreaBounds()
+ */
+ virtual void OnWebKeypadOpened(Tizen::Web::Controls::Web& source) = 0;
+
+ /**
+ * Called when the keypad is hidden from the screen.
+ *
+ * @since 2.0
+ *
+ * @param[in] source The source of the event
+ * @see Tizen::Ui::Controls::Form::GetClientAreaBounds()
+ */
+ virtual void OnWebKeypadClosed(Tizen::Web::Controls::Web& source) = 0;
+
+ /**
+ * Called when the keypad bounds are changed, for instance when the predictive text window which is located in the upper part of the keypad is shown.
+ *
+ * @since 2.0
+ *
+ * @param[in] source The source of the event
+ * @see Tizen::Ui::Controls::Form::GetClientAreaBounds()
+ */
+ virtual void OnWebKeypadBoundsChanged(Tizen::Web::Controls::Web& source) {};
+
+protected:
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // Gets the Impl instance.
+ //
+ // @since 2.0
+ //
+ virtual void IWebKeypadEventListener_Reserved1(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // Gets the Impl instance.
+ //
+ // @since 2.0
+ //
+ virtual void IWebKeypadEventListener_Reserved2(void) {}
+
+ //
+ // This method is for internal use only.
+ // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // @since 2.0
+ //
+ virtual void IWebKeypadEventListener_Reserved3(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // Gets the Impl instance.
+ //
+ // @since 2.0
+ //
+ virtual void IWebKeypadEventListener_Reserved4(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // Gets the Impl instance.
+ //
+ // @since 2.0
+ //
+ virtual void IWebKeypadEventListener_Reserved5(void) {}
+}; // IWebKeypadEventListener
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_IWEB_KEYPAD_EVENT_LISTENER_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrlIWebUiEventListener.h
+ * @brief This is the header file for the %IWebUiEventListener interface.
+ *
+ * This header file contains the declarations of the %IWebUiEventListener interface.
+ */
+#ifndef _FWEB_CTRL_IWEB_UI_EVENT_LISTENER_H_
+#define _FWEB_CTRL_IWEB_UI_EVENT_LISTENER_H_
+
+#include <FBaseRtIEventListener.h>
+#include <FWebCtrlWeb.h>
+#include <FGrpPoint.h>
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+/**
+ * @interface IWebUiEventListener
+ * @brief This interface is used for receiving user interface (UI) related events caused by the layout changes of a control.
+ *
+ * @since 2.0
+ *
+ * The %IWebUiEventListener interface is used for receiving user interface (UI) related events caused by the layout changes of a control.
+ * The browser engine requests a screen update through this interface when the layout of a page is changed.
+ */
+class _OSP_EXPORT_ IWebUiEventListener
+ : public virtual Tizen::Base::Runtime::IEventListener
+{
+public:
+ /**
+ * This polymorphic destructor should be overridden if required. @n
+ * This way, the destructors of the derived classes are called when the destructor of this interface is called.
+ *
+ * @since 2.0
+ */
+ virtual ~IWebUiEventListener(void) {}
+
+ /**
+ * Called when the layout of a page is updated. @n
+ * The application must call Tizen::Ui::Control::Show() if the screen needs to be updated.
+ *
+ * @since 2.0
+ *
+ * @param[in] source The source of the event
+ */
+ virtual void OnWebPageShowRequested(Tizen::Web::Controls::Web& source) = 0;
+
+
+ /**
+ * Called when a request for creating a new window is received. @n
+ * The returned %Web control instance must be constructed by using a child window's Construct() method.
+ *
+ * @since 2.0
+ *
+ * @return A pointer to the new WebWindow instance
+ */
+ virtual Tizen::Web::Controls::Web* OnWebWindowCreateRequested(void) = 0;
+
+
+ /**
+ * Called when a request for closing the window is received. @n
+ * This event is called from the parent window's listener that invoked the child window. @n
+ * The application must free the resource allocated for the Web Control.
+ *
+ * @since 2.0
+ *
+ * @param[in] source The source of the closing event
+ */
+ virtual void OnWebWindowCloseRequested(Tizen::Web::Controls::Web& source) = 0;
+
+ /**
+ * Called when the selected block of a page is updated.
+ *
+ * @since 2.0
+ *
+ * @param[in] source The source of the event
+ * @param[in] startPoint The starting point of the selected block
+ * @param[in] endPoint The ending point of the selected block
+ */
+ virtual void OnWebPageBlockSelected(Tizen::Web::Controls::Web& source, Tizen::Graphics::Point& startPoint, Tizen::Graphics::Point& endPoint) = 0;
+
+ /**
+ * Called just after the touch move event to determine whether the preventDefault() method is triggered or not. @n
+ * The application that wants to support the W3C preventDefault() feature is recommended to use this callback and delay the handling of the touch move event until this callback is received.
+ *
+ * @since 2.1
+ *
+ * @param[in] source The source of the event
+ * @param[in] trigger Set to @c true if the preventDefault() method is triggered, @n
+ * else @c false
+ * @remarks This callback is always called just after the touch move event and returns @c true when preventDefault() is triggered on the touch start or touch move event.
+ */
+ virtual void OnWebPreventDefaultTriggered(Tizen::Web::Controls::Web& source, bool trigger) {};
+
+protected:
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // Gets the Impl instance.
+ //
+ // @since 2.0
+ //
+ virtual void IWebUiEventListener_Reserved1(void) {};
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // Gets the Impl instance.
+ //
+ // @since 2.0
+ //
+ virtual void IWebUiEventListener_Reserved2(void) {};
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // Gets the Impl instance.
+ //
+ // @since 2.0
+ //
+ virtual void IWebUiEventListener_Reserved3(void) {};
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // Gets the Impl instance.
+ //
+ // @since 2.0
+ //
+ virtual void IWebUiEventListener_Reserved4(void) {};
+}; // IWebUiEventListener
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_IWEB_UI_EVENT_LISTENER_H_
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+* @file FWebCtrlIWebUiEventListenerF.h\r
+* @brief This is the header file for the %IWebUiEventListenerF interface.\r
+*\r
+* This header file contains the declarations of the %IWebUiEventListenerF interface.\r
+*/\r
+#ifndef _FWEB_CTRL_IWEB_UI_EVENT_LISTENER_F_H_\r
+#define _FWEB_CTRL_IWEB_UI_EVENT_LISTENER_F_H_\r
+\r
+#include <FBaseRtIEventListener.h>\r
+#include <FWebCtrlWeb.h>\r
+#include <FGrpPoint.h>\r
+\r
+namespace Tizen { namespace Web { namespace Controls\r
+{\r
+\r
+/**\r
+* @interface IWebUiEventListenerF\r
+* @brief This interface is used for receiving user interface (UI) related events caused by the layout changes of a control.\r
+*\r
+* @since 2.1\r
+*\r
+* The %IWebUiEventListenerF interface is used for receiving user interface (UI) related events caused by the layout changes of a control.\r
+* The browser engine requests a screen update through this interface when the layout of a page is changed.\r
+*/\r
+class _OSP_EXPORT_ IWebUiEventListenerF\r
+ : public virtual Tizen::Base::Runtime::IEventListener\r
+{\r
+public:\r
+ /**\r
+ * This polymorphic destructor should be overridden if required. @n\r
+ * This way, the destructors of the derived classes are called when the destructor of this interface is called.\r
+ *\r
+ * @since 2.1\r
+ */\r
+ virtual ~IWebUiEventListenerF (void) {}\r
+\r
+ /**\r
+ * Called when the layout of a page is updated. @n\r
+ * The application must call Tizen::Ui::Control::Show() if the screen needs to be updated.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @param[in] source The source of the event\r
+ */\r
+ virtual void OnWebPageShowRequested(Tizen::Web::Controls::Web& source) = 0;\r
+\r
+ /**\r
+ * Called when a request for creating a new window is received. @n\r
+ * The returned %Web control instance must be constructed by using a child window's Construct() method.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return A pointer to the new WebWindow instance\r
+ */\r
+ virtual Tizen::Web::Controls::Web* OnWebWindowCreateRequested(void) = 0;\r
+\r
+ /**\r
+ * Called when a request for closing the window is received. @n\r
+ * This event is called from the parent window's listener that invoked the child window. @n\r
+ * The application must free the resource allocated for the %Web control.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @param[in] source The source of the closing event\r
+ */\r
+ virtual void OnWebWindowCloseRequested(Tizen::Web::Controls::Web& source) = 0;\r
+\r
+ /**\r
+ * Called when the selected block of a page is updated.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @param[in] source The source of the event\r
+ * @param[in] startPoint The starting point of the selected block\r
+ * @param[in] endPoint The ending point of the selected block\r
+ */\r
+ virtual void OnWebPageBlockSelected(Tizen::Web::Controls::Web& source, Tizen::Graphics::FloatPoint& startPoint, Tizen::Graphics::FloatPoint& endPoint) = 0;\r
+\r
+ /**\r
+ * Called just after the touch move event to determine whether the preventDefault() method is triggered or not. @n\r
+ * The application that wants to support the W3C preventDefault() feature is recommended to use this callback and delay the handling of the touch move event until this callback is received.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @param[in] source The source of the event\r
+ * @param[in] trigger Set to @c true if the preventDefault() method is triggered, @n\r
+ * else @c false\r
+ * @remarks This callback is always called just after the touch move event and returns @c true when preventDefault() is triggered on the touch start or touch move event.\r
+ */\r
+ virtual void OnWebPreventDefaultTriggered(Tizen::Web::Controls::Web& source, bool trigger) {};\r
+\r
+protected:\r
+ //\r
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.\r
+ //\r
+ // Gets the Impl instance.\r
+ //\r
+ // @since 2.1\r
+ //\r
+ virtual void IWebUiEventListenerF_Reserved1(void) {};\r
+\r
+ //\r
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.\r
+ //\r
+ // Gets the Impl instance.\r
+ //\r
+ // @since 2.1\r
+ //\r
+ virtual void IWebUiEventListenerF_Reserved2(void) {};\r
+\r
+ //\r
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.\r
+ //\r
+ // Gets the Impl instance.\r
+ //\r
+ // @since 2.1\r
+ //\r
+ virtual void IWebUiEventListenerF_Reserved3(void) {};\r
+\r
+ //\r
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.\r
+ //\r
+ // Gets the Impl instance.\r
+ //\r
+ // @since 2.1\r
+ //\r
+ virtual void IWebUiEventListenerF_Reserved4(void) {};\r
+}; // IWebUiEventListenerF\r
+\r
+}}} // Tizen::Web::Controls\r
+#endif // _FWEB_CTRL_IWEB_UI_EVENT_LISTENER_F_H_\r
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrlPageNavigationList.h
+ * @brief This is the header file for the %PageNavigationList class.
+ *
+ * This header file contains the declarations of the %PageNavigationList class.
+ */
+#ifndef _FWEB_CTRL_PAGE_NAVIGATION_LIST_H_
+#define _FWEB_CTRL_PAGE_NAVIGATION_LIST_H_
+
+#include <FBaseObject.h>
+#include <FBaseColIList.h>
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+class _PageNavigationListImpl;
+}}} // Tizen::Web::Controls
+
+namespace Tizen { namespace Web
+{
+class HistoryItem;
+}} // Tizen::Web
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+/**
+ * @class PageNavigationList
+ * @brief This class contains the back and forward list for a %Web control.
+ *
+ * @since 2.0
+ *
+ * The %PageNavigationList class provides the back and forward list for a %Web control.
+ * @n
+ * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/web/controls_namespace.htm">Web Controls Guide</a>.
+ */
+class _OSP_EXPORT_ PageNavigationList
+ : public Tizen::Base::Object
+{
+public:
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.0
+ */
+ virtual ~PageNavigationList(void);
+
+ /**
+ * Gets the current history item.
+ *
+ * @since 2.0
+ *
+ * @return The current history item, @n
+ * else @c null if no history item exists
+ */
+ const Tizen::Web::HistoryItem* GetCurrentItem(void) const;
+
+ /**
+ * Gets the index of the current history item.
+ *
+ * @since 2.0
+ *
+ * @return The index of the currently viewed page in the web page navigation list, @n
+ * else @c -1 if no history item exists
+ */
+ int GetCurrentIndex(void) const;
+
+ /**
+ * Gets the history item that the specified @c index points to.
+ *
+ * @since 2.0
+ *
+ * @return A pointer to the history item at the specified @c index
+ * @param[in] index The index of the element @n
+ * The value of the index must be greater than or equal to @c 0.
+ * @exception E_OUT_OF_RANGE The specified @c index is out of the valid range.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ const Tizen::Web::HistoryItem* GetItemAt(int index) const;
+
+ /**
+ * Gets the total number of history items.
+ *
+ * @since 2.0
+ *
+ * @return The total number of items
+ */
+ int GetItemCount(void) const;
+
+private:
+ //
+ // This constructor is intentionally declared as private so that only the platform can create an instance.
+ //
+ // @remarks This constructor is hidden.
+ //
+ PageNavigationList(void);
+
+ //
+ // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @param[in] item The instance of the %PageNavigationList class to copy from
+ // @remarks This constructor is hidden.
+ //
+ PageNavigationList(const PageNavigationList& item);
+
+ //
+ // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @param[in] item The instance of the %PageNavigationList class to assign from
+ // @remarks This operator is hidden.
+ //
+ PageNavigationList& operator =(const PageNavigationList& item);
+
+private:
+ _PageNavigationListImpl* __pPageNavigationListImpl;
+
+ friend class _PageNavigationListImpl;
+
+ friend class _WebImpl;
+}; // PageNavigationList
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_PAGE_NAVIGATION_LIST_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrlWeb.h
+ * @brief This is the header file for the %Web class.
+ *
+ * This header file contains the declarations of the %Web class.
+ */
+#ifndef _FWEB_CTRL_WEB_H_
+#define _FWEB_CTRL_WEB_H_
+
+#include <FBaseBuffer.h>
+#include <FBaseResult.h>
+#include <FBaseString.h>
+#include <FUiContainer.h>
+
+namespace Tizen { namespace Graphics
+{
+class Dimension;
+class Point;
+class Rectangle;
+}} // Tizen::Graphics
+
+namespace Tizen { namespace Net { namespace Http
+{
+class HttpHeader;
+}}} // Tizen::Net::Http
+
+namespace Tizen { namespace Web { namespace Controls
+{
+class IJavaScriptBridge;
+class ILoadingListener;
+class ITextSearchListener;
+class IWebDownloadListener;
+class IWebKeypadEventListener;
+class IWebUiEventListener;
+class IWebUiEventListenerF;
+class IWebUiListener;
+class HitElementResult;
+class PageNavigationList;
+class WebSetting;
+class _WebImpl;
+}}} // Tizen::Web::Controls
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+/**
+ * @class Web
+ * @brief This class provides methods for embedding a browser in an application.
+ *
+ * @since 2.0
+ *
+ * The %Web class provides methods for embedding a browser in an application to load and render various types of %Web content. Similar to adding UI controls, the %Web content can be added to the application by adding a %Web control.
+ * @n
+ * For more information on the class features and %Web browser feature limitations, see <a href="../org.tizen.native.appprogramming/html/guide/web/controls_namespace.htm">Web Controls Guide</a> and <a href="../org.tizen.native.appprogramming/html/guide/web/supported_web_features.htm">Supported Features in the Web Control</a>.
+ *
+ * The following example demonstrates how to use the %Web class.
+ * @code
+// Sample code using Form for WebSample.h
+#include <FUi.h>
+#include <FWeb.h>
+
+class WebSample :
+ public Tizen::Ui::Controls::Form
+{
+public:
+ WebSample(void) {};
+ virtual ~WebSample(void) {};
+
+protected:
+ void LoadUrl(void);
+
+private:
+ Tizen::Web::Controls::Web *__pWeb;
+
+public:
+ virtual result OnInitializing(void);
+};
+
+// Sample code using Form for WebSample.cpp
+#include "WebSample.h"
+
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Web::Controls;
+
+result
+WebSample::OnInitializing(void)
+{
+ result r = E_SUCCESS;
+
+ // Constucts a Form
+ ...
+
+ __pWeb = new Web();
+ __pWeb->Construct(GetClientAreaBounds());
+ AddControl(__pWeb);
+
+ LoadUrl();
+
+ return r;
+}
+
+// Calls LoadUrl() with the URL of the Web content to display it on the Web control
+void
+WebSample::LoadUrl(void)
+{
+ Tizen::Base::String url(L"http://www.tizen.org/about/");
+
+ __pWeb->LoadUrl(url);
+}
+ * @endcode
+ *
+ * @code
+// Sample code using Window for WebSample.h
+#include <FApp.h>
+#include <FUi.h>
+#include <FWeb.h>
+
+class WebSample :
+ public Tizen::Ui::Window
+{
+public:
+ WebSample(void) {};
+ virtual ~WebSample(void) {};
+
+protected:
+ void LoadUrl(void);
+
+private:
+ Tizen::Web::Controls::Web *__pWeb;
+
+public:
+ virtual result OnInitializing(void);
+};
+
+// Sample code using Window for WebSample.cpp
+#include "WebSample.h"
+
+using namespace Tizen::App;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Web::Controls;
+
+result
+WebSample::OnInitializing(void)
+{
+ result r = E_SUCCESS;
+
+ // Constucts a Window
+ ...
+
+ Frame *pFrame = UiApp::GetInstance()->GetAppFrame()->GetFrame();
+ SetOwner(pFrame->GetCurrentForm());
+
+ __pWeb = new Web();
+ __pWeb->Construct(GetClientAreaBounds());
+ AddControl(__pWeb);
+
+ Show();
+ LoadUrl();
+
+ return r;
+}
+
+// Calls LoadUrl() with the URL of the Web content to display it on the Web control
+void
+WebSample::LoadUrl(void)
+{
+ Tizen::Base::String url(L"http://www.tizen.org/about/");
+
+ __pWeb->LoadUrl(url);
+}
+ * @endcode
+ */
+class _OSP_EXPORT_ Web
+ : public Tizen::Ui::Container
+{
+public:
+ /**
+ * The object is not fully constructed after this constructor is called. @n
+ * For full construction, the Construct() method must be called right after calling this constructor.
+ *
+ * @since 2.0
+ */
+ Web(void);
+
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.0
+ */
+ virtual ~Web(void);
+
+ /**
+ * Initializes this instance of the %Web control with the specified parameters.
+ *
+ * @since 2.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.service
+ *
+ * @return An error code
+ * @param[in] rect The rectangle size of the control
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_SYSTEM The method has failed.
+ * @exception E_INVALID_ARG The specified @c rect is invalid.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method. @b Since: @b 2.1
+ */
+ result Construct(const Tizen::Graphics::Rectangle& rect);
+
+ /**
+ * Initializes this instance of the %Web control with the specified parameters.
+ *
+ * @since 2.1
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.service
+ *
+ * @return An error code
+ * @param[in] rect The rectangle size of the control
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_SYSTEM The method has failed.
+ * @exception E_INVALID_ARG The specified @c rect is invalid.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method.
+ */
+ result Construct(const Tizen::Graphics::FloatRectangle& rect);
+
+ /**
+ * Loads the resource specified by the URL.
+ *
+ * @since 2.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.service
+ *
+ * @param[in] url The resource to load
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method. @b Since: @b 2.1
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ void LoadUrl(const Tizen::Base::String& url);
+
+ /**
+ * Loads the resource specified by the URL along with the given header of the HTTP request.
+ *
+ * @since 2.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.service
+ *
+ * @return An error code
+ * @param[in] url The resource to load
+ * @param[in] header The header of the HTTP request
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_HEADER The header object does not contain any header fields.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method. @b Since: @b 2.1
+ */
+ result LoadUrl(const Tizen::Base::String& url, const Tizen::Net::Http::HttpHeader& header);
+
+ /**
+ * Loads the resource specified by the URL along with the given header and body of the HTTP request. @n
+ * The header must include the content-type entity-header field that is needed to check the mime-type of the message body.
+ *
+ * @since 2.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.service
+ *
+ * @return An error code
+ * @param[in] url The resource to load
+ * @param[in] header The header of the HTTP request
+ * @param[in] body The message body of the HTTP request
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_HEADER The header object does not contain any header fields.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method. @b Since: @b 2.1
+ */
+ result LoadUrlWithPostRequest(const Tizen::Base::String& url, const Tizen::Net::Http::HttpHeader& header, const Tizen::Base::ByteBuffer& body);
+
+ /**
+ * Loads the content of the specified buffer.
+ *
+ * @since 2.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.service
+ *
+ * @param[in] baseUrl The uniform resource locator (URL) of the content
+ * @param[in] content The content
+ * @param[in] mime The MIME type of the content
+ * @param[in] encoding The <a href= "../org.tizen.native.appprogramming/html/guide/web/supported_web_features.htm">text encoding</a> of the content
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The content buffer is empty. @b Since: @b 2.1
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method. @b Since: @b 2.1
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ void LoadData(const Tizen::Base::String& baseUrl, const Tizen::Base::ByteBuffer& content, const Tizen::Base::String& mime, const Tizen::Base::String& encoding = "UTF-8");
+
+ /**
+ * Stops the current loading operation.
+ *
+ * @since 2.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.service
+ *
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method. @b Since: @b 2.1
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ void StopLoading(void);
+
+ /**
+ * Reloads the current page.
+ *
+ * @since 2.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.service
+ *
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method. @b Since: @b 2.1
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ void Reload(void);
+
+ /**
+ * Checks whether the page is loading.
+ *
+ * @since 2.0
+ *
+ * @return @c true if the page is loading, @n
+ * else @c false
+ */
+ bool IsLoading(void) const;
+
+ /**
+ * Checks whether the current %Web control has a back history item.
+ *
+ * @since 2.0
+ *
+ * @return @c true if a back history item exists, @n
+ * else @c false
+ */
+ bool CanGoBack(void) const;
+
+ /**
+ * Checks whether the current %Web control has a forward history item.
+ *
+ * @since 2.0
+ *
+ * @return @c true if a forward history item exists, @n
+ * else @c false
+ */
+ bool CanGoForward(void) const;
+
+ /**
+ * Goes to the back history of the current %Web control.
+ *
+ * @since 2.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.service
+ *
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method. @b Since: @b 2.1
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ void GoBack(void);
+
+ /**
+ * Goes to the forward history of the current %Web control.
+ *
+ * @since 2.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.service
+ *
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method. @b Since: @b 2.1
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ void GoForward(void);
+
+ /**
+ * Gets the backward and forward navigation list of the %Web control.
+ *
+ * @since 2.0
+ *
+ * @return A pointer to PageNavigationList that contains the history items of the %Web control
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ Tizen::Web::Controls::PageNavigationList* GetBackForwardListN(void) const;
+
+ /**
+ * Searches for a word on the current page. @n
+ * When called again, it searches for the next instance of the word on the page. Set @c searchForward to @c false to search for the word in the backward
+ * direction.
+ *
+ * @since 2.0
+ *
+ * @return @c true if the specified @c word is found, @n
+ * else @c false
+ * @param[in] word The string to search for
+ * @param[in] searchForward Set to @c true to search for the word in the forward direction from the current position, @n
+ * else @c false to search for the word in the backward direction from the current position
+ */
+ bool SearchText(const Tizen::Base::String& word, bool searchForward = true);
+
+ /**
+ * Sets the new values for the default setting. @n
+ * It fails to change the setting during data load.
+ *
+ * @since 2.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.service
+ *
+ * @return An error code
+ * @param[in] setting The setting to update
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method. @b Since: @b 2.1
+ */
+ result SetSetting(const Tizen::Web::Controls::WebSetting& setting);
+
+ /**
+ * Gets the setting of the %Web control.
+ *
+ * @since 2.0
+ *
+ * @return An instance of WebSetting
+ */
+ Tizen::Web::Controls::WebSetting GetSetting(void) const;
+
+
+ /**
+ * Gets the information of the element pointed by the specified coordinates.
+ *
+ * @since 2.0
+ *
+ * @return A HitElementResult of the pointed element
+ * @param[in] point The x and y coordinates
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified @c point is invalid.
+ * @exception E_UNSUPPORTED_FORMAT The image format is not supported.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ Tizen::Web::Controls::HitElementResult* GetElementByPointN(const Tizen::Graphics::Point& point) const;
+
+ /**
+ * Gets the information of the element pointed by the specified coordinates.
+ *
+ * @since 2.1
+ *
+ * @return A HitElementResult of the pointed element
+ * @param[in] point The x and y coordinates
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified @c point is invalid.
+ * @exception E_UNSUPPORTED_FORMAT The image format is not supported.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ Tizen::Web::Controls::HitElementResult* GetElementByPointN(const Tizen::Graphics::FloatPoint& point) const;
+
+ /**
+ * Evaluates the JavaScript string and returns the result.
+ *
+ * @since 2.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.service
+ *
+ * @return The result of the evaluated JavaScript, @n
+ * else @c null if an error occurs
+ * @param[in] scriptCode The JavaScript code as a string
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method. @b Since: @b 2.1
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ Tizen::Base::String* EvaluateJavascriptN(const Tizen::Base::String& scriptCode);
+
+ /**
+ * Sets the zoom-out level as a ratio.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] level The zoom-out level @n
+ * The value lies between the range @c 0.3 and @c 2.0. When the page view is at its original size, the level is @c 1.0. @n If the
+ * specified level is less than @c 1.0, the page view is reduced. @n If the specified level is greater than @c 1.0, the page view is
+ * magnified.
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_RANGE The specified @c level is either less than @c 0.3 or greater than @c 2.0.
+ */
+ result SetZoomLevel(float level);
+
+ /**
+ * Gets the zoom level of a page as a percentage.
+ *
+ * @since 2.0
+ *
+ * @return The value lies between the range @c 0.3 and @c 2.0
+ */
+ float GetZoomLevel(void) const;
+
+ /**
+ * Gets the title of the current page.
+ *
+ * @since 2.0
+ *
+ * @return The title of the current page
+ */
+ Tizen::Base::String GetTitle(void) const;
+
+ /**
+ * Gets the URL of the current page.
+ *
+ * @since 2.0
+ *
+ * @return The URL of the current page
+ */
+ Tizen::Base::String GetUrl(void) const;
+
+ /**
+ * Checks whether the specified multipurpose internet mail extensions (MIME) type is supported by %Tizen.
+ *
+ * @since 2.0
+ *
+ * @return @c true if the specified MIME type is supported, @n
+ * else @c false
+ * @param[in] mime The MIME type
+ */
+ bool IsMimeSupported(const Tizen::Base::String& mime) const;
+
+ /**
+ * Sets a load event listener.
+ *
+ * @since 2.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.service
+ *
+ * @param[in] pLoadingListener The listener receives the events that occur while loading the data
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method. @b Since: @b 2.1
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ void SetLoadingListener(Tizen::Web::Controls::ILoadingListener* pLoadingListener);
+
+ /**
+ * Sets a download event listener.
+ *
+ * @since 2.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.service
+ *
+ * @param[in] pDownLoadListener The listener to receive the data from a network incrementally
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method. @b Since: @b 2.1
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ void SetDownloadListener(Tizen::Web::Controls::IWebDownloadListener* pDownLoadListener);
+
+ /**
+ * Sets the starting point for the text selection block. @n
+ * It sets the selection block around the nearest word bound.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] startPoint The starting point for the text selection block
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG There is nothing to select from the specified starting point.
+ */
+ result SetBlockSelectionPosition(const Tizen::Graphics::Point& startPoint);
+
+ /**
+ * Sets the starting point for the text selection block. @n
+ * It sets the selection block around the nearest word bound.
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[in] startPoint The starting point for the text selection block
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG There is nothing to select from the specified starting point.
+ */
+ result SetBlockSelectionPosition(const Tizen::Graphics::FloatPoint& startPoint);
+
+ /**
+ * Releases the currently selected block.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @exception E_SUCCESS The method is successful.
+ *
+ */
+ result ReleaseBlock(void);
+
+ /**
+ * Gets the starting point and the ending point of the selected text block. @n
+ * When the %GetBlockRange() method is called without the selection block, the @c startPoint and @c endPoint have (0,0) values for the x and y coordinates.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[out] startPoint The starting point of the selected text block
+ * @param[out] endPoint The ending point of the selected text block
+ * @exception E_SUCCESS The method is successful.
+ */
+ result GetBlockRange(Tizen::Graphics::Point& startPoint, Tizen::Graphics::Point& endPoint) const;
+
+ /**
+ * Gets the starting point and the ending point of the selected text block. @n
+ * When this method is called without the selection block, the startPoint and endPoint have (0.0,0.0) values for the x and y coordinates.
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[out] startPoint The starting point of the selected text block
+ * @param[out] endPoint The ending point of the selected text block
+ * @exception E_SUCCESS The method is successful.
+ */
+ result GetBlockRange(Tizen::Graphics::FloatPoint& startPoint, Tizen::Graphics::FloatPoint& endPoint) const;
+
+
+ /**
+ * Gets the text of the selected text block.
+ *
+ * @since 2.0
+ *
+ * @return The selected text, @n
+ * else an empty string if there is no selection block
+ */
+ Tizen::Base::String GetTextFromBlock(void) const;
+
+ /**
+ * Enables or disables the vertical and horizontal scrolls.
+ *
+ * @since 2.0
+ *
+ * @param[in] enable Set to @c true to enable the scrolling of the web page, @n
+ * else @c false
+ * @exception E_SUCCESS The method is successful.
+ * @remarks This method does not affect the JavaScript touch event.
+ */
+ result SetScrollEnabled(bool enable);
+
+
+ /**
+ * Checks whether the web page scroll is enabled.
+ *
+ * @since 2.0
+ *
+ * @return @c true if the web page scroll is enabled, @n
+ * else @c false
+ */
+ bool IsScrollEnabled(void) const;
+
+ /**
+ * Registers a user interface (UI) event listener.
+ *
+ * @since 2.0
+ *
+ * @param[in] pUiEventListener The listener to receive the user interface (UI) related events
+ */
+ void SetWebUiEventListener(Tizen::Web::Controls::IWebUiEventListener* pUiEventListener);
+
+ /**
+ * Registers a user interface (UI) event listener.
+ *
+ * @since 2.1
+ *
+ * @param[in] pUiEventListener The listener to receive the user interface (UI) related events
+ */
+ void SetWebUiEventListenerF(Tizen::Web::Controls::IWebUiEventListenerF* pUiEventListener);
+
+ /**
+ * Checks whether the %Web control uses private browsing.
+ *
+ * @since 2.0
+ *
+ * @return @c true if private browsing is enabled, @n
+ * else @c false
+ */
+ bool IsPrivateBrowsingEnabled(void) const;
+
+ /**
+ * Sets the private browsing and returns the result.
+ *
+ * @since 2.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.service
+ *
+ * @return The result of setting the private browsing
+ * @param[in] enable Set to @c true to enable private browsing, @n
+ * else @c false
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method. @b Since: @b 2.1
+ */
+ result SetPrivateBrowsingEnabled(bool enable);
+
+ /**
+ * Clears the back and forward navigation list.
+ *
+ * @since 2.1
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.service
+ *
+ * @return An error code
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method.
+ * @see CanGoBack()
+ * @see CanGoForward()
+ * @see GoBack()
+ * @see GoForward()
+ */
+ result ClearHistory(void);
+
+ /**
+ * Clears the application's cache.
+ *
+ * @since 2.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.service
+ *
+ * @return An error code
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method. @b Since: @b 2.1
+ */
+ result ClearCache(void);
+
+ /**
+ * Clears the application's cookie.
+ *
+ * @since 2.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.service
+ *
+ * @return An error code
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method. @b Since: @b 2.1
+ */
+ result ClearCookie(void);
+
+ /**
+ * Clears the application's all stored form data.
+ *
+ * @since 2.1
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.service
+ *
+ * @return An error code
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method.
+ */
+ result ClearFormData(void);
+
+ /**
+ * Clears the application's all stored ID/password data.
+ *
+ * @since 2.1
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.service
+ *
+ * @return An error code
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method.
+ */
+ result ClearLoginFormData(void);
+
+ /**
+ * Checks whether the %Web control allows cookies. @n
+ *
+ * @since 2.0
+ *
+ * @return @c true if the cookie is allowed, @n
+ * else @c false
+ */
+ bool IsCookieEnabled(void) const;
+
+ /**
+ * Enables or disables a cookie.
+ *
+ * @since 2.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.service
+ *
+ * @return The result of enabling or disabling a cookie
+ * @param[in] enable Set to @c true if the web control allows a cookie, @n
+ * else @c false
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method. @b Since: @b 2.1
+ */
+ result SetCookieEnabled(bool enable);
+
+ /**
+ * Saves the current web page as a pdf file. @n
+ * The size parameter is used to set the size of a pdf file using millimeters.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] filePath The path of the pdf file that is created
+ * @param[in] pSize The width and height of the pdf file in millimeters. The width and height must be greater than @c 0. @n
+ * If the parameter contains @c null, the method uses the default size of the web page that is shown on the screen.
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
+ * - The specified path is invalid.
+ * - The specified size is invalid.
+ * @exception E_INACCESSIBLE_PATH The file path is not allowed for the application to write.
+ */
+ result SavePageAsPdf(const Tizen::Base::String& filePath, const Tizen::Graphics::Dimension* pSize = null);
+
+ /**
+ * Adds a JavaScript bridge instance.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] jsBridge The JavaScript bridge to add
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_ALREADY_EXIST A JavaScript bridge with the same name already exists.
+ */
+ result AddJavaScriptBridge(const IJavaScriptBridge& jsBridge);
+
+ /**
+ * Removes a JavaScript bridge instance.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] jsBridge The JavaScript bridge to remove
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_NOT_FOUND The specified element is not found.
+ */
+ result RemoveJavaScriptBridge(const IJavaScriptBridge& jsBridge);
+
+ /**
+ * Registers a keypad event listener. @n
+ * The registered listener is notified when the keypad associated with <input> tag or <textarea> tag is opened or closed.
+ *
+ * @since 2.0
+ *
+ * @param[in] pKeypadEventListener The event listener to set
+ * @remarks The interfaces of IWebKeypadEventListener are called only when the input style of the keypad is @c INPUT_STYLE_OVERLAY.
+ * @see WebSetting::SetInputStyle()
+ */
+ void SetWebKeypadEventListener(IWebKeypadEventListener* pKeypadEventListener);
+
+ /**
+ * Searches for all the instances of the text on the current page and then highlights them. @n
+ * The current matched block indicates the first match.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] text The string to search for
+ * @param[in] caseSensitive Set to @c true to search for the text in the case-sensitive mode, @n
+ * else @c false to search for the text in the backward direction from the current position
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified @c text is invalid.
+ * @remarks This method operates asynchronously.
+ * @see Tizen::Web::Controls::ITextSearchListener::OnTextFound()
+ */
+ result SearchTextAllAsync(const Tizen::Base::String& text, bool caseSensitive);
+
+ /**
+ * Scrolls the current matched block to the next text matched by SearchTextAllAsync().
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] searchForward Set to @c true to search for the text in the forward direction from the current position, @n
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_NOT_FOUND The next instance is not found.
+ * @exception E_INVALID_OPERATION The SearchTextAllAsync() method is not called.
+ * @remarks This method operates asynchronously.
+ * @see Tizen::Web::Controls::ITextSearchListener::OnTextFound()
+ */
+ result SearchNextAsync(bool searchForward = true);
+
+ /**
+ * Sets a text search listener.
+ *
+ * @since 2.0
+ *
+ * @param[in] pTextSearchListener The result of the search operation made by asynchronous methods
+ */
+ void SetTextSearchListener(ITextSearchListener* pTextSearchListener);
+
+ /**
+ * Gets the favicon image from the current page.
+ *
+ * @since 2.0
+ *
+ * @return The image
+ * @see Tizen::Web::Controls::ILoadingListener::OnFaviconReceived()
+ */
+ Tizen::Graphics::Bitmap* GetFaviconN(void) const;
+
+ /**
+ * Informs the browser engine to stop the screen operations such as updating a screen until %Web calls the Resume() method. @n
+ * It is useful when a %Web control is not visible and does not need to update its screen.
+ *
+ * @since 2.0
+ */
+ void Pause(void);
+
+ /**
+ * Informs the browser engine to resume the handling of the screen operations.
+ *
+ * @since 2.0
+ */
+ void Resume(void);
+
+ /**
+ * Scrolls the web page with the given coordinates.
+ *
+ * @since 2.1
+ *
+ * @param[in] diff The x and y coordinates
+ */
+ void ScrollBy(const Tizen::Graphics::Point& diff);
+
+ /**
+ * Sets the scrolled position of the web page.
+ *
+ * @since 2.1
+ *
+ * @param[in] dest The x and y coordinates
+ */
+ void ScrollTo(const Tizen::Graphics::Point& dest);
+
+ /**
+ * Gets the current scroll position of the web page.
+ *
+ * @since 2.1
+ *
+ * @return The x and y coordinates
+ */
+ Tizen::Graphics::Point GetScrollPosition(void) const;
+
+ /**
+ * Gets the size of the current web page.
+ *
+ * @since 2.1
+ *
+ * @return The size of the current web page
+ * @remarks If an application wants to get the displayed size, the return value should be multiplied by the zoom factor.
+ * @see GetZoomLevel()
+ */
+ Tizen::Graphics::Dimension GetPageSize(void) const;
+
+private:
+ //
+ // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @param[in] item The instance of the %Web class to copy from
+ // @remarks This constructor is hidden.
+ //
+ Web(const Web& item);
+
+ //
+ // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @param[in] item The instance of the %Web class to assign from
+ // @remarks This operator is hidden.
+ //
+ Web& operator =(const Web& item);
+}; // Web
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_WEB_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrlWebSetting.h
+ * @brief This is the header file for the %WebSetting class.
+ *
+ * This header file contains the declarations of the %WebSetting class for a %Web control.
+ */
+#ifndef _FWEB_CTRL_WEB_SETTING_H_
+#define _FWEB_CTRL_WEB_SETTING_H_
+
+#include <FBaseObject.h>
+#include <FBaseString.h>
+#include <FUiCtrlInputTypes.h>
+
+namespace Tizen { namespace Web { namespace Controls
+{
+class _WebSettingImpl;
+}}} // Tizen::Web::Control
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+/**
+ * @enum CacheMode
+ *
+ * Defines the types of cache mode.
+ *
+ * @since 2.0
+ */
+enum CacheMode
+{
+ WEB_CACHE_VALIDATED, /**< The use of cache data only when the cache data is valid */
+ WEB_CACHE_IGNORE /**< The retrieval of data from a network resource without using cache data */
+};
+
+/**
+ * @enum CertificateErrorHandlingMode
+ *
+ * Defines the types of certification error handling mode.
+ *
+ * @since 2.0
+ */
+enum CertificateErrorHandlingMode
+{
+ WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM, /**< The web certificate error handling mode: The confirm popup is displayed to get the user confirmation */
+ WEB_CERTIFICATE_ERROR_HANDLING_MODE_CANCEL, /**< The web certificate error handling mode: The confirm popup is not displayed and the request is cancelled */
+ WEB_CERTIFICATE_ERROR_HANDLING_MODE_CONTINUE /**< The web certificate error handling mode: The confirm popup is not displayed and the request proceeds */
+};
+
+/**
+ * @class WebSetting
+ * @brief This class holds the setting values for a %Web control.
+ *
+ * @since 2.0
+ *
+ * The %WebSetting class holds the setting values, which configure the behavior of a %Web control. An application can, for example, enable or disable JavaScript and image auto loading.
+ */
+class _OSP_EXPORT_ WebSetting
+ : public Tizen::Base::Object
+{
+public:
+ /**
+ * This is the default constructor for this class.
+ *
+ * @since 2.0
+ */
+ WebSetting(void);
+
+ /**
+ * Copying of objects using this copy constructor is allowed.
+ * This is the copy constructor for the %WebSetting class. @n
+ * It creates an instance of %WebSetting with the values of the specified instance.
+ *
+ * @since 2.0
+ *
+ * @param[in] setting An instance of %WebSetting
+ */
+ WebSetting(const WebSetting& setting);
+
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.0
+ */
+ virtual ~WebSetting(void);
+
+ /**
+ * Sets a cache control strategy for a %Web control.
+ *
+ * @since 2.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.service
+ *
+ * @param[in] mode The cache mode
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method. @b Since: @b 2.1
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ void SetCacheControl(CacheMode mode);
+
+ /**
+ * Sets the font size of the content.
+ *
+ * @since 2.0
+ *
+ * @param[in] fontSize The font size
+ */
+ void SetFontSize(int fontSize);
+
+ /**
+ * Sets the text encoding for the content of a %Web control.
+ *
+ * @since 2.0
+ *
+ * @param[in] encoding The text encoding
+ */
+ void SetDefaultTextEncoding(const Tizen::Base::String& encoding);
+
+ /**
+ * Enables or disables the use of JavaScript.
+ *
+ * @since 2.0
+ *
+ * @param[in] enable Set to @c true if the %Web control uses JavaScript, @n
+ * else @c false
+ */
+ void SetJavascriptEnabled(bool enable);
+
+ /**
+ * Decides if a %Web control loads images included in the content.
+ *
+ * @since 2.0
+ *
+ * @param[in] enable Set to @c true if the %Web control loads images included in the content, @n
+ * else @c false
+ */
+ void SetAutoImageLoadEnabled(bool enable);
+
+ /**
+ * Sets the input style of the keypad, which is displayed for the <input> or <textarea> tag.
+ *
+ * @since 2.0
+ *
+ * @param[in] inputStyle The input style of the keypad
+ * @remarks If an application sets the input style to @c INPUT_STYLE_OVERLAY, the application must implement IWebKeypadEventListener to rearrange the layout of the current Form.
+ *
+ */
+ void SetInputStyle(Tizen::Ui::Controls::InputStyle inputStyle);
+
+ /**
+ * Gets the value of the cache control strategy for a %Web control. @n
+ * The default value is @c WEB_CACHE_VALIDATED.
+ *
+ * @since 2.0
+ *
+ * @return A cache mode
+ */
+ CacheMode GetCacheControl(void) const;
+
+ /**
+ * Gets the font size of the content. @n
+ * The default size is @c 16.
+ *
+ * @since 2.0
+ *
+ * @return The size of the font
+ */
+ int GetFontSize(void) const;
+
+ /**
+ * Gets the text encoding of the content of a %Web control. @n
+ * The default encoding is UTF-8.
+ *
+ * @since 2.0
+ *
+ * @return The text encoding
+ */
+ Tizen::Base::String GetDefaultTextEncoding(void) const;
+
+ /**
+ * Checks whether a %Web control uses JavaScript. @n
+ * The default value is @c true.
+ *
+ * @since 2.0
+ *
+ * @return @c true if JavaScript is enabled and used by a %Web control, @n
+ * else @c false
+ */
+ bool IsJavascriptEnabled(void) const;
+
+ /**
+ * Checks whether a %Web control loads images included in the content automatically. @n
+ * The default value is @c true.
+ *
+ * @since 2.0
+ *
+ * @return @c true if auto image loading is enabled, @n
+ * else @c false
+ */
+ bool IsAutoImageLoadEnabled(void) const;
+
+ /**
+ * Gets the input style of the keypad, which is displayed for the <input> or <textarea> tag. @n
+ * The default style is @c INPUT_STYLE_FULLSCREEN.
+ *
+ * @since 2.0
+ *
+ * @return The input style of the keypad
+ */
+ Tizen::Ui::Controls::InputStyle GetInputStyle(void) const;
+
+ /**
+ * Sets the certificate error handling mode for a %Web control.
+ *
+ * @since 2.0
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.service
+ *
+ * @param[in] mode The certificate error handling mode
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method. @b Since: @b 2.1
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ void SetCertificateErrorHandlingMode(CertificateErrorHandlingMode mode);
+
+ /**
+ * Gets the value of the certificate error handling mode for a %Web control. @n
+ * The default value is @c WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM.
+ *
+ * @since 2.0
+ *
+ * @return The certificate error handling mode
+ */
+ CertificateErrorHandlingMode GetCertificateErrorHandlingMode(void) const;
+
+ /**
+ * Sets the user agent for a %Web control.
+ *
+ * @since 2.0
+ *
+ * @param[in] agent The user agent
+ */
+ void SetUserAgent(const Tizen::Base::String& agent);
+
+ /**
+ * Gets the value of the user agent for a %Web control.
+ *
+ * @since 2.0
+ *
+ * @return The value of the user agent
+ */
+ Tizen::Base::String GetUserAgent(void) const;
+
+ /**
+ * Decides if a %Web control loads the resized contents to fit the width automatically.
+ *
+ * @since 2.0
+ *
+ * @param[in] enable Set to @c true if the %Web control should load contents to fit the width, @n
+ * else @c false
+ */
+ void SetAutoFittingEnabled(bool enable);
+
+ /**
+ * Checks whether a %Web control loads the resized contents to fit the width. @n
+ * The default value is @c true.
+ *
+ * @since 2.0
+ *
+ * @return @c true if auto fitting is enabled, @n
+ * else @c false
+ */
+ bool IsAutoFittingEnabled(void) const;
+
+ /**
+ * Decides if a %Web control allows JavaScript to open a new window.
+ *
+ * @since 2.0
+ *
+ * @param[in] enable Set to @c true if the %Web control should allow JavaScript to open a new window, @n
+ * else @c false
+ */
+ void SetJavaScriptPopupEnabled(bool enable);
+
+ /**
+ * Checks whether a %Web control allows JavaScript to open a new window.
+ * The default value is @c true.
+ *
+ * @since 2.0
+ *
+ * @return @c true if opening a new window by JavaScript is enabled, @n
+ * else @c false
+ */
+ bool IsJavaScriptPopupEnabled(void) const;
+
+ /**
+ * Decides if a %Web control supports the HTML5 geolocation feature.
+ *
+ * @since 2.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.service
+ *
+ * @param[in] enable Set to @c true if the %Web control should support the HTML5 geolocation feature, @n
+ * else @c false
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method. @b Since: @b 2.1
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ void SetGeolocationEnabled(bool enable);
+
+ /**
+ * Checks whether a %Web control supports the HTML5 geolocation feature.
+ * The default value is @c true.
+ *
+ * @since 2.0
+ *
+ * @return @c true if the HTML5 geolocation feature is enabled, @n
+ * else @c false
+ */
+ bool IsGeolocationEnabled(void) const;
+
+ /**
+ * Decides if a %Web control saves the form data automatically and supports the autocomplete feature.
+ *
+ * @since 2.1
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.service
+ *
+ * @param[in] enable Set to @c true if the %Web control should save the form data automatically and supports the autocomplete feature, @n
+ * else @c false
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ void SetAutoFormDataShowEnabled(bool enable);
+
+ /**
+ * Checks whether a %Web control saves the form data automatically and supports the autocomplete feature.
+ * The default value is @c true.
+ *
+ * @since 2.1
+ *
+ * @return @c true if the %Web control saves the form data and enables the autocomplete feature, @n
+ * else @c false
+ */
+ bool IsAutoFormDataShowEnabled(void) const;
+
+ /**
+ * Decides if a %Web control saves the ID/password for a login form automatically and supports the autofill feature.
+ *
+ * @since 2.1
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.service
+ *
+ * @param[in] enable Set to @c true if the %Web control should save the login ID/password automatically and supports the autofill feature, @n
+ * else @c false
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ void SetAutoLoginFormFillEnabled(bool enable);
+
+ /**
+ * Checks whether a %Web control saves the ID/password for a login form automatically and supports the autofill feature.
+ * The default value is @c true.
+ *
+ * @since 2.1
+ *
+ * @return @c true if the %Web control saves the ID/password for a login form and enables the autofill feature, @n
+ * else @c false
+ */
+ bool IsAutoLoginFormFillEnabled(void) const;
+
+ /**
+ * Gets the hash value of the current instance.
+ *
+ * @since 2.0
+ *
+ * @return The hash value of the current instance
+ */
+ virtual int GetHashCode(void) const;
+
+ /**
+ * Compares two instances of the %WebSetting class.
+ *
+ * @since 2.0
+ *
+ * @return @c true if the two instances match, @n
+ * else @c false
+ * @param[in] obj The object to compare with the current instance
+ * @remarks This method returns @c true if and only if the two instances contain the same elements.
+ * @see Tizen::Base::Object::Equals()
+ */
+ virtual bool Equals(const Tizen::Base::Object& obj) const;
+
+ /**
+ * Copying of objects using this copy assignment operator is allowed.
+ *
+ * @since 2.0
+ *
+ * @param[in] setting The instance of the %WebSetting class to assign
+ */
+ WebSetting& operator =(const WebSetting& setting);
+
+private:
+ _WebSettingImpl* __pWebSettingImpl;
+
+ friend class _WebSettingImpl;
+}; // WebSetting
+
+}}} // Tizen::Web::Control
+#endif // _FWEB_CTRL_WEB_SETTING_H_
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+* @file FWebCtrlWebStorageManager.h\r
+* @brief This is the header file for the %WebStorageManager class.\r
+*\r
+* This header file contains the declarations of the %WebStorageManager class for a %Web control.\r
+*/\r
+#ifndef _FWEB_CTRL_WEB_STORAGE_MANAGER_H_\r
+#define _FWEB_CTRL_WEB_STORAGE_MANAGER_H_\r
+\r
+#include <unique_ptr.h>\r
+#include <FBaseString.h>\r
+\r
+namespace Tizen { namespace Base { namespace Collection\r
+{\r
+class IList;\r
+}}} // Tizen::Base::Collection\r
+\r
+namespace Tizen { namespace Web { namespace Controls\r
+{\r
+class _WebStorageManagerImpl;\r
+}}} // Tizen::Web::Control\r
+\r
+namespace Tizen { namespace Web { namespace Controls\r
+{\r
+\r
+/**\r
+* @enum WebStorageType\r
+*\r
+* Defines the web storage type.\r
+*\r
+* @since 2.1\r
+*/\r
+enum WebStorageType\r
+{\r
+ WEB_STORAGE_TYPE_APPLICATION_CACHE, /**< The web storage type: application cache */\r
+ WEB_STORAGE_TYPE_INDEXED_DATABASE, /**< The web storage type: indexed database */\r
+ WEB_STORAGE_TYPE_WEB_SQL_DATABASE, /**< The web storage type: web database */\r
+ WEB_STORAGE_TYPE_WEB_STORAGE, /**< The web storage type: web storage */\r
+ WEB_STORAGE_TYPE_FILE_SYSTEM /**< The web storage type: file system */\r
+};\r
+\r
+/**\r
+* @class WebStorageManager\r
+* @brief This class holds the setting values for a %Web control.\r
+*\r
+* @since 2.1\r
+*\r
+* @final This class is not intended for extension.\r
+*\r
+* The %WebStorageManager class holds the setting values for a %Web control.\r
+*/\r
+class _OSP_EXPORT_ WebStorageManager\r
+ : public Tizen::Base::Object\r
+{\r
+public:\r
+\r
+ /**\r
+ * Gets the list of origins for a given storage type. @n\r
+ * The @c WEB_STORAGE_TYPE_INDEXED_DATABASE is not supported.\r
+ *\r
+ * @since 2.1\r
+ * @privlevel public\r
+ * @privilege %http://tizen.org/privilege/web.privacy\r
+ *\r
+ * @return A pointer to Tizen::Base::Collection::IList that contains the origin(Tizen::Base::String) list, @n\r
+ * else @c null if no web storage data exists\r
+ * @param[in] storageType The web storage type\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_UNSUPPORTED_TYPE The specified @c storageType is not supported.\r
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
+ * @remarks The specific error code can be accessed using the GetLastResult() method.\r
+ */\r
+ Tizen::Base::Collection::IList* GetOriginListN(WebStorageType storageType) const;\r
+\r
+ /**\r
+ * Sets the default quota for a given origin of a given storage type. @n\r
+ * Only @c WEB_STORAGE_TYPE_WEB_SQL_DATABASE and @c WEB_STORAGE_TYPE_APPLICATION_CACHE are supported.\r
+ *\r
+ * @since 2.1\r
+ * @privlevel public\r
+ * @privilege %http://tizen.org/privilege/web.privacy\r
+ *\r
+ * @return An error code\r
+ * @param[in] storageType The web storage type\r
+ * @param[in] origin The origin\r
+ * @param[in] quota The quota of the web storage to set in bytes\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_ARG The specified @c origin is invalid.\r
+ * @exception E_UNSUPPORTED_TYPE The specified @c storageType is not supported.\r
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
+ */\r
+ result SetQuotaForOrigin(WebStorageType storageType, const Tizen::Base::String& origin, long quota);\r
+\r
+\r
+ /**\r
+ * Gets the quota for a given origin of a given storage type. @n\r
+ * Only @c WEB_STORAGE_TYPE_WEB_SQL_DATABASE is supported.\r
+ *\r
+ * @since 2.1\r
+ * @privlevel public\r
+ * @privilege %http://tizen.org/privilege/web.privacy\r
+ *\r
+ * @return The usage of the web storage in bytes\r
+ * @param[in] storageType The web storage type\r
+ * @param[in] origin The origin\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_ARG The specified @c origin is invalid.\r
+ * @exception E_UNSUPPORTED_TYPE The specified @c storageType is not supported.\r
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
+ */\r
+ long GetQuotaForOrigin(WebStorageType storageType, const Tizen::Base::String& origin);\r
+\r
+ /**\r
+ * Gets the usage for a given origin of a given storage type. @n\r
+ * @c WEB_STORAGE_TYPE_INDEXED_DATABASE and @c WEB_STORAGE_TYPE_FILE_SYSTEM are not supported.\r
+ *\r
+ * @since 2.1\r
+ * @privlevel public\r
+ * @privilege %http://tizen.org/privilege/web.privacy\r
+ *\r
+ * @return The usage of the web storage in bytes\r
+ * @param[in] storageType The web storage type\r
+ * @param[in] origin The origin\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_ARG The specified @c origin is invalid.\r
+ * @exception E_UNSUPPORTED_TYPE The specified @c storageType is not supported.\r
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
+ * @remarks The specific error code can be accessed using the GetLastResult() method.\r
+ */\r
+ long GetUsageForOrigin(WebStorageType storageType, const Tizen::Base::String& origin) const;\r
+\r
+ /**\r
+ * Removes the data for a given origin of a given storage type. @n\r
+ * @c WEB_STORAGE_TYPE_INDEXED_DATABASE is not supported.\r
+ *\r
+ * @since 2.1\r
+ * @privlevel public\r
+ * @privilege %http://tizen.org/privilege/web.privacy\r
+ *\r
+ * @return An error code\r
+ * @param[in] storageType The web storage type\r
+ * @param[in] origin The origin\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_ARG The specified @c origin is invalid.\r
+ * @exception E_UNSUPPORTED_TYPE The specified @c storageType is not supported.\r
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
+ * @see RemoveAll()\r
+ */\r
+ result Remove(WebStorageType storageType, const Tizen::Base::String& origin);\r
+\r
+ /**\r
+ * Removes all the data of a given storage type.\r
+ *\r
+ * @since 2.1\r
+ * @privlevel public\r
+ * @privilege %http://tizen.org/privilege/web.privacy\r
+ *\r
+ * @return An error code\r
+ * @param[in] storageType The web storage type\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_UNSUPPORTED_TYPE The specified @c storageType is not supported.\r
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
+ * @see Remove()\r
+ */\r
+ result RemoveAll(WebStorageType storageType);\r
+\r
+ /**\r
+ * Gets a web storage manager instance.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return A pointer to the %WebStorageManager instance, @n\r
+ * else @c null if it fails\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_OUT_OF_MEMORY The memory is insufficient.\r
+ * @remarks The specific error code can be accessed using the GetLastResult() method.\r
+ */\r
+ static WebStorageManager* GetInstance(void);\r
+\r
+private:\r
+ //\r
+ // This default constructor is intentionally declared as private to implement the Singleton semantic.\r
+ //\r
+ // @remarks This constructor is hidden.\r
+ //\r
+ WebStorageManager(void);\r
+\r
+ //\r
+ // This destructor is intentionally declared as private to implement the Singleton semantic.\r
+ //\r
+ // @remarks This destructor is hidden.\r
+ //\r
+ virtual ~WebStorageManager(void);\r
+\r
+ // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.\r
+ //\r
+ // @param[in] rhs The instance of the % WebStorageManager class to copy from\r
+ // @remarks This constructor is hidden.\r
+ //\r
+ WebStorageManager(const WebStorageManager& rhs);\r
+\r
+ //\r
+ // Initializes the web storage manager instance.\r
+ //\r
+ // @since 2.1\r
+ //\r
+ static void InitWebStorageManager(void);\r
+\r
+ //\r
+ // Destroys the web storage manager instance.\r
+ //\r
+ // @since 2.1\r
+ //\r
+ static void DestroyWebStorageManager(void);\r
+\r
+ //\r
+ // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.\r
+ //\r
+ // @param[in] rhs An instance of % WebStorageManager to assign from\r
+ // @remarks This operator is hidden.\r
+ //\r
+ WebStorageManager& operator=(const WebStorageManager& rhs);\r
+\r
+private:\r
+ _WebStorageManagerImpl* __pWebStorageManagerImpl;\r
+\r
+ static WebStorageManager* __pInstance;\r
+\r
+ friend class _WebStorageManagerImpl;\r
+\r
+ friend struct std::default_delete<WebStorageManager>;\r
+}; // WebStorageManager\r
+\r
+}}} // Tizen::Web::Controls\r
+#endif // _FWEB_CTRL_WEB_STORAGE_MANAGER_H_\r
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebHistoryItem.h
+ * @brief This is the header file for the %HistoryItem class.
+ *
+ * This header file contains the declarations of the %HistoryItem class.
+ */
+#ifndef _FWEB_HISTORY_ITEM_H_
+#define _FWEB_HISTORY_ITEM_H_
+
+#include <FBaseObject.h>
+#include <FBaseString.h>
+
+namespace Tizen { namespace Graphics
+{
+class Bitmap;
+}} // Tizen::Graphics
+
+namespace Tizen { namespace Web
+{
+class _HistoryItemImpl;
+class _WebHistoryImpl;
+}} // Tizen::Web
+
+namespace Tizen { namespace Web { namespace Controls
+{
+class _WebImpl;
+}}} // Tizen::Web::Controls
+
+namespace Tizen { namespace Web
+{
+
+/**
+ * @class HistoryItem
+ * @brief This class is used for accessing a history item stored in the %PageNavigationList class or the %WebHistory class.
+ *
+ * @since 2.0
+ *
+ * The %HistoryItem class provides access to the Controls::PageNavigationList class item and the WebHistory class.
+ * Each item contains the title and URL of the page visited.
+ */
+class _OSP_EXPORT_ HistoryItem
+ : public Tizen::Base::Object
+{
+public:
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.0
+ */
+ virtual ~HistoryItem(void);
+
+ /**
+ * Gets the page title of the current history item.
+ *
+ * @since 2.0
+ *
+ * @return The title of the current history item
+ */
+ Tizen::Base::String GetTitle(void) const;
+
+ /**
+ * Gets the URL of the current history item.
+ *
+ * @since 2.0
+ *
+ * @return The URL of the current history item
+ */
+ Tizen::Base::String GetUrl(void) const;
+
+ /**
+ * Gets the favicon image from %HistoryItem.
+ *
+ * @since 2.0
+ *
+ * @return The image
+ *
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ Tizen::Graphics::Bitmap* GetFaviconN(void) const;
+
+private:
+ //
+ // This default constructor is intentionally declared as private to implement the Singleton semantic
+ //
+ // @remarks This constructor is hidden.
+ //
+ HistoryItem(void);
+
+ //
+ // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @param[in] item The instance of the %HistoryItem class to copy from
+ // @remarks This constructor is hidden.
+ //
+ HistoryItem(const HistoryItem& item);
+
+ //
+ // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @param[in] item The instance of the %HistoryItem class to assign from
+ // @remarks This operator is hidden.
+ //
+ HistoryItem& operator =(const HistoryItem& item);
+
+private:
+ _HistoryItemImpl* __pHistoryItemImpl;
+
+ friend class Tizen::Web::Controls::_WebImpl;
+
+ friend class _HistoryItemImpl;
+
+ friend class _WebHistoryImpl;
+}; // HistoryItem
+
+}} // Tizen::Web
+#endif // _FWEB_HISTORY_ITEM_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebWebBookmark.h
+* @brief This is the header file for the %WebBookmark class.
+*
+* This header file contains the declarations of the %WebBookmark class.
+*/
+
+#ifndef _FWEB_WEB_BOOKMARK_H_
+#define _FWEB_WEB_BOOKMARK_H_
+
+#include <FBaseString.h>
+#include <FWebBookmarkItem.h>
+
+namespace Tizen { namespace Graphics
+{
+class Bitmap;
+}} // Tizen::Graphics
+
+namespace Tizen { namespace Web
+{
+class _WebBookmarkImpl;
+
+/**
+ * @class WebBookmark
+ * @brief This class provides methods to manage the bookmark items of the browser.
+ *
+ * @since 2.1
+ *
+ * @final This class is not intended for extension.
+ *
+ * The %WebBookmark class provides methods to get the browser's bookmark information and organize it.
+ * The bookmark system has a hierarchical structure with the parent folder ID supporting multiple folders and the bookmark items are represented by the BookmarkItem class. @n
+ * If you use these APIs to backup and restore the bookmark, add bookmark items and folders recursively from the topmost level.
+ */
+class _OSP_EXPORT_ WebBookmark
+ : public Tizen::Base::Object
+{
+public:
+ /**
+ * The object is not fully constructed after this constructor is called. @n
+ * For full construction, the Construct() method must be called right after calling this constructor.
+ *
+ * @since 2.1
+ */
+ WebBookmark(void);
+
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.1
+ */
+ virtual ~ WebBookmark(void);
+
+ /**
+ * Initializes this instance of %WebBookmark.
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_SYSTEM A system error has occurred.
+ */
+ result Construct(void);
+
+ /**
+ * Adds a bookmark folder.
+ *
+ * @since 2.1
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bookmark.write
+ *
+ * @return An error code
+ * @param[in] title The title of a bookmark item
+ * @param[out] folderId The current folder ID
+ * @param[in] parentId The parent folder ID
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
+ * - The specified title is an empty string. @n
+ * - The specified @c parentId is invalid.
+ * @exception E_OBJ_ALREADY_EXIST A folder with the same title and parent ID already exists.
+ * @exception E_SYSTEM The method has failed.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @see BookmarkItem::GetParentFolderId()
+ */
+ result AddFolder(const Tizen::Base::String& title, RecordId& folderId, RecordId parentId = ROOT_FOLDER_ID);
+
+
+ /**
+ * Adds bookmark contents.
+ *
+ * @since 2.1
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bookmark.write
+ *
+ * @return An error code
+ * @param[in] title The title of a bookmark item
+ * @param[in] url The URL of a bookmark item
+ * @param[out] bookmarkId The current bookmark ID
+ * @param[in] parentId The parent folder ID
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
+ * - The specified @c title is an empty string. @n
+ * - The specified @c url is an empty string. @n
+ * - The specified @c parentId is invalid.
+ * @exception E_OBJ_ALREADY_EXIST A folder with the same title and parent ID already exists.
+ * @exception E_SYSTEM The method has failed.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @see BookmarkItem::GetParentFolderId()
+ */
+ result AddBookmark(const Tizen::Base::String& title, const Tizen::Base::String& url, RecordId& bookmarkId, RecordId parentId = ROOT_FOLDER_ID);
+
+ /**
+ * Sets a favicon.
+ *
+ * @since 2.1
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bookmark.write
+ *
+ * @return An error code
+ * @param[in] bookmarkId The bookmark ID
+ * @param[in] favicon The favicon image
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified @c bookmarkId is invalid.
+ * @exception E_INVALID_DATA The specified @c favicon data is invalid.
+ * @exception E_SYSTEM The method has failed.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @see BookmarkItem::GetFaviconN()
+ */
+ result SetFavicon(RecordId bookmarkId, const Tizen::Graphics::Bitmap& favicon);
+
+ /**
+ * Gets the bookmark item that the specified @c index points to.
+ *
+ * @since 2.1
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bookmark.read
+ *
+ * @return The bookmark item at the specified @c index
+ * @param[in] index The index of the element @n
+ * The value of the @c index must be greater than or equal to @c 0.
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_RANGE The specified @c index is out of the valid range.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ const BookmarkItem* GetItemAt(int index) const;
+
+ /**
+ * Gets the total number of items.
+ *
+ * @since 2.1
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bookmark.read
+ *
+ * @return The total number of items
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ int GetItemCount(void) const;
+
+ /**
+ * Removes all the elements.
+ *
+ * @since 2.1
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bookmark.write
+ *
+ * @return An error code
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_SYSTEM The method has failed.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ */
+ result RemoveAll(void);
+
+private:
+ //
+ // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @param[in] rhs The instance of the %WebBookmark class to copy from
+ // @remarks This constructor is hidden.
+ //
+ WebBookmark(const WebBookmark & rhs);
+
+ //
+ // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @param[in] rhs An instance of %WebBookmark
+ // @remarks The method is declared but not implemented.
+ //
+ WebBookmark& operator=(const WebBookmark& rhs);
+
+private:
+ _WebBookmarkImpl * __pWebBookmarkImpl;
+
+ friend class _WebBookmarkImpl;
+}; // WebBookmark
+
+}} // Tizen::Web
+#endif // _FWEB_WEB_BOOKMARK_H_
+
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebWebHistory.h
+ * @brief This is the header file for the %WebHistory class.
+ * @since 2.0
+ *
+ * This header file contains the declarations of the %WebHistory class.
+ */
+#ifndef _FWEB_WEB_HISTORY_H_
+#define _FWEB_WEB_HISTORY_H_
+
+#include <FBaseObject.h>
+
+namespace Tizen { namespace Web
+{
+class HistoryItem;
+class _WebHistoryImpl;
+}} // Tizen::Web
+
+namespace Tizen { namespace Web
+{
+
+/**
+ * @class WebHistory
+ * @brief This class contains the pages visited by users in a browser.
+ *
+ * @since 2.0
+ *
+ * The %WebHistory class is used to retrieve the pages visited by users in a browser. The visited pages are represented by the HistoryItem class.
+ * The WEB_PRIVACY privilege is required to use this class.
+ *
+ */
+class _OSP_EXPORT_ WebHistory
+ : public Tizen::Base::Object
+{
+public:
+ /**
+ * The object is not fully constructed after this constructor is called. @n
+ * For full construction, the Construct() method must be called right after calling this constructor.
+ *
+ * @since 2.0
+ */
+ WebHistory(void);
+
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.0
+ */
+ virtual ~WebHistory(void);
+
+ /**
+ * Initializes this instance of %WebHistory.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_SYSTEM A system error has occurred.
+ */
+ result Construct(void);
+
+ /**
+ * Gets the history item that the specified @c index points to.
+ *
+ * @since 2.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.privacy
+ *
+ * @return The history item at the specified @c index
+ * @param[in] index The index of the element @n
+ * The value of the index must be greater than or equal to @c 0.
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_RANGE The specified @c index is out of the valid range.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ const HistoryItem* GetItemAt(int index) const;
+
+ /**
+ * Gets the total number of items.
+ *
+ * @since 2.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/web.privacy
+ *
+ * @return The total number of items
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ int GetItemCount(void) const;
+
+private:
+ //
+ // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @param[in] item The instance of the %WebHistory class to copy from
+ // @remarks This constructor is hidden.
+ //
+ WebHistory(const WebHistory& item);
+
+ //
+ // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @param[in] item The instance of the %WebHistory class to assign from
+ // @remarks This operator is hidden.
+ //
+ WebHistory& operator =(const WebHistory& item);
+
+private:
+ _WebHistoryImpl* __pWebHistoryImpl;
+
+ friend class _WebHistoryImpl;
+}; // WebHistory
+
+}} // Tizen::Web
+#endif // _FWEB_WEB_HISTORY_H_
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
\ No newline at end of file
--- /dev/null
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=/usr
+libdir=/usr/lib/osp
+includedir=/usr/include/osp
+
+Name: @PC_NAME@
+Description: @PACKAGE_DESCRIPTION@
+Version: @VERSION@
+Requires: @PC_REQUIRED@
+Libs: -L${libdir} @PC_LDFLAGS@
+Cflags: -I${includedir}
+
--- /dev/null
+%define debug_package %{nil}
+%define __strip /bin/true
+
+Name: osp-web
+Summary: osp web library
+Version: 1.2.2.0
+Release: 2
+Group: System/Libraries
+License: Apache-2.0
+Source0: %{name}-%{version}.tar.gz
+BuildRequires: cmake
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(capi-network-connection)
+BuildRequires: pkgconfig(capi-web-favorites)
+BuildRequires: pkgconfig(capi-content-media-content)
+BuildRequires: pkgconfig(dbus-1)
+BuildRequires: pkgconfig(ecore)
+BuildRequires: pkgconfig(edbus)
+BuildRequires: pkgconfig(eina)
+BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(ethumb)
+BuildRequires: pkgconfig(evas)
+BuildRequires: pkgconfig(ewebkit2)
+BuildRequires: pkgconfig(bundle)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(osp-appfw)
+BuildRequires: pkgconfig(osp-content)
+BuildRequires: osp-appfw-internal-devel
+BuildRequires: osp-content-internal-devel
+BuildRequires: pkgconfig(osp-net)
+BuildRequires: osp-net-internal-devel
+BuildRequires: pkgconfig(osp-uifw)
+BuildRequires: pkgconfig(osp-content)
+BuildRequires: osp-uifw-internal-devel
+BuildRequires: pkgconfig(osp-image-core)
+BuildRequires: pkgconfig(osp-image)
+BuildRequires: pkgconfig(osp-media)
+BuildRequires: osp-media-internal-devel
+BuildRequires: pkgconfig(osp-json)
+BuildRequires: pkgconfig(libsoup-2.4)
+BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(openssl)
+BuildRequires: pkgconfig(haptic)
+
+# runtime requires
+Requires: osp-appfw
+Requires: osp-media
+Requires: osp-net
+Requires: osp-json
+Requires: osp-content
+
+%description
+osp web library
+
+%package devel
+Summary: osp web library (Development)
+Group: TO_BE/FILLED_IN
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+osp web library (DEV)
+
+%package internal-devel
+Summary: osp web framework internel (Internal)
+Group: TO_BE/FILLED_IN
+Requires: %{name} = %{version}-%{release}
+
+%description internal-devel
+The Web Framework library of OSP (Internal-DEV)
+
+%package debug
+Summary: osp web library (Development)
+Group: TO_BE/FILLED_IN
+Requires: %{name} = %{version}-%{release}
+
+%description debug
+osp web library (DEV)
+
+%prep
+%setup -q
+
+%build
+%if 0%{?tizen_build_binary_release_type_eng}
+CXXFLAGS="$CXXFLAGS -D_SECURE_LOG"
+%endif
+MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+%ifarch %{ix86}
+%if 0%{?simulator}
+CXXFLAGS="$CXXFLAGS -D_OSP_DEBUG_ -D_OSP_X86_ -D_OSP_EMUL_" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
+%else
+CXXFLAGS="$CXXFLAGS -D_OSP_DEBUG_ -D_OSP_X86_ " cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
+%endif
+%else
+
+%if 0%{?tizen_build_binary_release_type_eng}
+CXXFLAGS="-O2 -g -pipe -Wall -fno-exceptions -Wformat -Wformat-security -Wl,--as-needed -fmessage-length=0 -march=armv7-a -mtune=cortex-a8 -mlittle-endian -mfpu=neon -mfloat-abi=softfp -D__SOFTFP__ -mthumb -Wa,-mimplicit-it=thumb -funwind-tables -D_OSP_DEBUG_ -D_SECURE_LOG -D_OSP_ARMEL_" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
+%else
+CXXFLAGS="-O2 -g -pipe -Wall -fno-exceptions -Wformat -Wformat-security -Wl,--as-needed -fmessage-length=0 -march=armv7-a -mtune=cortex-a8 -mlittle-endian -mfpu=neon -mfloat-abi=softfp -D__SOFTFP__ -mthumb -Wa,-mimplicit-it=thumb -funwind-tables -D_OSP_DEBUG_ -D_OSP_ARMEL_" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
+%endif
+
+%endif
+# Call make instruction with smp support
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+mkdir -p %{buildroot}/usr/share/license
+cat %{_builddir}/%{name}-%{version}/LICENSE.APLv2.0 >> %{buildroot}/usr/share/license/%{name}
+
+%make_install
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files
+%manifest osp-web.manifest
+/usr/share/license/%{name}
+%{_libdir}/osp/libosp-web.so*
+%{_libdir}/osp/browser-plugin/*.so
+
+%files devel
+%{_includedir}/osp/*.h
+%{_libdir}/pkgconfig/osp-web.pc
+
+%files internal-devel
+%{_includedir}/osp/web/controls/*.h
+
+%files debug
+%{_libdir}/osp/debug/*.so.*
+%{_libdir}/osp/browser-plugin/debug/*.so
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebHistoryItem.cpp
+ * @brief The file contains the definition of HistoryItem class.
+ *
+ * This file contains the definition of HistoryItem class.
+ */
+#include <new>
+#include <FBaseResult.h>
+#include <FBaseSysLog.h>
+#include <FGrpBitmap.h>
+#include <FWebBookmarkItem.h>
+#include "FWeb_BookmarkItemImpl.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+
+
+namespace Tizen { namespace Web
+{
+
+
+BookmarkItem::BookmarkItem(void)
+ : __pBookmarkItemImpl(new (std::nothrow) _BookmarkItemImpl())
+{
+ SysTryReturnVoidResult(NID_WEB, __pBookmarkItemImpl, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+}
+
+
+BookmarkItem::BookmarkItem(const BookmarkItem& rhs)
+ : __pBookmarkItemImpl(new (std::nothrow) _BookmarkItemImpl(*_BookmarkItemImpl::GetInstance(&rhs)))
+{
+ SysTryReturnVoidResult(NID_WEB, __pBookmarkItemImpl, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+}
+
+
+BookmarkItem::~BookmarkItem(void)
+{
+ delete __pBookmarkItemImpl;
+ __pBookmarkItemImpl = null;
+}
+
+
+String
+BookmarkItem::GetTitle(void) const
+{
+ SysAssertf(__pBookmarkItemImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pBookmarkItemImpl->GetTitle();
+}
+
+
+String
+BookmarkItem::GetUrl(void) const
+{
+ SysAssertf(__pBookmarkItemImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pBookmarkItemImpl->GetUrl();
+}
+
+
+Bitmap*
+BookmarkItem::GetFaviconN(void) const
+{
+ SysAssertf(__pBookmarkItemImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+
+ Bitmap* pFavicon = __pBookmarkItemImpl->GetFaviconN();
+ SysTryReturn(NID_WEB, GetLastResult() == E_SUCCESS, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ return pFavicon;
+}
+
+
+RecordId
+BookmarkItem::GetParentFolderId(void) const
+{
+ SysAssertf(__pBookmarkItemImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pBookmarkItemImpl->GetParentFolderId();
+}
+
+
+bool
+BookmarkItem::IsFolder(void) const
+{
+ SysAssertf(__pBookmarkItemImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pBookmarkItemImpl->IsFolder();
+}
+
+
+int
+BookmarkItem::GetHashCode(void) const
+{
+ SysAssertf(__pBookmarkItemImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pBookmarkItemImpl->GetHashCode();
+}
+
+
+bool
+BookmarkItem::Equals(const Object& obj) const
+{
+ SysAssertf(__pBookmarkItemImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ const BookmarkItem* pRhs = dynamic_cast< const BookmarkItem* >(&obj);
+ if (pRhs == null)
+ {
+ return false;
+ }
+
+ return __pBookmarkItemImpl->Equals(*pRhs->__pBookmarkItemImpl);
+}
+
+
+BookmarkItem&
+BookmarkItem::operator =(const BookmarkItem& rhs)
+{
+ if (&rhs == this)
+ {
+ return *this;
+ }
+
+ Object::operator =(rhs);
+ _BookmarkItemImpl* pImpl = _BookmarkItemImpl::GetInstance(this);
+ if (pImpl)
+ {
+ *pImpl = *_BookmarkItemImpl::GetInstance(&rhs);
+ }
+
+ return *this;
+}
+
+
+}} // Tizen::Web
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebHistoryItem.cpp
+ * @brief The file contains the definition of HistoryItem class.
+ *
+ * This file contains the definition of HistoryItem class.
+ */
+#include <new>
+#include <FBaseResult.h>
+#include <FBaseSysLog.h>
+#include <FGrpBitmap.h>
+#include <FWebHistoryItem.h>
+#include "FWeb_HistoryItemImpl.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+
+
+namespace Tizen { namespace Web
+{
+
+
+HistoryItem::HistoryItem(void)
+ : __pHistoryItemImpl(new (std::nothrow) _HistoryItemImpl())
+{
+ SysTryReturnVoidResult(NID_WEB, __pHistoryItemImpl, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+}
+
+
+HistoryItem::~HistoryItem(void)
+{
+ delete __pHistoryItemImpl;
+ __pHistoryItemImpl = null;
+}
+
+
+String
+HistoryItem::GetTitle(void) const
+{
+ SysAssertf(__pHistoryItemImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pHistoryItemImpl->GetTitle();
+}
+
+
+String
+HistoryItem::GetUrl(void) const
+{
+ SysAssertf(__pHistoryItemImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pHistoryItemImpl->GetUrl();
+}
+
+Bitmap*
+HistoryItem::GetFaviconN(void) const
+{
+ SysAssertf(__pHistoryItemImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+
+ Bitmap* pFavicon = __pHistoryItemImpl->GetFaviconN();
+ SysTryReturn(NID_WEB, GetLastResult() == E_SUCCESS, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ return pFavicon;
+}
+
+
+}} // Tizen::Web
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebWebBookmark.cpp
+ * @brief The file contains the definition of WebBookmark class.
+ *
+ * This file contains the definition of WebBookmark class.
+ */
+#include <new>
+#include <unique_ptr.h>
+#include <FBaseResult.h>
+#include <FBaseSysLog.h>
+#include <FGrpBitmap.h>
+#include <FWebWebBookmark.h>
+#include <FSec_AccessController.h>
+#include "FWeb_WebBookmarkImpl.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::Security;
+
+
+namespace Tizen { namespace Web
+{
+
+
+WebBookmark::WebBookmark(void)
+ : __pWebBookmarkImpl(null)
+{
+}
+
+
+WebBookmark::~WebBookmark(void)
+{
+ delete __pWebBookmarkImpl;
+ __pWebBookmarkImpl = null;
+}
+
+
+result
+WebBookmark::Construct(void)
+{
+ SysAssertf(__pWebBookmarkImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
+
+ result r = E_SUCCESS;
+
+ std::unique_ptr<_WebBookmarkImpl> pWebBookmarkImpl(new (std::nothrow) _WebBookmarkImpl());
+ SysTryReturnResult(NID_WEB, pWebBookmarkImpl.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ r = pWebBookmarkImpl->Construct();
+ SysTryReturn(NID_WEB, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pWebBookmarkImpl = pWebBookmarkImpl.release();
+
+ return E_SUCCESS;
+}
+
+
+result
+WebBookmark::AddFolder(const String& title, RecordId& folderId, RecordId parentId)
+{
+ SysAssertf(__pWebBookmarkImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_BOOKMARK_WRITE);
+ SysTryReturnResult(NID_WEB, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+
+ r = __pWebBookmarkImpl->AddFolder(title, parentId, folderId);
+ SysTryReturn(NID_WEB, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ SysLog(NID_WEB, "The current value of title is %ls, folderId is %d, parentId is %d", title.GetPointer(), folderId, parentId);
+
+ return E_SUCCESS;
+}
+
+
+result
+WebBookmark::AddBookmark(const String& title, const String& url, RecordId& bookmarkId, RecordId parentId)
+{
+ SysAssertf(__pWebBookmarkImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_BOOKMARK_WRITE);
+ SysTryReturnResult(NID_WEB, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+
+ r = __pWebBookmarkImpl->AddBookmark(title, url, parentId, bookmarkId);
+ SysTryReturn(NID_WEB, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ SysSecureLog(NID_WEB, "The current value of title is %ls, url is %ls, parentId is %d", title.GetPointer(), url.GetPointer(), parentId);
+
+ return E_SUCCESS;
+}
+
+
+result
+WebBookmark::SetFavicon(RecordId bookmarkId, const Bitmap& favicon)
+{
+ SysAssertf(__pWebBookmarkImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_BOOKMARK_WRITE);
+ SysTryReturnResult(NID_WEB, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+
+ r = __pWebBookmarkImpl->SetFavicon(bookmarkId, favicon);
+ SysTryReturn(NID_WEB, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ SysSecureLog(NID_WEB, "The current value of bookmarkId is %d", bookmarkId);
+
+ return E_SUCCESS;
+}
+
+
+const BookmarkItem*
+WebBookmark::GetItemAt(int index) const
+{
+ SysAssertf(__pWebBookmarkImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_BOOKMARK_READ);
+ SysTryReturn(NID_WEB, r == E_SUCCESS, null, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
+
+ const BookmarkItem* pItem = __pWebBookmarkImpl->GetItemAt(index);
+ SysTryReturn(NID_WEB, pItem, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ SysLog(NID_WEB, "The current value of index is %d", index);
+
+ return pItem;
+}
+
+
+int
+WebBookmark::GetItemCount(void) const
+{
+ SysAssertf(__pWebBookmarkImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_BOOKMARK_READ);
+ SysTryReturn(NID_WEB, r == E_SUCCESS, -1, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
+
+ return __pWebBookmarkImpl->GetItemCount();
+}
+
+
+result
+WebBookmark::RemoveAll(void)
+{
+ SysAssertf(__pWebBookmarkImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_BOOKMARK_WRITE);
+ SysTryReturnResult(NID_WEB, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+
+ r = __pWebBookmarkImpl->RemoveAll();
+ SysTryReturn(NID_WEB, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return E_SUCCESS;
+}
+
+
+}} // Tizen::Web
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebWebHistory.cpp
+ * @brief The file contains the definition of WebHistory class.
+ *
+ * This file contains the definition of WebHistory class.
+ */
+#include <new>
+#include <unique_ptr.h>
+#include <FBaseResult.h>
+#include <FBaseSysLog.h>
+#include <FWebWebHistory.h>
+#include <FSec_AccessController.h>
+#include "FWeb_WebHistoryImpl.h"
+
+
+using namespace Tizen::Security;
+
+
+namespace Tizen { namespace Web
+{
+
+
+WebHistory::WebHistory(void)
+ : __pWebHistoryImpl(null)
+{
+}
+
+
+WebHistory::~WebHistory(void)
+{
+ delete __pWebHistoryImpl;
+ __pWebHistoryImpl = null;
+}
+
+
+result
+WebHistory::Construct(void)
+{
+ SysAssertf(__pWebHistoryImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
+
+ result r = E_SUCCESS;
+
+ std::unique_ptr<_WebHistoryImpl> pWebHistoryImpl(new (std::nothrow) _WebHistoryImpl());
+ SysTryReturnResult(NID_WEB, pWebHistoryImpl.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ r = pWebHistoryImpl->Construct();
+ SysTryReturn(NID_WEB, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pWebHistoryImpl = pWebHistoryImpl.release();
+
+ return E_SUCCESS;
+}
+
+
+const HistoryItem*
+WebHistory::GetItemAt(int index) const
+{
+ SysAssertf(__pWebHistoryImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_PRIVACY);
+ SysTryReturn(NID_WEB, r == E_SUCCESS, null, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
+
+ const HistoryItem* pItem = __pWebHistoryImpl->GetItemAt(index);
+ SysTryReturn(NID_WEB, pItem, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ SysLog(NID_WEB, "The current value of index is %d", index);
+
+ return pItem;
+}
+
+
+int
+WebHistory::GetItemCount(void) const
+{
+ SysAssertf(__pWebHistoryImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_PRIVACY);
+ SysTryReturn(NID_WEB, r == E_SUCCESS, -1, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
+
+ return __pWebHistoryImpl->GetItemCount();
+}
+
+
+}} // Tizen::Web
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWeb_HistoryItemImplcpp
+ * @brief The file contains the definition of _HistoryItemImpl class.
+ *
+ * This file contains the definition of _HistoryItemImpl class.
+ */
+#include <favorites.h>
+#include <unique_ptr.h>
+#include <FBaseBoolean.h>
+#include <FBaseInteger.h>
+#include <FBaseSysLog.h>
+#include <FGrpBitmap.h>
+#include <FGrpDimension.h>
+#include <FUiCtrlFrame.h>
+#include <FWebBookmarkItem.h>
+#include "FWeb_BookmarkItemImpl.h"
+#include "FWebCtrl_Utility.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Web::Controls;
+
+
+namespace Tizen { namespace Web
+{
+
+
+_BookmarkItemImpl::_BookmarkItemImpl(void)
+ : __isFolder(false)
+ , __id(0)
+ , __parentId(0)
+ , __url(L"")
+ , __title(L"")
+
+{
+}
+
+
+_BookmarkItemImpl::~_BookmarkItemImpl(void)
+{
+}
+
+
+void
+_BookmarkItemImpl::SetBookmarkItem(RecordId id, const String& url, const String& title, RecordId parentId, bool isFolder)
+{
+ __id = id;
+ __url = url;
+ __title = title;
+ __parentId = parentId;
+ __isFolder = isFolder;
+}
+
+
+String
+_BookmarkItemImpl::GetTitle(void) const
+{
+ return __title;
+}
+
+
+String
+_BookmarkItemImpl::GetUrl(void) const
+{
+ return __url;
+}
+
+
+Bitmap*
+_BookmarkItemImpl::GetFaviconN(void) const
+{
+ result r = E_SUCCESS;
+ Frame* pFrame = null;
+ Evas* pEvas = null;
+ Evas_Object* pIcon = null;
+
+ BufferInfo bufferInfo;
+ ByteBuffer byteBuffer;
+
+ std::unique_ptr<Bitmap> pImage;
+ Dimension dimension;
+ int ret = 0;
+
+ pEvas = _Utility::GetEvasFromUiApp(pFrame);
+ SysTryCatch(NID_WEB, pEvas, , E_SYSTEM, "[E_SYSTEM] Propagating.");
+
+ ret = favorites_bookmark_get_favicon(__id, pEvas, &pIcon);
+ SysTryCatch(NID_WEB, ret == FAVORITES_ERROR_NONE, , E_SYSTEM, "[E_SYSTEM] Propagating.");
+
+ if (!pIcon)
+ {
+ return null;
+ }
+
+ r = _Utility::GetPixelBufferFromEvasObject(pIcon, bufferInfo);
+ SysTryCatch(NID_WEB, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ dimension.width = bufferInfo.width;
+ dimension.height = bufferInfo.height;
+
+ r = byteBuffer.Construct(reinterpret_cast < byte* >(bufferInfo.pPixels), 0, dimension.height * dimension.width * 32, dimension.height * dimension.width * 32 );
+ SysTryCatch(NID_WEB, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pImage = std::unique_ptr<Bitmap>(new (std::nothrow) Bitmap());
+ SysTryCatch(NID_WEB, pImage.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pImage->Construct(byteBuffer, dimension, BITMAP_PIXEL_FORMAT_ARGB8888);
+ SysTryCatch(NID_WEB, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ delete pFrame;
+
+ return pImage.release();
+
+CATCH:
+ delete pFrame;
+
+ return null;
+}
+
+
+RecordId
+_BookmarkItemImpl::GetParentFolderId(void) const
+{
+ return __parentId;
+}
+
+
+bool
+_BookmarkItemImpl::IsFolder(void) const
+{
+ return __isFolder;
+}
+
+
+bool
+_BookmarkItemImpl::Equals(const Object& obj) const
+{
+ const _BookmarkItemImpl* pRhs = dynamic_cast< const _BookmarkItemImpl* >(&obj);
+ if (pRhs == null)
+ {
+ return false;
+ }
+
+ return __id == pRhs->__id && __url == pRhs->__url && __title == pRhs->__title && __parentId == pRhs->__parentId
+ && __isFolder == pRhs->__isFolder;
+}
+
+
+int
+_BookmarkItemImpl::GetHashCode(void) const
+{
+ return Integer(__id).GetHashCode() + __url.GetHashCode() + __title.GetHashCode()
+ + Integer(__parentId).GetHashCode() + Boolean(__isFolder).GetHashCode();
+}
+
+
+_BookmarkItemImpl*
+_BookmarkItemImpl::GetInstance(BookmarkItem* pBookmarkItem)
+{
+ return pBookmarkItem->__pBookmarkItemImpl;
+}
+
+
+const _BookmarkItemImpl*
+_BookmarkItemImpl::GetInstance(const BookmarkItem* pBookmarkItem)
+{
+ return pBookmarkItem->__pBookmarkItemImpl;
+}
+
+
+}} // Tizen::Web
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWeb_HistoryItemImpl.h
+ * @brief The file contains the declaration of _HistoryItemImpl class.
+ *
+ * The file contains the declaration of _HistoryItemImpl class.
+ */
+#ifndef _FWEB_INTERNAL_BOOKMARK_ITEM_IMPL_H_
+#define _FWEB_INTERNAL_BOOKMARK_ITEM_IMPL_H_
+
+#include <FBaseString.h>
+
+namespace Tizen { namespace Web
+{
+class BookmarkItem;
+
+class _BookmarkItemImpl
+ : public Tizen::Base::Object
+{
+public:
+ _BookmarkItemImpl(void);
+
+ virtual ~_BookmarkItemImpl(void);
+
+ void SetBookmarkItem(RecordId id, const Tizen::Base::String& url, const Tizen::Base::String& title, RecordId parentId, bool isFolder);
+
+ Tizen::Base::String GetTitle(void) const;
+
+ Tizen::Base::String GetUrl(void) const;
+
+ Tizen::Graphics::Bitmap* GetFaviconN(void) const;
+
+ RecordId GetParentFolderId(void) const;
+
+ bool IsFolder(void) const;
+
+ virtual int GetHashCode(void) const;
+
+ virtual bool Equals(const Object& obj) const;
+
+ static _BookmarkItemImpl* GetInstance(BookmarkItem* pBookmarkItem);
+
+ static const _BookmarkItemImpl* GetInstance(const BookmarkItem* pBookmarkItem);
+
+private:
+ bool __isFolder;
+
+ RecordId __id;
+
+ RecordId __parentId;
+
+ Tizen::Base::String __url;
+
+ Tizen::Base::String __title;
+}; // _BookmarkItemImpl
+
+}} // Tizen::Web
+#endif // _FWEB_INTERNAL_BOOKMARK_ITEM_IMPL_H_
\ No newline at end of file
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWeb_HistoryItemImplcpp
+ * @brief The file contains the definition of _HistoryItemImpl class.
+ *
+ * This file contains the definition of _HistoryItemImpl class.
+ */
+#include <Ecore_Evas.h>
+//#include <elm_config.h>
+#include <EWebKit2.h>
+#include <favorites.h>
+#include <unique_ptr.h>
+#include <FBaseSysLog.h>
+#include <FGrpBitmap.h>
+#include <FGrpDimension.h>
+#include <FBase_StringConverter.h>
+#include <FUiCtrlFrame.h>
+#include <FWebHistoryItem.h>
+#include "FWeb_HistoryItemImpl.h"
+#include "FWebCtrl_Utility.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Web::Controls;
+
+
+namespace Tizen { namespace Web
+{
+
+
+_HistoryItemImpl::_HistoryItemImpl(void)
+ : __id(-1)
+ , __url(L"")
+ , __title(L"")
+{
+}
+
+
+_HistoryItemImpl::~_HistoryItemImpl(void)
+{
+}
+
+
+void
+_HistoryItemImpl::SetHistoryItem(const String& url, const String& title, int id)
+{
+ __id = id;
+ __url = url;
+ __title = title;
+}
+
+
+String
+_HistoryItemImpl::GetTitle(void) const
+{
+ return __title;
+}
+
+
+String
+_HistoryItemImpl::GetUrl(void) const
+{
+ return __url;
+}
+
+
+Bitmap*
+_HistoryItemImpl::GetFaviconN(void) const
+{
+ result r = E_SUCCESS;
+ Frame* pFrame = null;
+
+ Evas_Object* pIcon = null;
+
+ Ewk_Context* pDefaultContext = null;
+ std::unique_ptr<char[]> pUrl;
+ std::unique_ptr<Bitmap> pBitmapImage;
+
+ int ret = 0;
+ Dimension dimension;
+ BufferInfo bufferInfo;
+ ByteBuffer byteBuffer;
+
+ Evas* pEvas = _Utility::GetEvasFromUiApp(pFrame);
+ SysTryCatch(NID_WEB_CTRL, pEvas, , E_SYSTEM, "[E_SYSTEM] Propagating.");
+
+ if( __id == -1)
+ {
+ pDefaultContext = ewk_context_default_get();
+
+ pUrl = std::unique_ptr<char[]>(_StringConverter::CopyToCharArrayN(__url));
+ pIcon = ewk_context_icon_database_icon_object_add(pDefaultContext, pUrl.get(), pEvas);
+ }
+ else
+ {
+ ret = favorites_history_get_favicon(__id, pEvas, &pIcon);
+ SysTryCatch(NID_WEB_CTRL, ret == FAVORITES_ERROR_NONE, , E_SYSTEM, "[E_SYSTEM] Propagating.");
+ }
+
+ if (!pIcon)
+ {
+ return null;
+ }
+
+ r = _Utility::GetPixelBufferFromEvasObject(pIcon, bufferInfo);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ dimension.width = bufferInfo.width;
+ dimension.height = bufferInfo.height;
+
+ r = byteBuffer.Construct(reinterpret_cast < byte* >(bufferInfo.pPixels), 0, dimension.height * dimension.width * 32, dimension.height * dimension.width * 32 );
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pBitmapImage = std::unique_ptr<Bitmap>(new (std::nothrow) Bitmap());
+ SysTryCatch(NID_WEB_CTRL, pBitmapImage.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pBitmapImage->Construct(byteBuffer, dimension, BITMAP_PIXEL_FORMAT_ARGB8888);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+
+ delete pFrame;
+
+ return pBitmapImage.release();
+
+CATCH:
+ delete pFrame;
+
+ return null;
+}
+
+
+_HistoryItemImpl*
+_HistoryItemImpl::GetInstance(HistoryItem* pHistoryItem)
+{
+ return pHistoryItem->__pHistoryItemImpl;
+}
+
+
+const _HistoryItemImpl*
+_HistoryItemImpl::GetInstance(const HistoryItem* pHistoryItem)
+{
+ return pHistoryItem->__pHistoryItemImpl;
+}
+
+
+}} // Tizen::Web
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWeb_HistoryItemImpl.h
+ * @brief The file contains the declaration of _HistoryItemImpl class.
+ *
+ * The file contains the declaration of _HistoryItemImpl class.
+ */
+#ifndef _FWEB_INTERNAL_HISTORY_ITEM_IMPL_H_
+#define _FWEB_INTERNAL_HISTORY_ITEM_IMPL_H_
+
+#include <FBaseString.h>
+
+namespace Tizen { namespace Web { namespace Controls
+{
+class _WebImpl;
+}}} // Tizen::Web::Controls
+
+namespace Tizen { namespace Web
+{
+class HistoryItem;
+
+
+class _HistoryItemImpl
+ : public Tizen::Base::Object
+{
+public:
+ _HistoryItemImpl(void);
+
+ virtual ~_HistoryItemImpl(void);
+
+ void SetHistoryItem(const Tizen::Base::String& url, const Tizen::Base::String& title, int id = -1);
+
+ Tizen::Base::String GetTitle(void) const;
+
+ Tizen::Base::String GetUrl(void) const;
+
+ Tizen::Graphics::Bitmap* GetFaviconN(void) const;
+
+ static _HistoryItemImpl* GetInstance(HistoryItem* pHistoryItem);
+
+ static const _HistoryItemImpl* GetInstance(const HistoryItem* pHistoryItem);
+
+private:
+ int __id;
+
+ Tizen::Base::String __url;
+
+ Tizen::Base::String __title;
+}; // _HistoryItemImpl
+
+}} // Tizen::Web
+#endif // _FWEB_INTERNAL_HISTORY_ITEM_IMPL_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebWebHistory.cpp
+ * @brief The file contains the definition of WebHistory class.
+ *
+ * This file contains the definition of WebHistory class.
+ */
+#include <new>
+#include <favorites.h>
+#include <unique_ptr.h>
+#include <FBaseSysLog.h>
+#include <FGrpBitmap.h>
+#include <FWebBookmarkItem.h>
+#include <FWebWebBookmark.h>
+#include <FBase_StringConverter.h>
+#include <FUiCtrlFrame.h>
+#include "FWeb_BookmarkItemImpl.h"
+#include "FWeb_WebBookmarkImpl.h"
+#include "FWebCtrl_Utility.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Web::Controls;
+
+
+namespace Tizen { namespace Web
+{
+
+
+bool
+_BookmarkForEachCb(favorites_bookmark_entry_s* pItem, void* pUserData)
+{
+ SysAssertf(pItem && pUserData, "Failed to request");
+
+ result r = E_SUCCESS;
+
+ _WebBookmarkImpl* pImpl = reinterpret_cast< _WebBookmarkImpl* >(pUserData);
+
+ String url(pItem->address);
+ String title(pItem->title);
+
+ r = pImpl->AddItem(pItem->id, url, title, pItem->folder_id, pItem->is_folder);
+ SysTryReturn(NID_WEB, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return true;
+}
+
+
+_WebBookmarkImpl::_WebBookmarkImpl(void)
+ : __rootFolderId(ROOT_FOLDER_ID)
+{
+}
+
+
+_WebBookmarkImpl::~_WebBookmarkImpl(void)
+{
+ __bookmarkList.RemoveAll(true);
+}
+
+
+result
+_WebBookmarkImpl::Construct(void)
+{
+ result r = E_SUCCESS;
+
+ int ret = favorites_bookmark_get_root_folder_id(&__rootFolderId);
+ SysTryReturnResult(NID_WEB, ret == FAVORITES_ERROR_NONE, E_SYSTEM, "Failed to get root folder id.");
+
+ r = __bookmarkList.Construct();
+ SysTryReturn(NID_WEB, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ ret = favorites_bookmark_foreach(_BookmarkForEachCb, this);
+ SysTryCatch(NID_WEB, ret == FAVORITES_ERROR_NONE, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Failed to set bookmark callback.");
+
+ return E_SUCCESS;
+
+CATCH:
+ __bookmarkList.RemoveAll(true);
+
+ return r;
+}
+
+
+result
+_WebBookmarkImpl::AddFolder(const String& title, RecordId parentId, RecordId& folderId)
+{
+ std::unique_ptr<char[]> pTitle(_StringConverter::CopyToCharArrayN(title));
+ SysTryReturn(NID_WEB, pTitle.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ int realParentId = parentId;
+
+ if (parentId == ROOT_FOLDER_ID)
+ {
+ realParentId = __rootFolderId;
+ }
+
+ int ret = favorites_bookmark_add(pTitle.get(), null, realParentId, 1, &folderId);
+ SysTryReturn(NID_WEB, ret == FAVORITES_ERROR_NONE, ConvertErrorCode(ret), ConvertErrorCode(ret), "[%s] Propagating.", GetErrorMessage(ConvertErrorCode(ret)));
+
+ return E_SUCCESS;
+}
+
+
+result
+_WebBookmarkImpl::AddBookmark(const String& title, const String& url, RecordId parentId, RecordId& bookmarkId)
+{
+ std::unique_ptr<char[]> pTitle(_StringConverter::CopyToCharArrayN(title));
+ SysTryReturn(NID_WEB, pTitle.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+ std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
+ SysTryReturn(NID_WEB, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ int realParentId = parentId;
+
+ if (parentId == ROOT_FOLDER_ID)
+ {
+ realParentId = __rootFolderId;
+ }
+
+ int ret = favorites_bookmark_add(pTitle.get(), pUrl.get(), realParentId, 0, &bookmarkId);
+ SysTryReturn(NID_WEB, ret == FAVORITES_ERROR_NONE, ConvertErrorCode(ret), ConvertErrorCode(ret), "[%s] Propagating.", GetErrorMessage(ConvertErrorCode(ret)));
+
+ return E_SUCCESS;
+}
+
+
+result
+_WebBookmarkImpl::SetFavicon(RecordId bookmarkId, const Bitmap& favicon)
+{
+ SysTryReturnResult(NID_WEB, favicon.GetPixelColorFormat() == BITMAP_PIXEL_FORMAT_ARGB8888, E_INVALID_DATA, "The pixel format of a favicon must be ARGB8888");
+
+ result r = E_SUCCESS;
+ Frame* pFrame = null;
+
+ BufferInfo bufferInfo;
+ int ret = 0;
+
+ Evas_Object* pIcon = null;
+
+ Bitmap& temp = const_cast< Bitmap& >(favicon);
+
+ Evas* pEvas = _Utility::GetEvasFromUiApp(pFrame);
+ SysTryCatch(NID_WEB, pEvas, r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pIcon = evas_object_image_filled_add(pEvas);
+ evas_object_image_colorspace_set(pIcon, EVAS_COLORSPACE_ARGB8888);
+ evas_object_image_filled_set(pIcon, EINA_TRUE);
+ evas_object_image_alpha_set(pIcon,EINA_TRUE);
+
+ r = temp.Lock(bufferInfo);
+ SysTryCatch(NID_WEB, r == E_SUCCESS, , r, "[%s] Propagating.", r);
+
+ evas_object_image_size_set(pIcon, bufferInfo.width, bufferInfo.height);
+ evas_object_image_fill_set(pIcon, 0, 0, bufferInfo.width, bufferInfo.height);
+ evas_object_image_data_set(pIcon, bufferInfo.pPixels);
+
+ r = temp.Unlock();
+ SysTryCatch(NID_WEB, r == E_SUCCESS, , r, "[%s] Propagating.", r);
+
+ ret = favorites_bookmark_set_favicon(bookmarkId, pIcon);
+ SysTryCatch(NID_WEB, ret == FAVORITES_ERROR_NONE, r = ConvertErrorCode(ret), r, "[%s] Propagating.", GetErrorMessage(r));
+
+
+ delete pFrame;
+
+ return E_SUCCESS;
+
+CATCH:
+ delete pFrame;
+
+ return r;
+}
+
+
+const BookmarkItem*
+_WebBookmarkImpl::GetItemAt(int index) const
+{
+ SysTryReturn(NID_WEB,
+ (index >= 0 && index < GetItemCount()), null, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] The index is out of range.");
+
+ return dynamic_cast < const BookmarkItem* >(__bookmarkList.GetAt(index));
+}
+
+
+int
+_WebBookmarkImpl::GetItemCount(void) const
+{
+ return __bookmarkList.GetCount();
+}
+
+
+int
+_WebBookmarkImpl::GetRootFolderId(void) const
+{
+ int folderId = 0;
+ int ret = favorites_bookmark_get_root_folder_id(&folderId);
+ SysTryReturn(NID_WEB, ret == FAVORITES_ERROR_NONE, -1, ConvertErrorCode(ret), "[%s] Propagating.", GetErrorMessage(ConvertErrorCode(ret)));
+
+ return folderId;
+}
+
+
+result
+_WebBookmarkImpl::AddItem(RecordId id, const String& url, const String& title, RecordId parentId, bool isFolder)
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr<BookmarkItem> pBookmarkItem(new (std::nothrow) BookmarkItem());
+ SysTryReturnResult(NID_WEB, pBookmarkItem.get(), E_OUT_OF_MEMORY, "Memory allocation failed");
+
+ _BookmarkItemImpl* pBookmarkItemImpl = _BookmarkItemImpl::GetInstance(pBookmarkItem.get());
+ SysTryReturn(NID_WEB, pBookmarkItemImpl, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ int realParentId = parentId;
+
+ if (parentId == __rootFolderId)
+ {
+ realParentId = ROOT_FOLDER_ID;
+ }
+
+ pBookmarkItemImpl->SetBookmarkItem(id, url, title, realParentId, isFolder);
+
+ r = __bookmarkList.Add(*pBookmarkItem.get());
+ SysTryReturn(NID_WEB, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ pBookmarkItem.release();
+
+ return E_SUCCESS;
+}
+
+
+result
+_WebBookmarkImpl::RemoveAll(void)
+{
+ int ret = favorites_bookmark_delete_all_bookmarks();
+ SysTryReturn(NID_WEB, ret == FAVORITES_ERROR_NONE, ConvertErrorCode(ret), ConvertErrorCode(ret), "[%s] Propagating.", GetErrorMessage(ConvertErrorCode(ret)));
+
+ return E_SUCCESS;
+}
+
+
+result
+_WebBookmarkImpl::ConvertErrorCode(int err) const
+{
+ result r = E_SUCCESS;
+
+ switch (err)
+ {
+ case FAVORITES_ERROR_INVALID_PARAMETER:
+ r = E_INVALID_ARG;
+ break;
+
+ case FAVORITES_ERROR_ITEM_ALREADY_EXIST:
+ r = E_OBJ_ALREADY_EXIST;
+ break;
+
+ case FAVORITES_ERROR_DB_FAILED:
+ //fall through
+ default:
+ r = E_SYSTEM;
+ }
+
+ return r;
+}
+
+
+_WebBookmarkImpl*
+_WebBookmarkImpl::GetInstance(WebBookmark* pWebBookmark)
+{
+ return pWebBookmark->__pWebBookmarkImpl;
+}
+
+
+const _WebBookmarkImpl*
+_WebBookmarkImpl::GetInstance(const WebBookmark* pWebBookmark)
+{
+ return pWebBookmark->__pWebBookmarkImpl;
+}
+
+
+}} // Tizen::Web
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWeb_WebHistoryImpl.h
+ * @brief The file contains the declaration of _WebHistoryImpl class.
+ *
+ * The file contains the declaration of _WebHistoryImpl class.
+ */
+#ifndef _FWEB_INTERNAL_WEB_BOOKMARK_IMPL_H_
+#define _FWEB_INTERNAL_WEB_BOOKMARK_IMPL_H_
+
+#include <FBaseString.h>
+#include <FBaseColArrayList.h>
+
+namespace Tizen { namespace Web
+{
+class BookmarkItem;
+class WebBookmark;
+
+
+class _WebBookmarkImpl
+ : public Tizen::Base::Object
+{
+public:
+ _WebBookmarkImpl(void);
+
+ virtual ~_WebBookmarkImpl(void);
+
+ result Construct(void);
+
+ result AddFolder(const Tizen::Base::String& title, RecordId parentId, RecordId& folderId);
+
+ result AddBookmark(const Tizen::Base::String& title, const Tizen::Base::String& url, RecordId parentId, RecordId& bookmarkId);
+
+ result SetFavicon(RecordId bookmarkId, const Tizen::Graphics::Bitmap& favicon);
+
+ const BookmarkItem* GetItemAt(int index) const;
+
+ int GetItemCount(void) const;
+
+ RecordId GetRootFolderId(void) const;
+
+ result AddItem(RecordId id, const Tizen::Base::String& url, const Tizen::Base::String& title, RecordId parentId, bool isFolder);
+
+ result RemoveAll(void);
+
+ result ConvertErrorCode(int err) const;
+
+ static _WebBookmarkImpl* GetInstance(WebBookmark* pWebBookmark);
+
+ static const _WebBookmarkImpl* GetInstance(const WebBookmark* pWebBookmark);
+
+private:
+ int __rootFolderId;
+
+ Tizen::Base::Collection::ArrayList __bookmarkList;
+}; // _WebBookmarkImpl
+
+}} // Tizen::Web
+#endif // _FWEB_INTERNAL_WEB_BOOKMARK_IMPL_H_
\ No newline at end of file
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWeb_WebHistoryImplcpp
+ * @brief The file contains the definition of _WebHistoryImpl class.
+ *
+ * This file contains the definition of _WebHistoryImpl class.
+ */
+#include <new>
+#include <favorites.h>
+#include <unique_ptr.h>
+#include <FWebHistoryItem.h>
+#include <FWebWebHistory.h>
+#include <FBaseSysLog.h>
+#include "FWeb_HistoryItemImpl.h"
+#include "FWeb_WebHistoryImpl.h"
+
+
+using namespace Tizen::Base;
+
+
+namespace Tizen { namespace Web
+{
+
+
+bool
+_HistoryForEachCb(favorites_history_entry_s* pItem, void* pUserData)
+{
+ SysAssertf(pItem && pUserData, "Failed to request");
+
+ result r = E_SUCCESS;
+
+ _WebHistoryImpl* pImpl = reinterpret_cast< _WebHistoryImpl* >(pUserData);
+
+ String url(pItem->address);
+ String title(pItem->title);
+
+ r = pImpl->AddItem(url, title, pItem->id);
+ SysTryReturn(NID_WEB, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return true;
+}
+
+
+_WebHistoryImpl::_WebHistoryImpl(void)
+{
+}
+
+
+_WebHistoryImpl::~_WebHistoryImpl(void)
+{
+ __historyList.RemoveAll(true);
+}
+
+
+result
+_WebHistoryImpl::Construct(void)
+{
+ result r = E_SUCCESS;
+
+ r = __historyList.Construct();
+ SysTryReturn(NID_WEB, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ int ret = favorites_history_foreach(_HistoryForEachCb, this);
+ SysTryCatch(NID_WEB, ret == FAVORITES_ERROR_NONE, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Failed to Set history Callback.");
+
+ return E_SUCCESS;
+
+CATCH:
+ __historyList.RemoveAll(true);
+
+ return r;
+}
+
+
+const HistoryItem*
+_WebHistoryImpl::GetItemAt(int index) const
+{
+ SysTryReturn(NID_WEB,
+ (index >= 0 && index < GetItemCount()), null, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] The index is out of range.");
+
+ return dynamic_cast < const HistoryItem* >(__historyList.GetAt(index));
+}
+
+
+int
+_WebHistoryImpl::GetItemCount(void) const
+{
+ return __historyList.GetCount();
+}
+
+
+result
+_WebHistoryImpl::AddItem(const Tizen::Base::String& url, const Tizen::Base::String& title, int id)
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr<HistoryItem> pHistoryItem(new (std::nothrow) HistoryItem());
+ SysTryReturnResult(NID_WEB, pHistoryItem.get(), E_OUT_OF_MEMORY, "Memory allocation failed");
+
+ _HistoryItemImpl* pHistoryItemImpl = _HistoryItemImpl::GetInstance(pHistoryItem.get());
+ SysTryReturn(NID_WEB_CTRL, pHistoryItemImpl, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ pHistoryItemImpl->SetHistoryItem(url, title, id);
+
+ r = __historyList.Add(*pHistoryItem.get());
+ SysTryReturn(NID_WEB, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ pHistoryItem.release();
+
+ return E_SUCCESS;
+}
+
+
+_WebHistoryImpl*
+_WebHistoryImpl::GetInstance(WebHistory* pWebHistory)
+{
+ return pWebHistory->__pWebHistoryImpl;
+}
+
+
+const _WebHistoryImpl*
+_WebHistoryImpl::GetInstance(const WebHistory* pWebHistory)
+{
+ return pWebHistory->__pWebHistoryImpl;
+}
+
+
+}} // Tizen::Web
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWeb_WebHistoryImpl.h
+ * @brief The file contains the declaration of _WebHistoryImpl class.
+ *
+ * The file contains the declaration of _WebHistoryImpl class.
+ */
+#ifndef _FWEB_INTERNAL_WEB_HISTORY_IMPL_H_
+#define _FWEB_INTERNAL_WEB_HISTORY_IMPL_H_
+
+#include <FBaseString.h>
+#include <FBaseColArrayList.h>
+
+namespace Tizen { namespace Web
+{
+class HistoryItem;
+class WebHistory;
+
+
+class _WebHistoryImpl
+ : public Tizen::Base::Object
+{
+public:
+ _WebHistoryImpl(void);
+
+ virtual ~_WebHistoryImpl(void);
+
+ result Construct(void);
+
+ const HistoryItem* GetItemAt(int index) const;
+
+ int GetItemCount(void) const;
+
+ result AddItem(const Tizen::Base::String& url, const Tizen::Base::String& title, int id);
+
+ static _WebHistoryImpl* GetInstance(WebHistory* pWebHistory);
+
+ static const _WebHistoryImpl* GetInstance(const WebHistory* pWebHistory);
+
+private:
+ Tizen::Base::Collection::ArrayList __historyList;
+}; // _WebHistoryImpl
+
+}} // Tizen::Web
+#endif // _FWEB_INTERNAL_WEB_HISTORY_IMPL_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrlAuthenticationChallenge.cpp
+ * @brief The file contains the definition of AuthenticationChallenge class.
+ *
+ * The file contains the definition of AuthenticationChallenge class.
+ */
+#include <FBaseResult.h>
+#include <FBaseSysLog.h>
+#include <FWebCtrlAuthenticationChallenge.h>
+#include <FSec_AccessController.h>
+#include "FWebCtrl_AuthenticationChallengeImpl.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Security;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+AuthenticationChallenge::AuthenticationChallenge(void)
+ : __pAuthenticationChallengeImpl(new (std::nothrow) _AuthenticationChallengeImpl())
+{
+ SysTryReturnVoidResult(NID_WEB_CTRL, __pAuthenticationChallengeImpl, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+}
+
+
+AuthenticationChallenge::~AuthenticationChallenge(void)
+{
+ delete __pAuthenticationChallengeImpl;
+ __pAuthenticationChallengeImpl = null;
+}
+
+
+void
+AuthenticationChallenge::Process(const UserId& userId, const String& password)
+{
+ SysAssertf(__pAuthenticationChallengeImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+ r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
+ __pAuthenticationChallengeImpl->Process(userId, password);
+
+ SysSecureLog(NID_WEB_CTRL, "The current value of userId is %ls, password is %ls", userId.GetPointer(), password.GetPointer());
+}
+
+
+void
+AuthenticationChallenge::Cancel(void)
+{
+ SysAssertf(__pAuthenticationChallengeImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+ r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
+ __pAuthenticationChallengeImpl->Cancel();
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrlGeolocationPermissionManager.cpp
+ * @brief The file contains the definition of GeolocationPermissionManager class.
+ *
+ * The file contains the definition of GeolocationPermissionManager class.
+ */
+#include <pthread.h>
+#include <unique_ptr.h>
+#include <FBaseColIList.h>
+#include <FBaseSysLog.h>
+#include <FWebCtrlGeolocationPermissionManager.h>
+#include <FIo_DatabaseImpl.h>
+#include <FSec_AccessController.h>
+#include "FWebCtrl_GeolocationPermissionManagerImpl.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Security;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+GeolocationPermissionManager* GeolocationPermissionManager::__pInstance = null;
+
+
+GeolocationPermissionManager::GeolocationPermissionManager(void)
+ : __pGeolocationPermissionManagerImpl(null)
+{
+}
+
+
+GeolocationPermissionManager::~GeolocationPermissionManager(void)
+{
+ delete __pGeolocationPermissionManagerImpl;
+ __pGeolocationPermissionManagerImpl = null;
+}
+
+
+result
+GeolocationPermissionManager::Construct(void)
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr<_GeolocationPermissionManagerImpl> pGeolocationPermissionManagerImpl(new (std::nothrow) _GeolocationPermissionManagerImpl());
+ SysTryReturnResult(NID_WEB_CTRL, pGeolocationPermissionManagerImpl.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ r = pGeolocationPermissionManagerImpl->Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pGeolocationPermissionManagerImpl = pGeolocationPermissionManagerImpl.release();
+
+ return E_SUCCESS;
+}
+
+
+void
+GeolocationPermissionManager::InitGeolocationPermissionManager(void)
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr<GeolocationPermissionManager> pInstance(new (std::nothrow) GeolocationPermissionManager());
+ SysTryReturnVoidResult(NID_WEB_CTRL, pInstance.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pInstance->Construct();
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pInstance = pInstance.release();
+ std::atexit(DestroyGeolocationPermissionManager);
+}
+
+
+void
+GeolocationPermissionManager::DestroyGeolocationPermissionManager(void)
+{
+ delete __pInstance;
+ __pInstance = null;
+}
+
+
+GeolocationPermissionManager*
+GeolocationPermissionManager::GetInstance(void)
+{
+ static pthread_once_t onceBlock = PTHREAD_ONCE_INIT;
+ if (__pInstance== null)
+ {
+ ClearLastResult();
+ pthread_once(&onceBlock, InitGeolocationPermissionManager);
+ result r = GetLastResult();
+ if (IsFailed(r))
+ {
+ onceBlock = PTHREAD_ONCE_INIT;
+ }
+ }
+
+ return __pInstance;
+}
+
+
+IList*
+GeolocationPermissionManager::GetOriginListN(void) const
+{
+ SysAssertf(__pGeolocationPermissionManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_GEOLOCATIONPERMISSION_READ);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
+
+ IList* pList = __pGeolocationPermissionManagerImpl->GetOriginListN();
+ SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ return pList;
+}
+
+
+bool
+GeolocationPermissionManager::IsPermissionAllowed(const String& origin) const
+{
+ SysAssertf(__pGeolocationPermissionManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_GEOLOCATIONPERMISSION_READ);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
+
+ bool permission = __pGeolocationPermissionManagerImpl->IsPermissionAllowed(origin);
+ SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, false, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ SysLog(NID_WEB_CTRL, "The current value of origin is %ls", origin.GetPointer());
+
+ return permission;
+}
+
+
+result
+GeolocationPermissionManager::Remove(const String& origin)
+{
+ SysAssertf(__pGeolocationPermissionManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_GEOLOCATIONPERMISSION_WRITE);
+ SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
+
+ r = __pGeolocationPermissionManagerImpl->Remove(origin);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ SysLog(NID_WEB_CTRL, "The current value of origin is %ls", origin.GetPointer());
+
+ return E_SUCCESS;
+}
+
+
+result
+GeolocationPermissionManager::RemoveAll(void)
+{
+ SysAssertf(__pGeolocationPermissionManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_GEOLOCATIONPERMISSION_WRITE);
+ SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
+
+ r = __pGeolocationPermissionManagerImpl->RemoveAll();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return E_SUCCESS;
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrlHitElementResult.cpp
+ * @brief The file contains the definition of HitElementResult class.
+ *
+ * The file contains the definition of HitElementResult class.
+ */
+#include <new>
+#include <FBaseResult.h>
+#include <FBaseSysLog.h>
+#include <FGrpBitmap.h>
+#include <FWebCtrlHitElementResult.h>
+#include "FWebCtrl_HitElementResultImpl.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Graphics;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+HitElementResult::HitElementResult(void)
+ : __pHitElementResultImpl(new (std::nothrow) _HitElementResultImpl())
+{
+ SysTryReturnVoidResult(NID_WEB_CTRL, __pHitElementResultImpl, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+}
+
+
+HitElementResult::~HitElementResult(void)
+{
+ delete __pHitElementResultImpl;
+ __pHitElementResultImpl = null;
+}
+
+
+String
+HitElementResult::GetTagName(void) const
+{
+ SysAssertf(__pHitElementResultImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pHitElementResultImpl->GetTagName();
+}
+
+
+String
+HitElementResult::GetAttributeValue(const String& attributeName) const
+{
+ SysAssertf(__pHitElementResultImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ SysLog(NID_WEB_CTRL, "The current value of attributeName is %ls", attributeName.GetPointer());
+
+ return __pHitElementResultImpl->GetAttributeValue(attributeName);
+}
+
+
+String
+HitElementResult::GetContent(void) const
+{
+ SysAssertf(__pHitElementResultImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pHitElementResultImpl->GetContent();
+}
+
+
+String
+HitElementResult::GetUrl(void) const
+{
+ SysAssertf(__pHitElementResultImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pHitElementResultImpl->GetUrl();
+}
+
+
+const Bitmap*
+HitElementResult::GetImage(void) const
+{
+ SysAssertf(__pHitElementResultImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pHitElementResultImpl->GetImage();
+}
+
+
+bool
+HitElementResult::HasImage(void) const
+{
+ SysAssertf(__pHitElementResultImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pHitElementResultImpl->HasImage();
+}
+
+
+bool
+HitElementResult::HasUrl(void) const
+{
+ SysAssertf(__pHitElementResultImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pHitElementResultImpl->HasUrl();
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrlPageNavigationList.cpp
+ * @brief The file contains the definition of PageNavigationList class.
+ *
+ * The file contains the definition of PageNavigationList class.
+ */
+#include <new>
+#include <FBaseResult.h>
+#include <FBaseSysLog.h>
+#include <FWebCtrlPageNavigationList.h>
+#include <FWebHistoryItem.h>
+#include "FWebCtrl_PageNavigationListImpl.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+PageNavigationList::PageNavigationList(void)
+ : __pPageNavigationListImpl(new (std::nothrow) _PageNavigationListImpl())
+{
+ SysTryReturnVoidResult(NID_WEB_CTRL, __pPageNavigationListImpl, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+}
+
+
+PageNavigationList::~PageNavigationList(void)
+{
+ delete __pPageNavigationListImpl;
+ __pPageNavigationListImpl = null;
+}
+
+
+const HistoryItem*
+PageNavigationList::GetCurrentItem(void) const
+{
+ SysAssertf(__pPageNavigationListImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pPageNavigationListImpl->GetCurrentItem();
+}
+
+
+int
+PageNavigationList::GetCurrentIndex(void) const
+{
+ SysAssertf(__pPageNavigationListImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pPageNavigationListImpl->GetCurrentIndex();
+}
+
+
+const HistoryItem*
+PageNavigationList::GetItemAt(int index) const
+{
+ SysAssertf(__pPageNavigationListImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+
+ const HistoryItem* pItem = __pPageNavigationListImpl->GetItemAt(index);
+ SysTryReturn(NID_WEB_CTRL, pItem, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ SysLog(NID_WEB_CTRL, "The current value of index is %d", index);
+
+ return pItem;
+}
+
+
+int
+PageNavigationList::GetItemCount(void) const
+{
+ SysAssertf(__pPageNavigationListImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pPageNavigationListImpl->GetItemCount();
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrlWeb.cpp
+ * @brief The file contains the definition of Web class.
+ *
+ * The file contains the definition of Web class.
+ */
+#include <FBaseResult.h>
+#include <FBaseSysLog.h>
+#include <FGrpPoint.h>
+#include <FGrpRectangle.h>
+#include <FNetHttpHttpHeader.h>
+#include <FSysVibrator.h>
+#include <FWebCtrlHitElementResult.h>
+#include <FWebCtrlPageNavigationList.h>
+#include <FWebCtrlWeb.h>
+#include <FWebCtrlWebSetting.h>
+#include <FSec_AccessController.h>
+#include <FSys_VibratorImpl.h>
+#include "FWebCtrl_WebImpl.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Graphics;
+using namespace Tizen::Net::Http;
+using namespace Tizen::Security;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+Web::Web(void)
+{
+}
+
+
+Web::~Web(void)
+{
+}
+
+
+result
+Web::Construct(const Rectangle& rect)
+{
+ SysAssertf(_pControlImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
+
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+ r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
+ _WebImpl* pWebImpl = _WebImpl::CreateWebImplN(const_cast< Web* >(this), rect);
+ SysTryReturn(NID_WEB_CTRL, pWebImpl, GetLastResult(), GetLastResult(), "[%s] This instance has not been constructed as yet.", GetErrorMessage(GetLastResult()));
+
+ _pControlImpl = pWebImpl;
+
+ SysLog(NID_WEB_CTRL, "rect.x : %d, rect.y : %d, rect.width : %d, rect.height : %d", rect.x, rect.y, rect.width, rect.height);
+
+ return E_SUCCESS;
+}
+
+
+result
+Web::Construct(const FloatRectangle& rect)
+{
+ SysAssertf(_pControlImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
+
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+ r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
+ _WebImpl* pWebImpl = _WebImpl::CreateWebImplN(const_cast< Web* >(this), rect);
+ SysTryReturn(NID_WEB_CTRL, pWebImpl, GetLastResult(), GetLastResult(), "[%s] This instance has not been constructed as yet.", GetErrorMessage(GetLastResult()));
+
+ _pControlImpl = pWebImpl;
+
+ SysLog(NID_WEB_CTRL, "rect.x : %f, rect.y : %f, rect.width : %f, rect.height : %f", rect.x, rect.y, rect.width, rect.height);
+
+ return E_SUCCESS;
+}
+
+
+void
+Web::LoadUrl(const String& url)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+ r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
+ r = pWebImpl->LoadUrl(url);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ SysSecureLog(NID_WEB_CTRL, "The current value of url is %ls", url.GetPointer());
+}
+
+
+result
+Web::LoadUrl(const String& url, const HttpHeader& header)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+ r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
+ r = pWebImpl->LoadUrl(url, header);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ SysSecureLog(NID_WEB_CTRL, "The current value of url is %ls", url.GetPointer());
+
+ return E_SUCCESS;
+}
+
+
+result
+Web::LoadUrlWithPostRequest(const String& url, const HttpHeader& header, const ByteBuffer& body)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+ r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
+ SysSecureLog(NID_WEB_CTRL, "The current value of url is %ls, header is %d, body is %ls", url.GetPointer(), &header, (char*) body.GetPointer());
+
+ r = pWebImpl->LoadUrlWithPostRequest(url, header, body);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return E_SUCCESS;
+}
+
+
+void
+Web::LoadData(const String& baseUrl, const ByteBuffer& content, const String& mime, const String& encoding)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+ r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
+ r = pWebImpl->LoadData(baseUrl, content, mime, encoding);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ SysSecureLog(NID_WEB_CTRL, "baseUrl : %ls, content : %ls, mime : %ls, encoding : %ls", baseUrl.GetPointer(), reinterpret_cast < const char* >(content.GetPointer()), mime.GetPointer(), encoding.GetPointer());
+}
+
+
+void
+Web::StopLoading(void)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+ r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
+ pWebImpl->StopLoading();
+}
+
+
+void
+Web::Reload(void)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+ r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
+ pWebImpl->Reload();
+}
+
+
+bool
+Web::IsLoading(void) const
+{
+ const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ return pWebImpl->IsLoading();
+}
+
+
+bool
+Web::CanGoBack(void) const
+{
+ const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ return pWebImpl->CanGoBack();
+}
+
+
+bool
+Web::CanGoForward(void) const
+{
+ const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ return pWebImpl->CanGoForward();
+}
+
+
+void
+Web::GoBack(void)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+ r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
+ pWebImpl->GoBack();
+}
+
+
+void
+Web::GoForward(void)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+ r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
+ pWebImpl->GoForward();
+}
+
+
+PageNavigationList*
+Web::GetBackForwardListN(void) const
+{
+ const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+
+ const PageNavigationList* pList = pWebImpl->GetBackForwardListN();
+ SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, null, GetLastResult(), "[%s] Failed to get PageNavigationList.", GetErrorMessage(GetLastResult()));
+
+ return const_cast< PageNavigationList* >(pList);
+}
+
+
+bool
+Web::SearchText(const String& word, bool searchForward)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ SysLog(NID_WEB_CTRL, "The current value of word is %ls, searchForward is %d", word.GetPointer(), searchForward);
+
+ return pWebImpl->SearchText(word, searchForward);
+}
+
+
+result
+Web::SetSetting(const WebSetting& setting)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+ r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
+ r = pWebImpl->SetSetting(setting);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Failed to set setting.", GetErrorMessage(r));
+
+ return E_SUCCESS;
+}
+
+
+WebSetting
+Web::GetSetting(void) const
+{
+ const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ return pWebImpl->GetSetting();
+}
+
+
+HitElementResult*
+Web::GetElementByPointN(const Point& point) const
+{
+ const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+
+ const HitElementResult* pResult = pWebImpl->GetElementByPointN(point);
+ SysTryReturn(NID_WEB_CTRL, pResult, null, GetLastResult(), "[%s] Failed to get HitElementResult.", GetErrorMessage(GetLastResult()));
+
+ return const_cast< HitElementResult* >(pResult);
+}
+
+
+HitElementResult*
+Web::GetElementByPointN(const FloatPoint& point) const
+{
+ const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+
+ const HitElementResult* pResult = pWebImpl->GetElementByPointN(point);
+ SysTryReturn(NID_WEB_CTRL, pResult, null, GetLastResult(), "[%s] Failed to get HitElementResult.", GetErrorMessage(GetLastResult()));
+
+ return const_cast< HitElementResult* >(pResult);
+}
+
+
+String*
+Web::EvaluateJavascriptN(const String& scriptCode)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+ r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
+ String* pScript = pWebImpl->EvaluateJavascriptN(scriptCode);
+ SysTryReturn(NID_WEB_CTRL, pScript, null, GetLastResult(), "[%s] Failed to evaluate javascript.", GetErrorMessage(GetLastResult()));
+
+ SysLog(NID_WEB_CTRL, "The current value of scriptCode is %ls", scriptCode.GetPointer());
+
+ return pScript;
+}
+
+
+result
+Web::SetZoomLevel(float level)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ result r = E_SUCCESS;
+
+ r = pWebImpl->SetZoomLevel(level);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ SysLog(NID_WEB_CTRL, "The current value of level is %f", level);
+
+ return E_SUCCESS;
+}
+
+
+float
+Web::GetZoomLevel(void) const
+{
+ const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ return pWebImpl->GetZoomLevel();
+}
+
+
+String
+Web::GetTitle(void) const
+{
+ const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ return pWebImpl->GetTitle();
+}
+
+
+String
+Web::GetUrl(void) const
+{
+ const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ return pWebImpl->GetUrl();
+}
+
+
+bool
+Web::IsMimeSupported(const String& mime) const
+{
+ const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ SysLog(NID_WEB_CTRL, "The current value of mime is %ls", mime.GetPointer());
+
+ return pWebImpl->IsMimeSupported(mime);
+}
+
+
+void
+Web::SetLoadingListener(ILoadingListener* pLoadingListener)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+ r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
+ pWebImpl->SetLoadingListener(pLoadingListener);
+
+ SysLog(NID_WEB_CTRL, "The current value of pLoadingListener is %u", pLoadingListener);
+}
+
+
+void
+Web::SetDownloadListener(IWebDownloadListener* pDownLoadListener)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+ r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
+ pWebImpl->SetDownloadListener(pDownLoadListener);
+
+ SysLog(NID_WEB_CTRL, "The current value of pDownLoadListener is %u", pDownLoadListener);
+}
+
+
+result
+Web::SetBlockSelectionPosition(const Point& startPoint)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ result r = E_SUCCESS;
+
+ r = pWebImpl->SetBlockSelectionPosition(startPoint);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return E_SUCCESS;
+}
+
+
+result
+Web::SetBlockSelectionPosition(const FloatPoint& startPoint)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ result r = E_SUCCESS;
+
+ r = pWebImpl->SetBlockSelectionPosition(startPoint);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return E_SUCCESS;
+}
+
+
+result
+Web::ReleaseBlock(void)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ pWebImpl->ReleaseBlock();
+
+ return E_SUCCESS;
+}
+
+
+result
+Web::GetBlockRange(Point& startPoint, Point& endPoint) const
+{
+ const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ pWebImpl->GetBlockRange(startPoint, endPoint);
+
+ return E_SUCCESS;
+}
+
+
+result
+Web::GetBlockRange(FloatPoint& startPoint, FloatPoint& endPoint) const
+{
+ const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ pWebImpl->GetBlockRange(startPoint, endPoint);
+
+ return E_SUCCESS;
+}
+
+
+String
+Web::GetTextFromBlock(void) const
+{
+ const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ return pWebImpl->GetTextFromBlock();
+}
+
+
+result
+Web::SetScrollEnabled(bool enable)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ pWebImpl->SetScrollEnabled(enable);
+
+ SysLog(NID_WEB_CTRL, "The current value of enable is %d", enable);
+
+ return E_SUCCESS;
+}
+
+
+bool
+Web::IsScrollEnabled(void) const
+{
+ const _WebImpl* pWebImpl = const_cast< _WebImpl* >(_WebImpl::GetInstance(this));
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ return pWebImpl->IsScrollEnabled();
+}
+
+
+void
+Web::SetWebUiEventListener(IWebUiEventListener* pUiEventListener)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ pWebImpl->SetWebUiEventListener(pUiEventListener);
+
+ SysLog(NID_WEB_CTRL, "The current value of pUiEventListener is %u", pUiEventListener);
+}
+
+
+void
+Web::SetWebUiEventListenerF(IWebUiEventListenerF* pUiEventListener)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ pWebImpl->SetWebUiEventListenerF(pUiEventListener);
+
+ SysLog(NID_WEB_CTRL, "The current value of pUiEventListener is %u", pUiEventListener);
+}
+
+
+result
+Web::SearchTextAllAsync(const String& text, bool caseSensitive)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ result r = E_SUCCESS;
+
+ r = pWebImpl->SearchTextAllAsync(text, caseSensitive);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ SysLog(NID_WEB_CTRL, "The current value of text is %ls, caseSensitive is %d", text.GetPointer(), caseSensitive);
+
+ return E_SUCCESS;
+}
+
+
+result
+Web::SearchNextAsync(bool searchForward)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ result r = E_SUCCESS;
+
+ r = pWebImpl->SearchNextAsync(searchForward);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ SysLog(NID_WEB_CTRL, "The current value of searchForward is %d", searchForward);
+
+ return E_SUCCESS;
+}
+
+
+void
+Web::SetTextSearchListener(ITextSearchListener* pTextSearchListener)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ pWebImpl->SetTextSearchListener(pTextSearchListener);
+
+ SysLog(NID_WEB_CTRL, "The current value of pTextSearchListener is %u", pTextSearchListener);
+}
+
+
+bool
+Web::IsPrivateBrowsingEnabled(void) const
+{
+ const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ return pWebImpl->IsPrivateBrowsingEnabled();
+}
+
+
+result
+Web::SetPrivateBrowsingEnabled(bool enable)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+ r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
+ pWebImpl->SetPrivateBrowsingEnabled(enable);
+
+ SysLog(NID_WEB_CTRL, "The current value of enable is %d", enable);
+
+ return E_SUCCESS;
+}
+
+
+result
+Web::ClearHistory(void)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+ r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
+ pWebImpl->ClearHistory();
+
+ return E_SUCCESS;
+}
+
+
+result
+Web::ClearCache(void)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+ r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
+ pWebImpl->ClearCache();
+
+ return E_SUCCESS;
+}
+
+
+result
+Web::ClearCookie(void)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+ r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
+ pWebImpl->ClearCookie();
+
+ return E_SUCCESS;
+}
+
+
+result
+Web::ClearFormData(void)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+ r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
+ pWebImpl->ClearFormData();
+
+ return E_SUCCESS;
+}
+
+
+result
+Web::ClearLoginFormData(void)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+ r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
+ pWebImpl->ClearLoginFormData();
+
+ return E_SUCCESS;
+}
+
+
+bool
+Web::IsCookieEnabled(void) const
+{
+ const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ return pWebImpl->IsCookieEnabled();
+}
+
+
+result
+Web::SetCookieEnabled(bool enable)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+ r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
+ pWebImpl->SetCookieEnabled(enable);
+
+ SysLog(NID_WEB_CTRL, "The current value of enable is %d", enable);
+
+ return E_SUCCESS;
+}
+
+
+result
+Web::SavePageAsPdf(const String& filePath, const Dimension* pSize)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ result r = E_SUCCESS;
+
+ r = pWebImpl->SavePageAsPdf(filePath, pSize);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ SysLog(NID_WEB_CTRL, "The current value of filePath is %ls, pSize is %u", filePath.GetPointer(), pSize);
+
+ return E_SUCCESS;
+}
+
+
+result
+Web::AddJavaScriptBridge(const IJavaScriptBridge& jsBridge)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ result r = E_SUCCESS;
+
+ r = pWebImpl->AddJavaScriptBridge(jsBridge);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return E_SUCCESS;
+}
+
+
+result
+Web::RemoveJavaScriptBridge(const IJavaScriptBridge& jsBridge)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ result r = E_SUCCESS;
+
+ r = pWebImpl->RemoveJavaScriptBridge(jsBridge);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return E_SUCCESS;
+}
+
+
+void
+Web::SetWebKeypadEventListener(IWebKeypadEventListener* pKeypadEventListener)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ pWebImpl->SetWebKeypadEventListener(pKeypadEventListener);
+
+ SysLog(NID_WEB_CTRL, "The current value of pKeypadEventListener is %u", pKeypadEventListener);
+}
+
+
+Bitmap*
+Web::GetFaviconN(void) const
+{
+ const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+
+ Bitmap* pFavicon = pWebImpl->GetFaviconN();
+ SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ return pFavicon;
+}
+
+
+void
+Web::Pause(void)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ pWebImpl->Pause();
+}
+
+
+void
+Web::Resume(void)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ pWebImpl->Resume();
+}
+
+
+void
+Web::ScrollBy(const Tizen::Graphics::Point& diff)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ pWebImpl->ScrollBy(diff);
+}
+
+
+void
+Web::ScrollTo(const Tizen::Graphics::Point& dest)
+{
+ _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ pWebImpl->ScrollTo(dest);
+}
+
+
+Point
+Web::GetScrollPosition(void) const
+{
+ const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ return pWebImpl->GetScrollPosition();
+}
+
+
+Dimension
+Web::GetPageSize(void) const
+{
+ const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+ SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
+
+ return pWebImpl->GetPageSize();
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrlWebSetting.cpp
+ * @brief The file contains the definition of WebSetting class.
+ *
+ * The file contains the definition of WebSetting class.
+ */
+#include <new>
+#include <FBaseResult.h>
+#include <FBaseSysLog.h>
+#include <FWebCtrlWebSetting.h>
+#include <FSec_AccessController.h>
+#include "FWebCtrl_WebSettingImpl.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Security;
+using namespace Tizen::Ui::Controls;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+WebSetting::WebSetting(void)
+ : __pWebSettingImpl(new (std::nothrow) _WebSettingImpl())
+{
+ SysTryReturnVoidResult(NID_WEB_CTRL, __pWebSettingImpl, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+}
+
+
+WebSetting::WebSetting(const WebSetting& setting)
+ : __pWebSettingImpl(new (std::nothrow) _WebSettingImpl(*_WebSettingImpl::GetInstance(&setting)))
+{
+ SysTryReturnVoidResult(NID_WEB_CTRL, __pWebSettingImpl, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+}
+
+
+WebSetting&
+WebSetting::operator =(const WebSetting& setting)
+{
+ if (&setting == this)
+ {
+ return *this;
+ }
+
+ Object::operator =(setting);
+ _WebSettingImpl* pImpl = _WebSettingImpl::GetInstance(this);
+ if (pImpl)
+ {
+ *pImpl = *_WebSettingImpl::GetInstance(&setting);
+ }
+
+ return *this;
+}
+
+
+WebSetting::~WebSetting(void)
+{
+ delete __pWebSettingImpl;
+ __pWebSettingImpl = null;
+}
+
+
+void
+WebSetting::SetCacheControl(CacheMode mode)
+{
+ SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+ r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
+ __pWebSettingImpl->SetCacheControl(mode);
+
+ SysLog(NID_WEB_CTRL, "The current value of mode is %d", mode);
+}
+
+
+CacheMode
+WebSetting::GetCacheControl(void) const
+{
+ SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pWebSettingImpl->GetCacheControl();
+}
+
+
+void
+WebSetting::SetFontSize(int fontSize)
+{
+ SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ __pWebSettingImpl->SetFontSize(fontSize);
+
+ SysLog(NID_WEB_CTRL, "The current value of fontSize is %d", fontSize);
+}
+
+
+int
+WebSetting::GetFontSize(void) const
+{
+ SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pWebSettingImpl->GetFontSize();
+}
+
+
+void
+WebSetting::SetDefaultTextEncoding(const String& encoding)
+{
+ SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ __pWebSettingImpl->SetDefaultTextEncoding(encoding);
+
+ SysLog(NID_WEB_CTRL, "The current value of encoding is %ls", encoding.GetPointer());
+}
+
+
+String
+WebSetting::GetDefaultTextEncoding(void) const
+{
+ SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pWebSettingImpl->GetDefaultTextEncoding();
+}
+
+
+void
+WebSetting::SetJavascriptEnabled(bool enable)
+{
+ SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ __pWebSettingImpl->SetJavascriptEnabled(enable);
+
+ SysLog(NID_WEB_CTRL, "The current value of enable is %d", enable);
+}
+
+
+void
+WebSetting::SetAutoImageLoadEnabled(bool enable)
+{
+ SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ __pWebSettingImpl->SetAutoImageLoadEnabled(enable);
+
+ SysLog(NID_WEB_CTRL, "The current value of enable is %d", enable);
+}
+
+
+bool
+WebSetting::IsJavascriptEnabled(void) const
+{
+ SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pWebSettingImpl->IsJavascriptEnabled();
+}
+
+
+bool
+WebSetting::IsAutoImageLoadEnabled(void) const
+{
+ SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pWebSettingImpl->IsAutoImageLoadEnabled();
+}
+
+
+void
+WebSetting::SetInputStyle(InputStyle inputStyle)
+{
+ SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ __pWebSettingImpl->SetInputStyle(inputStyle);
+
+ SysLog(NID_WEB_CTRL, "The current value of inputStyle is %d", inputStyle);
+}
+
+
+InputStyle
+WebSetting::GetInputStyle(void) const
+{
+ SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pWebSettingImpl->GetInputStyle();
+}
+
+
+void
+WebSetting::SetCertificateErrorHandlingMode(CertificateErrorHandlingMode mode)
+{
+ SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+ r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
+ __pWebSettingImpl->SetCertificateErrorHandlingMode(mode);
+
+ SysLog(NID_WEB_CTRL, "The current value of mode is %d", mode);
+}
+
+
+CertificateErrorHandlingMode
+WebSetting::GetCertificateErrorHandlingMode(void) const
+{
+ SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pWebSettingImpl->GetCertificateErrorHandlingMode();
+}
+
+
+void
+WebSetting::SetUserAgent(const String& agent)
+{
+ SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ __pWebSettingImpl->SetUserAgent(agent);
+
+ SysLog(NID_WEB_CTRL, "The current value of agent is %ls", agent.GetPointer());
+}
+
+
+String
+WebSetting::GetUserAgent(void) const
+{
+ SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pWebSettingImpl->GetUserAgent();
+}
+
+
+void
+WebSetting::SetAutoFittingEnabled(bool enable)
+{
+ SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ __pWebSettingImpl->SetAutoFittingEnabled(enable);
+
+ SysLog(NID_WEB_CTRL, "The current value of enable is %d", enable);
+}
+
+
+bool
+WebSetting::IsAutoFittingEnabled(void) const
+{
+ SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pWebSettingImpl->IsAutoFittingEnabled();
+}
+
+
+void
+WebSetting::SetJavaScriptPopupEnabled(bool enable)
+{
+ SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ __pWebSettingImpl->SetJavaScriptPopupEnabled(enable);
+
+ SysLog(NID_WEB_CTRL, "The current value of enable is %d", enable);
+}
+
+
+bool
+WebSetting::IsJavaScriptPopupEnabled(void) const
+{
+ SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pWebSettingImpl->IsJavaScriptPopupEnabled();
+}
+
+
+void
+WebSetting::SetGeolocationEnabled(bool enable)
+{
+ SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+ r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
+ __pWebSettingImpl->SetGeolocationEnabled(enable);
+
+ SysLog(NID_WEB_CTRL, "The current value of enable is %d", enable);
+}
+
+
+bool
+WebSetting::IsGeolocationEnabled(void) const
+{
+ SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pWebSettingImpl->IsGeolocationEnabled();
+}
+
+
+void
+WebSetting::SetAutoFormDataShowEnabled(bool enable)
+{
+ SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+ r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
+ __pWebSettingImpl->SetAutoFormDataShowEnabled(enable);
+
+ SysLog(NID_WEB_CTRL, "The current value of enable is %d", enable);
+}
+
+
+bool
+WebSetting::IsAutoFormDataShowEnabled(void) const
+{
+ SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pWebSettingImpl->IsAutoFormDataShowEnabled();
+}
+
+
+void
+WebSetting::SetAutoLoginFormFillEnabled(bool enable)
+{
+ SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+ r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
+ __pWebSettingImpl->SetAutoLoginFormFillEnabled(enable);
+
+ SysLog(NID_WEB_CTRL, "The current value of enable is %d", enable);
+}
+
+
+bool
+WebSetting::IsAutoLoginFormFillEnabled(void) const
+{
+ SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pWebSettingImpl->IsAutoLoginFormFillEnabled();
+}
+
+
+bool
+WebSetting::Equals(const Object& obj) const
+{
+ SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ const WebSetting* pRhs = dynamic_cast< const WebSetting* >(&obj);
+ if (pRhs == null)
+ {
+ return false;
+ }
+
+ return __pWebSettingImpl->Equals(*pRhs->__pWebSettingImpl);
+}
+
+
+int
+WebSetting::GetHashCode(void) const
+{
+ SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pWebSettingImpl->GetHashCode();
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrlWebStorageManager.cpp
+ * @brief The file contains the definition of FWebCtrlWebStorageManager class.
+ *
+ * The file contains the definition of FWebCtrlWebStorageManager class.
+ */
+#include <pthread.h>
+#include <unique_ptr.h>
+#include <FBaseColIList.h>
+#include <FBaseSysLog.h>
+#include <FWebCtrlWebStorageManager.h>
+#include <FSec_AccessController.h>
+#include "FWebCtrl_WebStorageManagerImpl.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Security;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+WebStorageManager* WebStorageManager::__pInstance = null;
+
+
+WebStorageManager::WebStorageManager(void)
+ : __pWebStorageManagerImpl(null)
+{
+ std::unique_ptr<_WebStorageManagerImpl> pWebStorageManagerImpl(new (std::nothrow) _WebStorageManagerImpl());
+ SysTryReturnVoidResult(NID_WEB_CTRL, pWebStorageManagerImpl.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ __pWebStorageManagerImpl = pWebStorageManagerImpl.release();
+}
+
+
+WebStorageManager::~WebStorageManager(void)
+{
+ delete __pWebStorageManagerImpl;
+ __pWebStorageManagerImpl = null;
+}
+
+
+void
+WebStorageManager::InitWebStorageManager(void)
+{
+ std::unique_ptr<WebStorageManager> pInstance(new (std::nothrow) WebStorageManager());
+ SysTryReturnVoidResult(NID_WEB_CTRL, pInstance.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ __pInstance = pInstance.release();
+ std::atexit(DestroyWebStorageManager);
+}
+
+
+void
+WebStorageManager::DestroyWebStorageManager(void)
+{
+ delete __pInstance;
+ __pInstance = null;
+}
+
+
+WebStorageManager*
+WebStorageManager::GetInstance(void)
+{
+ static pthread_once_t onceBlock = PTHREAD_ONCE_INIT;
+ if (__pInstance== null)
+ {
+ ClearLastResult();
+ pthread_once(&onceBlock, InitWebStorageManager);
+ result r = GetLastResult();
+ if (IsFailed(r))
+ {
+ onceBlock = PTHREAD_ONCE_INIT;
+ }
+ }
+
+ return __pInstance;
+}
+
+
+IList*
+WebStorageManager::GetOriginListN(WebStorageType storageType) const
+{
+ SysAssertf(__pWebStorageManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_PRIVACY);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
+
+ IList* pList = __pWebStorageManagerImpl->GetOriginListN(storageType);
+ SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ return pList;
+}
+
+
+result
+WebStorageManager::SetQuotaForOrigin(WebStorageType storageType, const String& origin, long quota)
+{
+ SysAssertf(__pWebStorageManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_PRIVACY);
+ SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
+
+ r = __pWebStorageManagerImpl->SetQuotaForOrigin(storageType, origin, quota);
+ SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return E_SUCCESS;
+}
+
+
+long
+WebStorageManager::GetQuotaForOrigin(WebStorageType storageType, const String& origin)
+{
+ SysAssertf(__pWebStorageManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+ long quota = 0;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_PRIVACY);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, 0, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
+
+ quota = __pWebStorageManagerImpl->GetQuotaForOrigin(storageType, origin);
+ SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, 0, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ return quota;
+}
+
+
+long
+WebStorageManager::GetUsageForOrigin(WebStorageType storageType, const String& origin) const
+{
+ SysAssertf(__pWebStorageManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+ long usage = 0;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_PRIVACY);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, 0, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
+
+ usage = __pWebStorageManagerImpl->GetQuotaForOrigin(storageType, origin);
+ SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, 0, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ return usage;
+}
+
+
+result
+WebStorageManager::Remove(WebStorageType storageType, const String& origin)
+{
+ SysAssertf(__pWebStorageManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_PRIVACY);
+ SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
+
+ r = __pWebStorageManagerImpl->Remove(storageType, origin);
+ SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return E_SUCCESS;
+}
+
+
+result
+WebStorageManager::RemoveAll(WebStorageType storageType)
+{
+ SysAssertf(__pWebStorageManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_PRIVACY);
+ SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
+
+ r = __pWebStorageManagerImpl->RemoveAll(storageType);
+ SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return E_SUCCESS;
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_AppControlListener.cpp
+ * @brief The file contains the definition of _AppControlListener classes.
+ *
+ * The file contains the definition of _AppControlListener classes.
+ */
+#include <FAppAppControl.h>
+#include <FBaseSysLog.h>
+#include <FBaseUtilStringUtil.h>
+#include "FWebCtrl_AppControlListener.h"
+
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Base::Utility;
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+_CertificateListener::_CertificateListener(void)
+{
+}
+
+
+_CertificateListener::~_CertificateListener(void)
+{
+}
+
+
+void
+_CertificateListener::OnAppControlCompleteResponseReceived(const Tizen::App::AppId& providerId, const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pAppData)
+{
+ if (providerId == L"tizen.certificatemanager" && operationId == L"http://tizen.org/appcontrol/operation/pick")
+ {
+ SysTryReturnVoidResult(NID_WEB_CTRL, pAppData, E_SYSTEM, "[E_SYSTEM] Certificate Manager AppControl failed");
+
+ //String* pCertID = static_cast< String* >(const_cast< Object* >(pAppData->GetValue(String(L"Id"))));
+ // TODO : test if the result of Certificate AppControl complies with the following
+ // const char* pCertificateFile;
+ // ewk_set_certificate_file(pCertificateFile);
+ }
+
+ delete this;
+}
+
+
+_LocationSettingListener::_LocationSettingListener(Ewk_Geolocation_Permission_Request* pGeoLocationObject)
+ : __pGeoLocationObject(pGeoLocationObject)
+{
+}
+
+
+_LocationSettingListener::~_LocationSettingListener(void)
+{
+}
+
+
+void
+_LocationSettingListener::OnAppControlCompleteResponseReceived(const Tizen::App::AppId& providerId, const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pAppData)
+{
+ if (providerId == L"tizen.settings")
+ {
+ SysTryReturnVoidResult(NID_WEB_CTRL, pAppData, E_SYSTEM, "[E_SYSTEM] Settings AppControl failed");
+
+ String* pCategoryStr = static_cast< String* >(const_cast< Object* >(pAppData->GetValue(String("category"))));
+ String* pGPSStr = static_cast< String* >(const_cast< Object* >(pAppData->GetValue(String("GPS"))));
+
+ if (pCategoryStr && pCategoryStr->Equals(String(L"Location")) && pGPSStr && pGPSStr->Equals(String(L"GPSEnabled")))
+ {
+ ewk_geolocation_permission_request_set(__pGeoLocationObject, true);
+ }
+ else
+ {
+ ewk_geolocation_permission_request_set(__pGeoLocationObject, false);
+ }
+ }
+ delete this;
+}
+
+
+_MediaSelectionListener::_MediaSelectionListener(void)
+ : __pWebFrame(null)
+ , __pMediaAppControl(null)
+{
+
+}
+
+void
+_MediaSelectionListener::Construct(Evas_Object* pWebFrame, Tizen::App::AppControl* pMediaAppControl)
+{
+ __pWebFrame = pWebFrame;
+ std::unique_ptr<AppControl> pAppControl(pMediaAppControl);
+ __pMediaAppControl = std::move(pAppControl);
+}
+
+
+_MediaSelectionListener::~_MediaSelectionListener(void)
+{
+
+}
+
+
+void
+_MediaSelectionListener::OnAppControlCompleteResponseReceived(const Tizen::App::AppId& providerId, const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pAppData)
+{
+ Eina_List* pSelectedFileNames = null;
+ ArrayList* pSelectedFiles = null;
+ int fileCount = 0;
+
+ SysTryCatch(NID_WEB_CTRL, pAppData, , E_INVALID_ARG, "[E_INVALID_ARG] Invalid arguments to _MediaSelectionListener::OnAppControlCompleted");
+ pSelectedFiles = dynamic_cast< ArrayList* >(const_cast< Object* >(pAppData->GetValue(String("http://tizen.org/appcontrol/data/selected"))));
+ SysTryCatch(NID_WEB_CTRL, pSelectedFiles, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ fileCount = pSelectedFiles->GetCount();
+
+ for (int i = 0; i < fileCount; i++)
+ {
+ String* pFile = static_cast<String*>(pSelectedFiles->GetAt(i));
+ SysTryCatch(NID_WEB_CTRL, pFile, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ std::unique_ptr<ByteBuffer> pByteBuf(StringUtil::StringToUtf8N(*pFile));
+ SysTryCatch(NID_WEB_CTRL, pByteBuf.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ pSelectedFileNames = eina_list_append(pSelectedFileNames, strdup((const char*)pByteBuf->GetPointer()));
+ SysTryCatch(NID_WEB_CTRL, pSelectedFileNames, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ }
+
+ ewk_view_open_panel_reply(__pWebFrame, pSelectedFileNames, EINA_TRUE);
+ eina_list_free(pSelectedFileNames);
+
+ delete this;
+ return;
+
+CATCH:
+ ewk_view_open_panel_reply(__pWebFrame, null, EINA_FALSE);
+ eina_list_free(pSelectedFileNames);
+ delete this;
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_AppControlListener.h
+ * @brief The file contains the declaration of AppControl listener classes.
+ *
+ * The file contains the declaration of AppControl listener classes.
+ */
+#ifndef _FWEB_CTRL_INTERNAL_APPCONTROL_LISTENERS_H_
+#define _FWEB_CTRL_INTERNAL_APPCONTROL_LISTENERS_H_
+
+#include <unique_ptr.h>
+#include <EWebKit2.h>
+#include <FAppIAppControlListener.h>
+#include <FAppIAppControlResponseListener.h>
+#include <FBaseColAllElementsDeleter.h>
+#include <FBaseColArrayList.h>
+#include <FBaseColIList.h>
+#include <FBaseObject.h>
+#include <FBaseString.h>
+
+namespace Tizen { namespace App
+{
+class AppControl;
+}} // Tizen::App
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+class _CertificateListener
+ : public Tizen::App::IAppControlResponseListener
+ , public Tizen::Base::Object
+ , virtual public Tizen::Base::Runtime::IEventListener
+{
+public:
+ _CertificateListener(void);
+
+ virtual ~_CertificateListener(void);
+
+ void OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData);
+
+
+}; //_CertificateListener
+
+
+class _LocationSettingListener
+ : public Tizen::App::IAppControlResponseListener
+ , public Tizen::Base::Object
+ , virtual public Tizen::Base::Runtime::IEventListener
+{
+public:
+ _LocationSettingListener(Ewk_Geolocation_Permission_Request* pGeoLocationObject);
+
+ virtual ~_LocationSettingListener(void);
+
+ void OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData);
+
+private:
+ Ewk_Geolocation_Permission_Request* __pGeoLocationObject;
+}; //_LocationSettingListener
+
+
+class _MediaSelectionListener
+ : public Tizen::App::IAppControlResponseListener
+ , public Tizen::Base::Object
+ , virtual public Tizen::Base::Runtime::IEventListener
+{
+public:
+ _MediaSelectionListener(void);
+
+ virtual ~_MediaSelectionListener(void);
+
+ void Construct(Evas_Object* pWebFrame, Tizen::App::AppControl* pMediaAppControl = null);
+
+ void OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData);
+
+private:
+ _MediaSelectionListener(const _MediaSelectionListener&);
+
+ _MediaSelectionListener& operator =(const _MediaSelectionListener&);
+
+private:
+ Evas_Object* __pWebFrame;
+
+ std::unique_ptr<Tizen::App::AppControl> __pMediaAppControl;
+}; //_MediaSelectionListener
+
+}}} //Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_APPCONTROL_LISTENERS_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_AuthConfirmPopup.cpp
+ * @brief The file contains the definition of _AuthConfirmPopup class.
+ */
+#include <FBaseColArrayList.h>
+#include <FBaseSysLog.h>
+#include <FGrpDimension.h>
+#include <FGrpRectangle.h>
+#include <FSysVibrator.h>
+#include <FUiCtrlButton.h>
+#include <FUiCtrlEditField.h>
+#include <FUiCtrlLabel.h>
+#include <FUiCtrlPanel.h>
+#include <FUiKeyEventInfo.h>
+#include <FUiLayout.h>
+#include <FUiVerticalBoxLayout.h>
+#include <FSys_SystemResource.h>
+#include <FSys_VibratorImpl.h>
+#include <FUi_ControlManager.h>
+#include <FUi_ResourceManager.h>
+#include "FWebCtrl_AuthConfirmPopup.h"
+#include "FWebCtrl_WebImpl.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Graphics;
+using namespace Tizen::System;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+static const int EDIT_TEXT_SIZE = 35;
+
+
+_AuthConfirmPopup::_AuthConfirmPopup(void)
+ : __pIdEditField(null)
+ , __pPwdEditField(null)
+ , __pImpl(null)
+{
+}
+
+
+_AuthConfirmPopup::~_AuthConfirmPopup(void)
+{
+}
+
+
+// Authentication popup
+result
+_AuthConfirmPopup::Construct(const String& host, const String& realm, _WebImpl* pImpl)
+{
+ __pImpl = pImpl;
+ SysAssertf(__pImpl != null, "Failed to get _WebImpl");
+
+ _SystemResource* pSysResource = _SystemResource::GetInstance();
+ SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
+
+ result r = E_SUCCESS;
+ _WebPopupData* pPopupData = _WebPopup::GetPopupData();
+ SysTryReturn(NID_WEB_CTRL, pPopupData, r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ Rectangle rect(0, 0, 0, 0);
+ rect.width = pPopupData->popupDim.width;
+ rect.height = (2*pPopupData->spacePad) + (pPopupData->editDim.height*2) + pPopupData->panelHeight + (2*pPopupData->labelDim.height);
+ r = _WebPopup::Construct(true, Dimension(rect.width, rect.height));
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ SetTitleText(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_HEADER_ENTER_CREDENTIALS_ABB"));
+
+ //host realm label
+ rect.height = 2*pPopupData->labelDim.height;
+
+ std::unique_ptr<Label> pLabel(new (std::nothrow) Label());
+ SysTryReturnResult(NID_WEB_CTRL, pLabel.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ String hostRealm(host);
+ hostRealm.Append(L": \n ");
+ hostRealm.Append(realm);
+
+ Rectangle labelRect(rect);
+ labelRect.width = pPopupData->labelDim.width;
+ r = pLabel->Construct(labelRect, hostRealm);
+
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pLabel->SetTextConfig(pPopupData->labelFontSize, LABEL_TEXT_STYLE_NORMAL);
+ pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+
+ r = AddControl(*pLabel);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ Label* pHostLabel = pLabel.release();
+
+ // Id Edit Field
+ rect.x = 0;
+ rect.y = 0;
+ rect.height = pPopupData->editDim.height;
+ rect.width = pPopupData->labelDim.width;
+
+ std::unique_ptr<EditField> pIdEditField(new (std::nothrow) EditField());
+ SysTryReturnResult(NID_WEB_CTRL, pIdEditField.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ r = pIdEditField->Construct(rect, EDIT_FIELD_STYLE_NORMAL);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pIdEditField->SetGuideText(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_WIFI_BODY_ENTER_YOUR_ID"));
+ pIdEditField->SetGuideTextColor(Color::GetColor(COLOR_ID_GREY));
+ pIdEditField->SetTextSize(EDIT_TEXT_SIZE);;
+
+ r = AddControl(*pIdEditField);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pIdEditField = pIdEditField.release();
+
+ std::unique_ptr<EditField> pPwdEditField(new (std::nothrow) EditField());
+ SysTryReturnResult(NID_WEB_CTRL, pPwdEditField.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ r = pPwdEditField->Construct(rect, EDIT_FIELD_STYLE_PASSWORD);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pPwdEditField->SetGuideText(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_ENTER_YOUR_PASSWORD_ABB"));
+ pPwdEditField->SetGuideTextColor(Color::GetColor(COLOR_ID_GREY));
+ pPwdEditField->SetTextSize(EDIT_TEXT_SIZE);;
+
+ r = AddControl(*pPwdEditField);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pPwdEditField = pPwdEditField.release();
+
+ __pIdEditField->SetFocus();
+
+ Panel* pButtonPanel = CreateAndAddPanel();
+ SysTryReturn(NID_WEB_CTRL, pButtonPanel, r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ //Add Buttons
+ ArrayList idList(SingleObjectDeleter);
+ r = idList.Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ idList.Add(new Integer(ID_BUTTON_AUTH_CANCEL));
+ idList.Add(new Integer(ID_BUTTON_AUTH_PROCESS));
+
+
+ ArrayList titleList(SingleObjectDeleter);
+ r = titleList.Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ titleList.Add(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_CANCEL_ABB")));
+ titleList.Add(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_CONTINUE_ABB")));
+
+ r = CreateAndAddButtons(idList, titleList, pButtonPanel);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ std::unique_ptr<VerticalBoxLayout> pLayout(dynamic_cast< VerticalBoxLayout* >(GetLayoutN()));
+ SysTryReturn(NID_WEB_CTRL, pLayout.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ pLayout->SetHorizontalAlignment(*pHostLabel, LAYOUT_HORIZONTAL_ALIGN_CENTER);
+ pLayout->SetHorizontalAlignment(*__pIdEditField, LAYOUT_HORIZONTAL_ALIGN_CENTER);
+ pLayout->SetHorizontalAlignment(*__pPwdEditField, LAYOUT_HORIZONTAL_ALIGN_CENTER);
+
+ pLayout->SetSpacing(*__pPwdEditField, pPopupData->spacePad);
+ pLayout->SetSpacing(*pButtonPanel, pPopupData->spacePad);
+
+ SetPropagatedKeyEventListener(this);
+
+ return E_SUCCESS;
+}
+
+
+void
+_AuthConfirmPopup::OnActionPerformed(const Control& source, int actionId)
+{
+ result r = E_SUCCESS;
+
+ r = HidePopup();
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ ArrayList* pAuthValueList = null;
+
+ switch (actionId)
+ {
+ case ID_BUTTON_AUTH_PROCESS:
+
+ pAuthValueList = new (std::nothrow) ArrayList();
+ pAuthValueList->Construct();
+ pAuthValueList->Add(new String(__pIdEditField->GetText()));
+ pAuthValueList->Add(new String(__pPwdEditField->GetText()));
+ __pImpl->SendUserEvent(ID_AUTHENTICATION_CONFIRM_POPUP_PROCESS, pAuthValueList);
+ break;
+
+ case ID_BUTTON_AUTH_CANCEL:
+ __pImpl->SendUserEvent(ID_AUTHENTICATION_CONFIRM_POPUP_CANCEL, null);
+ break;
+
+ default:
+ break;
+ }
+}
+
+bool
+_AuthConfirmPopup::OnKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
+{
+ return false;
+}
+
+bool
+_AuthConfirmPopup::OnKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
+{
+ result r = E_SUCCESS;
+ if ((keyEventInfo.GetKeyCode() == KEY_ESC || keyEventInfo.GetKeyCode() == KEY_BACK) && source.GetShowState() == true)
+ {
+ r = HidePopup();
+ if (IsFailed(r))
+ {
+ SysLogException(NID_WEB_CTRL, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+
+ __pImpl->SendUserEvent(ID_AUTHENTICATION_CONFIRM_POPUP_CANCEL, null);
+ }
+
+ return false;
+}
+
+bool
+_AuthConfirmPopup::OnPreviewKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
+{
+ return false;
+}
+
+bool
+_AuthConfirmPopup::OnPreviewKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
+{
+ return false;
+}
+
+bool
+_AuthConfirmPopup::TranslateKeyEventInfo(Control& source, KeyEventInfo& keyEventInfo)
+{
+ return false;
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_AuthConfirmPopup.h
+ * @brief The file contains the definition of _AuthConfirmPopup class.
+ */
+
+#ifndef _FWEB_CTRL_INTERNAL_AUTH_CONFIRM_POPUP_H_
+#define _FWEB_CTRL_INTERNAL_AUTH_CONFIRM_POPUP_H_
+
+#include <unique_ptr.h>
+#include <FBaseString.h>
+#include <FUiIPropagatedKeyEventListener.h>
+#include "FWebCtrl_WebPopup.h"
+
+namespace Tizen { namespace Ui
+{
+class IActionEventListener;
+}} // Tizen::Ui
+
+namespace Tizen { namespace Ui { namespace Controls
+{
+class EditField;
+}}} // Tizen::Ui::Controls
+
+namespace Tizen { namespace Web { namespace Controls
+{
+class _WebImpl;
+
+
+enum _AuthPopupButtonId
+{
+ ID_BUTTON_AUTH_PROCESS,
+ ID_BUTTON_AUTH_CANCEL
+};
+
+
+class _AuthConfirmPopup
+ : public _WebPopup
+ , public Tizen::Ui::IPropagatedKeyEventListener
+{
+
+public:
+ /**
+ * Constructor
+ */
+ _AuthConfirmPopup(void);
+
+ /**
+ * Destructor
+ */
+ virtual ~_AuthConfirmPopup(void);
+
+ result Construct(const Tizen::Base::String& host, const Tizen::Base::String& realm, _WebImpl* pImpl);
+
+ virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+
+ virtual bool OnKeyPressed (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
+ virtual bool OnKeyReleased (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
+ virtual bool OnPreviewKeyPressed (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
+ virtual bool OnPreviewKeyReleased (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
+ virtual bool TranslateKeyEventInfo (Tizen::Ui::Control &source, Tizen::Ui::KeyEventInfo &keyEventInfo);
+
+private:
+ _AuthConfirmPopup(const _AuthConfirmPopup&);
+
+ _AuthConfirmPopup& operator =(const _AuthConfirmPopup&);
+
+private:
+ Tizen::Ui::Controls::EditField* __pIdEditField;
+ Tizen::Ui::Controls::EditField* __pPwdEditField;
+ _WebImpl* __pImpl;
+
+}; // _AuthConfirmPopup
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_AUTH_COMMON_POPUP_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_AuthenticationChallengeImpl.cpp
+ * @brief The file contains the definition of _AuthenticationChallengeImpl class.
+ *
+ * The file contains the definition of _AuthenticationChallengeImpl class.
+ */
+#include <unique_ptr.h>
+#include <EWebKit2.h>
+#include <FBaseErrors.h>
+#include <FWebCtrlAuthenticationChallenge.h>
+#include <FBase_StringConverter.h>
+#include <FBaseSysLog.h>
+#include "FWebCtrl_AuthenticationChallengeImpl.h"
+
+
+using namespace Tizen::Base;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+_AuthenticationChallengeImpl::_AuthenticationChallengeImpl(void)
+ : __pAuthChallengeHandler(null)
+ , __pWebFrame(null)
+{
+}
+
+_AuthenticationChallengeImpl::~_AuthenticationChallengeImpl(void)
+{
+}
+
+
+void
+_AuthenticationChallengeImpl::Process(const UserId& userId, const Tizen::Base::String& password)
+{
+ std::unique_ptr<char[]> pUserId(_StringConverter::CopyToCharArrayN(userId));
+ std::unique_ptr<char[]> pUserPwd(_StringConverter::CopyToCharArrayN(password));
+ SysTryReturnVoidResult(NID_WEB_CTRL, pUserId.get() && pUserPwd.get(), E_SYSTEM, "[%s] A system error has been occurred. Failed to convert strings.", GetErrorMessage(E_SYSTEM));
+
+ //ewk_auth_response_ok(__pAuthChallengeHandler, pUserId, pUserPwd);
+ ewk_auth_challenge_credential_use(__pAuthChallengeHandler, pUserId.get(), pUserPwd.get());
+}
+
+
+void
+_AuthenticationChallengeImpl::Cancel(void)
+{
+ //ewk_auth_response_cancel(__pAuthChallengeHandler);
+ ewk_auth_challenge_credential_cancel(__pAuthChallengeHandler);
+ evas_object_smart_callback_call(__pWebFrame, "authentication,canceled", NULL);
+}
+
+
+void
+_AuthenticationChallengeImpl::SetAuthenticationChallengeHandler(Ewk_Auth_Challenge* pAuthHandler)
+{
+ SysTryReturnVoidResult(NID_WEB_CTRL, pAuthHandler, E_INVALID_ARG, "[%s] Invalid argument(s) is used. pAuthHandler instance is null." , GetErrorMessage(E_INVALID_ARG));
+ __pAuthChallengeHandler = pAuthHandler;
+}
+
+
+void
+_AuthenticationChallengeImpl::SetWebEvasObject(Evas_Object* pObj)
+{
+ SysTryReturnVoidResult(NID_WEB_CTRL, pObj, E_INVALID_ARG, "[%s] Invalid argument(s) is used. pAuthHandler instance is null." , GetErrorMessage(E_INVALID_ARG));
+ __pWebFrame = pObj;
+}
+
+
+_AuthenticationChallengeImpl*
+_AuthenticationChallengeImpl::GetInstance(AuthenticationChallenge* pAuthChallenge)
+{
+
+ SysTryReturn(NID_WEB_CTRL, pAuthChallenge, null, E_INVALID_ARG, "[%s] Invalid argument(s) is used. pAuthChallenge instance is null." , GetErrorMessage(E_INVALID_ARG));
+ return pAuthChallenge->__pAuthenticationChallengeImpl;
+}
+
+
+const _AuthenticationChallengeImpl*
+_AuthenticationChallengeImpl::GetInstance(const AuthenticationChallenge* pAuthChallenge)
+{
+ SysTryReturn(NID_WEB_CTRL, pAuthChallenge, null, E_INVALID_ARG, "[%s] Invalid argument(s) is used. pAuthChallenge instance is null." , GetErrorMessage(E_INVALID_ARG));
+ return pAuthChallenge->__pAuthenticationChallengeImpl;
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_AuthenticationChallengeImpl.h
+ * @brief This is the header file for the %_AuthenticationChallengeImpl class.
+ *
+ * This header file contains the declarations of the %_AuthenticationChallengeImpl class.
+ */
+#ifndef _FWEB_CTRL_INTERNAL_AUTHENTICATION_CHALLENGE_IMPL_H_
+#define _FWEB_CTRL_INTERNAL_AUTHENTICATION_CHALLENGE_IMPL_H_
+
+#include <EWebKit2.h>
+#include <FBaseDataType.h>
+#include <FBaseObject.h>
+#include <FBaseString.h>
+
+namespace Tizen { namespace Web { namespace Controls
+{
+class AuthenticationChallenge;
+
+
+class _AuthenticationChallengeImpl
+ : public Tizen::Base::Object
+{
+public:
+ _AuthenticationChallengeImpl(void);
+
+ virtual ~_AuthenticationChallengeImpl(void);
+
+ void Process(const UserId& userId, const Tizen::Base::String& password);
+
+ void Cancel(void);
+
+ void SetAuthenticationChallengeHandler(Ewk_Auth_Challenge* pAuthHandler);
+
+ void SetWebEvasObject(Evas_Object* pObj);
+
+ static _AuthenticationChallengeImpl* GetInstance(AuthenticationChallenge* pAuthChallenge);
+
+ static const _AuthenticationChallengeImpl* GetInstance(const AuthenticationChallenge* pAuthChallenge);
+
+private:
+ Ewk_Auth_Challenge* __pAuthChallengeHandler;
+
+ Evas_Object* __pWebFrame;
+
+}; // _AuthenticationChallengeImpl
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_AUTHENTICATION_CHALLENGE_IMPL_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_CertificateConfirmPopup.cpp
+ * @brief The file contains the definition of _CertificateConfirmPopup class.
+ */
+#include <FAppApp.h>
+#include <FBaseColArrayList.h>
+#include <FBaseSysLog.h>
+#include <FBaseUtilUri.h>
+#include <FGrpDimension.h>
+#include <FGrpRectangle.h>
+#include <FIoDbEnumerator.h>
+#include <FIoDbStatement.h>
+#include <FSecCertX509Certificate.h>
+#include <FUiCtrlButton.h>
+#include <FUiCtrlLabel.h>
+#include <FUiCtrlPanel.h>
+#include <FUiKeyEventInfo.h>
+#include <FUiLayout.h>
+#include <FUiVerticalBoxLayout.h>
+#include <FIo_DatabaseImpl.h>
+#include <FSys_SystemResource.h>
+#include <FUi_ControlManager.h>
+#include <FUi_ResourceManager.h>
+#include "FWebCtrl_CertificateConfirmPopup.h"
+#include "FWebCtrl_WebManager.h"
+#include "FWebCtrl_Utility.h"
+#include "FWebCtrl_WebImpl.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Base::Utility;
+using namespace Tizen::Graphics;
+using namespace Tizen::Io;
+using namespace Tizen::Security::Cert;
+using namespace Tizen::System;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+static const int EDIT_TEXT_SIZE = 30;
+
+
+_CertificateConfirmPopup::_CertificateConfirmPopup(void)
+ : __certPopupMode(CERTIFICATE_POPUP_MODE_USER_CONFIRM)
+ , __confirm(false)
+ , __pCertificatePolicyData(null)
+ , __pParent(null)
+ , __pCertificatePopup(null)
+ , __reaction(false)
+{
+}
+
+
+_CertificateConfirmPopup::~_CertificateConfirmPopup(void)
+{
+ if (IsModalPopup() == true)
+ {
+ HandleUserAction(false);
+ }
+ if (__pCertificatePopup.get())
+ {
+ __pCertificatePopup.reset();
+ }
+}
+
+
+result
+_CertificateConfirmPopup::Construct(_CertificatePopupMode certPopupMode, Ewk_Certificate_Policy_Decision* pPolicy, Tizen::Web::Controls::_CertificateConfirmPopup* pParent)
+{
+ SysTryReturnResult(NID_WEB_CTRL, pPolicy, E_INVALID_ARG, "Certificate Policy pointer is null.");
+ result r = E_SUCCESS;
+
+ _SystemResource* pSysResource = _SystemResource::GetInstance();
+ SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
+
+ _WebPopupData* pPopupData = _WebPopup::GetPopupData();
+ SysTryReturn(NID_WEB_CTRL, pPopupData, r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pCertificatePolicyData = pPolicy;
+ __certPopupMode = certPopupMode;
+ String titleText = L"";
+ int popupMaxHeight = 0;
+ Rectangle rect(0, 0, 0, 0);
+
+ __pParent = pParent;
+
+ ArrayList idList(SingleObjectDeleter);
+ r = idList.Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ ArrayList titleList(SingleObjectDeleter);
+ r = titleList.Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ if( __certPopupMode == CERTIFICATE_POPUP_MODE_VIEW )
+ {
+ titleText = pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_HEADER_SECURITY_CERTIFICATE_ABB");
+ popupMaxHeight = 4*pPopupData->labelDim.height + pPopupData->panelHeight;
+
+ rect.height = 4*pPopupData->labelDim.height;
+ rect.width = pPopupData->labelDim.width;
+
+ idList.Add(*(new Integer(ID_BUTTON_CERTIFICATE_CLOSE)));
+ titleList.Add(*(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_OK"))));
+ }
+ else // CERTIFICATE_POPUP_MODE_CONFIRM
+ {
+ titleText = pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_HEADER_SECURITY_WARNING_ABB");
+ popupMaxHeight = 2*pPopupData->labelDim.height + pPopupData->panelHeight;
+
+ rect.height = 2*pPopupData->labelDim.height;
+ rect.width = pPopupData->labelDim.width;
+
+ idList.Add(*(new Integer(ID_BUTTON_CERTIFICATE_CANCEL)));
+ idList.Add(*(new Integer(ID_BUTTON_CERTIFICATE_VIEW)));
+ idList.Add(*(new Integer(ID_BUTTON_CERTIFICATE_ALLOW)));
+
+ titleList.Add(*(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_CANCEL_ABB"))));
+ titleList.Add(*(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON2_VIEW_CERTIFICATE"))));
+ titleList.Add(*(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_CONTINUE_ABB"))));
+ }
+
+ r = _WebPopup::Construct(true, Dimension(pPopupData->popupDim.width, popupMaxHeight));
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ SetTitleText(titleText);
+
+ std::unique_ptr<VerticalBoxLayout> pLayout(dynamic_cast< VerticalBoxLayout* >(GetLayoutN()));
+ SysTryReturn(NID_WEB_CTRL, pLayout.get(), r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ if( certPopupMode == CERTIFICATE_POPUP_MODE_VIEW )
+ {
+ String certString;
+ result r = GenerateCertifiate(certString);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ std::unique_ptr<TextBox> pTextBox(new (std::nothrow) TextBox());
+ SysTryReturnResult(NID_WEB_CTRL, pTextBox.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ r = pTextBox->Construct(rect, TEXT_BOX_BORDER_ROUNDED);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pTextBox->SetTextSize(EDIT_TEXT_SIZE);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pTextBox->SetAutoLinkMask(LINK_TYPE_NONE);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pTextBox->SetText(certString);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = AddControl(*pTextBox);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ TextBox* pCertBox = pTextBox.release();
+ pLayout->SetHorizontalAlignment(*pCertBox, LAYOUT_HORIZONTAL_ALIGN_CENTER);
+ }
+ else // CERTIFICATE_POPUP_MODE_CONFIRM
+ {
+ std::unique_ptr<Label> pLabel(new (std::nothrow) Label());
+ SysTryReturnResult(NID_WEB_CTRL, pLabel.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ String message = L"";
+ message = pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_THERE_ARE_PROBLEMS_WITH_THE_SECURITY_CERTIFICATE_FOR_THIS_SITE_C");
+ message.Append(L"\n");
+ message.Append(ewk_certificate_policy_decision_url_get(__pCertificatePolicyData));
+
+ r = pLabel->Construct(rect, message);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pLabel->SetTextConfig(pPopupData->labelFontSize, LABEL_TEXT_STYLE_NORMAL);
+ pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+
+ r = AddControl(*pLabel);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ Label* pInfoLabel = pLabel.release();
+ pLayout->SetHorizontalFitPolicy(*pInfoLabel, FIT_POLICY_PARENT);
+ }
+ Panel* pButtonPanel = CreateAndAddPanel();
+ SysTryReturn(NID_WEB_CTRL, pButtonPanel, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ r = CreateAndAddButtons(idList, titleList, pButtonPanel);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ SetPropagatedKeyEventListener(this);
+
+ return E_SUCCESS;
+}
+
+
+void
+_CertificateConfirmPopup::OnActionPerformed(const Control& source, int actionId)
+{
+ result r = E_SUCCESS;
+
+ switch (actionId)
+ {
+ case ID_BUTTON_CERTIFICATE_ALLOW:
+ {
+ if (__reaction)
+ {
+ return;
+ }
+
+ HandleUserAction(true);
+ break;
+ }
+
+ case ID_BUTTON_CERTIFICATE_VIEW:
+ {
+ if (__reaction)
+ {
+ return;
+ }
+
+ __reaction = true;
+ std::unique_ptr<_CertificateConfirmPopup> pCertificatePopup(new (std::nothrow) _CertificateConfirmPopup());
+ SysTryReturnVoidResult(NID_WEB_CTRL, pCertificatePopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ r = pCertificatePopup->Construct(CERTIFICATE_POPUP_MODE_VIEW, __pCertificatePolicyData, this);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pCertificatePopup = std::move(pCertificatePopup);
+
+ r = __pCertificatePopup->ShowPopup();
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ return;
+ }
+
+ case ID_BUTTON_CERTIFICATE_CANCEL:
+ {
+ if (__reaction)
+ {
+ return;
+ }
+
+ HandleUserAction(false);
+ break;
+ }
+
+ case ID_BUTTON_CERTIFICATE_CLOSE:
+ {
+ if (__reaction)
+ {
+ return;
+ }
+
+ break;
+ }
+
+ default:
+ SysAssert(false);
+ break;
+ }
+
+ r = HidePopup();
+ if (IsFailed(r))
+ {
+ SysLogException(NID_WEB_CTRL, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ if (__certPopupMode == CERTIFICATE_POPUP_MODE_VIEW)
+ {
+ __pParent->SendUserEvent(ID_CERTIFICATE_CONFIRM_POPUP_CLOSE, null);
+ }
+}
+
+
+void
+_CertificateConfirmPopup::OnUserEventReceivedN(RequestId requestId, IList* pArgs)
+{
+ switch (requestId)
+ {
+ case ID_CERTIFICATE_CONFIRM_POPUP_CLOSE:
+ {
+ __pCertificatePopup.reset();
+
+ if (__reaction)
+ {
+ __reaction = false;
+ }
+
+ break;
+ }
+ default:
+ break;
+ }
+
+}
+
+
+bool
+_CertificateConfirmPopup::OnKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
+{
+ return false;
+}
+
+bool
+_CertificateConfirmPopup::OnKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
+{
+ result r = E_SUCCESS;
+ if ((keyEventInfo.GetKeyCode() == KEY_ESC || keyEventInfo.GetKeyCode() == KEY_BACK) && source.GetShowState() == true)
+ {
+ if (__certPopupMode == CERTIFICATE_POPUP_MODE_USER_CONFIRM)
+ {
+ HandleUserAction(false);
+ }
+ r = HidePopup();
+ if (IsFailed(r))
+ {
+ SysLogException(NID_WEB_CTRL, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ if (__certPopupMode == CERTIFICATE_POPUP_MODE_VIEW)
+ {
+ __pParent->SendUserEvent(ID_CERTIFICATE_CONFIRM_POPUP_CLOSE, null);
+ }
+ }
+
+ return false;
+}
+
+bool
+_CertificateConfirmPopup::OnPreviewKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
+{
+ return false;
+}
+
+bool
+_CertificateConfirmPopup::OnPreviewKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
+{
+ return false;
+}
+
+bool
+_CertificateConfirmPopup::TranslateKeyEventInfo(Control& source, KeyEventInfo& keyEventInfo)
+{
+ return false;
+}
+
+bool
+_CertificateConfirmPopup::GetConfirmResult() const
+{
+ return __confirm;
+}
+
+
+void
+_CertificateConfirmPopup::HandleUserAction(bool allow)
+{
+ __confirm = allow;
+
+ String pem(ewk_certificate_policy_decision_certificate_pem_get(__pCertificatePolicyData));
+ ewk_certificate_policy_decision_allowed_set(__pCertificatePolicyData, static_cast< Eina_Bool >(allow));
+ AddCertificateDb(pem, allow);
+}
+
+
+void
+_CertificateConfirmPopup::AddCertificateDb(const String& pem, bool allow)
+{
+ _DatabaseImpl db;
+ String certificatePath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
+ String table(CERTIFICATE_TABLE_NAME);
+
+ result r = db.Construct(certificatePath, "r+", null);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ std::unique_ptr<DbStatement> pStmt(db.CreateStatementN(L"Insert Into " + table + L" (pem, allow) Values (?, ?)"));
+ SysTryReturnVoidResult(NID_WEB_CTRL, pStmt.get(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ SysLog(NID_WEB_CTRL, "The current value of pem is %ls, allow is %d", pem.GetPointer(), allow);
+
+ pStmt->BindString(0, pem);
+ pStmt->BindInt(1, static_cast < int >(allow));
+
+ db.BeginTransaction();
+
+ std::unique_ptr<DbEnumerator> pEnum(db.ExecuteStatementN(*pStmt));
+
+ db.CommitTransaction();
+}
+
+
+result
+_CertificateConfirmPopup::GenerateCertifiate(String& certString)
+{
+ SysTryReturnResult(NID_WEB_CTRL, __pCertificatePolicyData, E_INVALID_ARG, "Certificate Policy pointer is null.");
+
+ _SystemResource* pSysResource = _SystemResource::GetInstance();
+ SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
+
+ String pemString(ewk_certificate_policy_decision_certificate_pem_get(__pCertificatePolicyData));
+ std::unique_ptr<ByteBuffer> pByteBuf(StringUtil::StringToUtf8N(pemString));
+ SysTryReturnResult(NID_WEB_CTRL, pByteBuf.get(), E_INVALID_DATA, "Certificate pem information is Empty.");
+
+ X509Certificate certificate;
+ result r = certificate.Construct(*pByteBuf);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ //Issued to
+ certString.Append(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_ISSUED_TO_C"));
+ certString.Append(L"\n\n");
+ String subject = certificate.GetSubject();
+
+ certString.Append(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_COMMON_NAME_C"));
+ certString.Append(L"\n");
+ certString.Append(GetStringOfToken(subject, L"/CN=") + L"\n");
+
+ certString.Append(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_ORGANISATION_C"));
+ certString.Append(L"\n");
+ certString.Append(GetStringOfToken(subject, L"/O=") + L"\n");
+
+ certString.Append(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP ,"IDS_TPLATFORM_BODY_ORGANISATIONAL_UNIT_C"));
+ certString.Append(L"\n");
+ certString.Append(GetStringOfToken(subject, L"/OU=") + L"\n");
+
+ certString.Append(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_SERIAL_NUMBER_C"));
+ certString.Append(L"\n");
+ certString.Append(certificate.GetSerialNumber() + L"\n\n\n");
+
+ //Issued by
+ certString.Append(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_ISSUED_BY_C"));
+ certString.Append(L"\n\n");
+ String issuer = certificate.GetIssuer();
+
+ certString.Append(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_COMMON_NAME_C"));
+ certString.Append(L"\n");
+ certString.Append(GetStringOfToken(issuer, L"/CN=") + L"\n");
+
+ certString.Append(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_ORGANISATION_C"));
+ certString.Append(L"\n");
+ certString.Append(GetStringOfToken(issuer, L"/O=") + L"\n");
+
+ certString.Append(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_ORGANISATIONAL_UNIT_C"));
+ certString.Append(L"\n");
+ certString.Append(GetStringOfToken(issuer, L"/OU=") + L"\n\n");
+
+ //Validity
+ certString.Append(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_VALIDITY_C"));
+ certString.Append(L"\n\n");
+ certString.Append(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_POP_CERTI_VALID_FROM_C"));
+ certString.Append(L"\n");
+ certString.Append(certificate.GetNotBefore() + L"\n\n");
+
+ certString.Append(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_CERTIFICATE_VALID_TILL"));
+ certString.Append(L":\n");
+ certString.Append(certificate.GetNotAfter() + L"\n\n\n");
+
+ //FingerPrints
+ certString.Append(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_FINGERPRINTS_C"));
+ certString.Append(L"\n\n");
+ certString.Append(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_SIGNATURE_ALGORITHM_VODA"));
+ certString.Append(L":\n");
+ certString.Append(certificate.GetSignatureAlgorithm() + L"\n\n");
+
+ std::unique_ptr<ByteBuffer> pFingerPrint(certificate.GetFingerprintN());
+ if (pFingerPrint.get() && pFingerPrint->GetPointer())
+ {
+ String fingerPrint;
+ StringUtil::Utf8ToString((const char*)pFingerPrint->GetPointer(), fingerPrint);
+ fingerPrint.SetLength(pFingerPrint->GetLimit());
+ certString.Append(fingerPrint + L"\n\n");
+ }
+
+ return E_SUCCESS;
+}
+
+
+String
+_CertificateConfirmPopup::GetStringOfToken(const String& parseString, const String& parseToken)
+{
+ String inString(parseString);
+ int index = 0;
+
+ String outString;
+ outString.Append(L"\n");
+
+ result r = inString.IndexOf(parseToken, 0, index);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, outString, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ int prsTokLen = parseToken.GetLength();
+ r = inString.Remove(0, index + prsTokLen);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, outString, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ while (true)
+ {
+ r = inString.IndexOf(parseToken, 0, index);
+
+ switch (r)
+ {
+ case E_SUCCESS:
+ r = inString.Remove(index, prsTokLen);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, outString, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ inString.Insert(L"\n", index);
+ continue;
+
+ case E_OBJ_NOT_FOUND:
+ r = inString.IndexOf('=', 0, index);
+ if (r == E_SUCCESS)
+ {
+ int slashIndex = 0;
+ r = inString.LastIndexOf('/', index - 3, slashIndex);
+
+ if (!IsFailed(r) && (slashIndex == index - 2 || slashIndex == index - 3))
+ {
+ inString.Remove(slashIndex, inString.GetLength() - slashIndex);
+ }
+ }
+ inString.Append(L"\n");
+ outString = inString;
+ return outString;
+
+ default:
+ return outString;
+ }
+ }
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_EflWebkit.cpp
+ * @brief The file contains the definition of _EflWebkit class.
+ *
+ * The file contains the definition of _EflWebkit class.
+ */
+#include <unique_ptr.h>
+#include <vconf.h>
+#include <EWebKit2.h>
+#include <net_connection.h>
+#include <FAppApp.h>
+#include <FGrpPoint.h>
+#include <FGrpRectangle.h>
+#include <FSysVibrator.h>
+#include <FUiAnimVisualElement.h>
+#include <FBaseSysLog.h>
+#include <FBase_StringConverter.h>
+#include <FGrp_CoordinateSystem.h>
+#include <FSecCert_CertService.h>
+#include <FUi_Control.h>
+#include <FUi_Window.h>
+#include "FUiAnim_EflNode.h"
+#include "FUiAnim_VisualElementImpl.h"
+#include "FUiAnim_VisualElementSurfaceImpl.h"
+#include "FWebCtrl_EflWebkit.h"
+#include "FWebCtrl_Utility.h"
+#include "FWebCtrl_WebImpl.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::Io;
+using namespace Tizen::Security::Cert;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Animations;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+static const char PLUGIN_DIRECTORY_PATH[] = "/usr/lib/osp/browser-plugin/";
+
+static const wchar_t ICON_DB_DIRECTORY_PATH[] = L"data/.webkit/iconDatabase/";
+static const wchar_t ICON_DB_FILE_NAME[] = L"icon.db";
+
+
+_EflWebkit::_EflWebkit(void)
+ : __pWebFrame(null)
+ , __pContainerVisualElement(null)
+ , __pSurface(null)
+{
+}
+
+
+_EflWebkit::~_EflWebkit(void)
+{
+ if (__pContainerVisualElement)
+ {
+ __pContainerVisualElement->SetSurface(null);
+ }
+
+ delete __pSurface;
+ __pSurface = null;
+
+ if (__pWebFrame)
+ {
+ evas_object_del(__pWebFrame);
+ __pWebFrame = null;
+ }
+}
+
+
+result
+_EflWebkit::Construct(const Rectangle& rect, VisualElement& containerVisualElement, _Control* pControl)
+{
+ result r = E_SUCCESS;
+
+ const _VisualElementImpl* pWebVisualElementImpl = _VisualElementImpl::GetInstance(containerVisualElement);
+ SysAssertf(pWebVisualElementImpl, "Failed to get VisualElement of Web control.");
+
+ _EflNode* pEflNode = dynamic_cast< _EflNode* >(pWebVisualElementImpl->GetNativeNode());
+ SysAssertf(pEflNode, "Failed to get native node.");
+
+ Evas* pEvas = pEflNode->GetEvas();
+ SysAssertf(pEvas, "Failed to get Evas.");
+
+ __pWebFrame = ewk_view_add(pEvas);
+ SysTryReturnResult(NID_WEB_CTRL, __pWebFrame, E_SYSTEM, "A system error has been occurred. Failed to create webkit instance.");
+
+ evas_object_pass_events_set(__pWebFrame, EINA_TRUE);
+
+ r = SetWebConfiguration();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ _ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetTransformer();
+ SysAssertf(pXformer, "Failed to get coordinate transformer.");
+
+ evas_object_resize(__pWebFrame, pXformer->TransformHorizontal(rect.width), pXformer->TransformVertical(rect.height));
+ evas_object_move(__pWebFrame, pXformer->TransformHorizontal(rect.x), pXformer->TransformVertical(rect.y));
+
+#if 0
+ pEflNode->AddNativeSmartObject(containerVisualElement, __pWebFrame);
+#else
+ __pContainerVisualElement = &containerVisualElement;
+
+ DisplayContext* pDisplayContext = pControl->GetRootWindow()->GetDisplayContext();
+ SysTryReturn(NID_WEB_CTRL, pDisplayContext, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ __pSurface = _VisualElementSurfaceImpl::CreateSurfaceUsingExistingObjectN(*pDisplayContext, (Handle)__pWebFrame, Dimension(rect.width, rect.height));
+ SysTryReturn(NID_WEB_CTRL, __pSurface, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ containerVisualElement.SetSurface(__pSurface);
+#endif
+
+ return E_SUCCESS;
+}
+
+
+result
+_EflWebkit::SetWebConfiguration(void) const
+{
+ result r = E_SUCCESS;
+
+ Ewk_Context* pContext = ewk_view_context_get(__pWebFrame);
+ SysAssertf(pContext, "Failed to request.");
+
+ Ewk_Settings* pSettings = ewk_view_settings_get(__pWebFrame);
+ SysAssertf(pSettings, "Failed to get webkit instance.");
+
+ ewk_context_cache_model_set(pContext, EWK_CACHE_MODEL_PRIMARY_WEBBROWSER);
+
+ ewk_settings_text_selection_enabled_set(pSettings, EINA_FALSE);
+ ewk_settings_uses_keypad_without_user_action_set(pSettings, EINA_FALSE);
+
+ ewk_context_additional_plugin_path_set(pContext, PLUGIN_DIRECTORY_PATH);
+
+ String certPath(_CertService::GetCertificateCrtFilePath());
+ std::unique_ptr<char[]> pCertPath(_StringConverter::CopyToCharArrayN(certPath));
+ SysTryReturn(NID_WEB_CTRL, pCertPath.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ ewk_context_certificate_file_set(pContext, pCertPath.get());
+
+ String iconPath(App::App::GetInstance()->GetAppRootPath() + ICON_DB_DIRECTORY_PATH + ICON_DB_FILE_NAME);
+ std::unique_ptr<char[]> pIconPath(_StringConverter::CopyToCharArrayN(iconPath));
+ SysTryReturn(NID_WEB_CTRL, pIconPath.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ ewk_context_icon_database_path_set(pContext, pIconPath.get());
+
+ InitializeCustomHeader();
+
+ return E_SUCCESS;
+}
+
+
+result
+_EflWebkit::SetProxyAddress(char* pProxy) const
+{
+ Ewk_Context* pContext = ewk_view_context_get(__pWebFrame);
+ SysAssertf(pContext, "Failed to get context.");
+
+ if (!pProxy || !strlen(pProxy))
+ {
+ ewk_context_proxy_uri_set(pContext, null);
+ }
+ else
+ {
+ ewk_context_proxy_uri_set(pContext, pProxy);
+ }
+
+ SysLog(NID_WEB_CTRL, "The current value of proxy is %s", pProxy);
+
+ return E_SUCCESS;
+}
+
+
+void
+_EflWebkit::InitializeCustomHeader(void) const
+{
+ char pAcceptLang[6] = {0, };
+ char* pLangSet = vconf_get_str(VCONFKEY_LANGSET);
+ const char name[] = "Accept-Language";
+
+ if (pLangSet && strlen(pLangSet))
+ {
+ strncpy(pAcceptLang, pLangSet, 2);
+
+ char *pRawData = strchr(pLangSet, '_');
+ if (pRawData && strlen(pLangSet) >= 5)
+ {
+ strcat(pAcceptLang, "-");
+ strncat(pAcceptLang, pRawData + 1, 2);
+ }
+ }
+ else
+ {
+ strcat(pAcceptLang, "en");
+ }
+ free(pLangSet);
+
+ ewk_view_custom_header_add(__pWebFrame, name, pAcceptLang);
+}
+
+
+Evas_Object*
+_EflWebkit::GetWebEvasObject(void) const
+{
+ return __pWebFrame;
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_EflWebkit.h
+ * @brief The file contains the declaration of _EflWebkit class.
+ *
+ * The file contains the declaration of _EflWebkit class.
+ */
+#ifndef _FWEB_CTRL_INTERNAL_EFL_WEBKIT_H_
+#define _FWEB_CTRL_INTERNAL_EFL_WEBKIT_H_
+
+#include <Evas.h>
+#include <FBaseString.h>
+
+namespace Tizen { namespace Graphics
+{
+class Rectangle;
+}} // Tizen::Graphics
+
+namespace Tizen { namespace Ui
+{
+class _Control;
+}} // Tizen::Ui
+
+namespace Tizen { namespace Ui { namespace Animations
+{
+class VisualElement;
+class VisualElementSurface;
+}}} // Tizen::Ui::Animations
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+class _EflWebkit
+ : public Tizen::Base::Object
+{
+public:
+ _EflWebkit(void);
+
+ virtual ~_EflWebkit(void);
+
+ result Construct(const Tizen::Graphics::Rectangle& rect, Tizen::Ui::Animations::VisualElement& containerVisualElement, Tizen::Ui::_Control* pControl);
+
+ Evas_Object* GetWebEvasObject(void) const;
+
+ result SetProxyAddress(char* pProxy) const;
+
+// result GetPixelBufferFromEvasObject(const Evas_Object* source, Tizen::Graphics::BufferInfo& bufferInfo);
+
+private:
+ _EflWebkit(const _EflWebkit&);
+
+ result SetWebConfiguration(void) const;
+
+ void InitializeCustomHeader(void) const;
+
+ _EflWebkit& operator =(const _EflWebkit&);
+
+private:
+ Evas_Object* __pWebFrame;
+ Tizen::Ui::Animations::VisualElement* __pContainerVisualElement;
+ Tizen::Ui::Animations::VisualElementSurface* __pSurface;
+}; // _EflWebkit
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_EFL_WEBKIT_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_FormDataWindow.cpp
+ * @brief The file contains the definition of _FormDataWindow class.
+ */
+#include <ewk_view.h>
+#include <unique_ptr.h>
+#include <FBaseSysLog.h>
+#include <FSysVibrator.h>
+#include <FUiCtrlCustomItem.h>
+#include <FUiCtrlListView.h>
+#include <FUiVerticalBoxLayout.h>
+#include <FBase_StringConverter.h>
+#include <FUi_ResourceManager.h>
+#include "FWebCtrl_FormDataWindow.h"
+#include "FWebCtrl_WebImpl.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Base::Utility;
+using namespace Tizen::Graphics;
+using namespace Tizen::System;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+_FormDataWindow::_FormDataWindow(void)
+ : __pListView(null)
+ , __pWebView(null)
+ , __pWebImpl(null)
+ , __listItemHeight(0)
+{
+}
+
+
+_FormDataWindow::~_FormDataWindow(void)
+{
+ __listElementArray.RemoveAll(true);
+}
+
+
+result
+_FormDataWindow::Construct(const Rectangle& rect, _WebImpl* pImpl, Evas_Object* pWebView)
+{
+ VerticalBoxLayout layout;
+
+ result r = layout.Construct(VERTICAL_DIRECTION_DOWNWARD);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ GET_COLOR_CONFIG(LIST::ELEMENT_TEXT_NORMAL, __normalColor);
+ GET_COLOR_CONFIG(LIST::ELEMENT_TEXT_PRESSED, __pressedColor);
+ GET_COLOR_CONFIG(LIST::ELEMENT_TEXT_HIGHLIGHTED, __highlightedColor);
+
+ __listItemHeight = rect.height;
+ Rectangle windowRect(rect);
+
+ r = Window::Construct(layout, windowRect, true, true);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Error Propogating.", GetErrorMessage(r));
+ SetBounds(rect);
+
+ Window::SetOwner(&pImpl->GetPublic());
+
+ std::unique_ptr<ListView> pListView(new (std::nothrow) ListView());
+ SysTryReturnResult(NID_WEB_CTRL, pListView.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ r = pListView->Construct(Rectangle(0, 0, windowRect.width, windowRect.height), true, SCROLL_STYLE_FADE_OUT);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = __listElementArray.Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pListView->SetItemProvider(*this);
+ pListView->AddListViewItemEventListener(*this);
+ pListView->SetTextOfEmptyList(L"");
+
+ r = AddControl(*pListView);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pListView = pListView.release();
+
+ std::unique_ptr< VerticalBoxLayout > pLayout(dynamic_cast< VerticalBoxLayout* >(GetLayoutN()));
+ SysTryReturn(NID_WEB_CTRL, pLayout.get(), r = GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ pLayout->SetHorizontalAlignment(*__pListView, LAYOUT_HORIZONTAL_ALIGN_CENTER);
+ pLayout->SetHorizontalFitPolicy(*__pListView, FIT_POLICY_PARENT);
+
+ __pWebImpl = pImpl;
+ __pWebView = pWebView;
+
+ return E_SUCCESS;
+}
+
+
+//IListViewItemProvider
+ListItemBase*
+_FormDataWindow::CreateItem(int index, int itemWidth)
+{
+ String* pListElement = static_cast< String* >(__listElementArray.GetAt(index));
+ SysTryReturn(NID_WEB_CTRL, pListElement, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ std::unique_ptr<CustomItem> pItem(new (std::nothrow) CustomItem());
+ SysTryReturn(NID_WEB_CTRL, pItem.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.",GetErrorMessage(E_OUT_OF_MEMORY));
+
+ result r = pItem->Construct(Dimension(itemWidth, __listItemHeight), LIST_ANNEX_STYLE_NORMAL);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ int listItemHeight = 0;
+ int listItemTextSize = 0;
+ int listItemLeftMargin = 0;
+
+ GET_SHAPE_CONFIG(LIST::LIST_DEFAULT_ITEM_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, listItemHeight);
+ GET_SHAPE_CONFIG(LIST::LIST_ITEM_TEXT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, listItemTextSize);
+ GET_SHAPE_CONFIG(LIST::LIST_ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, listItemLeftMargin);
+
+ if (__listItemHeight > listItemHeight)
+ {
+ __listItemHeight = listItemHeight;
+ }
+
+ if (__listItemHeight*2/3 < listItemTextSize)
+ {
+ listItemTextSize = __listItemHeight*2/3;
+ }
+
+ Rectangle itemRect = Rectangle(listItemLeftMargin, 0, itemWidth, __listItemHeight);
+ r = pItem->AddElement(itemRect, ID_FORMAT_STRING, *pListElement, listItemTextSize, __normalColor, __pressedColor, __highlightedColor);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return pItem.release();
+}
+
+
+bool
+_FormDataWindow::DeleteItem(int index, ListItemBase* pItem, int itemWidth)
+{
+ delete pItem;
+
+ return true;
+}
+
+
+int
+_FormDataWindow::GetItemCount(void)
+{
+ return __listElementArray.GetCount();
+}
+
+
+// IListViewItemEventListener
+void
+_FormDataWindow::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId, ListContextItemStatus state)
+{
+}
+
+
+void
+_FormDataWindow::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status)
+{
+ std::unique_ptr< char[] > pInputValue;
+
+ String* pListElement = static_cast< String* >(__listElementArray.GetAt(index));
+ SysTryCatch(NID_WEB_CTRL, pListElement, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ pInputValue = std::unique_ptr< char[] >(_StringConverter::CopyToCharArrayN(*pListElement));
+ SysTryCatch(NID_WEB_CTRL, pInputValue.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ ewk_view_focused_input_element_value_set(__pWebView, pInputValue.get());
+
+CATCH:
+ SetShowState(false);
+ __pWebImpl->HideFormDataWindow(false);
+}
+
+
+void
+_FormDataWindow::OnListViewItemSwept(ListView& listView, int index, SweepDirection direction)
+{
+}
+
+
+result
+_FormDataWindow::UpdateList(Eina_List* pDataList, const Rectangle& rect)
+{
+ SysTryReturnResult(NID_WEB_CTRL, pDataList, E_INVALID_ARG, "Invalid argument(s) is used. data list pointer should not be null.");
+
+ __listElementArray.RemoveAll(true);
+
+ __listItemHeight = rect.height;
+
+ int itemCount = eina_list_count(pDataList);
+
+ for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
+ {
+ char* pItemText = static_cast<char*>(eina_list_nth(pDataList, itemIndex));
+
+ std::unique_ptr<String> pListElement(new (std::nothrow) String(pItemText));
+ SysTryReturnResult(NID_WEB_CTRL, pListElement.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ result r = __listElementArray.Add(*pListElement);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pListElement.release();
+ }
+
+ __pListView->UpdateList();
+
+ int windowHeight = itemCount*__listItemHeight;
+
+ Rectangle webRect = __pWebImpl->GetBounds();//is it better to take application rect
+ int bottomLimit = webRect.y + webRect.height;
+ int topLimit = webRect.y;
+ Rectangle windowRect(rect);
+
+ if (__pWebImpl->IsKeypadVisible())
+ {
+ Rectangle keyRect = __pWebImpl->GetPreviousKeypadBounds();
+ bottomLimit = keyRect.y;
+ }
+
+ int windowBottom = rect.y + windowHeight;
+
+ while (true)
+ {
+ if (windowBottom > bottomLimit)
+ {
+ int newWindowTop = rect.y - rect.height - windowHeight;
+ if (newWindowTop < topLimit)//check in reverse direction
+ {
+ if (--itemCount)
+ {
+ windowHeight = itemCount*__listItemHeight;
+ windowBottom = rect.y + windowHeight;
+ }
+ else
+ {
+ break;
+ }
+ }
+ else
+ {//reverse direction is good
+ windowRect.y = rect.y - rect.height - windowHeight;
+ break;
+ }
+ }
+ else
+ {
+ //rect is good
+ break;
+ }
+ }
+
+ windowRect.height = windowHeight;
+ __pListView->SetBounds(Rectangle(0, 0, windowRect.width, windowRect.height));
+ SetBounds(windowRect);
+
+ return E_SUCCESS;
+}
+
+
+result
+_FormDataWindow::LaunchFormDataWindow(void)
+{
+ result r = SetFocusable(false);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = SetShowState(true);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = Show();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return E_SUCCESS;
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_FormDataWindow.h
+ * @brief The file contains the declaration of _FormDataWindow class.
+ *
+ * The file contains the declaration of _FormDataWindow class.
+ */
+#ifndef _FWEB_CTRL_INTERNAL_FORMDATA_WINDOW_H_
+#define _FWEB_CTRL_INTERNAL_FORMDATA_WINDOW_H_
+
+#include <FBaseColIList.h>
+#include <FBaseString.h>
+#include <FUiCtrlIListViewItemEventListener.h>
+#include <FUiCtrlIListViewItemProvider.h>
+#include <FUiWindow.h>
+
+
+namespace Tizen { namespace Graphics
+{
+class Rectangle;
+}} // Tizen::Graphics
+
+namespace Tizen { namespace Ui
+{
+class IActionEventListener;
+}} // Tizen::Ui
+
+namespace Tizen { namespace Ui { namespace Controls
+{
+class ListItemBase;
+class ListView;
+}}} // Tizen::Ui::Controls
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+class _WebImpl;
+
+class _FormDataWindow
+ : public Tizen::Ui::Window
+ , public Tizen::Ui::Controls::IListViewItemEventListener
+ , public Tizen::Ui::Controls::IListViewItemProvider
+{
+public:
+ /**
+ * Constructor
+ */
+ _FormDataWindow(void);
+
+ /**
+ * Destructor
+ */
+ virtual ~_FormDataWindow(void);
+
+ result Construct(const Tizen::Graphics::Rectangle& rect, _WebImpl* pImpl, Evas_Object* pWebView);
+
+ //IListViewItemProvider
+ virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth);
+ virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth);
+ virtual int GetItemCount(void);
+
+ // IListViewItemEventListener
+ virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state);
+ virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status);
+ virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction);
+
+ result UpdateList(Eina_List* pDataList, const Tizen::Graphics::Rectangle& rect);
+ result LaunchFormDataWindow(void);
+
+private:
+ /**
+ * This is the copy constructor for this class.
+ */
+ _FormDataWindow(const _FormDataWindow& source);
+
+ /**
+ * This is the assignment operator for this class.
+ */
+ _FormDataWindow& operator =(const _FormDataWindow& source);
+
+public:
+ static const int ID_FORMAT_STRING = 300;
+
+private:
+ Tizen::Base::Collection::ArrayList __listElementArray;
+ Tizen::Ui::Controls::ListView* __pListView;
+ Evas_Object* __pWebView;
+ _WebImpl* __pWebImpl;
+ int __listItemHeight;
+ Tizen::Graphics::Color __normalColor, __pressedColor, __highlightedColor;
+}; // _FormDataWindow
+
+}}} //Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_FORMDATA_WINDOW_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_GeolocationPermissionManagerImpl.cpp
+ * @brief The file contains the definition of _GeolocationPermissionManagerImp class.
+ */
+
+#include <EWebKit2.h>
+#include <unique_ptr.h>
+#include <FAppApp.h>
+#include <FBaseColIList.h>
+#include <FBaseSysLog.h>
+#include <FIoDbEnumerator.h>
+#include <FWebCtrlGeolocationPermissionManager.h>
+#include <FIo_DatabaseImpl.h>
+#include "FWebCtrl_WebManager.h"
+#include "FWebCtrl_GeolocationPermissionManagerImpl.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Io;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+_GeolocationPermissionManagerImpl::_GeolocationPermissionManagerImpl(void)
+{
+}
+
+
+_GeolocationPermissionManagerImpl::~_GeolocationPermissionManagerImpl(void)
+{
+}
+
+
+result
+_GeolocationPermissionManagerImpl::Construct(void)
+{
+ result r = E_SUCCESS;
+
+ String geolocationPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
+
+ r = __db.Construct(geolocationPath, "r+", null);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return E_SUCCESS;
+}
+
+
+IList*
+_GeolocationPermissionManagerImpl::GetOriginListN(void) const
+{
+ result r = E_SUCCESS;
+
+ String table(GEOLOCATION_TABLE_NAME);
+ std::unique_ptr<DbEnumerator> pEnum(__db.QueryN(L"Select origin From " + table));
+ SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ if (!pEnum.get())
+ {
+ return null;
+ }
+
+ std::unique_ptr<ArrayList> pList(new (std::nothrow) ArrayList());
+ SysTryReturn(NID_WEB_CTRL, pList.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pList->Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ while (pEnum->MoveNext() == E_SUCCESS)
+ {
+ std::unique_ptr<String> origin(new (std::nothrow) String());
+ SysTryReturn(NID_WEB_CTRL, origin.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ r = pEnum->GetStringAt(0, *origin.get());
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ SysLog(NID_WEB_CTRL, "The current value of origin is %ls", origin->GetPointer());
+
+ r = pList->Add(*origin.get());
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+ origin.release();
+ }
+
+ return pList.release();
+}
+
+
+bool
+_GeolocationPermissionManagerImpl::IsPermissionAllowed(const String& origin) const
+{
+ result r = E_SUCCESS;
+
+ String table(GEOLOCATION_TABLE_NAME);
+
+ std::unique_ptr<DbEnumerator> pEnum(__db.QueryN(L"Select permission From " + table + " Where origin = '" + origin + "'"));
+ SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, false, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+ SysTryReturn(NID_WEB_CTRL, pEnum.get(), false, E_DATA_NOT_FOUND, "[E_DATA_NOT_FOUND] There is no permission data.");
+
+ r = pEnum->MoveNext();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ int permission = 0;
+ r = pEnum->GetIntAt(0, permission);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return static_cast <bool>(permission);
+}
+
+
+result
+_GeolocationPermissionManagerImpl::Remove(const String& origin)
+{
+ result r = E_SUCCESS;
+
+ String table(GEOLOCATION_TABLE_NAME);
+
+ __db.BeginTransaction();
+
+ r = __db.ExecuteSql(L"Delete From " + table + " Where origin = '" + origin + "'", true);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __db.CommitTransaction();
+
+ return E_SUCCESS;
+
+CATCH:
+ __db.RollbackTransaction();
+
+ return r;
+}
+
+
+result
+_GeolocationPermissionManagerImpl::RemoveAll(void)
+{
+ result r = E_SUCCESS;
+
+ String table(GEOLOCATION_TABLE_NAME);
+
+ __db.BeginTransaction();
+
+ r = __db.ExecuteSql(L"Delete From " + table, true);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __db.CommitTransaction();
+
+ return E_SUCCESS;
+
+CATCH:
+ __db.RollbackTransaction();
+
+ return r;
+}
+
+
+_GeolocationPermissionManagerImpl*
+_GeolocationPermissionManagerImpl::GetInstance(GeolocationPermissionManager* pGeolocationPermissionManager)
+{
+ SysTryReturn(NID_WEB_CTRL, pGeolocationPermissionManager, null, E_INVALID_ARG, "[%s] Invalid argument(s) is used. pGeolocationPermissionManager instance is null" , GetErrorMessage(E_INVALID_ARG));
+ return pGeolocationPermissionManager->__pGeolocationPermissionManagerImpl;
+}
+
+
+const _GeolocationPermissionManagerImpl*
+_GeolocationPermissionManagerImpl::GetInstance(const GeolocationPermissionManager* pGeolocationPermissionManager)
+{
+ SysTryReturn(NID_WEB_CTRL, pGeolocationPermissionManager, null, E_INVALID_ARG, "[%s] Invalid argument(s) is used. pGeolocationPermissionManager instance is null" , GetErrorMessage(E_INVALID_ARG));
+ return pGeolocationPermissionManager->__pGeolocationPermissionManagerImpl;
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_GeolocationPermissionManagerImpl.h
+ * @brief The file contains the declaration of _GeolocationPermissionManagerImpl class.
+ *
+ * The file contains the declaration of _GeolocationPermissionManagerImpl class.
+ */
+#ifndef _FWEB_CTRL_INTERNAL_GEOLOCATION_PERMISSION_MANAGER_IMPL_H_
+#define _FWEB_CTRL_INTERNAL_GEOLOCATION_PERMISSION_MANAGER_IMPL_H_
+
+#include <FBaseString.h>
+
+namespace Tizen { namespace Base { namespace Collection
+{
+class IList;
+}}}
+
+namespace Tizen { namespace Io
+{
+class _DatabaseImpl;
+}}
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+class GeolocationPermissionManager;
+
+class _GeolocationPermissionManagerImpl
+ : public Tizen::Base::Object
+{
+public:
+ _GeolocationPermissionManagerImpl(void);
+
+ virtual ~_GeolocationPermissionManagerImpl(void);
+
+ result Construct(void);
+
+ Tizen::Base::Collection::IList* GetOriginListN(void) const;
+
+ bool IsPermissionAllowed(const Tizen::Base::String& origin) const;
+
+ result Remove(const Tizen::Base::String& origin);
+
+ result RemoveAll(void);
+
+ static _GeolocationPermissionManagerImpl* GetInstance(GeolocationPermissionManager* pGeolocationPermissionManager);
+
+ static const _GeolocationPermissionManagerImpl* GetInstance(const GeolocationPermissionManager* pGeolocationPermissionManager);
+
+private:
+ _GeolocationPermissionManagerImpl(const _GeolocationPermissionManagerImpl& rhs);
+
+ _GeolocationPermissionManagerImpl& operator=(const _GeolocationPermissionManagerImpl& rhs);
+
+private:
+ mutable Tizen::Io::_DatabaseImpl __db;
+};
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_GEOLOCATION_PERMISSION_MANAGER_IMPL_H_
\ No newline at end of file
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_GestureState.cpp
+ * @brief The file contains the definition of _Web class.
+ *
+ * The file contains the definition of _Web class.
+ */
+#include <Ecore.h>
+#include <EWebKit2.h>
+#include <FBaseRtTimer.h>
+#include <FBaseSysLog.h>
+#include <FGrpPoint.h>
+#include <FUi_CoordinateSystemUtils.h>
+#include <FUi_Control.h>
+#include <FUi_TouchManager.h>
+#include <FUi_UiTouchEvent.h>
+#include "FWebCtrl_GestureState.h"
+#include "FWebCtrl_Web.h"
+#include "FWebCtrl_WebImpl.h"
+#include "FWebCtrl_WebSettingImpl.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Runtime;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui;
+using namespace Tizen::Web::Controls;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+static const int FLICK_SCROLL_WEIGHT = 3000;
+static const double PINCH_ZOOM_FINGER_FACTOR = 1.0;
+static const double PINCH_ZOOM_DISTANCE_TOLERANCE = 40.0;
+
+
+void
+SetGestureEvent(Ewk_Event_Gesture& gestureEvent, Ewk_Gesture_Type gestureType, const Point& absPoint, const Point& velocity, double scale, int count)
+{
+ gestureEvent.type = gestureType;
+ gestureEvent.position.x = absPoint.x;
+ gestureEvent.position.y = absPoint.y;
+ gestureEvent.velocity.x = velocity.x;
+ gestureEvent.velocity.y = velocity.y;
+ gestureEvent.scale = scale;
+ gestureEvent.count = count;
+ gestureEvent.timestamp = ecore_time_get() * 1000;
+}
+
+
+_TapGestureState::_TapGestureState(_Web* pWeb)
+ : __pWebCore(pWeb)
+ , __longPressed(false)
+ , __doubleTapped(false)
+ , __pressed(false)
+ , __released(false)
+ , __pressedPosition(0.0f, 0.0f)
+{
+ __timer.Construct(*this);
+}
+
+
+_TapGestureState::~_TapGestureState(void)
+{
+}
+
+
+bool
+_TapGestureState::OnLongPressGestureDetected(_TouchLongPressGestureDetector& gesture)
+{
+ if (__pressed == false)
+ {
+ LongPressTouch();
+ }
+
+ __longPressed = true;
+
+ return true;
+}
+
+
+bool
+_TapGestureState::OnTapGestureDetected(_TouchTapGestureDetector& gesture)
+{
+ __doubleTapped = true;
+
+ return true;
+}
+
+
+void
+_TapGestureState::PressTouch(void)
+{
+ Ewk_Event_Gesture gestureEvent;
+ Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(__pressedPosition)));
+
+ SetGestureEvent(gestureEvent, EWK_GESTURE_TAP, absPoint, Point(0, 0), 0.0, 1);
+
+ const Ewk_View_Smart_Data* pSmartData = static_cast< Ewk_View_Smart_Data* >(evas_object_smart_data_get(__pWebCore->GetWebNativeNode()));
+ SysAssertf(pSmartData, "Failed to get webkit smart data.");
+ pSmartData->api->gesture_start(const_cast< Ewk_View_Smart_Data* >(pSmartData), &gestureEvent);
+}
+
+
+void
+_TapGestureState::ReleaseTouch(void)
+{
+ __released = false;
+
+ if (!__pWebCore->Contains(__pressedPosition))
+ {
+ _TouchInfo dummyTouchInfo;
+ OnTouchCanceled(*__pWebCore, dummyTouchInfo);
+ return;
+ }
+
+ Evas_Object* pView = __pWebCore->GetWebNativeNode();
+ Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(__pressedPosition)));
+
+ if (__longPressed)
+ {
+ Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pView, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
+ SysTryReturnVoidResult(NID_WEB_CTRL, pEwkHitTest, E_SYSTEM, "Failed to get hit test.");
+
+ String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
+
+ Eina_Hash* pAttrHash = ewk_hit_test_attribute_hash_get(pEwkHitTest);
+ char* pValue = reinterpret_cast< char* >(eina_hash_find(pAttrHash, "contenteditable"));
+ if (tagName.Equals(L"INPUT", false) || tagName.Equals(L"TEXTAREA", false) || pValue)
+ {
+ Eina_Rectangle leftHandle;
+ Eina_Rectangle rightHandle;
+
+ ewk_view_text_selection_range_get(pView, &leftHandle, &rightHandle);
+ if (((rightHandle.x + rightHandle.w) == 0) && ((rightHandle.y + rightHandle.h) == 0))
+ {
+ Ewk_Event_Gesture gestureEvent;
+
+ SetGestureEvent(gestureEvent, EWK_GESTURE_LONG_PRESS, absPoint, Point(0, 0), 0.0, 1);
+
+ const Ewk_View_Smart_Data* pSmartData = reinterpret_cast< Ewk_View_Smart_Data* >(evas_object_smart_data_get(pView));
+ SysAssertf(pSmartData, "Failed to get webkit smart data.");
+ pSmartData->api->gesture_end(const_cast< Ewk_View_Smart_Data* >(pSmartData), &gestureEvent);
+ }
+ }
+ }
+ else
+ {
+ Ewk_Event_Gesture gestureEvent;
+ int touchCount = 1;
+ if (__doubleTapped)
+ {
+ touchCount = 2;
+ }
+
+ SetGestureEvent(gestureEvent, EWK_GESTURE_TAP, absPoint, Point(0, 0), 0.0, touchCount);
+
+ const Ewk_View_Smart_Data* pSmartData = reinterpret_cast< Ewk_View_Smart_Data* >(evas_object_smart_data_get(pView));
+ SysAssertf(pSmartData, "Failed to get webkit smart data.");
+ pSmartData->api->gesture_end(const_cast< Ewk_View_Smart_Data* >(pSmartData), &gestureEvent);
+ }
+}
+
+
+void
+_TapGestureState::LongPressTouch(void)
+{
+ //To disable focus ring
+ Ewk_Event_Gesture gestureEvent;
+
+ SetGestureEvent(gestureEvent, EWK_GESTURE_LONG_PRESS, Point(0, 0), Point(0, 0), 0.0, 0);
+
+ const Ewk_View_Smart_Data* pSmartData = reinterpret_cast< Ewk_View_Smart_Data* >(evas_object_smart_data_get(__pWebCore->GetWebNativeNode()));
+ SysAssertf(pSmartData, "Failed to get webkit smart data.");
+ pSmartData->api->gesture_move(const_cast< Ewk_View_Smart_Data* >(pSmartData), &gestureEvent);
+}
+
+
+bool
+_TapGestureState::OnTouchPressed(const _Control& source, const _TouchInfo& touchInfo)
+{
+ __pressedPosition = touchInfo.GetCurrentPosition();
+
+ if (__pressed == false)
+ {
+ __timer.Start(400);
+
+ __longPressed = false;
+ __doubleTapped = false;
+ __pressed = true;
+
+ PressTouch();
+ }
+ else
+ {
+ __timer.Cancel();
+
+ __pressed = false;
+ }
+
+ return true;
+}
+
+
+bool
+_TapGestureState::OnTouchMoved(const _Control& source, const _TouchInfo& touchInfo)
+{
+ Ewk_Event_Gesture gestureEvent;
+ Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(touchInfo.GetCurrentPosition())));
+
+ SetGestureEvent(gestureEvent, EWK_GESTURE_PAN, absPoint, Point(0, 0), 0.0, 0);
+
+ const Ewk_View_Smart_Data* pSmartData = reinterpret_cast< Ewk_View_Smart_Data* >(evas_object_smart_data_get(__pWebCore->GetWebNativeNode()));
+ SysAssertf(pSmartData, "Failed to get webkit smart data.");
+ pSmartData->api->gesture_start(const_cast< Ewk_View_Smart_Data* >(pSmartData), &gestureEvent);
+
+ __pWebCore->ChangeGesture(WEB_GESTURE_TYPE_PANNING);
+
+ if (!_WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsScrollEnabled())
+ {
+ return false;
+ }
+
+ return true;
+}
+
+
+bool
+_TapGestureState::OnTouchReleased(const _Control& source, const _TouchInfo& touchInfo)
+{
+ __released = true;
+
+ if (__pressed == true)
+ {
+ return true;
+ }
+
+ ReleaseTouch();
+
+ return true;
+}
+
+
+bool
+_TapGestureState::OnTouchCanceled(const _Control& source, const _TouchInfo& touchInfo)
+{
+ Ewk_Event_Gesture gestureEvent;
+
+ SetGestureEvent(gestureEvent, EWK_GESTURE_LONG_PRESS, Point(0, 0), Point(0, 0), 0.0, 0);
+
+ const Ewk_View_Smart_Data* pSmartData = reinterpret_cast< Ewk_View_Smart_Data* >(evas_object_smart_data_get(__pWebCore->GetWebNativeNode()));
+ SysAssertf(pSmartData, "Failed to get webkit smart data.");
+ pSmartData->api->gesture_move(const_cast< Ewk_View_Smart_Data* >(pSmartData), &gestureEvent);
+
+ return true;
+}
+
+
+void
+_TapGestureState::OnTimerExpired(Timer& timer)
+{
+ if (__longPressed == false)
+ {
+ __pressed = false;
+
+ if (__released == true)
+ {
+ ReleaseTouch();
+ }
+ }
+}
+
+
+_PanningGestureState::_PanningGestureState(_Web* pWeb)
+ : __pWebCore(pWeb)
+{
+}
+
+
+_PanningGestureState::~_PanningGestureState(void)
+{
+}
+
+
+bool
+_PanningGestureState::OnTouchPressed(const _Control& source, const _TouchInfo& touchInfo)
+{
+ return true;
+}
+
+
+bool
+_PanningGestureState::OnTouchMoved(const _Control& source, const _TouchInfo& touchInfo)
+{
+ if (!_WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsScrollEnabled())
+ {
+ return false;
+ }
+
+ Ewk_Event_Gesture gestureEvent;
+ Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(touchInfo.GetCurrentPosition())));
+
+ SetGestureEvent(gestureEvent, EWK_GESTURE_PAN, absPoint, Point(0, 0), 0.0, 0);
+
+ const Ewk_View_Smart_Data* pSmartData = reinterpret_cast< Ewk_View_Smart_Data* >(evas_object_smart_data_get(__pWebCore->GetWebNativeNode()));
+ SysAssertf(pSmartData, "Failed to get webkit smart data.");
+ pSmartData->api->gesture_move(const_cast< Ewk_View_Smart_Data* >(pSmartData), &gestureEvent);
+
+ return true;
+}
+
+
+bool
+_PanningGestureState::OnTouchReleased(const _Control& source, const _TouchInfo& touchInfo)
+{
+ Ewk_Event_Gesture gestureEvent;
+ Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(touchInfo.GetCurrentPosition())));
+
+ SetGestureEvent(gestureEvent, EWK_GESTURE_PAN, absPoint, Point(0, 0), 0.0, 0);
+
+ const Ewk_View_Smart_Data* pSmartData = reinterpret_cast< Ewk_View_Smart_Data* >(evas_object_smart_data_get(__pWebCore->GetWebNativeNode()));
+ SysAssertf(pSmartData, "Failed to get webkit smart data.");
+ pSmartData->api->gesture_end(const_cast< Ewk_View_Smart_Data* >(pSmartData), &gestureEvent);
+
+ __pWebCore->ChangeGesture(WEB_GESTURE_TYPE_TAP);
+
+ return true;
+}
+
+
+bool
+_PanningGestureState::OnTouchCanceled(const _Control& source, const _TouchInfo& touchInfo)
+{
+ return OnTouchReleased(source, touchInfo);
+}
+
+
+_FlickGestureState::_FlickGestureState(_Web* pWeb)
+ : __pWebCore(pWeb)
+ , __velocity(0, 0)
+{
+}
+
+
+_FlickGestureState::~_FlickGestureState(void)
+{
+}
+
+
+bool
+_FlickGestureState::OnFlickGestureDetected(_TouchFlickGestureDetector& gesture)
+{
+ __pWebCore->ChangeGesture(WEB_GESTURE_TYPE_FLICK);
+
+ if (_WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsScrollEnabled())
+ {
+ int duration = gesture.GetDuration();
+ gesture.GetDistance(__velocity.x, __velocity.y);
+
+ __velocity.x = (__velocity.x * FLICK_SCROLL_WEIGHT) / duration;
+ __velocity.y = (__velocity.y * FLICK_SCROLL_WEIGHT) / duration;
+ }
+
+ return true;
+}
+
+
+bool
+_FlickGestureState::OnTouchPressed(const _Control& source, const _TouchInfo& touchInfo)
+{
+ return true;
+}
+
+
+bool
+_FlickGestureState::OnTouchMoved(const _Control& source, const _TouchInfo& touchInfo)
+{
+ return true;
+}
+
+
+bool
+_FlickGestureState::OnTouchReleased(const _Control& source, const _TouchInfo& touchInfo)
+{
+ Ewk_Event_Gesture gestureEvent;
+ Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(touchInfo.GetCurrentPosition())));
+
+ SetGestureEvent(gestureEvent, EWK_GESTURE_PAN, absPoint, Point(0, 0), 0.0, 0);
+
+ const Ewk_View_Smart_Data* pSmartData = reinterpret_cast< Ewk_View_Smart_Data* >(evas_object_smart_data_get(__pWebCore->GetWebNativeNode()));
+ SysAssertf(pSmartData, "Failed to get webkit smart data.");
+ pSmartData->api->gesture_end(const_cast< Ewk_View_Smart_Data* >(pSmartData), &gestureEvent);
+
+ if (_WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsScrollEnabled())
+ {
+ SetGestureEvent(gestureEvent, EWK_GESTURE_FLICK, absPoint, __velocity, 0.0, 0);
+
+ pSmartData->api->gesture_start(const_cast< Ewk_View_Smart_Data* >(pSmartData), &gestureEvent);
+ }
+
+ __pWebCore->ChangeGesture(WEB_GESTURE_TYPE_TAP);
+
+ return true;
+}
+
+
+bool
+_FlickGestureState::OnTouchCanceled(const _Control& source, const _TouchInfo& touchInfo)
+{
+ return OnTouchPressed(source, touchInfo);
+}
+
+
+_PinchGestureState::_PinchGestureState(_Web* pWeb)
+ : __pWebCore(pWeb)
+ , __standardScale(0.0)
+{
+}
+
+
+_PinchGestureState::~_PinchGestureState(void)
+{
+}
+
+
+bool
+_PinchGestureState::OnPinchGestureStarted(_TouchPinchGestureDetector& gesture)
+{
+ __pWebCore->ChangeGesture(WEB_GESTURE_TYPE_PINCH);
+
+ Ewk_Event_Gesture gestureEvent;
+ Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(gesture.GetCenterPointF())));
+ __standardScale = static_cast< double >(gesture.GetScaleF());
+
+ SetGestureEvent(gestureEvent, EWK_GESTURE_PINCH, absPoint, Point(0, 0), 1.0, 0);
+
+ const Ewk_View_Smart_Data* pSmartData = reinterpret_cast< Ewk_View_Smart_Data* >(evas_object_smart_data_get(__pWebCore->GetWebNativeNode()));
+ SysAssertf(pSmartData, "Failed to get webkit smart data.");
+ pSmartData->api->gesture_start(const_cast< Ewk_View_Smart_Data* >(pSmartData), &gestureEvent);
+
+ return true;
+}
+
+
+bool
+_PinchGestureState::OnPinchGestureChanged(_TouchPinchGestureDetector& gesture)
+{
+ Ewk_Event_Gesture gestureEvent;
+ Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(gesture.GetCenterPointF())));
+ double relScale = static_cast< double >(gesture.GetScaleF()) /__standardScale;
+
+ SetGestureEvent(gestureEvent, EWK_GESTURE_PINCH, absPoint, Point(0, 0), relScale, 0);
+
+ const Ewk_View_Smart_Data* pSmartData = reinterpret_cast< Ewk_View_Smart_Data* >(evas_object_smart_data_get(__pWebCore->GetWebNativeNode()));
+ SysAssertf(pSmartData, "Failed to get webkit smart data.");
+ pSmartData->api->gesture_move(const_cast< Ewk_View_Smart_Data* >(pSmartData), &gestureEvent);
+
+ return true;
+}
+
+
+bool
+_PinchGestureState::OnPinchGestureFinished(_TouchPinchGestureDetector& gesture)
+{
+ Ewk_Event_Gesture gestureEvent;
+
+ SetGestureEvent(gestureEvent, EWK_GESTURE_PINCH, Point(0, 0), Point(0, 0), 0.0, 0);
+
+ const Ewk_View_Smart_Data* pSmartData = reinterpret_cast< Ewk_View_Smart_Data* >(evas_object_smart_data_get(__pWebCore->GetWebNativeNode()));
+ SysAssertf(pSmartData, "Failed to get webkit smart data.");
+ pSmartData->api->gesture_end(const_cast<Ewk_View_Smart_Data*>(pSmartData), &gestureEvent);
+
+ return true;
+}
+
+
+bool
+_PinchGestureState::OnTouchPressed(const _Control& source, const _TouchInfo& touchInfo)
+{
+ return true;
+}
+
+
+bool
+_PinchGestureState::OnTouchMoved(const _Control& source, const _TouchInfo& touchInfo)
+{
+ return true;
+}
+
+
+bool
+_PinchGestureState::OnTouchReleased(const _Control& source, const _TouchInfo& touchInfo)
+{
+ _TouchManager* pTouchManager = _TouchManager::GetInstance();
+ SysAssertf(pTouchManager, "Failed to get touch manager.");
+ if(pTouchManager->GetPointCount() == 0)
+ {
+ __pWebCore->ChangeGesture(WEB_GESTURE_TYPE_TAP);
+ }
+
+ return true;
+}
+
+
+bool
+_PinchGestureState::OnTouchCanceled(const _Control& source, const _TouchInfo& touchInfo)
+{
+ Ewk_Event_Gesture gestureEvent;
+
+ SetGestureEvent(gestureEvent, EWK_GESTURE_PINCH, Point(0, 0), Point(0, 0), 0.0, 0);
+
+ const Ewk_View_Smart_Data* pSmartData = reinterpret_cast< Ewk_View_Smart_Data* >(evas_object_smart_data_get(__pWebCore->GetWebNativeNode()));
+ SysAssertf(pSmartData, "Failed to get webkit smart data.");
+ pSmartData->api->gesture_end(const_cast< Ewk_View_Smart_Data* >(pSmartData), &gestureEvent);
+
+ __pWebCore->ChangeGesture(WEB_GESTURE_TYPE_TAP);
+
+ return true;
+}
+
+
+}}}
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_GestureState.h
+ * @brief The file contains the declaration of _TapGestureState, _PanningGestureState, _FlickGestureState and _PinchGestureState class.
+ *
+ * The file contains the declaration of _TapGestureState, _PanningGestureState, _FlickGestureState and _PinchGestureState class.
+ */
+#ifndef _FWEB_CTRL_INTERNAL_GESTURE_STATE_H_
+#define _FWEB_CTRL_INTERNAL_GESTURE_STATE_H_
+
+#include <FBaseRtITimerEventListener.h>
+#include <FUi_ITouchEventListener.h>
+
+namespace Tizen {namespace Base { namespace Runtime
+{
+class Timer;
+}}} // Tizen::Base::Runtime
+
+namespace Tizen { namespace Graphics
+{
+class Point;
+}} // Tizen::Graphics
+
+namespace Tizen { namespace Ui
+{
+class _Control;
+class _TouchInfo;
+class _TouchFlickGestureDetector;
+class _TouchLongPressGestureDetector;
+class _TouchPinchGestureDetector;
+class _TouchTapGestureDetector;
+}} // Tizen::Ui
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+class _Web;
+
+class _TapGestureState
+ : public Tizen::Base::Runtime::ITimerEventListener
+ , public Tizen::Ui::_ITouchEventListener
+{
+public:
+ _TapGestureState(_Web* pWeb);
+
+ virtual ~_TapGestureState(void);
+
+ bool OnLongPressGestureDetected(Tizen::Ui::_TouchLongPressGestureDetector& gesture);
+
+ bool OnTapGestureDetected(Tizen::Ui::_TouchTapGestureDetector& gesture);
+
+ void PressTouch(void);
+
+ void ReleaseTouch(void);
+
+ void LongPressTouch(void);
+
+ virtual bool OnTouchPressed(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
+
+ virtual bool OnTouchReleased(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
+
+ virtual bool OnTouchMoved(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
+
+ virtual bool OnTouchCanceled(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
+
+ virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
+
+private:
+ _Web* __pWebCore;
+
+ bool __longPressed;
+
+ bool __doubleTapped;
+
+ bool __pressed;
+
+ bool __released;
+
+ Tizen::Graphics::FloatPoint __pressedPosition;
+
+ Tizen::Base::Runtime::Timer __timer;
+};
+
+
+class _PanningGestureState
+ : public Tizen::Ui::_ITouchEventListener
+{
+public:
+ _PanningGestureState(_Web* pWeb);
+
+ virtual ~_PanningGestureState(void);
+
+ virtual bool OnTouchPressed(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
+
+ virtual bool OnTouchReleased(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
+
+ virtual bool OnTouchMoved(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
+
+ virtual bool OnTouchCanceled(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
+
+private:
+ _Web* __pWebCore;
+};
+
+class _FlickGestureState
+ : public Tizen::Ui::_ITouchEventListener
+{
+public:
+ _FlickGestureState(_Web* pWeb);
+
+ virtual ~_FlickGestureState(void);
+
+ bool OnFlickGestureDetected(Tizen::Ui::_TouchFlickGestureDetector& gesture);
+
+ virtual bool OnTouchPressed(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
+
+ virtual bool OnTouchReleased(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
+
+ virtual bool OnTouchMoved(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
+
+ virtual bool OnTouchCanceled(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
+
+private:
+ _Web* __pWebCore;
+
+ Tizen::Graphics::Point __velocity;
+};
+
+class _PinchGestureState
+ : public Tizen::Ui::_ITouchEventListener
+{
+public:
+ _PinchGestureState(_Web* pWeb);
+
+ virtual ~_PinchGestureState(void);
+
+ bool OnPinchGestureStarted(Tizen::Ui::_TouchPinchGestureDetector& gesture);
+
+ bool OnPinchGestureChanged(Tizen::Ui::_TouchPinchGestureDetector& gesture);
+
+ bool OnPinchGestureFinished(Tizen::Ui::_TouchPinchGestureDetector& gesture);
+
+ virtual bool OnTouchPressed(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
+
+ virtual bool OnTouchReleased(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
+
+ virtual bool OnTouchMoved(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
+
+ virtual bool OnTouchCanceled(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
+
+private:
+ _Web* __pWebCore;
+
+ double __standardScale;
+};
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_GESTURE_STATE_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_HitElementResultImpl.cpp
+ * @brief The file contains the definition of _HitElementResultImpl class.
+ *
+ * The file contains the definition of _HitElementResultImpl class.
+ */
+#include <FGrpBitmap.h>
+#include <FWebCtrlHitElementResult.h>
+#include <FBaseSysLog.h>
+#include "FWebCtrl_HitElementResultImpl.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Graphics;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+_HitElementResultImpl::_HitElementResultImpl(void)
+ : __pAttributeMap(null)
+ , __pImage(null)
+ , __content(L"")
+ , __tagName(L"")
+ , __url(L"")
+{
+}
+
+
+_HitElementResultImpl::~_HitElementResultImpl(void)
+{
+}
+
+
+void
+_HitElementResultImpl::SetHitElementResult(IMap* pAttributeMap, Bitmap* pImage, const String& tagName, const String& content, const String& url)
+{
+ __pAttributeMap = std::unique_ptr<IMap, AllElementsDeleter>(pAttributeMap);
+ __pImage = std::unique_ptr<Bitmap>(pImage);
+ __tagName = tagName;
+ __content = content;
+ __url = url;
+}
+
+
+String
+_HitElementResultImpl::GetTagName(void) const
+{
+ return __tagName;
+}
+
+
+String
+_HitElementResultImpl::GetAttributeValue(const String& attributeName) const
+{
+ String attribute(L"");
+
+ if (__pAttributeMap.get())
+ {
+ const String* pValue = dynamic_cast< const String* >(__pAttributeMap->GetValue(attributeName));
+
+ if (pValue)
+ {
+ attribute = *pValue;
+ }
+ }
+
+ return attribute;
+}
+
+
+String
+_HitElementResultImpl::GetContent(void) const
+{
+ return __content;
+}
+
+
+String
+_HitElementResultImpl::GetUrl(void) const
+{
+ return __url;
+}
+
+
+const Bitmap*
+_HitElementResultImpl::GetImage(void) const
+{
+ return __pImage.get();
+}
+
+
+bool
+_HitElementResultImpl::HasImage(void) const
+{
+ if (__pImage.get())
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+
+bool
+_HitElementResultImpl::HasUrl(void) const
+{
+ if (__url.GetLength())
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+
+_HitElementResultImpl*
+_HitElementResultImpl::GetInstance(HitElementResult* pHitElementResult)
+{
+ return pHitElementResult->__pHitElementResultImpl;
+}
+
+
+const _HitElementResultImpl*
+_HitElementResultImpl::GetInstance(const HitElementResult* pHitElementResult)
+{
+ return pHitElementResult->__pHitElementResultImpl;
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_HitElementResultImpl.h
+ * @brief The file contains the declaration of _HitElementResultImpl class.
+ *
+ * The file contains the declaration of _HitElementResultImpl class.
+ */
+#ifndef _FWEB_CTRL_INTERNAL_HIT_ELEMENT_RESULT_IMPL_H_
+#define _FWEB_CTRL_INTERNAL_HIT_ELEMENT_RESULT_IMPL_H_
+
+#include <unique_ptr.h>
+#include <FBaseColAllElementsDeleter.h>
+#include <FBaseColIMap.h>
+#include <FBaseString.h>
+
+namespace Tizen { namespace Graphics
+{
+class Bitmap;
+}} // Tizen::Graphics
+
+namespace Tizen { namespace Web { namespace Controls
+{
+class HitElementResult;
+
+
+class _HitElementResultImpl
+ : public Tizen::Base::Object
+{
+public:
+ _HitElementResultImpl(void);
+
+ virtual ~_HitElementResultImpl(void);
+
+ void SetHitElementResult(Tizen::Base::Collection::IMap* pAttributeMap, Tizen::Graphics::Bitmap* pImage, const Tizen::Base::String& tagName, const Tizen::Base::String& content, const Tizen::Base::String& url);
+
+ Tizen::Base::String GetAttributeValue(const Tizen::Base::String& attributeName) const;
+
+ Tizen::Base::String GetContent(void) const;
+
+ const Tizen::Graphics::Bitmap* GetImage(void) const;
+
+ Tizen::Base::String GetTagName(void) const;
+
+ Tizen::Base::String GetUrl(void) const;
+
+ bool HasImage(void) const;
+
+ bool HasUrl(void) const;
+
+ static _HitElementResultImpl* GetInstance(HitElementResult* pHitElementResult);
+
+ static const _HitElementResultImpl* GetInstance(const HitElementResult* pHitElementResult);
+
+private:
+ _HitElementResultImpl(_HitElementResultImpl& hitElementResultImpl);
+
+ _HitElementResultImpl& operator =(const _HitElementResultImpl& hitElementResultImpl);
+
+private:
+ std::unique_ptr<Tizen::Base::Collection::IMap, Tizen::Base::Collection::AllElementsDeleter> __pAttributeMap;
+
+ std::unique_ptr<Tizen::Graphics::Bitmap> __pImage;
+
+ Tizen::Base::String __content;
+
+ Tizen::Base::String __tagName;
+
+ Tizen::Base::String __url;
+}; // _HitElementResultImpl
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_HIT_ELEMENT_RESULT_IMPL_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_DateTimeHandler.cpp
+ * @brief The file contains the definition of _DateTimeHandler class.
+ */
+#include <FBaseDateTime.h>
+#include <FBaseSysLog.h>
+#include <FGrpDimension.h>
+#include <FGrpRectangle.h>
+#include <FLclDateTimeFormatter.h>
+#include <FLclLocale.h>
+#include <FSystem.h>
+#include <FUiCtrlButton.h>
+#include <FUiCtrlEditField.h>
+#include <FUiCtrlEditDate.h>
+#include <FUiCtrlEditTime.h>
+#include <FUiCtrlLabel.h>
+#include <FUiCtrlPanel.h>
+#include <FUiIActionEventListener.h>
+#include <FUiKeyEventInfo.h>
+#include <FUiLayout.h>
+#include <FUiVerticalBoxLayout.h>
+#include <FWebCtrlAuthenticationChallenge.h>
+#include <FSys_SystemResource.h>
+#include <FUi_ControlManager.h>
+#include <FUi_ResourceManager.h>
+#include "FWebCtrl_WebImpl.h"
+#include "FWebCtrl_InputPickerPopup.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Graphics;
+using namespace Tizen::Locales;
+using namespace Tizen::System;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+static const int DATE_POPUP_BUTTON_WIDTH = 250;
+
+
+_InputPickerPopup::_InputPickerPopup(void)
+ : __pEditDate(null)
+ , __pEditTime(null)
+ , __pSelectionBtn(null)
+ , __pColorPicker(null)
+ , __pButtonPanel(null)
+ , __popupHeight(0)
+ , __popupWidth(0)
+ , __panelHeight(0)
+ , __inputType(EWK_INPUT_TYPE_TIME)
+{
+}
+
+
+_InputPickerPopup::~_InputPickerPopup(void)
+{
+ if (IsModalPopup())
+ {
+ HidePopup();
+ }
+}
+
+
+result
+_InputPickerPopup::Construct(const String& strDate, Ewk_Input_Type inputType, Tizen::Web::Controls::_WebImpl* pImpl)
+{
+ result r = E_SUCCESS;
+
+ Dimension dim;
+ int dateHeight = 0;
+ int dateWidth = 0;
+ int sideMargin = 0;
+ int internalGap = 0;
+ DateTime inputDateTime;
+
+ __inputPickerMode = INPUT_MODE_DATE;
+ __inputType = inputType;
+
+ SystemTime::GetCurrentTime(UTC_TIME, inputDateTime);
+
+ if (!strDate.IsEmpty())
+ {
+ r = Parse(strDate, inputDateTime);
+ }
+
+ _ControlOrientation orientation = _CONTROL_ORIENTATION_PORTRAIT;
+
+ _WebPopupData* pPopupData = _WebPopup::GetPopupData();
+ SysTryReturn(NID_WEB_CTRL, pPopupData, r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ GET_SHAPE_CONFIG(EDITDATE::WIDTH, orientation, dateWidth);
+ GET_SHAPE_CONFIG(EDITDATE::HEIGHT, orientation, dateHeight);
+ GET_SHAPE_CONFIG(POPUP::SIDE_BORDER, orientation, sideMargin);
+ GET_SHAPE_CONFIG(MESSAGEBOX::DEFAULT_WIDTH, orientation, __popupWidth);
+ GET_SHAPE_CONFIG(MESSAGEBOX::MIN_HEIGHT, orientation, __popupHeight);
+ GET_SHAPE_CONFIG(MESSAGEBOX::BUTTON_INTERNAL_GAP, orientation, internalGap);
+
+ __panelHeight = pPopupData->panelHeight;
+
+ __popupWidth += sideMargin;
+
+ std::unique_ptr<EditDate> pEditDate(new (std::nothrow) EditDate());
+ SysTryReturnResult(NID_WEB_CTRL, pEditDate.get(), E_OUT_OF_MEMORY, "Memory Allocation Failed.");
+
+ std::unique_ptr<EditTime> pEditTime(new (std::nothrow) EditTime());
+ SysTryReturnResult(NID_WEB_CTRL, pEditTime.get(), E_OUT_OF_MEMORY, "Memory Allocation Failed.");
+
+ int space = dateHeight/4;
+
+ _SystemResource* pSysResource = _SystemResource::GetInstance();
+ SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
+
+ switch (__inputType)
+ {
+ case EWK_INPUT_TYPE_TIME :
+
+ __popupHeight = dateHeight + space + __panelHeight;
+ r = CreatePopup();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ SetTitleText(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_HEADER_SET_TIME"));
+
+ r = pEditTime->Construct(Point(0, 0), L"Time (Default format) :");
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = AddControl(*pEditTime);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ pEditTime->SetTime(inputDateTime);
+ __pEditTime = pEditTime.release();
+ break;
+
+ case EWK_INPUT_TYPE_DATETIME :
+ //fall through
+
+ case EWK_INPUT_TYPE_DATETIMELOCAL :
+
+ __popupHeight = 2*dateHeight + space + __panelHeight + internalGap;
+ r = CreatePopup();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ SetTitleText(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_HEADER_SET_DATE_AND_TIME_ABB"));
+
+ r = pEditDate->Construct(Point(0, 0), L"Date (Default format) :");
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pEditTime->Construct(Point(0, 0), L"Time (Default format) :");
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = AddControl(*pEditTime);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pEditTime->SetTime(inputDateTime);
+ __pEditTime = pEditTime.release();
+
+ r = AddControl(*pEditDate);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pEditDate->SetDate(inputDateTime);
+ __pEditDate = pEditDate.release();
+
+ dateHeight = 2 * dateHeight;
+ break;
+
+ case EWK_INPUT_TYPE_WEEK :
+ //fall through
+ case EWK_INPUT_TYPE_DATE :
+ //fall through
+ case EWK_INPUT_TYPE_MONTH :
+
+ __popupHeight = dateHeight + space + __panelHeight;
+ r = CreatePopup();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ SetTitleText(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_HEADER_SET_DATE"));
+
+ r = pEditDate->Construct(Point(0, 0), L"Date (Default format) :");
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = AddControl(*pEditDate);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pEditDate->SetDate(inputDateTime);
+ __pEditDate = pEditDate.release();
+ break;
+
+ default:
+ r = E_UNSUPPORTED_OPTION;
+ SysLogException(NID_WEB_CTRL, r, "[%s] %d is unsupported.", GetErrorMessage(r), __inputType);
+ return r;
+ }
+
+ __pButtonPanel = CreateAndAddPanel();
+ SysTryReturn(NID_WEB_CTRL, __pButtonPanel, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ ArrayList idList(SingleObjectDeleter);
+ r = idList.Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ ArrayList titleList(SingleObjectDeleter);
+ r = titleList.Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ idList.Add(*(new Integer(ID_BUTTON_INPUT_DATE_SELECTION)));
+
+ titleList.Add(*(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_OK"))));
+
+ r = CreateAndAddButtons(idList, titleList, __pButtonPanel);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ SetPropagatedKeyEventListener(this);
+
+ std::unique_ptr<VerticalBoxLayout> pLayout(dynamic_cast< VerticalBoxLayout* >(GetLayoutN()));
+ SysTryReturnResult(NID_WEB_CTRL, pLayout.get(), E_OUT_OF_MEMORY, "Memory Allocation Failed.");
+
+ if (__pEditDate)
+ {
+ __pEditDate->SetSize(__popupWidth,__pEditDate->GetSize().height);
+ pLayout->SetHorizontalAlignment(*__pEditDate, LAYOUT_HORIZONTAL_ALIGN_LEFT);
+ pLayout->SetSpacing(*__pEditDate, sideMargin);
+ }
+
+ if (__pEditTime)
+ {
+ __pEditTime->SetSize(__popupWidth,__pEditTime->GetSize().height);
+ pLayout->SetHorizontalAlignment(*__pEditTime, LAYOUT_HORIZONTAL_ALIGN_LEFT);
+ pLayout->SetSpacing(*__pEditTime, sideMargin);
+ }
+
+ if (__pButtonPanel)
+ {
+ pLayout->SetSpacing(*__pButtonPanel, space);
+ }
+
+ return E_SUCCESS;
+}
+
+
+result
+_InputPickerPopup::Construct(const Color& color, Tizen::Web::Controls::_WebImpl* pImpl)
+{
+ result r = E_SUCCESS;
+
+ __inputPickerMode = INPUT_MODE_COLOR;
+
+ _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
+
+ _SystemResource* pSysResource = _SystemResource::GetInstance();
+ SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
+
+ _WebPopupData* pPopupData = _WebPopup::GetPopupData();
+ SysTryReturn(NID_WEB_CTRL, pPopupData, r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ std::unique_ptr<ColorPicker> pColorPicker(new (std::nothrow) ColorPicker());
+ SysTryReturnResult(NID_WEB_CTRL, pColorPicker.get(), E_OUT_OF_MEMORY, "Memory Allocation Failed.");
+
+ r = pColorPicker->Construct(Point(0,0));
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pColorPicker->SetColor(color);
+
+ CalculateColorPickerPopupSize(orientation);
+
+ r = CreatePopup();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ SetTitleText(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_HEADER_SET_COLOUR"));
+
+ SetPropagatedKeyEventListener(this);
+
+ r = AddControl(*pColorPicker);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pColorPicker = pColorPicker.release();
+
+ __pButtonPanel = CreateAndAddPanel();
+ SysTryReturn(NID_WEB_CTRL, __pButtonPanel, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ ArrayList idList(SingleObjectDeleter);
+ r = idList.Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ ArrayList titleList(SingleObjectDeleter);
+ r = titleList.Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ idList.Add(*(new Integer(ID_BUTTON_INPUT_COLOR_SELECTION)));
+ titleList.Add(*(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_OK"))));
+
+ r = CreateAndAddButtons(idList, titleList, __pButtonPanel);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ std::unique_ptr<VerticalBoxLayout> pLayout(dynamic_cast< VerticalBoxLayout* >(GetLayoutN()));
+ SysTryReturnResult(NID_WEB_CTRL, pLayout.get(), E_OUT_OF_MEMORY, "Memory Allocation Failed.");
+
+ pLayout->SetHorizontalAlignment(*__pColorPicker, LAYOUT_HORIZONTAL_ALIGN_LEFT);
+
+ int sideMargin = 0;
+ GET_SHAPE_CONFIG(POPUP::SIDE_BORDER, orientation, sideMargin);
+
+ pLayout->SetSpacing(*__pColorPicker, sideMargin);
+
+ return E_SUCCESS;
+
+}
+
+
+void
+_InputPickerPopup::CalculateColorPickerPopupSize(_ControlOrientation orientation)
+{
+ int sideMargin = 0;
+ Dimension dim;
+ _WebPopupData* pPopupData = _WebPopup::GetPopupData();
+
+ GET_SHAPE_CONFIG(POPUP::SIDE_BORDER, orientation, sideMargin);
+
+ __panelHeight = pPopupData->panelHeight;
+ GET_DIMENSION_CONFIG(COLORPICKER::DEFAULT_SIZE, orientation, dim);
+
+ dim.width += sideMargin;
+ __popupWidth = dim.width;
+ __popupHeight = dim.height + __panelHeight;
+}
+
+
+result
+_InputPickerPopup::CreatePopup(void)
+{
+ result r = E_SUCCESS;
+ bool hasTitle = true;
+
+ r = _WebPopup::Construct(hasTitle, Dimension(__popupWidth, __popupHeight));
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return E_SUCCESS;
+}
+
+void
+_InputPickerPopup::OnActionPerformed(const Control& source, int actionId)
+{
+ result r = E_SUCCESS;
+
+ switch(actionId)
+ {
+ case ID_BUTTON_INPUT_DATE_SELECTION:
+ r = UpdateDate();
+ break;
+
+ case ID_BUTTON_INPUT_COLOR_SELECTION:
+ UpdateColor();
+ break;
+
+ default:
+ SysAssert(false);
+ break;
+ }
+
+ r = HidePopup();
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+}
+
+
+result
+_InputPickerPopup::ChangeLayout(_ControlOrientation orientation)
+{
+ result r = E_SUCCESS;
+
+ if (__inputPickerMode != INPUT_MODE_COLOR) //Change the layout for color only.
+ {
+ return r;
+ }
+
+ int x = 0;
+ int y = 0;
+ _WebPopupData* __pWebPopupData = _WebPopup::GetPopupData();
+ Dimension screenRect = _ControlManager::GetInstance()->GetScreenSize();
+
+ CalculateColorPickerPopupSize(orientation);
+ __popupHeight += __pWebPopupData->titleHeight;
+
+ if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
+ {
+ x = (screenRect.width - __popupWidth) / 2;
+ y = (screenRect.height - __popupHeight) / 2;
+ }
+ else
+ {
+ x = (screenRect.height - __popupWidth) / 2;
+ y = (screenRect.width - __popupHeight) / 2;
+ }
+
+ r = SetBounds(Rectangle(x, y, __popupWidth, __popupHeight));
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = __pButtonPanel->SetSize(__popupWidth, __popupHeight);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ int buttonMargin;
+ int idCount = 1;
+ GET_SHAPE_CONFIG(MESSAGEBOX::BUTTON_SIDE_MARGIN_01, _CONTROL_ORIENTATION_PORTRAIT, buttonMargin);
+
+ int buttonWidth = (__popupWidth - buttonMargin*(idCount+1)) / idCount;
+ int buttonTopMargin = (__pWebPopupData->panelHeight - __pWebPopupData->btnDim.height)/2;
+
+ if (__pButtonPanel->GetControl(0))
+ {
+ r = (__pButtonPanel->GetControl(0))->SetBounds(Rectangle(buttonMargin, buttonTopMargin, buttonWidth, __pWebPopupData->btnDim.height));
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+
+ return E_SUCCESS;
+}
+
+
+result
+_InputPickerPopup::UpdateDate(void)
+{
+ result r = E_SUCCESS;
+
+ String formattedString;
+ DateTime dateTime;
+
+ std::unique_ptr<DateTimeFormatter> pDateFormatter(DateTimeFormatter::CreateDateFormatterN(DATE_TIME_STYLE_DEFAULT));
+ SysTryReturn(NID_WEB_CTRL, pDateFormatter.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ switch (__inputType)
+ {
+ case EWK_INPUT_TYPE_TIME :
+ formattedString = L"HH:mm";
+ pDateFormatter->ApplyPattern(formattedString);
+ pDateFormatter->Format(__pEditTime->GetTime(), __dateStr);
+ break;
+
+ case EWK_INPUT_TYPE_DATETIME :
+ formattedString = L"yyyy-MM-dd";
+ pDateFormatter->ApplyPattern(formattedString);
+ pDateFormatter->Format(__pEditDate->GetDate(), __dateStr);
+
+ formattedString = L"\'T\'HH:mm\'Z\'";
+ pDateFormatter->ApplyPattern(formattedString);
+ pDateFormatter->Format(__pEditTime->GetTime(), __dateStr);
+ break;
+
+ case EWK_INPUT_TYPE_DATETIMELOCAL :
+ formattedString = L"yyyy-MM-dd";
+ pDateFormatter->ApplyPattern(formattedString);
+ pDateFormatter->Format(__pEditDate->GetDate(), __dateStr);
+
+ formattedString = L"\'T\'HH:mm";
+ pDateFormatter->ApplyPattern(formattedString);
+ pDateFormatter->Format(__pEditTime->GetTime(), __dateStr);
+ break;
+
+ case EWK_INPUT_TYPE_WEEK :
+ formattedString = L"yyyy-\'W\'ww";
+ pDateFormatter->ApplyPattern(formattedString);
+ pDateFormatter->Format(__pEditDate->GetDate(), __dateStr);
+
+ break;
+
+ case EWK_INPUT_TYPE_DATE :
+ formattedString = L"yyyy-MM-dd";
+ pDateFormatter->ApplyPattern(formattedString);
+ pDateFormatter->Format(__pEditDate->GetDate(), __dateStr);
+ break;
+
+ case EWK_INPUT_TYPE_MONTH :
+ formattedString = L"yyyy-MM";
+ pDateFormatter->ApplyPattern(formattedString);
+ pDateFormatter->Format(__pEditDate->GetDate(), __dateStr);
+ break;
+
+ default :
+ r = E_UNSUPPORTED_OPTION;
+ SysLogException(NID_WEB_CTRL, r, "[%s] %d is unsupported.", GetErrorMessage(r), __inputType);
+ return r;
+ }
+
+ return E_SUCCESS;
+}
+
+
+void
+_InputPickerPopup::UpdateColor(void)
+{
+ __Color = __pColorPicker->GetColor();
+}
+
+
+bool
+_InputPickerPopup::OnKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
+{
+ return false;
+}
+
+bool
+_InputPickerPopup::OnKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
+{
+ if ((keyEventInfo.GetKeyCode() == KEY_ESC || keyEventInfo.GetKeyCode() == KEY_BACK) && source.GetShowState() == true)
+ {
+ HidePopup();
+ }
+
+ return false;
+}
+
+bool
+_InputPickerPopup::OnPreviewKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
+{
+ return false;
+}
+
+bool
+_InputPickerPopup::OnPreviewKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
+{
+ return false;
+}
+
+bool
+_InputPickerPopup::TranslateKeyEventInfo(Control& source, KeyEventInfo& keyEventInfo)
+{
+ return false;
+}
+
+String
+_InputPickerPopup::GetDate(void) const
+{
+ return __dateStr;
+}
+
+
+Color
+_InputPickerPopup::GetColor(void) const
+{
+ return __Color;
+}
+
+
+result
+_InputPickerPopup::Parse(const String& strDateTime, DateTime & dateTime)
+{
+ std::unique_ptr<DateTimeFormatter> pDateFormatter(DateTimeFormatter::CreateDateFormatterN(DATE_TIME_STYLE_DEFAULT));
+ SysTryReturn(NID_WEB_CTRL, pDateFormatter.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ int year = 1;
+ int day = 1;
+ int days = 1;
+ int month = 1;
+ int hour = 0;
+ int minute = 0;
+ int week = 0;
+
+ result r = E_SUCCESS;
+
+ String formattedString = L"e";
+ String dayno;
+
+ const wchar_t* pMchar = static_cast< const wchar_t* >(strDateTime.GetPointer());
+ wchar_t* pTmp = static_cast< wchar_t* >(malloc(sizeof(wchar_t) * 10));
+ SysTryReturnResult(NID_WEB_CTRL, pTmp, E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ switch (__inputType)
+ {
+ case EWK_INPUT_TYPE_TIME : //"HH:mm";
+
+ // hour
+ wcsncpy(pTmp, pMchar, 2);
+ pTmp[2] = L'\0';
+ hour = static_cast< int >(wcstol(pTmp, null, 10));
+
+ // minute
+ wcsncpy(pTmp, pMchar + 3, 2);
+ pTmp[2] = L'\0';
+ minute = static_cast< int >(wcstol(pTmp, null, 10));
+ dateTime.SetValue(1, 1, 1, hour,minute);
+ break;
+
+ case EWK_INPUT_TYPE_DATETIME : // "yyyy-MM-ddTHH:mmZ";
+ //fall through
+ case EWK_INPUT_TYPE_DATETIMELOCAL :
+ // year
+ wcsncpy(pTmp, pMchar, 4);
+ pTmp[4] = L'\0';
+
+ year = static_cast< int >(wcstol(pTmp, null, 10));
+
+ // month
+ wcsncpy(pTmp, pMchar + 5, 2);
+ pTmp[2] = L'\0';
+
+ month = static_cast< int >(wcstol(pTmp, null, 10));
+
+ // day
+ wcsncpy(pTmp, pMchar + 8, 2);
+ pTmp[2] = L'\0';
+
+ day = static_cast< int >(wcstol(pTmp, null, 10));
+
+ // hour
+ wcsncpy(pTmp, pMchar + 11, 2);
+ pTmp[2] = L'\0';
+
+ hour = static_cast< int >(wcstol(pTmp, null, 10));
+
+ // minute
+ wcsncpy(pTmp, pMchar + 14, 2);
+ pTmp[2] = L'\0';
+ minute = static_cast< int >(wcstol(pTmp, null, 10));
+ dateTime.SetValue(year, month, day, hour, minute);
+ break;
+
+ case EWK_INPUT_TYPE_WEEK : //"yyyy-Www";
+
+ // year
+ wcsncpy(pTmp, pMchar, 4);
+ pTmp[4] = L'\0';
+
+ year = static_cast< int >(wcstol(pTmp, null, 10));
+
+ // week
+ wcsncpy(pTmp, pMchar + 6, 2);
+ pTmp[2] = L'\0';
+ week = static_cast< int >(wcstol(pTmp, null, 10));
+
+ dateTime.SetValue(year,1,1);
+ pDateFormatter->ApplyPattern(formattedString);
+ pDateFormatter->Format(dateTime, dayno);
+ Integer::Parse(dayno, day);
+ days = (week*7) - day;
+
+ GetDateTimeForWeek(year, days, dateTime);
+ break;
+
+ case EWK_INPUT_TYPE_DATE : //"yyyy-MM-dd"
+ // year
+ wcsncpy(pTmp, pMchar, 4);
+ pTmp[4] = L'\0';
+ year = static_cast< int >(wcstol(pTmp, null, 10));
+
+ // month
+ wcsncpy(pTmp, pMchar + 5, 2);
+ pTmp[2] = L'\0';
+ month = static_cast< int >(wcstol(pTmp, null, 10));
+
+ // day
+ wcsncpy(pTmp, pMchar + 8, 2);
+ pTmp[2] = L'\0';
+ day = static_cast< int >(wcstol(pTmp, null, 10));
+
+ dateTime.SetValue(year, month, day);
+ break;
+
+ case EWK_INPUT_TYPE_MONTH : //"yyyy-MM";
+
+ // year
+ wcsncpy(pTmp, pMchar, 4);
+ pTmp[4] = L'\0';
+ year = static_cast< int >(wcstol(pTmp, null, 10));
+
+ // month
+ wcsncpy(pTmp, pMchar + 5, 2);
+ pTmp[2] = L'\0';
+ month = static_cast< int >(wcstol(pTmp, null, 10));
+
+ dateTime.SetValue(year, month, 1);
+ break;
+
+ default :
+ r = E_UNSUPPORTED_OPTION;
+ SysLogException(NID_WEB_CTRL, r, "[%s] %d is unsupported.", GetErrorMessage(r), __inputType);
+ }
+
+ free(pTmp);
+
+ return r;
+}
+
+
+void
+_InputPickerPopup::GetDateTimeForWeek(int year, int days, DateTime& dateTime)
+{
+ int monthDays = 0;
+
+ for (int month = 1; month <= 12; month++)
+ {
+ DateTime::GetDaysInMonth(year, month, monthDays);
+
+ if (days - monthDays < 0)
+ {
+ dateTime.SetValue(year, month, days);
+ break;
+ }
+
+ days -= monthDays;
+ }
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_InputPickerPopup.h
+ * @brief The file contains the definition of _InputPickerPopup class.
+ */
+
+#ifndef _FWEB_CTRL_INTERNAL_INPUT_POPUP_H_
+#define _FWEB_CTRL_INTERNAL_INPUT_POPUP_H_
+
+#include <unique_ptr.h>
+#include <ewk_view.h>
+#include <FBase.h>
+#include <FBaseString.h>
+#include <FGrpColor.h>
+#include <FUi.h>
+#include <FUiIActionEventListener.h>
+#include <FUiIPropagatedKeyEventListener.h>
+#include <FUi_ControlManager.h>
+#include "FWebCtrl_WebPopup.h"
+
+namespace Tizen { namespace Ui
+{
+class IActionEventListener;
+}} // Tizen::Ui
+
+namespace Tizen { namespace Ui { namespace Controls
+{
+class Popup;
+class EditDate;
+class EditTime;
+}}} // Tizen::Ui::Controls
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+enum _InputPickerButtonId
+{
+ ID_BUTTON_INPUT_DATE_SELECTION,
+ ID_BUTTON_INPUT_COLOR_SELECTION
+};
+
+enum _InputPickerMode
+{
+ INPUT_MODE_DATE,
+ INPUT_MODE_COLOR
+};
+
+
+class _InputPickerPopup
+ : public _WebPopup
+ , public Tizen::Ui::IPropagatedKeyEventListener
+{
+
+public:
+ /**
+ * Constructor
+ */
+ _InputPickerPopup(void);
+
+ /**
+ * Destructor
+ */
+ virtual ~_InputPickerPopup(void);
+
+ result Construct(const Tizen::Base::String& strDate, Ewk_Input_Type inputType, Tizen::Web::Controls::_WebImpl* pImpl);
+
+ result Construct(const Tizen::Graphics::Color& color, Tizen::Web::Controls::_WebImpl* pImpl);
+
+ void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+
+ result ChangeLayout(Tizen::Ui::_ControlOrientation orientation);
+
+ Tizen::Base::String GetDate(void) const;
+ Tizen::Graphics::Color GetColor(void) const;
+
+ virtual bool OnKeyPressed (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
+ virtual bool OnKeyReleased (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
+ virtual bool OnPreviewKeyPressed (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
+ virtual bool OnPreviewKeyReleased (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
+ virtual bool TranslateKeyEventInfo (Tizen::Ui::Control &source, Tizen::Ui::KeyEventInfo &keyEventInfo);
+
+private:
+ _InputPickerPopup(const _InputPickerPopup& rhs);
+
+ _InputPickerPopup& operator =(const _InputPickerPopup& rhs);
+
+ result CreatePopup(void);
+
+ void CalculateColorPickerPopupSize(Tizen::Ui::_ControlOrientation orientation);
+
+ result UpdateDate(void);
+ void UpdateColor(void);
+
+ result Parse(const Tizen::Base::String& strDateTime, Tizen::Base::DateTime& dateTime);
+
+ void GetDateTimeForWeek(int year, int totalDays, Tizen::Base::DateTime& dateTime);
+
+private:
+
+ Tizen::Ui::Controls::EditDate* __pEditDate;
+ Tizen::Ui::Controls::EditTime* __pEditTime;
+ Tizen::Ui::Controls::Button* __pSelectionBtn;
+ Tizen::Ui::Controls::ColorPicker* __pColorPicker;
+ Tizen::Ui::Controls::Panel* __pButtonPanel;
+
+ int __popupHeight;
+ int __popupWidth;
+ int __panelHeight;
+
+ Ewk_Input_Type __inputType;
+ Tizen::Base::String __dateStr;
+ Tizen::Graphics::Color __Color;
+
+ _InputPickerMode __inputPickerMode;
+}; // _InputPickerPopup
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_INPUT_POPUP_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_PageNavigationListImpl.cpp
+ * @brief The file contains the definition of _PageNavigationListImpl class.
+ *
+ * The file contains the definition of _PageNavigationListImpl class.
+ */
+#include <FWebCtrlPageNavigationList.h>
+#include <FWebHistoryItem.h>
+#include <FBaseSysLog.h>
+#include "FWebCtrl_PageNavigationListImpl.h"
+
+
+using namespace Tizen::Base::Collection;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+_PageNavigationListImpl::_PageNavigationListImpl(void)
+ : __pNavigationList(null)
+ , __currentIndex(-1)
+{
+}
+
+
+_PageNavigationListImpl::~_PageNavigationListImpl(void)
+{
+}
+
+
+void
+_PageNavigationListImpl::SetPageNavigationList(IList* pList, int currentIndex)
+{
+ __pNavigationList = std::unique_ptr<IList, AllElementsDeleter>(pList);
+ __currentIndex = currentIndex;
+}
+
+
+const HistoryItem*
+_PageNavigationListImpl::GetCurrentItem(void) const
+{
+ int index = GetCurrentIndex();
+
+ return GetItemAt(index);
+}
+
+
+int
+_PageNavigationListImpl::GetCurrentIndex(void) const
+{
+ return __currentIndex;
+}
+
+
+const HistoryItem*
+_PageNavigationListImpl::GetItemAt(int index) const
+{
+ SysTryReturn(NID_WEB_CTRL,
+ index >= 0 && index < GetItemCount(), null, E_OUT_OF_RANGE,
+ "[E_OUT_OF_RANGE] The index(%d) must be between 0 and %d(%d).", index, GetItemCount() - 1, index);
+
+ return dynamic_cast< const HistoryItem* >(__pNavigationList->GetAt(index));
+}
+
+
+int
+_PageNavigationListImpl::GetItemCount(void) const
+{
+ return __pNavigationList->GetCount();
+}
+
+
+_PageNavigationListImpl*
+_PageNavigationListImpl::GetInstance(PageNavigationList* pPageNavigationList)
+{
+ return pPageNavigationList->__pPageNavigationListImpl;
+}
+
+
+const _PageNavigationListImpl*
+_PageNavigationListImpl::GetInstance(const PageNavigationList* pPageNavigationList)
+{
+ return pPageNavigationList->__pPageNavigationListImpl;
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_PageNavigationListImpl.h
+ * @brief The file contains the declaration of _PageNavigationListImpl class.
+ *
+ * The file contains the declaration of _PageNavigationListImpl class.
+ */
+#ifndef _FWEB_CTRL_INTERNAL_PAGE_NAVIGATION_LIST_IMPL_H_
+#define _FWEB_CTRL_INTERNAL_PAGE_NAVIGATION_LIST_IMPL_H_
+
+#include <unique_ptr.h>
+#include <FBaseColAllElementsDeleter.h>
+#include <FBaseColIList.h>
+#include <FBaseObject.h>
+
+namespace Tizen { namespace Web
+{
+class HistoryItem;
+}} // Tizen::Web
+
+namespace Tizen { namespace Web { namespace Controls
+{
+class PageNavigationList;
+
+
+class _PageNavigationListImpl
+ : public Tizen::Base::Object
+{
+public:
+ _PageNavigationListImpl(void);
+
+ virtual ~_PageNavigationListImpl(void);
+
+ void SetPageNavigationList(Tizen::Base::Collection::IList* pList, int currentIndex);
+
+ const Tizen::Web::HistoryItem* GetCurrentItem(void) const;
+
+ int GetCurrentIndex(void) const;
+
+ const Tizen::Web::HistoryItem* GetItemAt(int index) const;
+
+ int GetItemCount(void) const;
+
+ static _PageNavigationListImpl* GetInstance(PageNavigationList* pPageNavigationList);
+
+ static const _PageNavigationListImpl* GetInstance(const PageNavigationList* pPageNavigationList);
+
+private:
+ _PageNavigationListImpl(_PageNavigationListImpl& pageNavigationListImpl);
+
+ _PageNavigationListImpl& operator =(const _PageNavigationListImpl& pageNavigationListImpl);
+
+private:
+ std::unique_ptr<Tizen::Base::Collection::IList, Tizen::Base::Collection::AllElementsDeleter> __pNavigationList;
+
+ int __currentIndex;
+}; // _PageNavigationListImpl
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_PAGE_NAVIGATION_LIST_IMPL_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_AuthConfirmPopup.cpp
+ * @brief The file contains the definition of _AuthConfirmPopup class.
+ */
+#include <ewk_view.h>
+#include <FBaseColIList.h>
+#include <FBaseSysLog.h>
+#include <FGrpColor.h>
+#include <FGrpDimension.h>
+#include <FGrpRectangle.h>
+#include <FUiCtrlButton.h>
+#include <FUiCtrlEditField.h>
+#include <FUiCtrlLabel.h>
+#include <FUiCtrlPanel.h>
+#include <FUiCtrlTextBox.h>
+#include <FUiKeyEventInfo.h>
+#include <FUiLayout.h>
+#include <FUiVerticalBoxLayout.h>
+#include <FWebCtrlAuthenticationChallenge.h>
+#include <FBase_StringConverter.h>
+#include <FSys_SystemResource.h>
+#include <FUi_ControlManager.h>
+#include <FUi_ResourceManager.h>
+#include <FUiCtrl_TextBoxImpl.h>
+#include "FWebCtrl_PromptPopup.h"
+#include "FWebCtrl_WebImpl.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Graphics;
+using namespace Tizen::System;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+static const int EDIT_TEXT_SIZE = 35;
+
+
+_PromptPopup::_PromptPopup(void)
+ : __pEditField(null)
+ , __pWebView(null)
+ , __pImpl(null)
+{
+}
+
+
+_PromptPopup::~_PromptPopup(void)
+{
+}
+
+
+// Prompt popup
+result
+_PromptPopup::Construct(const String& message, const String& defaultVale, Evas_Object* pView, _WebImpl* pImpl)
+{
+ result r = E_SUCCESS;
+ Rectangle rect(0, 0, 0, 0);
+
+ int popupHeight = 0;
+
+ __pImpl = pImpl;
+ __pWebView = pView;
+
+ _WebPopupData* pPopupData = _WebPopup::GetPopupData();
+ SysTryReturn(NID_WEB_CTRL, pPopupData, r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ popupHeight = pPopupData->editDim.height + pPopupData->labelDim.height + pPopupData->panelHeight + (2 * pPopupData->spacePad);
+
+ r = _WebPopup::Construct(true, Dimension(pPopupData->popupDim.width, popupHeight));
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ SetTitleText("Prompt Dialog");
+
+ //Text box
+ rect = GetClientAreaBounds();
+ rect.width = pPopupData->labelDim.width;
+ rect.y = 0;
+ rect.height = pPopupData->labelDim.height;
+
+ std::unique_ptr<TextBox> pTextBox(new (std::nothrow) TextBox());
+ SysTryReturnResult(NID_WEB_CTRL, pTextBox.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ r = pTextBox->Construct(rect, TEXT_BOX_BORDER_ROUNDED);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pTextBox->SetTextSize(EDIT_TEXT_SIZE);
+ pTextBox->SetText(message);
+ pTextBox->SetColor(TEXT_BOX_STATUS_NORMAL, GetColor());
+ pTextBox->SetColor(TEXT_BOX_STATUS_HIGHLIGHTED, GetColor());
+
+ r = AddControl(*pTextBox);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ TextBox* pTmpTextBox = pTextBox.release();
+
+ //Edit Field
+ rect.y = 0;
+ rect.height = pPopupData->editDim.height;
+
+ std::unique_ptr<EditField> pEditField(new (std::nothrow) EditField());
+ SysTryReturnResult(NID_WEB_CTRL, pEditField.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ r = pEditField->Construct(rect, EDIT_FIELD_STYLE_NORMAL);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pEditField->SetTextSize(EDIT_TEXT_SIZE);
+ pEditField->SetText(defaultVale);
+
+ r = AddControl(*pEditField);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pEditField = pEditField.release();
+ __pEditField->SetFocus();
+
+ //Panel
+ Panel* pButtonPanel = CreateAndAddPanel();
+ SysTryReturn(NID_WEB_CTRL, pButtonPanel, r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ _SystemResource* pSysResource = _SystemResource::GetInstance();
+ SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
+
+ ArrayList idList(SingleObjectDeleter);
+ r = idList.Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ idList.Add(*(new Integer(ID_BUTTON_PROMPT_CANCEL)));
+ idList.Add(*(new Integer(ID_BUTTON_PROMPT_OK)));
+
+ ArrayList titleList(SingleObjectDeleter);
+ r = titleList.Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ titleList.Add(*(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_CANCEL_ABB"))));
+ titleList.Add(*(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_OK"))));
+
+ r = CreateAndAddButtons(idList, titleList, pButtonPanel);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ std::unique_ptr<VerticalBoxLayout> pLayout(dynamic_cast< VerticalBoxLayout* >(GetLayoutN()));
+ SysTryReturn(NID_WEB_CTRL, pLayout.get(), r = GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ pLayout->SetHorizontalAlignment(*pTmpTextBox, LAYOUT_HORIZONTAL_ALIGN_CENTER);
+ pLayout->SetHorizontalAlignment(*__pEditField, LAYOUT_HORIZONTAL_ALIGN_CENTER);
+
+ pLayout->SetSpacing(*__pEditField, pPopupData->spacePad);
+ pLayout->SetSpacing(*pButtonPanel, pPopupData->spacePad);
+
+ SetPropagatedKeyEventListener(this);
+
+ return r;
+}
+
+
+const String
+_PromptPopup::GetPromptText()
+{
+ return __pEditField->GetText();
+}
+
+
+void
+_PromptPopup::OnActionPerformed(const Control& source, int actionId)
+{
+ switch (actionId)
+ {
+ case ID_BUTTON_PROMPT_OK:
+ {
+ HidePopup(ID_BUTTON_PROMPT_OK);
+ std::unique_ptr<char[]> pResult(_StringConverter::CopyToCharArrayN(GetPromptText()));
+ ewk_view_javascript_prompt_reply(__pWebView, pResult.get());
+ break;
+ }
+ case ID_BUTTON_PROMPT_CANCEL:
+ HidePopup(ID_BUTTON_PROMPT_CANCEL);
+ ewk_view_javascript_prompt_reply(__pWebView, null);
+ break;
+
+ default:
+ SysAssertf(false, "unknown action ID used");
+ break;
+ }
+ __pImpl->SendUserEvent(ID_PROMPT_POPUP_CLOSE, null);
+}
+
+bool
+_PromptPopup::OnKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
+{
+ return false;
+}
+
+bool
+_PromptPopup::OnKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
+{
+ if ((keyEventInfo.GetKeyCode() == KEY_ESC || keyEventInfo.GetKeyCode() == KEY_BACK) && source.GetShowState() == true)
+ {
+ HidePopup(ID_BUTTON_PROMPT_CANCEL);
+ ewk_view_javascript_prompt_reply(__pWebView, null);
+ __pImpl->SendUserEvent(ID_PROMPT_POPUP_CLOSE, null);
+ }
+
+ return false;
+}
+
+bool
+_PromptPopup::OnPreviewKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
+{
+ return false;
+}
+
+bool
+_PromptPopup::OnPreviewKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
+{
+ return false;
+}
+
+bool
+_PromptPopup::TranslateKeyEventInfo(Control& source, KeyEventInfo& keyEventInfo)
+{
+ return false;
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_PromptPopup.h
+ * @brief The file contains the definition of _PromptPopup class.
+ */
+#ifndef _FWEB_CTRL_PROMPT_POPUP_H_
+#define _FWEB_CTRL_PROMPT_POPUP_H_
+
+#include <unique_ptr.h>
+#include <FBaseString.h>
+#include <FUiIPropagatedKeyEventListener.h>
+#include "FWebCtrl_WebPopup.h"
+
+namespace Tizen { namespace Ui { namespace Controls
+{
+class EditField;
+}}} // Tizen::Ui::Controls
+
+namespace Tizen { namespace Web { namespace Controls
+{
+class _WebImpl;
+}}} // Tizen::Web::Controls
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+enum _PromptPopupButtonId
+{
+ ID_BUTTON_PROMPT_CANCEL,
+ ID_BUTTON_PROMPT_OK
+};
+
+
+class _PromptPopup
+ : public _WebPopup
+ , public Tizen::Ui::IPropagatedKeyEventListener
+{
+
+public:
+ /**
+ * Constructor
+ */
+ _PromptPopup(void);
+
+ /**
+ * Destructor
+ */
+ virtual ~_PromptPopup(void);
+
+ result Construct(const Tizen::Base::String& message, const Tizen::Base::String& defaultValue, Evas_Object* pView, _WebImpl* pImpl);
+
+ const Tizen::Base::String GetPromptText(void);
+
+ virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+
+ virtual bool OnKeyPressed (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
+ virtual bool OnKeyReleased (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
+ virtual bool OnPreviewKeyPressed (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
+ virtual bool OnPreviewKeyReleased (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
+ virtual bool TranslateKeyEventInfo (Tizen::Ui::Control &source, Tizen::Ui::KeyEventInfo &keyEventInfo);
+
+private:
+
+ _PromptPopup(const _PromptPopup&);
+
+ _PromptPopup& operator =(const _PromptPopup&);
+
+private:
+
+ Tizen::Ui::Controls::EditField* __pEditField;
+ Evas_Object* __pWebView;
+ _WebImpl* __pImpl;
+}; // _PromptPopup
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_PROMPT_POPUP_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_SelectBox.cpp
+ * @brief The file contains the definition of _SelectBox class.
+ *
+ * The file contains the definition of _SelectBox class.
+ */
+#include <ewk_view.h>
+#include <ewk_popup_menu_item.h>
+#include <unique_ptr.h>
+#include <FBaseColAllElementsDeleter.h>
+#include <FBaseSysLog.h>
+#include <FCntDownloadRequest.h>
+#include <FGrpDimension.h>
+#include <FGrpRectangle.h>
+#include <FUiCtrlButton.h>
+#include <FUiCtrlCustomItem.h>
+#include <FUiCtrlGroupedList.h>
+#include <FUiCtrlListItemBase.h>
+#include <FUiCtrlListView.h>
+#include <FUiCtrlPanel.h>
+#include <FUiIActionEventListener.h>
+#include <FUiKeyEventInfo.h>
+#include <FUiVerticalBoxLayout.h>
+#include <FCnt_DownloadManagerImpl.h>
+#include <FSys_SystemResource.h>
+#include <FUi_ResourceManager.h>
+#include "FWebCtrl_SelectBox.h"
+#include "FWebCtrl_WebImpl.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Content;
+using namespace Tizen::Graphics;
+using namespace Tizen::System;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+static const int POSITION_INVALID = -1;
+
+
+template< class Type > Type
+Max(Type a, Type b)
+{
+ return a > b ? a : b;
+}
+
+
+int CompareChangedItems(const void* pData1, const void* pData2)
+{
+ SysAssertf(pData1 && pData2, "input parameters are null");
+
+ const int* pLeft = static_cast<const int*>(pData1);
+ const int* pRight = static_cast<const int*>(pData2);
+
+ return (*pLeft - *pRight);
+}
+
+
+//Internal class for maintaining states of list elements
+class _ListElement
+ : public Object
+{
+public:
+ _ListElement(const String& itemText);
+
+ virtual ~_ListElement(void) {}
+
+ //Set functions
+ void ListElementSetItemEnabled(bool isEnabled);
+ void ListElementSetItemType(short itemType);
+ void ListElementSetItemSelected(bool isSelected);
+
+ //Get functions
+ short ListElementGetItemType(void) const { return __itemType; }
+
+ String ListElementGetString(void) const { return __itemStr; }
+
+ bool ListElementIsItemEnabled(void) const { return __isEnabled; }
+
+ bool ListElementIsItemSelected(void) const { return __isSelected; }
+
+private:
+ _ListElement(void);
+
+private:
+ String __itemStr;
+ short __itemType;
+ bool __isEnabled;
+ bool __isSelected;
+}; // _ListElement
+
+
+_ListElement::_ListElement(const String& itemText)
+ : __itemType(_SelectBox::LIST_ITEM_TYPE_NORMAL)
+ , __isEnabled(true)
+ , __isSelected(false)
+{
+ __itemStr = itemText;
+}
+
+
+void
+_ListElement::ListElementSetItemEnabled(bool isEnabled)
+{
+ __isEnabled = isEnabled;
+}
+
+
+void
+_ListElement::ListElementSetItemType(short itemType)
+{
+ __itemType = itemType;
+}
+
+
+void
+_ListElement::ListElementSetItemSelected(bool isSelected)
+{
+ __isSelected = isSelected;
+}
+
+
+_SelectBox::_SelectBox(void)
+ : __pListView(null)
+ , __multiSelection(false)
+ , __SelectedIndex(-1)
+ , __prevIndex(-1)
+ , __panelHeight(0)
+ , __orientation(_CONTROL_ORIENTATION_PORTRAIT)
+ , __pWebView(null)
+ , __pToggledArray(null)
+ , __url(L"")
+ , __pImpl(null)
+{
+}
+
+
+_SelectBox::~_SelectBox(void)
+{
+ if (__multiSelection)
+ {
+ eina_inarray_flush(__pToggledArray);
+ delete __pToggledArray;
+ }
+
+ __listElementArray.RemoveAll(true);
+}
+
+
+result
+_SelectBox::Construct(Tizen::Web::Controls::_WebImpl* pImpl, bool isMultiSelect, const String& title, int listCount, Evas_Object* pWebView, const String& url)
+{
+ result r = E_SUCCESS;
+ Rectangle rect;
+
+ int listItemHeight = 0;
+ int listMaxHeihgt = 0;
+ int listViewHeight = 0;
+
+ __pWebView = pWebView;
+ __url = const_cast< String& >(url);
+ __pImpl = pImpl;
+
+ GET_SHAPE_CONFIG(CONTEXTMENU::LIST_ITEM_HEIGHT, __orientation, listItemHeight);
+
+ __multiSelection = isMultiSelect;
+
+ _WebPopupData* pPopupData = _WebPopup::GetPopupData();
+ SysTryReturn(NID_WEB_CTRL, pPopupData, r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ listMaxHeihgt = listCount * listItemHeight;
+
+ rect.height = listMaxHeihgt;
+ rect.width = pPopupData->popupDim.width;
+ rect.x = 0;
+ rect.y = 0;
+
+ r = _WebPopup::Construct(!title.IsEmpty(), Dimension(rect.width, rect.height));
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ if (!title.IsEmpty())
+ {
+ Popup::SetTitleText(title);
+ }
+
+ listViewHeight = listCount * listItemHeight;
+ std::unique_ptr<ListView> pListView(new (std::nothrow) ListView());
+ SysTryReturnResult(NID_WEB_CTRL, pListView.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ r = pListView->Construct(Rectangle(0, 0, GetClientAreaBounds().width, listViewHeight), true, SCROLL_STYLE_FADE_OUT);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = __listElementArray.Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pListView->SetItemProvider(*this);
+ pListView->AddListViewItemEventListener(*this);
+ pListView->SetTextOfEmptyList(L"");
+
+ r = AddControl(*pListView);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pListView = pListView.release();
+
+ if (__multiSelection)
+ {
+ Panel* pButtonPanel = CreateAndAddPanel();
+ SysTryReturn(NID_WEB_CTRL, pButtonPanel, r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __panelHeight = pButtonPanel->GetHeight();
+
+ _SystemResource* pSysResource = _SystemResource::GetInstance();
+ SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
+
+ ArrayList idList(SingleObjectDeleter);
+ r = idList.Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ idList.Add(*(new Integer(ID_BUTTON_SELECTION)));
+
+ ArrayList titleList(SingleObjectDeleter);
+ r = titleList.Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ titleList.Add(*(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_OK"))));
+
+ __pToggledArray = eina_inarray_new(sizeof(int), 0);
+ SysTryReturnResult(NID_WEB_CTRL, __pToggledArray, E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ r = CreateAndAddButtons(idList, titleList, pButtonPanel);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ SetSize(GetSize().width,GetSize().height + __panelHeight);
+ }
+
+ SetPropagatedKeyEventListener(this);
+
+ return r;
+}
+
+result
+_SelectBox::AddListItem(const String& itemText, int itemType, bool slected)
+{
+ result r = E_SUCCESS;
+ std::unique_ptr<_ListElement> pListElement(new (std::nothrow) _ListElement(itemText));
+ SysTryReturnResult(NID_WEB_CTRL, pListElement.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ pListElement->ListElementSetItemType(itemType);
+ pListElement->ListElementSetItemSelected(slected);
+
+ r = __listElementArray.Add(*pListElement);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pListElement.release();
+ return r;
+}
+
+
+IList*
+_SelectBox::GetSelectedListN(void) const
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr<ArrayList, AllElementsDeleter> pSelectedList(new (std::nothrow) ArrayList());
+ SysTryReturn(NID_WEB_CTRL, pSelectedList.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.",GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pSelectedList->Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ for (int index = 0; index < __pListView->GetItemCount(); index++)
+ {
+ if (__pListView->IsItemChecked(index))
+ {
+ std::unique_ptr<Integer> pIdxResult(new (std::nothrow) Integer(index));
+ SysTryReturn(NID_WEB_CTRL, pIdxResult.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.",GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pSelectedList->Add(*pIdxResult);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Memory Allocation failed.",GetErrorMessage(r));
+
+ pIdxResult.release();
+ }
+ }
+
+ return pSelectedList.release();
+}
+
+
+//IListViewItemProvider
+ListItemBase*
+_SelectBox::CreateItem(int index, int itemWidth)
+{
+ result r = E_SUCCESS;
+ int listItemXPos = 0;
+ int listItemYPos = 0;
+ int checkBoxWidth = 0;
+ int listItemHeight = 0;
+ int popupBetweenListNBtnGap = 0;
+
+ ListAnnexStyle subStyle = (__multiSelection) ? LIST_ANNEX_STYLE_MARK : LIST_ANNEX_STYLE_NORMAL;
+ ListAnnexStyle groupStyle = LIST_ANNEX_STYLE_NORMAL;
+
+ _ListElement* pListElement = static_cast< _ListElement* >(__listElementArray.GetAt(index));
+ SysTryReturn(NID_WEB_CTRL, pListElement, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ GET_SHAPE_CONFIG(CONTEXTMENU::LIST_ITEM_HEIGHT, __orientation, listItemHeight);
+ GET_SHAPE_CONFIG(LISTVIEW::ITEM_ELEMENT_LEFT_MARGIN, __orientation, listItemXPos);
+ GET_SHAPE_CONFIG(LIST::LIST_CHECK_ITEM_WIDTH, __orientation, checkBoxWidth);
+ GET_SHAPE_CONFIG(MESSAGEBOX::BUTTON_TOP_MARGIN, __orientation, popupBetweenListNBtnGap);
+
+ std::unique_ptr<CustomItem> pItem(new (std::nothrow) CustomItem());
+ SysTryReturn(NID_WEB_CTRL, pItem.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.",GetErrorMessage(E_OUT_OF_MEMORY));
+
+ int itemType = pListElement->ListElementGetItemType();
+ Rectangle popupRect = this->GetClientAreaBounds();
+
+ int listTxtMaxWidth = popupRect.width - listItemXPos - checkBoxWidth - popupBetweenListNBtnGap;
+
+ switch (itemType)
+ {
+ case LIST_ITEM_TYPE_NORMAL:
+ //fall through
+ case LIST_ITEM_TYPE_SUB:
+ r = pItem->Construct(Dimension(itemWidth, listItemHeight), subStyle);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+ break;
+
+ case LIST_ITEM_TYPE_GROUP:
+ SysLog(NID_WEB_CTRL, "The current value of index [%d] [%d]", index, pListElement->ListElementIsItemEnabled());
+ r = pItem->Construct(Dimension(itemWidth, listItemHeight), groupStyle);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+ break;
+
+ default:
+ return null;
+ }
+
+ String elementString = pListElement->ListElementGetString();
+
+ if (elementString.IsEmpty())
+ {
+ elementString.Append(L" ");
+ }
+
+ r = pItem->AddElement(Rectangle(listItemXPos, listItemYPos, listTxtMaxWidth, listItemHeight),
+ ID_FORMAT_STRING, elementString, true);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ if (IsMultiSelectable())
+ {
+ r = __pListView->SetItemChecked(index, pListElement->ListElementIsItemSelected());
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+
+ r = __pListView->SetItemEnabled(index, !(itemType == LIST_ITEM_TYPE_GROUP));
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return pItem.release();
+}
+
+
+bool
+_SelectBox::DeleteItem(int index, ListItemBase* pItem, int itemWidth)
+{
+ delete pItem;
+ pItem = null;
+
+ return true;
+}
+
+
+int
+_SelectBox::GetItemCount(void)
+{
+ return __listElementArray.GetCount();
+}
+
+
+void
+_SelectBox::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId, ListContextItemStatus state)
+{
+}
+
+
+void
+_SelectBox::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status)
+{
+ if (__multiSelection)
+ {
+ int pos = eina_inarray_search(__pToggledArray, &index, CompareChangedItems);
+
+ if (pos == POSITION_INVALID)
+ {
+ eina_inarray_push(__pToggledArray, &index);
+ }
+ else
+ {
+ eina_inarray_remove(__pToggledArray, &index);
+ }
+ }
+ else
+ {
+ //In case of single selection ... update the index.
+ if (__url.GetLength() == 0)
+ {
+ __SelectedIndex = index;
+ SysLog(NID_WEB_CTRL,"The current value of Update Selected index is %d",index);
+ if (__pWebView)
+ {
+ ewk_view_popup_menu_select(__pWebView, __SelectedIndex);
+ }
+ }
+ else
+ {
+ result r = E_SUCCESS;
+
+ RequestId reqId = 0;
+ DownloadRequest request(__url);
+
+ _DownloadManagerImpl* pManagerImpl = _DownloadManagerImpl::GetInstance();
+ SysTryReturnVoidResult(NID_WEB_CTRL, pManagerImpl, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ r = pManagerImpl->Start(request, reqId);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+
+ result r = HidePopup();
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pImpl->SendUserEvent(ID_USER_SCRIPT_SELECTBOX_CLOSE, null);
+ }
+}
+
+
+void
+_SelectBox::OnListViewItemSwept(ListView& listView, int index, SweepDirection direction)
+{
+
+}
+
+
+void
+_SelectBox::OnActionPerformed(const Control& source, int actionId)
+{
+ result r = HidePopup();
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ if (__url.GetLength() == 0)
+ {
+ switch (actionId)
+ {
+ case ID_BUTTON_SELECTION:
+ {
+ ewk_view_popup_menu_multiple_select(__pWebView, __pToggledArray);
+ break;
+ }
+ case ID_BUTTON_CANCEL:
+ {
+ if (__multiSelection)
+ {
+ ewk_view_popup_menu_multiple_select(__pWebView, null);
+ }
+ else
+ {
+ ewk_view_popup_menu_select(__pWebView, __prevIndex);
+ }
+ break;
+ }
+ default:
+ SysAssertf(false, "Invalid Action ID");
+ }
+ }
+
+ __pImpl->SendUserEvent(ID_USER_SCRIPT_SELECTBOX_CLOSE, null);
+}
+
+bool
+_SelectBox::OnKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
+{
+ return false;
+}
+
+bool
+_SelectBox::OnKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
+{
+ if ((keyEventInfo.GetKeyCode() == KEY_ESC || keyEventInfo.GetKeyCode() == KEY_BACK) && source.GetShowState() == true)
+ {
+ result r = HidePopup();
+ if (IsFailed(r))
+ {
+ SysLogException(NID_WEB_CTRL, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+
+ if (__url.GetLength() == 0)
+ {
+ if (__multiSelection)
+ {
+ ewk_view_popup_menu_multiple_select(__pWebView, null);
+ }
+ else
+ {
+ ewk_view_popup_menu_select(__pWebView, __prevIndex);
+ }
+ }
+
+ __pImpl->SendUserEvent(ID_USER_SCRIPT_SELECTBOX_CLOSE, null);
+ }
+
+ return false;
+}
+
+bool
+_SelectBox::OnPreviewKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
+{
+ return false;
+}
+
+bool
+_SelectBox::OnPreviewKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
+{
+ return false;
+}
+
+bool
+_SelectBox::TranslateKeyEventInfo(Control& source, KeyEventInfo& keyEventInfo)
+{
+ return false;
+}
+
+result
+_SelectBox::UpdateList(Eina_List* pItems, int prevIndex, bool clearPrevList, bool isGroupdList)
+{
+ SysTryReturnResult(NID_WEB_CTRL, __pListView, E_INVALID_STATE, "List View is in an invalid state");
+
+ if (clearPrevList)
+ {
+ __listElementArray.RemoveAll(true);
+ if (__multiSelection)
+ {
+ eina_inarray_flush(__pToggledArray);
+ }
+ }
+
+ //Create list required for selectBox
+ int itemCount = eina_list_count(pItems);
+ SysTryReturn(NID_WEB_CTRL, itemCount > 0, E_SYSTEM, E_SYSTEM, "[%s] A system error has been occurred. ItemCount is invalid.", GetErrorMessage(E_SYSTEM));
+
+ bool isSelected = false;
+
+ if (!__multiSelection)
+ {
+ __prevIndex = prevIndex;
+ }
+
+ for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
+ {
+ Ewk_Popup_Menu_Item* pItem = static_cast<Ewk_Popup_Menu_Item*>(eina_list_nth(pItems, itemIndex));
+ SysTryReturn(NID_WEB_CTRL, pItem, E_SYSTEM, E_SYSTEM, "[%s] A system error has been occurred. Failed to get item.", GetErrorMessage(E_SYSTEM));
+
+ if (ewk_popup_menu_item_type_get(pItem) == EWK_POPUP_MENU_ITEM)
+ {
+ String text(ewk_popup_menu_item_text_get(pItem));
+
+ if (__multiSelection)
+ {
+ isSelected = ( ewk_popup_menu_item_selected_get(pItem) == EINA_TRUE ) ? true : false;
+ }
+ else
+ {
+ isSelected = (itemIndex == prevIndex) ? true : false;
+ }
+
+ if (isGroupdList)
+ {
+ AddListItem(text, _SelectBox::LIST_ITEM_TYPE_GROUP, isSelected);
+ }
+ else
+ {
+ AddListItem(text, _SelectBox::LIST_ITEM_TYPE_NORMAL, isSelected);
+ }
+ }
+ }
+
+ int listItemHeight = 0;
+ GET_SHAPE_CONFIG(CONTEXTMENU::LIST_ITEM_HEIGHT, __orientation, listItemHeight);
+ int prevCount = (__pListView->GetSize()).height / listItemHeight;
+ int defaultCount = __multiSelection ? DEFAULT_LIST_ITEM_COUNT -1 : DEFAULT_LIST_ITEM_COUNT;
+
+ if ((prevCount != itemCount)
+ && ((prevCount < defaultCount && itemCount < defaultCount)
+ || (prevCount < defaultCount && itemCount >= defaultCount)
+ || (prevCount >= defaultCount && itemCount < defaultCount)))
+ {
+ int listViewNewHeight = ((itemCount < defaultCount) ? itemCount : defaultCount) * listItemHeight;
+ int popupHeight = __multiSelection ? (listViewNewHeight + __panelHeight) : listViewNewHeight;
+
+ __pListView->SetSize((__pListView->GetSize()).width, listViewNewHeight);
+ SetSize(GetSize().width, popupHeight);
+ }
+
+ __pListView->UpdateList();
+
+ return E_SUCCESS;
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_SelectBox.h
+ * @brief The file contains the declaration of _SelectBox class.
+ *
+ * The file contains the declaration of _SelectBox class.
+ */
+#ifndef _FWEB_CTRL_INTERNAL_SELECT_BOX_H_
+#define _FWEB_CTRL_INTERNAL_SELECT_BOX_H_
+
+#include <Evas.h>
+#include <FBaseColIList.h>
+#include <FBaseString.h>
+#include <FUiCtrlIListViewItemEventListener.h>
+#include <FUiCtrlIListViewItemProvider.h>
+#include <FUiIPropagatedKeyEventListener.h>
+#include <FUi_ControlManager.h>
+#include "FWebCtrl_WebPopup.h"
+#include "FWebCtrl_WebImpl.h"
+
+namespace Tizen { namespace Graphics
+{
+class Rectangle;
+}} // Tizen::Graphics
+
+namespace Tizen { namespace Ui
+{
+class IActionEventListener;
+}} // Tizen::Ui
+
+namespace Tizen { namespace Ui { namespace Controls
+{
+class Button;
+class GroupedList;
+class ListItemBase;
+class ListView;
+}}} // Tizen::Ui::Controls
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+enum _ButtonFormat
+{
+ ID_BUTTON_SELECTION = 5,
+ ID_BUTTON_CANCEL
+};
+
+class _SelectBox
+ : public _WebPopup
+ , public Tizen::Ui::Controls::IListViewItemEventListener
+ , public Tizen::Ui::Controls::IListViewItemProvider
+ , public Tizen::Ui::IPropagatedKeyEventListener
+{
+public:
+ /**
+ * Constructor
+ */
+ _SelectBox(void);
+
+ /**
+ * Destructor
+ */
+ virtual ~_SelectBox(void);
+
+ result Construct(Tizen::Web::Controls::_WebImpl* pImpl, bool isMultiSelect, const Tizen::Base::String& title, int listItemCnt, Evas_Object* pWebView = null, const Tizen::Base::String& url = L"");
+ Tizen::Base::Collection::IList* GetSelectedListN(void) const;
+
+ //IListViewItemProvider
+ virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth);
+ virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth);
+ virtual int GetItemCount(void);
+
+ // IListViewItemEventListener
+ virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state);
+ virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status);
+ virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction);
+
+ virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+
+ virtual bool OnKeyPressed (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
+ virtual bool OnKeyReleased (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
+ virtual bool OnPreviewKeyPressed (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
+ virtual bool OnPreviewKeyReleased (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
+ virtual bool TranslateKeyEventInfo (Tizen::Ui::Control &source, Tizen::Ui::KeyEventInfo &keyEventInfo);
+
+ result AddListItem(const Tizen::Base::String& itemText, int itemType,bool slected);
+ result UpdateList(Eina_List* pItems, int prevIndex, bool clearPrevList, bool isGroupdList);
+
+private:
+ /**
+ * This is the copy constructor for this class.
+ */
+ _SelectBox(const _SelectBox& source);
+
+ /**
+ * This is the assignment operator for this class.
+ */
+ _SelectBox& operator =(const _SelectBox& source);
+
+ bool IsMultiSelectable(void) const { return __multiSelection; }
+ void UpdateSelectionIndex(int index);
+ result CreateButtons(int btnHeight, int buttonGap);
+
+public:
+ static const int ID_FORMAT_STRING = 300;
+ static const int LIST_ITEM_TYPE_GROUP = 2;
+ static const int LIST_ITEM_TYPE_NORMAL = 1;
+ static const int LIST_ITEM_TYPE_SUB = 0;
+ static const int DEFAULT_LIST_ITEM_COUNT = 5;
+
+private:
+ Tizen::Base::Collection::ArrayList __listElementArray;
+ Tizen::Ui::Controls::ListView* __pListView;
+ Tizen::Web::Controls::_WebImpl* __pImpl;
+ bool __multiSelection;
+ int __SelectedIndex;
+ int __prevIndex;
+ int __panelHeight;
+ Tizen::Ui::_ControlOrientation __orientation;
+ Evas_Object* __pWebView;
+ Eina_Inarray* __pToggledArray;
+ Tizen::Base::String __url;
+}; // _SelectBox
+
+}}} //Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_SELECT_BOX_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_UserConfirmPopup.cpp
+ * @brief The file contains the definition of _UserConfirmPopup class.
+ */
+#include <EWebKit2.h>
+#include <FAppApp.h>
+#include <FBaseColArrayList.h>
+#include <FBaseSysLog.h>
+#include <FBaseUtilUri.h>
+#include <FGrpDimension.h>
+#include <FGrpFont.h>
+#include <FGrpRectangle.h>
+#include <FIoDbEnumerator.h>
+#include <FIoDbStatement.h>
+#include <FSecCertX509Certificate.h>
+#include <FUiCtrlButton.h>
+#include <FUiCtrlLabel.h>
+#include <FUiCtrlPanel.h>
+#include <FUiCtrlScrollPanel.h>
+#include <FUiKeyEventInfo.h>
+#include <FUiLayout.h>
+#include <FUiVerticalBoxLayout.h>
+#include <FGrp_TextTextObject.h>
+#include <FGrp_TextTextSimple.h>
+#include <FIo_DatabaseImpl.h>
+#include <FSys_SystemResource.h>
+#include <FUi_ControlManager.h>
+#include <FUi_ResourceManager.h>
+#include "FWebCtrl_WebManager.h"
+#include "FWebCtrl_UserConfirmPopup.h"
+#include "FWebCtrl_Utility.h"
+#include "FWebCtrl_WebImpl.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Base::Utility;
+using namespace Tizen::Graphics;
+using namespace Tizen::Graphics::_Text;
+using namespace Tizen::Io;
+using namespace Tizen::Security::Cert;
+using namespace Tizen::System;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+static const int TEXT_SIZE_ADJUST = 1;
+
+
+_UserConfirmPopup::_UserConfirmPopup(void)
+ : __pUserPolicyData(null)
+ , __userConfirmMode(USER_CONFIRM_USERMEDIA)
+ , __pCheckButton(null)
+ , __isUserActionNeeded(false)
+ , __sync(false)
+ , __pImpl(null)
+{
+}
+
+
+_UserConfirmPopup::~_UserConfirmPopup(void)
+{
+ if (__isUserActionNeeded == true)
+ {
+ HandleUserAction(EINA_FALSE);
+ __isUserActionNeeded = false;
+ }
+}
+
+
+result
+_UserConfirmPopup::Construct(_UserConfirmMode userConfirmMode, void* pEventInfo, Tizen::Web::Controls::_WebImpl* pImpl, bool sync, String msg)
+{
+ result r = E_SUCCESS;
+ SysTryReturnResult(NID_WEB_CTRL, pEventInfo, E_INVALID_ARG, "Invalid argument(s) is used. pPolicy is null.");
+ SysTryReturnResult(NID_WEB_CTRL, userConfirmMode >= USER_CONFIRM_USERMEDIA && userConfirmMode <= USER_CONFIRM_INDEXED_DB_QUOTA_EXCEDED, E_INVALID_ARG,
+ "Invalid userConfirmMode is used. [%d]", userConfirmMode);
+
+ _SystemResource* pSysResource = _SystemResource::GetInstance();
+ SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
+
+ _WebPopupData* pPopupData = _WebPopup::GetPopupData();
+ SysTryReturn(NID_WEB_CTRL, pPopupData, r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pUserPolicyData = pEventInfo;
+ __userConfirmMode = userConfirmMode;
+ __sync = sync;
+
+ __isUserActionNeeded = true;
+
+ bool hasTitle = true;
+ int popupMaxHeight = 2*pPopupData->labelDim.height + pPopupData->panelHeight;
+
+ __pImpl = pImpl;
+ SysAssertf(__pImpl != null, "Failed to get _WebImpl");
+
+ if (__userConfirmMode == USER_CONFIRM_GEOLOCATION)
+ {
+ popupMaxHeight += pPopupData->checkDim.height;
+ }
+
+ if (__userConfirmMode == USER_SCRIPT_ALERT)
+ {
+ hasTitle = false;
+ }
+
+ r = _WebPopup::Construct(hasTitle, Dimension(pPopupData->popupDim.width, popupMaxHeight));
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ if (userConfirmMode != USER_SCRIPT_ALERT)
+ {
+ SetTitleText(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_HEADER_SECURITY_WARNING_ABB"));
+ }
+
+ String message = L"";
+ if (userConfirmMode >= USER_SCRIPT_ALERT && userConfirmMode <= USER_CONFIRM_INDEXED_DB_QUOTA_EXCEDED)
+ {
+ message = msg;
+ }
+ else
+ {
+ message = GetMessageFromPolicy();
+ }
+
+ Rectangle rect(0, 0, 0, 0);
+
+ //label
+ rect.height = 2*pPopupData->labelDim.height;
+ rect.width = pPopupData->labelDim.width;
+
+ //With the font of label and width of label, required height is calculated
+ // using textobject. TEXT_SIZE_ADJUST is used to increase font size and get bigger height
+ // as the accurate height is not fitting text in some cases.
+ Font font;
+ r = font.Construct(FONT_STYLE_PLAIN, pPopupData->labelFontSize + TEXT_SIZE_ADJUST);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ std::unique_ptr<TextObject> pTextObject(new (std::nothrow) TextObject());
+ SysTryReturnResult(NID_WEB_CTRL, pTextObject.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ r = pTextObject->Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ std::unique_ptr<TextSimple> pSimpleText(new (std::nothrow) TextSimple(message.GetPointer(), message.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL, &font));
+ SysTryReturnResult(NID_WEB_CTRL, pSimpleText.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ r = pTextObject->AppendElement(*pSimpleText);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pSimpleText.release();
+
+ r = pTextObject->SetWrap(TEXT_OBJECT_WRAP_TYPE_WORD);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pTextObject->SetBounds(rect);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pTextObject->SetFont(&font, 0, message.GetLength());
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pTextObject->Compose();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ int labelHeight = pTextObject->GetTotalHeight();
+
+ std::unique_ptr<Label> pLabel(new (std::nothrow) Label());
+ SysTryReturnResult(NID_WEB_CTRL, pLabel.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ r = pLabel->Construct(rect, message);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pLabel->SetTextConfig(pPopupData->labelFontSize, LABEL_TEXT_STYLE_NORMAL);
+ pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+
+ Control* pInfoLabel = null;
+
+ if (rect.height < labelHeight)
+ {
+ //message text is bigger than label, scroll is created to accomodate it.
+ std::unique_ptr<ScrollPanel> pScrollPanel(new (std::nothrow) ScrollPanel());
+ SysTryReturnResult(NID_WEB_CTRL, pScrollPanel.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ r = pScrollPanel->Construct(rect);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = AddControl(*pScrollPanel);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ ScrollPanel* pSPanel = pScrollPanel.release();
+
+ r = pLabel->SetSize(Dimension(rect.width, labelHeight));
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pSPanel->AddControl(*pLabel);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pLabel.release();
+ pInfoLabel = pSPanel;
+ }
+ else
+ {
+ r = AddControl(*pLabel);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pInfoLabel = pLabel.release();
+ }
+
+ //checkbutton
+ if (__userConfirmMode == USER_CONFIRM_GEOLOCATION)
+ {
+ rect.y = 0;
+ rect.height = pPopupData->checkDim.height;
+
+ std::unique_ptr<CheckButton> pCheckButton (new (std::nothrow) CheckButton());
+ SysTryReturnResult(NID_WEB_CTRL, pCheckButton.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ r = pCheckButton->Construct(Rectangle(0, 0, rect.width, rect.height), CHECK_BUTTON_STYLE_MARK, BACKGROUND_STYLE_NONE, false, pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_REMEMBER_PREFERENCE"));
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = AddControl(*pCheckButton);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pCheckButton = pCheckButton.release();
+ }
+
+ Panel* pButtonPanel = CreateAndAddPanel();
+ SysTryReturn(NID_WEB_CTRL, pButtonPanel, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ ArrayList idList(SingleObjectDeleter);
+ r = idList.Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ ArrayList titleList(SingleObjectDeleter);
+ r = titleList.Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ if (userConfirmMode == USER_SCRIPT_ALERT)
+ {
+ idList.Add(*(new Integer(ID_BUTTON_USER_ALLOW)));
+ titleList.Add(*(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_OK"))));
+ }
+ else if (userConfirmMode == USER_BEFORE_UNLOAD_CONFIRM)
+ {
+ idList.Add(*(new Integer(ID_BUTTON_USER_CANCEL)));
+ idList.Add(*(new Integer(ID_BUTTON_USER_ALLOW)));
+ titleList.Add(*(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_LEAVE"))));
+ titleList.Add(*(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_STAY"))));
+ }
+ else
+ {
+ idList.Add(*(new Integer(ID_BUTTON_USER_CANCEL)));
+ idList.Add(*(new Integer(ID_BUTTON_USER_ALLOW)));
+ titleList.Add(*(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_CANCEL_ABB"))));
+ titleList.Add(*(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_CONTINUE_ABB"))));
+ }
+
+ r = CreateAndAddButtons(idList, titleList, pButtonPanel);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ std::unique_ptr<VerticalBoxLayout> pLayout(dynamic_cast< VerticalBoxLayout* >(GetLayoutN()));
+ SysTryReturn(NID_WEB_CTRL, pLayout.get(), r = GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ pLayout->SetHorizontalAlignment(*pInfoLabel, LAYOUT_HORIZONTAL_ALIGN_CENTER);
+ if (__userConfirmMode == USER_CONFIRM_GEOLOCATION)
+ {
+ pLayout->SetHorizontalAlignment(*__pCheckButton, LAYOUT_HORIZONTAL_ALIGN_CENTER);
+ }
+
+ SetPropagatedKeyEventListener(this);
+ return E_SUCCESS;
+}
+
+
+void
+_UserConfirmPopup::OnActionPerformed(const Control& source, int actionId)
+{
+ result r = E_SUCCESS;
+
+ switch (actionId)
+ {
+ case ID_BUTTON_USER_ALLOW:
+ HandleUserAction(EINA_TRUE);
+ break;
+
+ case ID_BUTTON_USER_CANCEL:
+ HandleUserAction(EINA_FALSE);
+ break;
+
+ default:
+ break;
+ }
+
+ r = HidePopup();
+ if (IsFailed(r))
+ {
+ SysLogException(NID_WEB_CTRL, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+
+ if (!__sync)
+ {
+ switch(__userConfirmMode)
+ {
+ case USER_CONFIRM_USERMEDIA:
+ {
+ __pImpl->SendUserEvent(ID_USER_CONFIRM_USERMEDIA_CLOSE, null);
+ break;
+ }
+ case USER_CONFIRM_GEOLOCATION:
+ {
+ __pImpl->SendUserEvent(ID_USER_CONFIRM_GEOLOCATION_CLOSE, null);
+ break;
+ }
+ case USER_CONFIRM_NOTIFICATION:
+ {
+ __pImpl->SendUserEvent(ID_USER_CONFIRM_NOTIFICATION_CLOSE, null);
+ break;
+ }
+ case USER_SCRIPT_ALERT:
+ {
+ __pImpl->SendUserEvent(ID_USER_SCRIPT_ALERT_CLOSE, null);
+ break;
+ }
+ case USER_SCRIPT_CONFIRM:
+ {
+ __pImpl->SendUserEvent(ID_USER_SCRIPT_CONFIRM_CLOSE, null);
+ break;
+ }
+ case USER_BEFORE_UNLOAD_CONFIRM:
+ {
+ __pImpl->SendUserEvent(ID_USER_BEFORE_UNLOAD_CONFIRM_CLOSE, null);
+ break;
+ }
+ default:
+ SysAssert(false);
+ }
+ }
+}
+
+
+String
+_UserConfirmPopup::GetMessageFromPolicy(void)
+{
+ _SystemResource* pSysResource = _SystemResource::GetInstance();
+ SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
+
+ String message;
+
+ switch(__userConfirmMode)
+ {
+ case USER_CONFIRM_USERMEDIA:
+ {
+ message = L"Do you want to allow acccess to media?\n";
+ break;
+ }
+ case USER_PROTOCOL_HANDLER:
+ {
+ Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(__pUserPolicyData);
+ SysAssertf(pHandlerData, "Failed to request");
+
+ String target(ewk_custom_handlers_data_target_get(pHandlerData));
+ String baseUri(ewk_custom_handlers_data_base_url_get(pHandlerData));
+
+ message = baseUri + String(L" is asking to register ") + target + String(L" protocol handler.");
+ break;
+ }
+ case USER_CONTENT_HANDLER:
+ {
+ Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(__pUserPolicyData);
+ SysAssertf(pHandlerData, "Failed to request");
+
+ String target(ewk_custom_handlers_data_target_get(pHandlerData));
+ String baseUri(ewk_custom_handlers_data_base_url_get(pHandlerData));
+
+ message = String(baseUri) + String(L" is asking to register ") + String(target) + String(L" content handler.");
+ break;
+ }
+ case USER_CONFIRM_GEOLOCATION:
+ {
+ Ewk_Geolocation_Permission_Request* pGeoLocPermReq = reinterpret_cast< Ewk_Geolocation_Permission_Request* >(__pUserPolicyData);
+ const Ewk_Security_Origin* pSecurityOrigin = ewk_geolocation_permission_request_origin_get(pGeoLocPermReq);
+
+ message = _Utility::CreateOrigin(pSecurityOrigin);
+ message.Append(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_PS_REQUESTS_YOUR_LOCATION"));
+ break;
+ }
+ case USER_CONFIRM_NOTIFICATION:
+ {
+ Ewk_Notification_Permission_Request* pPermissionRequest = reinterpret_cast< Ewk_Notification_Permission_Request* >(__pUserPolicyData);
+ const Ewk_Security_Origin* pSecurityOrigin = ewk_notification_permission_request_origin_get(pPermissionRequest);
+ message = _Utility::CreateOrigin(pSecurityOrigin);
+ message.Append(L" wants to display notifications");
+ break;
+ }
+ default:
+ SysAssert(false);
+ }
+
+ return message;
+}
+
+
+void
+_UserConfirmPopup::HandleUserAction(Eina_Bool allow)
+{
+ switch (__userConfirmMode)
+ {
+ case USER_CONFIRM_USERMEDIA:
+ {
+ Ewk_User_Media_Permission_Request* pPolicy = reinterpret_cast< Ewk_User_Media_Permission_Request* >(__pUserPolicyData);
+ ewk_user_media_permission_request_set(pPolicy, allow);
+ break;
+ }
+ case USER_PROTOCOL_HANDLER:
+ {
+ RegisterHandler(false, allow);
+ break;
+ }
+ case USER_CONTENT_HANDLER:
+ {
+ RegisterHandler(true, allow);
+ break;
+ }
+ case USER_CONFIRM_GEOLOCATION:
+ {
+ Ewk_Geolocation_Permission_Request* pPolicy = reinterpret_cast< Ewk_Geolocation_Permission_Request* >(__pUserPolicyData);
+ if (__pCheckButton->IsSelected())
+ {
+ result r = AddGeolocationDb(pPolicy, static_cast < bool >(allow));
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+CATCH:
+ ewk_geolocation_permission_request_set(pPolicy, allow);
+ break;
+ }
+ case USER_CONFIRM_NOTIFICATION:
+ {
+ Ewk_Notification_Permission_Request* pPermissionRequest = reinterpret_cast< Ewk_Notification_Permission_Request* >(__pUserPolicyData);
+ ewk_notification_permission_request_set(pPermissionRequest, allow);
+ break;
+ }
+ case USER_SCRIPT_ALERT:
+ {
+ Evas_Object* pView = reinterpret_cast< Evas_Object* >(__pUserPolicyData);
+ ewk_view_javascript_alert_reply(pView);
+ break;
+ }
+ case USER_SCRIPT_CONFIRM:
+ {
+ Evas_Object* pView = reinterpret_cast< Evas_Object* >(__pUserPolicyData);
+ ewk_view_javascript_confirm_reply(pView, allow);
+ break;
+ }
+ case USER_BEFORE_UNLOAD_CONFIRM:
+ {
+ Evas_Object* pView = reinterpret_cast< Evas_Object* >(__pUserPolicyData);
+ ewk_view_before_unload_confirm_panel_reply(pView, !allow);
+ break;
+ }
+ case USER_CONFIRM_APP_CACHE:
+ {
+ Evas_Object *pObj = reinterpret_cast< Evas_Object* >(__pUserPolicyData);
+ ewk_view_application_cache_permission_reply(pObj, allow);
+ break;
+ }
+ case USER_CONFIRM_DB_QUOTA_EXCEDED:
+ {
+ Evas_Object *pObj = reinterpret_cast< Evas_Object* >(__pUserPolicyData);
+ ewk_view_exceeded_database_quota_reply(pObj, allow);
+ break;
+ }
+ case USER_CONFIRM_LOCAL_FS_QUOTA_EXCEDED:
+ {
+ Evas_Object *pObj = reinterpret_cast< Evas_Object* >(__pUserPolicyData);
+ ewk_view_exceeded_local_file_system_quota_reply(pObj, allow);
+ break;
+ }
+ case USER_CONFIRM_INDEXED_DB_QUOTA_EXCEDED:
+ {
+ Evas_Object *pObj = reinterpret_cast< Evas_Object* >(__pUserPolicyData);
+ ewk_view_exceeded_indexed_database_quota_reply(pObj, allow);
+ break;
+ }
+ default:
+ SysAssert(false);
+ }
+ __isUserActionNeeded = false;
+}
+
+
+result
+_UserConfirmPopup::AddGeolocationDb(Ewk_Geolocation_Permission_Request* pPolicy, bool enable)
+{
+ _DatabaseImpl db;
+ String geolocationPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
+ String table(GEOLOCATION_TABLE_NAME);
+
+ const Ewk_Security_Origin* pSecurityOrigin = ewk_geolocation_permission_request_origin_get(pPolicy);
+ String origin = _Utility::CreateOrigin(pSecurityOrigin);
+
+ result r = db.Construct(geolocationPath, "r+", null);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ std::unique_ptr<DbStatement> pStmt(db.CreateStatementN(L"Insert Into " + table + L" (origin, permission) Values (?, ?)"));
+ SysTryReturn(NID_WEB_CTRL, pStmt.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ SysLog(NID_WEB_CTRL, "The current value of stmt is %u, host is %ls", pStmt.get(), origin.GetPointer());
+
+ pStmt->BindString(0, origin);
+ pStmt->BindInt(1, static_cast < int >(enable));
+
+ db.BeginTransaction();
+
+ std::unique_ptr<DbEnumerator> pEnum(db.ExecuteStatementN(*pStmt));
+
+ db.CommitTransaction();
+
+ return E_SUCCESS;
+}
+
+
+void
+_UserConfirmPopup::RegisterHandler(bool checkHandler, Eina_Bool allow)
+{
+ _DatabaseImpl db;
+ String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
+ String table;
+ int checkId = 0;
+
+ if(checkHandler == true)
+ {
+ table = CUSTOM_CONTENT_TABLE_NAME;
+ }
+ else
+ {
+ table = CUSTOM_PROTOCOL_TABLE_NAME;
+ }
+ Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(__pUserPolicyData);
+ SysAssertf(pHandlerData, "Failed to request");
+
+ String baseUri(ewk_custom_handlers_data_base_url_get(pHandlerData));
+ String uri = ewk_custom_handlers_data_url_get(pHandlerData);
+ String target = ewk_custom_handlers_data_target_get(pHandlerData);
+
+ result r = db.Construct(handlerPath, "r+", null);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ std::unique_ptr<DbEnumerator> pEnum(db.QueryN(L"Select id From " + table + L" Where baseUrl = '" + baseUri + L"' AND url = '" + uri + L"' AND mime = '" + target + L"'"));
+
+ if(pEnum.get())
+ {
+ pEnum->MoveNext();
+ pEnum->GetIntAt(0, checkId);
+
+ std::unique_ptr<DbStatement> pUpdateStmt(db.CreateStatementN(L"Update " + table + L" Set allow = (?) Where id = (?)"));
+ SysTryReturnVoidResult(NID_WEB_CTRL, pUpdateStmt.get(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ pUpdateStmt->BindInt(0, static_cast < int >(allow));
+ pUpdateStmt->BindInt(1, checkId);
+
+ db.BeginTransaction();
+
+ std::unique_ptr<DbEnumerator> pEnum(db.ExecuteStatementN(*pUpdateStmt));
+
+ db.CommitTransaction();
+
+ }
+ else
+ {
+ std::unique_ptr<DbStatement> pStmt(db.CreateStatementN(L"Insert Into " + table + L" (baseUrl, url, mime, allow) Values (?, ?, ?, ?)"));
+ SysTryReturnVoidResult(NID_WEB_CTRL, pStmt.get(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ pStmt->BindString(0, baseUri);
+ pStmt->BindString(1, uri);
+ pStmt->BindString(2, target);
+ pStmt->BindInt(3, static_cast < int >(allow));
+
+ db.BeginTransaction();
+
+ std::unique_ptr<DbEnumerator> pRegisterEnum(db.ExecuteStatementN(*pStmt));
+
+ db.CommitTransaction();
+ }
+}
+
+bool
+_UserConfirmPopup::OnKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
+{
+ return false;
+}
+
+bool
+_UserConfirmPopup::OnKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
+{
+ result r = E_SUCCESS;
+ if ((keyEventInfo.GetKeyCode() == KEY_ESC || keyEventInfo.GetKeyCode() == KEY_BACK) && source.GetShowState() == true)
+ {
+ HandleUserAction(EINA_FALSE);
+ r = HidePopup();
+
+ if (IsFailed(r))
+ {
+ SysLogException(NID_WEB_CTRL, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+
+ switch (__userConfirmMode)
+ {
+ case USER_CONFIRM_USERMEDIA:
+ {
+ __pImpl->SendUserEvent(ID_USER_CONFIRM_USERMEDIA_CLOSE, null);
+ break;
+ }
+ case USER_CONFIRM_GEOLOCATION:
+ {
+ __pImpl->SendUserEvent(ID_USER_CONFIRM_GEOLOCATION_CLOSE, null);
+ break;
+ }
+ case USER_CONFIRM_NOTIFICATION:
+ {
+ __pImpl->SendUserEvent(ID_USER_CONFIRM_NOTIFICATION_CLOSE, null);
+ break;
+ }
+ case USER_SCRIPT_ALERT:
+ {
+ __pImpl->SendUserEvent(ID_USER_SCRIPT_ALERT_CLOSE, null);
+ break;
+ }
+ case USER_SCRIPT_CONFIRM:
+ {
+ __pImpl->SendUserEvent(ID_USER_SCRIPT_CONFIRM_CLOSE, null);
+ break;
+ }
+ case USER_BEFORE_UNLOAD_CONFIRM:
+ {
+ __pImpl->SendUserEvent(ID_USER_BEFORE_UNLOAD_CONFIRM_CLOSE, null);
+ break;
+ }
+ case USER_PROTOCOL_HANDLER:
+ case USER_CONTENT_HANDLER:
+ case USER_CONFIRM_APP_CACHE:
+ case USER_CONFIRM_DB_QUOTA_EXCEDED:
+ case USER_CONFIRM_LOCAL_FS_QUOTA_EXCEDED:
+ case USER_CONFIRM_INDEXED_DB_QUOTA_EXCEDED:
+ break;
+ default:
+ SysAssert(false);
+ }
+ }
+ return false;
+}
+
+bool
+_UserConfirmPopup::OnPreviewKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
+{
+ return false;
+}
+
+bool
+_UserConfirmPopup::OnPreviewKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
+{
+ return false;
+}
+
+bool
+_UserConfirmPopup::TranslateKeyEventInfo(Control& source, KeyEventInfo& keyEventInfo)
+{
+ return false;
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FWebCtrl_Utility.cpp\r
+ * @brief The file contains the definition of _Utility class.\r
+ *\r
+ * The file contains the definition of _Utility class.\r
+ */\r
+\r
+#include <Ecore.h>\r
+#include <FAppUiApp.h>\r
+#include <FAppIAppFrame.h>\r
+#include <FBaseSysLog.h>\r
+#include <FApp_AppInfo.h>\r
+#include <FUiAnim_EflNode.h>\r
+#include <FUiAnim_VisualElementImpl.h>\r
+#include <FUiCtrlFrame.h>\r
+#include <FUi_ControlImpl.h>\r
+#include "FWebCtrl_Utility.h"\r
+\r
+using namespace Tizen::App;\r
+using namespace Tizen::Base;\r
+using namespace Tizen::Graphics;\r
+using namespace Tizen::Ui;\r
+using namespace Tizen::Ui::Controls;\r
+using namespace Tizen::Ui::Animations;\r
+\r
+namespace Tizen { namespace Web { namespace Controls\r
+{\r
+\r
+\r
+static const float SEVICE_APP_FRAME_SIZE = 200;\r
+\r
+\r
+_Utility::_Utility(void)\r
+{\r
+}\r
+\r
+_Utility::~_Utility(void)\r
+{\r
+}\r
+\r
+\r
+Evas*\r
+_Utility::GetEvasFromUiApp(Tizen::Ui::Controls::Frame* pTempFrame)\r
+{\r
+ Frame* pFrame = null;\r
+ Evas* pEvas = null;\r
+ if (_AppInfo::GetAppType() == _APP_TYPE_UI_APP)\r
+ {\r
+ IAppFrame* pAppFrame = Application::GetInstance()->GetAppFrame();\r
+ SysTryReturn(NID_WEB_CTRL, pAppFrame, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));\r
+\r
+ pFrame = pAppFrame->GetFrame();\r
+ SysTryReturn(NID_WEB_CTRL, pFrame, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); \r
+ }\r
+ else\r
+ {\r
+ pFrame = new (std::nothrow) Frame();\r
+ pFrame->Construct(Rectangle(0, 0, SEVICE_APP_FRAME_SIZE, SEVICE_APP_FRAME_SIZE)); \r
+\r
+ pTempFrame = pFrame;\r
+ }\r
+\r
+ _ControlImpl* pControlimpl = _ControlImpl::GetInstance(*pFrame);\r
+ SysTryReturn(NID_WEB_CTRL, pControlimpl, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));\r
+\r
+ VisualElement* pVisual = pControlimpl->GetCore().GetVisualElement();\r
+ SysTryReturn(NID_WEB_CTRL, pVisual, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));\r
+\r
+ _VisualElementImpl* pWebVisualElementImpl = _VisualElementImpl::GetInstance(*pVisual);\r
+ SysTryReturn(NID_WEB_CTRL,pWebVisualElementImpl, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));\r
+\r
+ _EflNode* pEflNode = dynamic_cast< _EflNode* >(pWebVisualElementImpl->GetNativeNode());\r
+ SysTryReturn(NID_WEB_CTRL, pEflNode, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));\r
+\r
+ pEvas = pEflNode->GetEvas();\r
+ SysTryReturn(NID_WEB_CTRL, pEvas, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));\r
+\r
+ return pEvas;\r
+}\r
+\r
+\r
+result\r
+_Utility::GetPixelBufferFromEvasObject(const Evas_Object* source, Tizen::Graphics::BufferInfo& bufferInfo)\r
+{\r
+ bufferInfo.pPixels = evas_object_image_data_get(source, EINA_FALSE);\r
+ SysTryReturnResult(NID_WEB_CTRL, bufferInfo.pPixels, E_INVALID_DATA, "Failed to get pixel data from evas object.");\r
+\r
+ evas_object_image_size_get(source, &bufferInfo.width, &bufferInfo.height);\r
+\r
+ Evas_Colorspace colorSpace = evas_object_image_colorspace_get(source);\r
+\r
+ switch (colorSpace)\r
+ {\r
+ case EVAS_COLORSPACE_ARGB8888:\r
+ bufferInfo.bitsPerPixel = 32;\r
+ bufferInfo.pixelFormat = PIXEL_FORMAT_ARGB8888;\r
+ break;\r
+\r
+ case EVAS_COLORSPACE_YCBCR422P601_PL:\r
+ bufferInfo.bitsPerPixel = 0;\r
+ bufferInfo.pixelFormat = PIXEL_FORMAT_MIN;\r
+ break;\r
+\r
+ case EVAS_COLORSPACE_YCBCR422P709_PL:\r
+ bufferInfo.bitsPerPixel = 0;\r
+ bufferInfo.pixelFormat = PIXEL_FORMAT_MIN;\r
+ break;\r
+\r
+ case EVAS_COLORSPACE_RGB565_A5P:\r
+ bufferInfo.bitsPerPixel = 0;\r
+ bufferInfo.pixelFormat = PIXEL_FORMAT_MIN;\r
+ break;\r
+\r
+ case EVAS_COLORSPACE_GRY8:\r
+ bufferInfo.bitsPerPixel = 0;\r
+ bufferInfo.pixelFormat = PIXEL_FORMAT_MIN;\r
+ break;\r
+\r
+ case EVAS_COLORSPACE_YCBCR422601_PL:\r
+ bufferInfo.bitsPerPixel = 0;\r
+ bufferInfo.pixelFormat = PIXEL_FORMAT_MIN;\r
+ break;\r
+\r
+ case EVAS_COLORSPACE_YCBCR420NV12601_PL:\r
+ bufferInfo.bitsPerPixel = 0;\r
+ bufferInfo.pixelFormat = PIXEL_FORMAT_MIN;\r
+ break;\r
+\r
+ case EVAS_COLORSPACE_YCBCR420TM12601_PL:\r
+ bufferInfo.bitsPerPixel = 0;\r
+ bufferInfo.pixelFormat = PIXEL_FORMAT_MIN;\r
+ break;\r
+\r
+ default:\r
+ bufferInfo.bitsPerPixel = 0;\r
+ bufferInfo.pixelFormat = PIXEL_FORMAT_MIN;\r
+ break;\r
+ }\r
+\r
+ bufferInfo.pitch = bufferInfo.width * bufferInfo.bitsPerPixel / 8;\r
+\r
+ SysLog(NID_WEB_CTRL, "color space : %d, pitch (%d), w-h (%d, %d)", colorSpace, bufferInfo.pitch, bufferInfo.width, bufferInfo.height);\r
+\r
+ return E_SUCCESS;\r
+}\r
+\r
+\r
+String\r
+_Utility::CreateOrigin(const Ewk_Security_Origin* pSecurityOrigin)\r
+{\r
+ String protocol(ewk_security_origin_protocol_get(pSecurityOrigin));\r
+ String host(ewk_security_origin_host_get(pSecurityOrigin));\r
+ int port = ewk_security_origin_port_get(pSecurityOrigin);\r
+\r
+ String origin = protocol + L"://" + host;\r
+\r
+ if (port)\r
+ {\r
+ origin.Append(L":");\r
+ origin.Append(port);\r
+ }\r
+\r
+ SysLog(NID_WEB_CTRL, "The current value of origin is %ls", origin.GetPointer());\r
+\r
+ return origin;\r
+}\r
+\r
+\r
+}}}\r
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FWebCtrl_Utility.h\r
+ * @brief The file contains the declaration of _Utility class.\r
+ *\r
+ * The file contains the declaration of _EflWebkit class.\r
+ */\r
+#ifndef _FWEB_CTRL_INTERNAL_UTILITY_H_\r
+#define _FWEB_CTRL_INTERNAL_UTILITY_H_\r
+\r
+#include <EWebKit2.h>\r
+#include <Evas.h>\r
+#include <FGrpBufferInfo.h>\r
+\r
+namespace Tizen { namespace Ui { namespace Controls\r
+{\r
+class Frame;\r
+}}}\r
+\r
+namespace Tizen { namespace Web { namespace Controls\r
+{\r
+\r
+class _Utility\r
+{\r
+public:\r
+ static Evas* GetEvasFromUiApp(Tizen::Ui::Controls::Frame* pTempFrame);\r
+\r
+ static result GetPixelBufferFromEvasObject(const Evas_Object* source, Tizen::Graphics::BufferInfo& bufferInfo);\r
+\r
+ static Tizen::Base::String CreateOrigin(const Ewk_Security_Origin* pSecurityOrigin);\r
+\r
+private:\r
+ _Utility(void);\r
+ \r
+ virtual ~_Utility(void);\r
+}; \r
+\r
+}}} // Tizen::Web::Controls\r
+#endif \r
+\r
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_Web.cpp
+ * @brief The file contains the definition of _Web class.
+ *
+ * The file contains the definition of _Web class.
+ */
+#include <Ecore_X.h>
+#include <Elementary.h>
+#include <memory>
+#include <FBaseByteBuffer.h>
+#include <FBaseColLinkedListT.h>
+#include <FBaseSysLog.h>
+#include <FBaseColIListT.h>
+#include <FGrpFloatPoint.h>
+#include <FGrpPoint.h>
+#include <FGrpBitmap.h>
+#include <FGrpCanvas.h>
+#include <FGrpFloatRectangle.h>
+#include <FSysVibrator.h>
+#include <FWebCtrlWebSetting.h>
+#include <FGrp_CoordinateSystem.h>
+#include <FSys_VibratorImpl.h>
+#include <FUiAnim_EflNode.h>
+#include <FUiAnim_VisualElement.h>
+#include <FUiAnim_VisualElementImpl.h>
+#include <FUi_CoordinateSystemUtils.h>
+#include <FUi_AccessibilityContainer.h>
+#include <FUi_AccessibilityElement.h>
+#include <FUi_UiEventManager.h>
+#include <FUi_IAccessibilityFocusHandler.h>
+#include <FUi_IAccessibilityListener.h>
+#include <FUi_Math.h>
+#include <FUi_TouchManager.h>
+#include "FWebCtrl_EflWebkit.h"
+#include "FWebCtrl_GestureState.h"
+#include "FWebCtrl_Web.h"
+#include "FWebCtrl_WebSettingImpl.h"
+#include "FWebCtrl_Utility.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Animations;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+class _WebAccessibilityListener
+ : public Tizen::Ui::_IAccessibilityListener
+{
+public:
+ _WebAccessibilityListener(Evas_Object* pView);
+
+ virtual ~_WebAccessibilityListener(void);
+
+ virtual bool OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+
+ virtual bool OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+
+ virtual bool OnAccessibilityReadingElement(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+
+ virtual bool OnAccessibilityReadElement(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+
+ virtual bool OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+
+ virtual bool OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+
+ virtual bool OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+
+ virtual bool OnAccessibilityValueIncreased(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+
+ virtual bool OnAccessibilityValueDecreased(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+
+private:
+ Evas_Object* __pView;
+};
+
+
+_WebAccessibilityListener::_WebAccessibilityListener(Evas_Object* pView)
+ : __pView(pView)
+{
+}
+
+
+_WebAccessibilityListener::~_WebAccessibilityListener(void)
+{
+}
+
+
+bool
+_WebAccessibilityListener::OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return true;
+}
+
+
+bool
+_WebAccessibilityListener::OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return true;
+}
+
+
+bool
+_WebAccessibilityListener::OnAccessibilityReadingElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return true;
+}
+
+
+bool
+_WebAccessibilityListener::OnAccessibilityReadElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return true;
+}
+
+
+bool
+_WebAccessibilityListener::OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return true;
+}
+
+
+bool
+_WebAccessibilityListener::OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ Ewk_View_Smart_Data* pSmartData = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(__pView));
+ SysAssertf(pSmartData, "Failed to get webkit smart data.");
+
+ Elm_Access_Action_Info* pActionInfo = new Elm_Access_Action_Info();
+ SysTryReturn(NID_WEB_CTRL, pActionInfo, false, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ bool result = false;
+
+ pActionInfo->action_type = ELM_ACCESS_ACTION_UNHIGHLIGHT;
+
+ result = pSmartData->api->screen_reader_action_execute(pSmartData, pActionInfo);
+ delete pActionInfo;
+
+ return result;
+}
+
+
+bool
+_WebAccessibilityListener::OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ Ewk_View_Smart_Data* pSmartData = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(__pView));
+ SysAssertf(pSmartData, "Failed to get webkit smart data.");
+
+ Elm_Access_Action_Info* pActionInfo = new Elm_Access_Action_Info();
+ SysTryReturn(NID_WEB_CTRL, pActionInfo, false, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ bool result = false;
+
+ pActionInfo->action_type = ELM_ACCESS_ACTION_ACTIVATE;
+
+ result = pSmartData->api->screen_reader_action_execute(pSmartData, pActionInfo);
+ delete pActionInfo;
+
+ return result;
+}
+
+
+bool
+_WebAccessibilityListener::OnAccessibilityValueIncreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return true;
+}
+
+
+bool
+_WebAccessibilityListener::OnAccessibilityValueDecreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return true;
+}
+
+
+class _WebAccessibilityFocusHandler
+ : public Tizen::Ui::_IAccessibilityFocusHandler
+{
+public:
+ _WebAccessibilityFocusHandler(Evas_Object* pView);
+
+ virtual ~_WebAccessibilityFocusHandler(void);
+
+ virtual bool OnMoveFocus(Tizen::Ui::_AccessibilityFocusDirection direction);
+
+ virtual bool OnMoveFocus(const Tizen::Graphics::Point& point);
+
+private:
+ Evas_Object* __pView;
+};
+
+
+_WebAccessibilityFocusHandler::_WebAccessibilityFocusHandler(Evas_Object* pView)
+ : __pView(pView)
+{
+}
+
+
+_WebAccessibilityFocusHandler::~_WebAccessibilityFocusHandler(void)
+{
+}
+
+
+bool
+_WebAccessibilityFocusHandler::OnMoveFocus(Tizen::Ui::_AccessibilityFocusDirection direction)
+{
+ Ewk_View_Smart_Data* pSmartData = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(__pView));
+ SysAssertf(pSmartData, "Failed to get webkit smart data.");
+
+ Elm_Access_Action_Info* pActionInfo = new Elm_Access_Action_Info();
+ SysTryReturn(NID_WEB_CTRL, pActionInfo, false, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ bool result = false;
+
+ if (direction == Tizen::Ui::_ACCESSIBILITY_FOCUS_DIRECTION_PREVIOUS)
+ {
+ pActionInfo->action_type = ELM_ACCESS_ACTION_HIGHLIGHT;
+
+ pActionInfo->action_by = ELM_ACCESS_ACTION_HIGHLIGHT_PREV;
+
+ result = pSmartData->api->screen_reader_action_execute(pSmartData, pActionInfo);
+ }
+ else if (direction == Tizen::Ui::_ACCESSIBILITY_FOCUS_DIRECTION_NEXT)
+ {
+ pActionInfo->action_type = ELM_ACCESS_ACTION_HIGHLIGHT;
+
+ pActionInfo->action_by = ELM_ACCESS_ACTION_HIGHLIGHT_NEXT;
+
+ result = pSmartData->api->screen_reader_action_execute(pSmartData, pActionInfo);
+ }
+ delete pActionInfo;
+
+ return result;
+}
+
+
+bool
+_WebAccessibilityFocusHandler::OnMoveFocus(const Tizen::Graphics::Point& point)
+{
+ Ewk_View_Smart_Data* pSmartData = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(__pView));
+ SysAssertf(pSmartData, "Failed to get webkit smart data.");
+
+ Elm_Access_Action_Info* pActionInfo = new Elm_Access_Action_Info();
+ SysTryReturn(NID_WEB_CTRL, pActionInfo, false, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ bool result = false;
+
+ pActionInfo->action_type = ELM_ACCESS_ACTION_READ;
+ pActionInfo->x = point.x;
+ pActionInfo->y = point.y;
+
+ result = pSmartData->api->screen_reader_action_execute(pSmartData, pActionInfo);
+ delete pActionInfo;
+
+ return result;
+}
+
+
+void
+OnEdgeLeft(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _Web* pCore = reinterpret_cast< _Web* >(pUserData);
+ SysAssertf(pCore, "Failed to request");
+
+ pCore->SetEdgeReachedEvent(WEB_EDGE_LEFT);
+}
+
+
+void
+OnEdgeRight(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _Web* pCore = reinterpret_cast< _Web* >(pUserData);
+ SysAssertf(pCore, "Failed to request");
+
+ pCore->SetEdgeReachedEvent(WEB_EDGE_RIGHT);
+}
+
+
+void
+OnEdgeTop(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _Web* pCore = reinterpret_cast< _Web* >(pUserData);
+ SysAssertf(pCore, "Failed to request");
+
+ pCore->SetEdgeReachedEvent(WEB_EDGE_TOP);
+}
+
+
+void
+OnEdgeBottom(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _Web* pCore = reinterpret_cast< _Web* >(pUserData);
+ SysAssertf(pCore, "Failed to request");
+
+ pCore->SetEdgeReachedEvent(WEB_EDGE_BOTTOM);
+}
+
+
+_Web::_Web(void)
+ : __pGestureHandler(null)
+ , __pEflWebkit(null)
+ , __pWebSetting(null)
+ , __pGestureFlick(null)
+ , __pGestureLongPress(null)
+ , __pGesturePinch(null)
+ , __pGestureDoubleTap(null)
+ , __pTouchEventInfoList(null)
+ , __pTapGestureHandler(null)
+ , __pPanningGestureHandler(null)
+ , __pFlickGestureHandler(null)
+ , __pPinchGestureHandler(null)
+ , __pWebAccessibilityListener(null)
+ , __pWebAccessibilityFocusHandler(null)
+ , __gestureType(WEB_GESTURE_TYPE_TAP)
+ , __edgeType(WEB_EDGE_NONE)
+ , __focus(false)
+ , __pTextElement(null)
+ , __previousTouchedPosition(0.0f, 0.0f)
+ , __isFullScreenEntered(false)
+ , __isRotated(false)
+ , __touchPressed(false)
+{
+ SetBackgroundColor(Color(0, 0, 0, 0));
+}
+
+
+_Web::~_Web(void)
+{
+ RemoveGestureListener();
+
+ _AccessibilityContainer* pContainer = GetAccessibilityContainer();
+ if (pContainer)
+ {
+ pContainer->RemoveListener(*dynamic_cast<_IAccessibilityListener*>(__pWebAccessibilityListener.get()));
+ pContainer->SetFocusHandler(null);
+ }
+}
+
+
+_Web*
+_Web::CreateWebN(void)
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr<_Web> pWeb(new (std::nothrow) _Web());
+ SysTryReturn(NID_WEB_CTRL, pWeb.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ pWeb->__pWebSetting = std::unique_ptr<WebSetting>(new (std::nothrow) WebSetting());
+ SysTryReturn(NID_WEB_CTRL, pWeb->__pWebSetting.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ pWeb->AcquireHandle();
+ pWeb->SetMultiTouchEnabled(true);
+ pWeb->SetTouchPressThreshold(0.08);
+
+ r = pWeb->AddGestureListeners();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pWeb->InitializeGestureStates();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return pWeb.release();
+}
+
+
+result
+_Web::CreateWebkitEvasObject(void)
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr<_EflWebkit> pEflWebkit(new (std::nothrow) _EflWebkit());
+ SysTryReturnResult(NID_WEB_CTRL, pEflWebkit.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ _VisualElement* pVe = GetVisualElement();
+ r = pEflWebkit->Construct(GetAbsoluteBounds(), *pVe, this);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ _VisualElementImpl* pVeImpl = _VisualElementImpl::GetInstance(*pVe);
+ pVeImpl->SetCaptureProvider(this);
+
+ __pEflWebkit = std::move(pEflWebkit);
+
+ Evas_Object* pView = GetWebNativeNode();
+ evas_object_smart_callback_add(pView, "edge,left", OnEdgeLeft, this);
+ evas_object_smart_callback_add(pView, "edge,right", OnEdgeRight, this);
+ evas_object_smart_callback_add(pView, "edge,top", OnEdgeTop, this);
+ evas_object_smart_callback_add(pView, "edge,bottom", OnEdgeBottom, this);
+
+ return E_SUCCESS;
+}
+
+
+result
+_Web::InitializeGestureStates(void)
+{
+ __pPinchGestureHandler = std::unique_ptr<_PinchGestureState>(new (std::nothrow) _PinchGestureState(this));
+ SysTryReturnResult(NID_WEB_CTRL, __pPinchGestureHandler.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ __pTapGestureHandler = std::unique_ptr<_TapGestureState>(new (std::nothrow) _TapGestureState(this));
+ SysTryReturnResult(NID_WEB_CTRL, __pTapGestureHandler.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ __pPanningGestureHandler = std::unique_ptr<_PanningGestureState>(new (std::nothrow) _PanningGestureState(this));
+ SysTryReturnResult(NID_WEB_CTRL, __pPanningGestureHandler.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ __pFlickGestureHandler = std::unique_ptr<_FlickGestureState>(new (std::nothrow) _FlickGestureState(this));
+ SysTryReturnResult(NID_WEB_CTRL, __pFlickGestureHandler.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ __pGestureHandler = __pTapGestureHandler.get();
+
+ return E_SUCCESS;
+}
+
+
+result
+_Web::AddGestureListeners(void)
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr<_TouchFlickGestureDetector> pGestureFlick(new (std::nothrow) _TouchFlickGestureDetector());
+ SysTryReturnResult(NID_WEB_CTRL, pGestureFlick.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pGestureFlick->AddGestureListener(*this);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = AddGestureDetector(*pGestureFlick.get());
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pGestureFlick = std::move(pGestureFlick);
+
+ std::unique_ptr<_TouchLongPressGestureDetector> pGestureLongPress(new (std::nothrow) _TouchLongPressGestureDetector());
+ SysTryReturnResult(NID_WEB_CTRL, pGestureLongPress.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pGestureLongPress->AddGestureListener(*this);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = AddGestureDetector(*pGestureLongPress.get());
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pGestureLongPress = std::move(pGestureLongPress);
+
+ std::unique_ptr<_TouchTapGestureDetector> pGestureDoubleTap(new (std::nothrow) _TouchTapGestureDetector());
+ SysTryReturnResult(NID_WEB_CTRL, pGestureDoubleTap.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pGestureDoubleTap->AddGestureListener(*this);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = AddGestureDetector(*pGestureDoubleTap.get());
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pGestureDoubleTap = std::move(pGestureDoubleTap);
+
+ std::unique_ptr<_TouchPinchGestureDetector> pGesturePinch(new (std::nothrow) _TouchPinchGestureDetector());
+ SysTryReturnResult(NID_WEB_CTRL, pGesturePinch.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pGesturePinch->AddGestureListener(*this);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = AddGestureDetector(*pGesturePinch.get());
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pGesturePinch = std::move(pGesturePinch);
+
+ return E_SUCCESS;
+}
+
+
+void
+_Web::RemoveGestureListener(void)
+{
+ if (__pGestureFlick.get())
+ {
+ __pGestureFlick->RemoveGestureListener(*this);
+ RemoveGestureDetector(*__pGestureFlick);
+ }
+
+ if (__pGestureLongPress.get())
+ {
+ __pGestureLongPress->RemoveGestureListener(*this);
+ RemoveGestureDetector(*__pGestureLongPress);
+ }
+
+ if (__pGestureDoubleTap.get())
+ {
+ __pGestureDoubleTap->RemoveGestureListener(*this);
+ RemoveGestureDetector(*__pGestureDoubleTap);
+ }
+
+ if (__pGesturePinch.get())
+ {
+ __pGesturePinch->RemoveGestureListener(*this);
+ RemoveGestureDetector(*__pGesturePinch);
+ }
+
+ Evas_Object* pView = GetWebNativeNode();
+ if (pView)
+ {
+ evas_object_smart_callback_del(pView, "edge,left", OnEdgeLeft);
+ evas_object_smart_callback_del(pView, "edge,right", OnEdgeRight);
+ evas_object_smart_callback_del(pView, "edge,top", OnEdgeTop);
+ evas_object_smart_callback_del(pView, "edge,bottom", OnEdgeBottom);
+ }
+}
+
+
+result
+_Web::InitializeWebNativeNode(void)
+{
+ result r = E_SUCCESS;
+
+ r = CreateWebkitEvasObject();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ SetNativeObjectFocusable(false);
+
+ _AccessibilityContainer* pContainer = GetAccessibilityContainer();
+ SysTryReturn(NID_WEB_CTRL, pContainer, E_SYSTEM, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(E_SYSTEM));
+
+ __pTextElement = new (std::nothrow) _AccessibilityElement(true);
+ SysTryReturn(NID_WEB_CTRL, __pTextElement, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ __pTextElement->SetBounds(FloatRectangle(0.0f, 0.0f, GetBoundsF().width, GetBoundsF().height));
+ __pTextElement->SetLabel(L"Web control");
+
+ pContainer->AddElement(*__pTextElement);
+ pContainer->Activate(true);
+
+ std::unique_ptr<_WebAccessibilityListener> pListener(new (std::nothrow) _WebAccessibilityListener(GetWebNativeNode()));
+ SysTryReturn(NID_WEB_CTRL, pListener, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ __pWebAccessibilityListener = std::move(pListener);
+
+ pContainer->AddListener(*dynamic_cast<_IAccessibilityListener*>(__pWebAccessibilityListener.get()));
+
+ std::unique_ptr<_WebAccessibilityFocusHandler> pFocusHandler(new (std::nothrow) _WebAccessibilityFocusHandler(GetWebNativeNode()));
+ SysTryReturn(NID_WEB_CTRL, pFocusHandler, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ __pWebAccessibilityFocusHandler = std::move(pFocusHandler);
+
+ pContainer->SetFocusHandler(dynamic_cast<_IAccessibilityFocusHandler*>(__pWebAccessibilityFocusHandler.get()));
+
+ return E_SUCCESS;
+}
+
+
+Point
+_Web::GetAbsoluteCoordinate(Point relativePoint)
+{
+ return _CoordinateSystemUtils::Transform(ConvertToScreenPosition(relativePoint));
+}
+
+
+FloatPoint
+_Web::GetAbsoluteCoordinate(FloatPoint relativePoint)
+{
+ return _CoordinateSystemUtils::Transform(ConvertToScreenPosition(relativePoint));
+}
+
+
+Point
+_Web::GetRelativeCoordinate(Point absolutePoint)
+{
+ return ConvertToControlPosition(_CoordinateSystemUtils::InverseTransform(absolutePoint));
+}
+
+
+FloatPoint
+_Web::GetRelativeCoordinate(FloatPoint absolutePoint)
+{
+ return ConvertToControlPosition(_CoordinateSystemUtils::InverseTransform(absolutePoint));
+}
+
+
+Evas_Object*
+_Web::GetWebNativeNode(void)
+{
+ if (__pEflWebkit.get())
+ {
+ return __pEflWebkit->GetWebEvasObject();
+ }
+
+ return null;
+}
+
+
+WebSetting*
+_Web::GetSetting(void) const
+{
+ return __pWebSetting.get();
+}
+
+
+_EflWebkit*
+_Web::GetEflWebkit(void) const
+{
+ return __pEflWebkit.get();
+}
+
+
+FloatPoint
+_Web::GetTouchPosition(void) const
+{
+ return __previousTouchedPosition;
+}
+
+
+result
+_Web::OnAttaching(const _Control* pParent)
+{
+ if (__pEflWebkit.get())
+ {
+ evas_object_show(__pEflWebkit->GetWebEvasObject());
+ evas_object_focus_set(__pEflWebkit->GetWebEvasObject(), EINA_TRUE);
+ }
+
+ return E_SUCCESS;
+}
+
+
+result
+_Web::OnBoundsChanging(const Rectangle& bounds)
+{
+ Rectangle absoluteBounds = GetAbsoluteBounds();
+ Rectangle webBounds = GetBounds();
+ _ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetTransformer();
+ SysTryReturnResult(NID_WEB_CTRL, pXformer, E_SYSTEM, "[%s] A system error has been occurred. Failed to get coordinate transformer.", GetErrorMessage(E_SYSTEM));
+
+ if (__pEflWebkit.get() && __isRotated == false)
+ {
+ evas_object_move(__pEflWebkit->GetWebEvasObject(), pXformer->TransformHorizontal(absoluteBounds.x - webBounds.x + bounds.x), pXformer->TransformVertical(absoluteBounds.y - webBounds.y + bounds.y));
+ evas_object_resize(__pEflWebkit->GetWebEvasObject(), pXformer->TransformHorizontal(bounds.width), pXformer->TransformVertical(bounds.height));
+ }
+
+ return E_SUCCESS;
+}
+
+
+void
+_Web::OnBoundsChanged(void)
+{
+ __isRotated = false;
+}
+
+
+void
+_Web::OnChangeLayout(_ControlOrientation orientation)
+{
+ __isRotated = true;
+}
+
+
+void
+_Web::ChangeGesture(_WebGestureType type)
+{
+ switch (type)
+ {
+ case WEB_GESTURE_TYPE_TAP:
+ __pGestureHandler = __pTapGestureHandler.get();
+ __gestureType = WEB_GESTURE_TYPE_TAP;
+ break;
+
+ case WEB_GESTURE_TYPE_PANNING:
+ __pGestureHandler = __pPanningGestureHandler.get();
+ __gestureType = WEB_GESTURE_TYPE_PANNING;
+ break;
+
+ case WEB_GESTURE_TYPE_FLICK:
+ __pGestureHandler = __pFlickGestureHandler.get();
+ __gestureType = WEB_GESTURE_TYPE_FLICK;
+ break;
+
+ case WEB_GESTURE_TYPE_PINCH:
+ __pGestureHandler = __pPinchGestureHandler.get();
+ __gestureType = WEB_GESTURE_TYPE_PINCH;
+ break;
+
+ default:
+ SysAssert(false);
+ }
+}
+
+
+void
+_Web::SetEdgeReachedEvent(_WebEdgeType type)
+{
+ __edgeType |= type;
+
+ switch(type)
+ {
+ case WEB_EDGE_LEFT:
+ __edgeType &= ~WEB_EDGE_RIGHT;
+ break;
+
+ case WEB_EDGE_RIGHT:
+ __edgeType &= ~WEB_EDGE_LEFT;
+ break;
+
+ case WEB_EDGE_TOP:
+ __edgeType &= ~WEB_EDGE_BOTTOM;
+ break;
+
+ case WEB_EDGE_BOTTOM:
+ __edgeType &= ~WEB_EDGE_TOP;
+ break;
+
+ default:
+ SysAssert(false);
+ }
+}
+
+
+bool
+_Web::OnTouchPressed(const _Control& source, const _TouchInfo& touchInfo)
+{
+ __touchPressed = true;
+
+ if (__pEflWebkit.get())
+ {
+ __edgeType = WEB_EDGE_NONE;
+ __previousTouchedPosition = touchInfo.GetCurrentPosition();
+
+ SendTouchEventForJavaScript(touchInfo);
+
+ return __pGestureHandler->OnTouchPressed(source, touchInfo);
+ }
+
+ return false;
+}
+
+
+bool
+_Web::CanOutOfEdgeLeft(float scrollDistanceX, int pageDistance)
+{
+ if (scrollDistanceX < 0.0f)
+ {
+ __edgeType &= ~WEB_EDGE_RIGHT;
+
+ return false;
+ }
+ else if (scrollDistanceX > 0.0f && pageDistance != 0)
+ {
+ __edgeType &= ~WEB_EDGE_LEFT;
+ }
+
+ return true;
+}
+
+
+bool
+_Web::CanOutOfEdgeRight(float scrollDistanceX, int pageDistance)
+{
+ if (scrollDistanceX > 0.0f)
+ {
+ __edgeType &= ~WEB_EDGE_LEFT;
+
+ return false;
+ }
+ else if (scrollDistanceX < 0.0f && pageDistance != 0)
+ {
+ __edgeType &= ~WEB_EDGE_RIGHT;
+ }
+
+ return true;
+}
+
+
+bool
+_Web::CanOutOfEdgeTop(float scrollDistanceY, int pageDistance)
+{
+ if (scrollDistanceY < 0.0f)
+ {
+ __edgeType &= ~WEB_EDGE_BOTTOM;
+
+ return false;
+ }
+ else if (scrollDistanceY > 0.0f && pageDistance != 0)
+ {
+ __edgeType &= ~WEB_EDGE_TOP;
+ }
+
+ return true;
+}
+
+
+bool
+_Web::CanOutOfEdgeBottom(float scrollDistanceY, int pageDistance)
+{
+ if (scrollDistanceY > 0.0f)
+ {
+ __edgeType &= ~WEB_EDGE_TOP;
+
+ return false;
+ }
+ else if (scrollDistanceY < 0.0f && pageDistance != 0)
+ {
+ __edgeType &= ~WEB_EDGE_BOTTOM;
+ }
+
+ return true;
+}
+
+
+bool
+_Web::CanConsumeTouchMoved(float scrollDistanceX, float scrollDistanceY)
+{
+ if (__edgeType == WEB_EDGE_NONE)
+ {
+ return true;
+ }
+
+ bool ret = true;
+
+ int scrollWidth = 0;
+ int scrollHeight = 0;
+ ewk_view_scroll_size_get(GetWebNativeNode(), &scrollWidth, &scrollHeight);
+
+ int scrollX = 0;
+ int scrollY = 0;
+ ewk_view_scroll_pos_get(GetWebNativeNode(), &scrollX, &scrollY);
+
+ if (scrollWidth == 0)
+ {
+ if (__edgeType & WEB_EDGE_TOP)
+ {
+ if (!CanOutOfEdgeTop(scrollDistanceY, scrollY - 0))
+ {
+ return false;
+ }
+ }
+ else if (__edgeType & WEB_EDGE_BOTTOM)
+ {
+ if (!CanOutOfEdgeBottom(scrollDistanceY, scrollY - scrollHeight))
+ {
+ return false;
+ }
+ }
+ }
+
+ if (scrollHeight == 0)
+ {
+ if (__edgeType & WEB_EDGE_LEFT)
+ {
+ if (!CanOutOfEdgeLeft(scrollDistanceX, scrollX - 0))
+ {
+ return false;
+ }
+ }
+ else if (__edgeType & WEB_EDGE_RIGHT)
+ {
+ if (!CanOutOfEdgeRight(scrollDistanceX, scrollX - scrollWidth))
+ {
+ return false;
+ }
+ }
+ }
+
+ if (scrollWidth > 0 && scrollHeight > 0)
+ {
+ if ((__edgeType & WEB_EDGE_LEFT) && (__edgeType & WEB_EDGE_TOP))
+ {
+ if (!CanOutOfEdgeLeft(scrollDistanceX, scrollX - 0) || !CanOutOfEdgeTop(scrollDistanceY, scrollY - 0))
+ {
+ return false;
+ }
+ }
+ else if ((__edgeType & WEB_EDGE_LEFT) && (__edgeType & WEB_EDGE_BOTTOM))
+ {
+ if (!CanOutOfEdgeLeft(scrollDistanceX, scrollX - 0) || !CanOutOfEdgeBottom(scrollDistanceY, scrollY - scrollHeight))
+ {
+ return false;
+ }
+ }
+ else if ((__edgeType & WEB_EDGE_RIGHT) && (__edgeType & WEB_EDGE_TOP))
+ {
+ if (!CanOutOfEdgeRight(scrollDistanceX, scrollX - scrollWidth) || !CanOutOfEdgeTop(scrollDistanceY, scrollY - 0))
+ {
+ return false;
+ }
+ }
+ else if ((__edgeType & WEB_EDGE_RIGHT) && (__edgeType & WEB_EDGE_BOTTOM))
+ {
+ if (!CanOutOfEdgeRight(scrollDistanceX, scrollX - scrollWidth) || !CanOutOfEdgeBottom(scrollDistanceY, scrollY - scrollHeight))
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+
+bool
+_Web::OnTouchMoved(const _Control& source, const _TouchInfo& touchInfo)
+{
+ if (__pEflWebkit.get())
+ {
+ SendTouchEventForJavaScript(touchInfo);
+
+ float scrollDistanceX = __previousTouchedPosition.x - touchInfo.GetCurrentPosition().x;
+ float scrollDistanceY = __previousTouchedPosition.y - touchInfo.GetCurrentPosition().y;
+ __previousTouchedPosition = touchInfo.GetCurrentPosition();
+
+ if (CanConsumeTouchMoved(scrollDistanceX, scrollDistanceY))
+ {
+ return __pGestureHandler->OnTouchMoved(source, touchInfo);
+ }
+ }
+
+ return false;
+}
+
+
+bool
+_Web::OnTouchReleased(const _Control& source, const _TouchInfo& touchInfo)
+{
+ __touchPressed = false;
+
+ SetFocused();
+
+ if (__pEflWebkit.get())
+ {
+ SendTouchEventForJavaScript(touchInfo);
+
+ return __pGestureHandler->OnTouchReleased(source, touchInfo);
+ }
+
+ return false;
+}
+
+
+bool
+_Web::OnTouchCanceled(const _Control& source, const _TouchInfo& touchInfo)
+{
+ if (__pEflWebkit.get())
+ {
+ SendTouchEventForJavaScript(touchInfo);
+
+ return __pGestureHandler->OnTouchCanceled(source, touchInfo);
+ }
+
+ return false;
+}
+
+
+bool
+_Web::OnLongPressGestureDetected(_TouchLongPressGestureDetector& gesture)
+{
+ if (__pEflWebkit.get() && __gestureType == WEB_GESTURE_TYPE_TAP)
+ {
+ return __pTapGestureHandler->OnLongPressGestureDetected(gesture);
+ }
+
+ return false;
+}
+
+
+bool
+_Web::OnLongPressGestureCanceled(_TouchLongPressGestureDetector& gesture)
+{
+ return false;
+}
+
+
+bool
+_Web::OnTapGestureDetected(_TouchTapGestureDetector& gesture)
+{
+ if (__pEflWebkit.get())
+ {
+ return __pTapGestureHandler->OnTapGestureDetected(gesture);
+ }
+
+ return false;
+}
+
+
+bool
+_Web::OnTapGestureCanceled(_TouchTapGestureDetector& gesture)
+{
+ return false;
+}
+
+
+bool
+_Web::OnFlickGestureDetected(_TouchFlickGestureDetector& gesture)
+{
+ if (__pEflWebkit.get())
+ {
+ return __pFlickGestureHandler->OnFlickGestureDetected(gesture);
+ }
+
+ return false;
+}
+
+
+bool
+_Web::OnFlickGestureCanceled(_TouchFlickGestureDetector& gesture)
+{
+ return false;
+}
+
+
+bool
+_Web::OnPinchGestureStarted(Tizen::Ui::_TouchPinchGestureDetector& gesture)
+{
+ if (__pEflWebkit.get())
+ {
+ return __pPinchGestureHandler->OnPinchGestureStarted(gesture);
+ }
+
+ return false;
+}
+
+
+bool
+_Web::OnPinchGestureChanged(Tizen::Ui::_TouchPinchGestureDetector& gesture)
+{
+ if (__pEflWebkit.get() && __gestureType == WEB_GESTURE_TYPE_PINCH)
+ {
+ return __pPinchGestureHandler->OnPinchGestureChanged(gesture);
+ }
+
+ return false;
+}
+
+
+bool
+_Web::OnPinchGestureFinished(Tizen::Ui::_TouchPinchGestureDetector& gesture)
+{
+ if (__pEflWebkit.get() && __gestureType == WEB_GESTURE_TYPE_PINCH)
+ {
+ return __pPinchGestureHandler->OnPinchGestureFinished(gesture);
+ }
+
+ return false;
+}
+
+
+bool
+_Web::OnPinchGestureCanceled(Tizen::Ui::_TouchPinchGestureDetector& gesture)
+{
+ return false;
+}
+
+
+Canvas*
+_Web::OnCanvasRequestedN(const FloatRectangle& bounds)
+{
+ SysTryReturn(NID_WEB_CTRL, bounds.width >= 0.0f && bounds.height >= 0.0f, null, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] Canvas size is out of range. size = (%f, %f)", bounds.width, bounds.height);
+ if (bounds.width == 0.0f || bounds.height == 0.0f)
+ {
+ FloatDimension size(GetSizeF());
+ SysTryReturn(NID_WEB_CTRL, bounds.x >= 0.0f && bounds.y >= 0.0f && bounds.x <= size.width && bounds.y <= size.height, null, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] Bounds is out of range.");
+ }
+
+ result r = E_SUCCESS;
+
+ Rectangle absBounds(_CoordinateSystemUtils::ConvertToInteger(_CoordinateSystemUtils::Transform(bounds)));
+
+ Eina_Rectangle rect;
+ EINA_RECTANGLE_SET(&rect, absBounds.x, absBounds.y, absBounds.width, absBounds.height);
+
+ Evas_Object* pWebFrame = GetWebNativeNode();
+ Evas_Object* pScreenShot = ewk_view_screenshot_contents_get(pWebFrame, rect, 1.0f, evas_object_evas_get(pWebFrame));
+
+ std::unique_ptr<Canvas> pCanvas(new (std::nothrow) Canvas());
+ SysTryReturn(NID_WEB_CTRL, pCanvas.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ if (pScreenShot)
+ {
+ BufferInfo bufferInfo;
+
+ r = _Utility::GetPixelBufferFromEvasObject(pScreenShot, bufferInfo);
+ evas_object_del(pScreenShot);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] propagating", GetErrorMessage(r));
+
+ r = pCanvas->Construct(bufferInfo);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] propagating", GetErrorMessage(r));
+ }
+ else
+ {
+ r = pCanvas->Construct(bounds);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] propagating", GetErrorMessage(r));
+ }
+
+ return pCanvas.release();
+}
+
+
+Bitmap*
+_Web::OnCapturedBitmapRequestedN(void)
+{
+ result r = E_SUCCESS;
+
+ BufferInfo bufferInfo;
+ SysTryReturn(NID_WEB_CTRL, OnCaptureAcquire(bufferInfo), null, E_SYSTEM, "[%s] A system error has been occurred. Failed to get snapshot of Web control", GetErrorMessage(E_SYSTEM));
+
+ ByteBuffer buffer;
+ int bufferSize = bufferInfo.bitsPerPixel * bufferInfo.width * bufferInfo.height;
+
+ r = buffer.Construct(reinterpret_cast < byte* >(bufferInfo.pPixels), 0, bufferSize, bufferSize);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] propagating", GetErrorMessage(r));
+
+ std::unique_ptr<Bitmap> pBitmap(new (std::nothrow) Bitmap());
+ SysTryReturn(NID_WEB_CTRL, pBitmap.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pBitmap->Construct(buffer, Dimension(bufferInfo.width, bufferInfo.height), BITMAP_PIXEL_FORMAT_ARGB8888);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] propagating", GetErrorMessage(r));
+
+ return pBitmap.release();
+}
+
+
+bool
+_Web::OnCaptureAcquire(BufferInfo& output)
+{
+ result r = E_SUCCESS;
+
+ FloatPoint position(GetPositionF());
+ FloatDimension size(GetSizeF());
+
+ Dimension absSize(_CoordinateSystemUtils::ConvertToInteger(_CoordinateSystemUtils::Transform(size)));
+
+ Eina_Rectangle rect;
+ EINA_RECTANGLE_SET(&rect, 0, 0, absSize.width, absSize.height);
+
+ Evas_Object* pWebFrame = GetWebNativeNode();
+ Evas_Object* pScreenShot = ewk_view_screenshot_contents_get(pWebFrame, rect, 1.0f, evas_object_evas_get(pWebFrame));
+ SysTryReturn(NID_WEB_CTRL, pScreenShot, false, E_SYSTEM, "[%s] A system error has been occurred. Failed to get snapshot of Web control", GetErrorMessage(E_SYSTEM));
+
+ r = _Utility::GetPixelBufferFromEvasObject(pScreenShot, output);
+ evas_object_del(pScreenShot);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] propagating", GetErrorMessage(r));
+
+ return true;
+}
+
+
+void
+_Web::SendTouchEventForJavaScript(const _TouchInfo& touchInfo)
+{
+ result r = E_SUCCESS;
+
+ _TouchManager* pTouchManager = _TouchManager::GetInstance();
+ SysAssertf(pTouchManager, "Failed to get touch manager.");
+
+ std::unique_ptr<IListT<_FingerInfo*> > pTouchList(pTouchManager->GetMultiFingerInfoListN());
+ SysTryReturnVoidResult(NID_WEB_CTRL, pTouchList.get(), GetLastResult(), "[%s] Failed to get touch list.", GetErrorMessage(GetLastResult()));
+
+ std::unique_ptr<IBidirectionalEnumeratorT<_FingerInfo*> > pTouchListEnum(pTouchList->GetBidirectionalEnumeratorN());
+ SysAssertf(pTouchListEnum.get() != null, "Failed to get enumerator of touch list.");
+
+ Eina_List* pPointList = null;
+ _FingerInfo* pFingerInfo = null;
+ while(pTouchListEnum->MoveNext() == E_SUCCESS)
+ {
+ r = pTouchListEnum->GetCurrent(pFingerInfo);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ _TouchStatus state = pFingerInfo->GetStatus();
+ if(state == _TOUCH_PRESSED || state == _TOUCH_MOVED || state == _TOUCH_RELEASED || state == _TOUCH_CANCELED)
+ {
+ Point integerPoint(_CoordinateSystemUtils::ConvertToInteger(GetAbsoluteCoordinate(pFingerInfo->GetPoint())));
+
+ Ewk_Touch_Point* pPoint = static_cast<Ewk_Touch_Point*>(calloc(1, sizeof(Ewk_Touch_Point)));
+ pPoint->id = pFingerInfo->GetPointId();
+ pPoint->x = integerPoint.x;
+ pPoint->y = integerPoint.y;
+ pPoint->state = GetEvasTouchState((TouchStatus)pFingerInfo->GetStatus());
+ SysSecureLog(NID_WEB_CTRL, "The current value of id is %lu, x is %d, y is %d, state is %d", pPoint->id, pPoint->x, pPoint->y, pPoint->state);
+
+ pPointList = eina_list_append(pPointList, pPoint);
+ }
+ }
+
+ ewk_view_feed_touch_event(__pEflWebkit->GetWebEvasObject(), GetEwkTouchEvent(touchInfo.GetTouchStatus()), pPointList, null);
+
+ void* pData = null;
+ EINA_LIST_FREE(pPointList, pData)
+ free(pData);
+}
+
+
+Ewk_Touch_Event_Type
+_Web::GetEwkTouchEvent(_TouchStatus touchStatus)
+{
+ Ewk_Touch_Event_Type ewkTouchEvent = EWK_TOUCH_CANCEL;
+
+ switch (touchStatus)
+ {
+ case _TOUCH_PRESSED :
+ ewkTouchEvent = EWK_TOUCH_START;
+ break;
+ case _TOUCH_MOVED :
+ ewkTouchEvent = EWK_TOUCH_MOVE;
+ break;
+ case _TOUCH_RELEASED :
+ ewkTouchEvent = EWK_TOUCH_END;
+ break;
+ case _TOUCH_CANCELED :
+ //fall through
+ default :
+ ewkTouchEvent = EWK_TOUCH_CANCEL;
+ break;
+ }
+
+ return ewkTouchEvent;
+}
+
+
+Evas_Touch_Point_State
+_Web::GetEvasTouchState(TouchStatus touchStatus)
+{
+ Evas_Touch_Point_State evasTouchState = EVAS_TOUCH_POINT_CANCEL;
+
+ switch (touchStatus)
+ {
+ case TOUCH_PRESSED :
+ evasTouchState = EVAS_TOUCH_POINT_DOWN;
+ break;
+ case TOUCH_MOVED :
+ evasTouchState = EVAS_TOUCH_POINT_MOVE;
+ break;
+ case TOUCH_RELEASED :
+ evasTouchState = EVAS_TOUCH_POINT_UP;
+ break;
+ case TOUCH_CANCELED :
+ //fall through
+ default :
+ evasTouchState = EVAS_TOUCH_POINT_CANCEL;
+ //todo : mapping EVAS_TOUCH_POINT_STILL, /**< Touch point is not moved af
+ break;
+ }
+
+ return evasTouchState;
+}
+
+
+void
+_Web::SetFullScreenEntered(bool isFullScreenEntered)
+{
+ __isFullScreenEntered = isFullScreenEntered;
+}
+
+
+void
+_Web::SetFocusEnd(bool focus)
+{
+ __focus = focus;
+}
+
+
+bool
+_Web::IsFocusEnd(void) const
+{
+ return __focus;
+}
+
+
+bool
+_Web::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
+{
+ Ecore_X_Window rootWindow = ecore_x_window_root_first_get();
+ Ecore_X_Atom keyboardExist = ecore_x_atom_get("X External Keyboard Exist");
+ unsigned int keyboardNumber = 0;
+ int ret = ecore_x_window_prop_card32_get(rootWindow, keyboardExist, &keyboardNumber, 1);
+ if (keyboardNumber == 0)
+ {
+ return false;
+ }
+
+ _KeyCode keyCode = keyInfo.GetKeyCode();
+
+ if (IsFocusEnd() == true)
+ {
+ SetFocusEnd(false);
+ evas_object_focus_set(GetWebNativeNode(), EINA_FALSE);
+ return false;
+ }
+
+ switch(keyCode)
+ {
+ case _KEY_UP:
+ case _KEY_DOWN:
+ evas_object_focus_set(GetWebNativeNode(), EINA_FALSE);
+ return false;
+ break;
+ default:
+ break;
+ }
+
+ evas_object_focus_set(GetWebNativeNode(), EINA_TRUE);
+
+ return true;
+}
+
+
+bool
+_Web::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
+{
+ if (__isFullScreenEntered)
+ {
+ if (keyInfo.GetKeyCode() == _KEY_ESC || keyInfo.GetKeyCode() == _KEY_BACK)
+ {
+ __isFullScreenEntered = false;
+
+ ewk_view_fullscreen_exit(GetWebNativeNode());
+
+ return true;
+ }
+ }
+
+ return false;
+}
+
+
+void
+_Web::OnDrawFocus(void)
+{
+}
+
+
+bool
+_Web::OnFocusLost(const _Control& source)
+{
+ _Control::OnFocusLost(*this);
+
+ if (__touchPressed == true)
+ {
+ _TouchManager* pTouchManager = _TouchManager::GetInstance();
+ SysAssertf(pTouchManager, "Failed to get touch manager.");
+
+ Point absPoint(_CoordinateSystemUtils::ConvertToInteger(pTouchManager->GetPosition(pTouchManager->GetCurrentPointId())));
+
+ Ewk_Touch_Point* pPoint = static_cast< Ewk_Touch_Point* >(calloc(1, sizeof(Ewk_Touch_Point)));
+ pPoint->id = 0;
+ pPoint->x = absPoint.x;
+ pPoint->y = absPoint.y;
+ pPoint->state = EVAS_TOUCH_POINT_CANCEL;
+
+ Eina_List* pPointList = null;
+ pPointList = eina_list_append(pPointList, pPoint);
+
+ ewk_view_feed_touch_event(GetWebNativeNode(), EWK_TOUCH_CANCEL, pPointList, null);
+
+ void* pData = null;
+ EINA_LIST_FREE(pPointList, pData)
+ free(pData);
+
+ __touchPressed = false;
+ }
+
+ return false;
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_Web.h
+ * @brief The file contains the declaration of _Web class.
+ *
+ * The file contains the declaration of _Web class.
+ */
+#ifndef _FWEB_CTRL_INTERNAL_WEB_H_
+#define _FWEB_CTRL_INTERNAL_WEB_H_
+
+#include <unique_ptr.h>
+#include <EWebKit2.h>
+#include <FBaseColIListT.h>
+#include <FUi_Control.h>
+#include <FUi_ITouchFlickGestureEventListener.h>
+#include <FUi_ITouchLongPressGestureEventListener.h>
+#include <FUi_ITouchPinchGestureEventListener.h>
+#include <FUi_ITouchTapGestureEventListener.h>
+#include <FUiAnim_IVisualElementCaptureProvider.h>
+
+namespace Tizen { namespace Ui
+{
+class _AccessibilityElement;
+class _TouchInfo;
+}} // Tizen::Ui
+
+namespace Tizen { namespace Ui { namespace Animations
+{
+class VisualElement;
+}}} // Tizen::Ui::Animations
+
+namespace Tizen { namespace Graphics
+{
+class Canvas;
+class Dimension;
+class Point;
+class FloatRectangle;
+}} // Tizen::Graphics
+
+namespace Tizen { namespace Web { namespace Controls
+{
+class _EflWebkit;
+class _WebSettingImpl;
+class _TapGestureState;
+class _PanningGestureState;
+class _FlickGestureState;
+class _PinchGestureState;
+class _WebAccessibilityListener;
+class _WebAccessibilityFocusHandler;
+class WebSetting;
+
+enum _WebGestureType
+{
+ WEB_GESTURE_TYPE_TAP,
+ WEB_GESTURE_TYPE_PANNING,
+ WEB_GESTURE_TYPE_FLICK,
+ WEB_GESTURE_TYPE_PINCH
+};
+
+enum _WebEdgeType
+{
+ WEB_EDGE_NONE = 1,
+ WEB_EDGE_LEFT = 1 << 1,
+ WEB_EDGE_RIGHT = 1 << 2,
+ WEB_EDGE_TOP = 1 << 3,
+ WEB_EDGE_BOTTOM = 1 << 4,
+};
+
+class _Web
+ : public Tizen::Ui::_Control
+ , public Tizen::Ui::_ITouchFlickGestureEventListener
+ , public Tizen::Ui::_ITouchLongPressGestureEventListener
+ , public Tizen::Ui::_ITouchPinchGestureEventListener
+ , public Tizen::Ui::_ITouchTapGestureEventListener
+ , public Tizen::Ui::Animations::_IVisualElementCaptureProvider
+ , virtual public Tizen::Base::Runtime::IEventListener
+ , virtual public Tizen::Ui::_IUiEventListener
+ , virtual public Tizen::Ui::_IUiEventPreviewer
+ , virtual public Tizen::Ui::_ITouchGestureEventListener
+{
+public:
+ _Web(void);
+
+ virtual ~_Web(void);
+
+ static _Web* CreateWebN(void);
+
+ result InitializeWebNativeNode(void);
+
+ Evas_Object* GetWebNativeNode(void);
+
+ void ChangeGesture(_WebGestureType type);
+
+ Tizen::Graphics::Point GetAbsoluteCoordinate(Tizen::Graphics::Point relativePoint);
+ Tizen::Graphics::FloatPoint GetAbsoluteCoordinate(Tizen::Graphics::FloatPoint relativePoint);
+
+ Tizen::Graphics::Point GetRelativeCoordinate(Tizen::Graphics::Point absolutePoint);
+ Tizen::Graphics::FloatPoint GetRelativeCoordinate(Tizen::Graphics::FloatPoint absolutePoint);
+
+ WebSetting* GetSetting(void) const;
+
+ _EflWebkit* GetEflWebkit(void) const;
+
+ Tizen::Graphics::FloatPoint GetTouchPosition(void) const;
+
+ void SetEdgeReachedEvent(_WebEdgeType type);
+
+ void SetFullScreenEntered(bool isFullScreenEntered);
+
+ void SetFocusEnd(bool focus);
+
+ bool IsFocusEnd(void) const;
+
+ bool CanOutOfEdgeLeft(float scrollDistanceX, int pageDistance);
+ bool CanOutOfEdgeRight(float scrollDistanceX, int pageDistance);
+ bool CanOutOfEdgeTop(float scrollDistanceY, int pageDistance);
+ bool CanOutOfEdgeBottom(float scrollDistanceY, int pageDistance);
+ bool CanConsumeTouchMoved(float scrollDistanceX, float scrollDistanceY);
+ virtual result OnAttaching(const _Control* pParent);
+ virtual result OnBoundsChanging(const Tizen::Graphics::Rectangle& bounds);
+ virtual void OnBoundsChanged(void);
+ virtual void OnChangeLayout(Tizen::Ui::_ControlOrientation orientation);
+
+ virtual bool OnTouchPressed(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchInfo);
+ virtual bool OnTouchReleased(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchInfo);
+ virtual bool OnTouchMoved(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchInfo);
+ virtual bool OnTouchCanceled(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchInfo);
+
+ virtual bool OnPinchGestureStarted(Tizen::Ui::_TouchPinchGestureDetector& gesture);
+ virtual bool OnPinchGestureChanged(Tizen::Ui::_TouchPinchGestureDetector& gesture);
+ virtual bool OnPinchGestureFinished(Tizen::Ui::_TouchPinchGestureDetector& gesture);
+ virtual bool OnPinchGestureCanceled(Tizen::Ui::_TouchPinchGestureDetector& gesture);
+
+ virtual bool OnFlickGestureDetected(Tizen::Ui::_TouchFlickGestureDetector& gesture);
+ virtual bool OnFlickGestureCanceled(Tizen::Ui::_TouchFlickGestureDetector& gesture);
+
+ virtual bool OnLongPressGestureDetected(Tizen::Ui::_TouchLongPressGestureDetector& gesture);
+ virtual bool OnLongPressGestureCanceled(Tizen::Ui::_TouchLongPressGestureDetector& gesture);
+
+ virtual bool OnTapGestureDetected(Tizen::Ui::_TouchTapGestureDetector& gesture);
+ virtual bool OnTapGestureCanceled(Tizen::Ui::_TouchTapGestureDetector& gesture);
+
+ virtual Tizen::Graphics::Canvas* OnCanvasRequestedN(const Tizen::Graphics::FloatRectangle& size);
+ virtual Tizen::Graphics::Bitmap* OnCapturedBitmapRequestedN(void);
+ virtual bool OnCaptureAcquire(Tizen::Graphics::BufferInfo& output);
+ virtual void OnCaptureReleased(void) {};
+
+ virtual bool OnKeyPressed(const Tizen::Ui::_Control& source, const Tizen::Ui::_KeyInfo& keyInfo);
+ virtual bool OnKeyReleased(const Tizen::Ui::_Control& source, const Tizen::Ui::_KeyInfo& keyInfo);
+ virtual void OnDrawFocus(void);
+ virtual bool OnFocusLost(const Tizen::Ui::_Control& source);
+
+private:
+ _Web(const _Web& value);
+
+ _Web& operator =(const _Web& value);
+
+ result CreateWebkitEvasObject(void);
+
+ result InitializeGestureStates(void);
+ result AddGestureListeners(void);
+ void RemoveGestureListener(void);
+
+ void SendTouchEventForJavaScript(const Tizen::Ui::_TouchInfo& touchInfo);
+ void SendTouchEventForJavaScriptWithTouchInfo(const Tizen::Ui::_TouchInfo& touchInfo);
+
+ Ewk_Touch_Event_Type GetEwkTouchEvent(Tizen::Ui::_TouchStatus touchStatus);
+ Evas_Touch_Point_State GetEvasTouchState(Tizen::Ui::TouchStatus touchStatus);
+
+private:
+ Tizen::Ui::_ITouchEventListener* __pGestureHandler;
+
+ std::unique_ptr<_EflWebkit> __pEflWebkit;
+
+ std::unique_ptr<WebSetting> __pWebSetting;
+
+ std::unique_ptr<Tizen::Ui::_TouchFlickGestureDetector> __pGestureFlick;
+
+ std::unique_ptr<Tizen::Ui::_TouchLongPressGestureDetector> __pGestureLongPress;
+
+ std::unique_ptr<Tizen::Ui::_TouchPinchGestureDetector> __pGesturePinch;
+
+ std::unique_ptr<Tizen::Ui::_TouchTapGestureDetector> __pGestureDoubleTap;
+
+ std::unique_ptr<Tizen::Base::Collection::IListT<Tizen::Ui::_TouchInfo*> > __pTouchEventInfoList;
+
+ std::unique_ptr<_TapGestureState> __pTapGestureHandler;
+
+ std::unique_ptr<_PanningGestureState> __pPanningGestureHandler;
+
+ std::unique_ptr<_FlickGestureState> __pFlickGestureHandler;
+
+ std::unique_ptr<_PinchGestureState> __pPinchGestureHandler;
+
+ std::unique_ptr<_WebAccessibilityListener> __pWebAccessibilityListener;
+
+ std::unique_ptr<_WebAccessibilityFocusHandler> __pWebAccessibilityFocusHandler;
+
+ _WebGestureType __gestureType;
+
+ int __edgeType;
+
+ bool __focus;
+
+ Tizen::Ui::_AccessibilityElement* __pTextElement;
+
+ Tizen::Graphics::FloatPoint __previousTouchedPosition;
+
+ bool __isFullScreenEntered;
+
+ bool __isRotated;
+
+ bool __touchPressed;
+}; // _Web
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_WEB_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_WebDataHandler.cpp
+ * @brief The file contains the definition of _WebDataHandler class.
+ *
+ * The file contains the definition of _WebDataHandler class.
+ */
+
+#include <FBaseInteger.h>
+#include <FBaseSysLog.h>
+#include <FBaseUtilUri.h>
+#include <FWebCtrlILoadingListener.h>
+#include <FWebCtrlIWebDownloadListener.h>
+#include <FBase_StringConverter.h>
+#include <FNetHttp_HttpSessionImpl.h>
+#include <FNetHttp_HttpTransactionImpl.h>
+#include "FWebCtrl_WebDataHandler.h"
+#include "FWebCtrl_WebEvent.h"
+#include "FWebCtrl_WebEventArg.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Utility;
+using namespace Tizen::Net::Http;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+_WebDataHandler::_WebDataHandler(void)
+ : __pDownloadListener(null)
+ , __pWebEvent(null)
+ , __pHttpSession(null)
+{
+}
+
+
+_WebDataHandler::~_WebDataHandler(void)
+{
+
+}
+
+
+result
+_WebDataHandler::StartDownload(const String& url)
+{
+ SysSecureLog(NID_WEB_CTRL, "The current value of url is %ls", url.GetPointer());
+
+ SysTryReturnResult(NID_WEB_CTRL, __pHttpSession.get() == null, E_INVALID_OPERATION, "[%s] Already Downloading is in progress.", GetErrorMessage(E_INVALID_OPERATION));
+
+ Uri baseUri;
+ baseUri.SetUri(url);
+
+ String domain(baseUri.GetScheme());
+ domain.Append(L"://");
+ domain.Append(baseUri.GetHost());
+ if (baseUri.GetPort() != -1)
+ {
+ domain.Append(L":");
+ domain.Append(Integer(baseUri.GetPort()).ToString());
+ }
+
+ std::unique_ptr<HttpSession> pHttpSession(new (std::nothrow) HttpSession());
+ SysTryReturnResult(NID_WEB_CTRL, pHttpSession.get() , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ result r = pHttpSession->Construct(NET_HTTP_SESSION_MODE_NORMAL, null, domain, null);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] propogating.", GetErrorMessage(r));
+
+ r = pHttpSession->SetAutoRedirectionEnabled(true);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] propogating.", GetErrorMessage(r));
+
+ _HttpSessionImpl* pSessionImpl = _HttpSessionImpl::GetInstance(*(pHttpSession.get()));
+ SysTryReturn(NID_WEB_CTRL, pSessionImpl != null, r = GetLastResult(), r, "[%s] propogating. Failed to get _HttpSessionImpl", GetErrorMessage(r));
+
+ std::unique_ptr<HttpTransaction> pHttpTransaction( pSessionImpl->OpenTransactionN());
+ SysTryReturn(NID_WEB_CTRL, pHttpTransaction.get(), r = GetLastResult(), r, "[%s] propogating. OpenTransactionN Failed.", GetErrorMessage(r));
+
+ r = pHttpTransaction->AddHttpTransactionListener(*this);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r,"[%s] propogating.", GetErrorMessage(r));
+
+
+ HttpRequest* pHttpRequest = const_cast< HttpRequest* >(pHttpTransaction->GetRequest());
+ SysTryReturn(NID_WEB_CTRL, pHttpRequest != null, r = GetLastResult(), r,"[%s] -propogating. GetRequest Failed.", GetErrorMessage(r));
+
+ r = pHttpRequest->SetUri(url);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r,"[%s] Propogating.", GetErrorMessage(r));
+
+ r = pHttpRequest->SetMethod(NET_HTTP_METHOD_GET);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r,"[%s] Propogating.", GetErrorMessage(r));
+
+ _HttpTransactionImpl* pHttpTransactionImpl = _HttpTransactionImpl::GetInstance(*pHttpTransaction);
+ SysTryReturn(NID_WEB_CTRL, pHttpTransactionImpl != null, r = GetLastResult(), r,"[%s] -propogating. Failed to get instance of _HttpTransactionImpl.", GetErrorMessage(r));
+
+ r = pHttpTransactionImpl->Submit();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r,"[%s] Propogating.", GetErrorMessage(r));
+
+ __pHttpSession = std::move(pHttpSession);
+ pHttpTransaction.release();
+ return r;
+}
+
+
+Tizen::Web::Controls::IWebDownloadListener*
+_WebDataHandler::GetDownloadListener(void) const
+{
+ return __pDownloadListener;
+}
+
+
+void
+_WebDataHandler::SetDownloadListener(const Tizen::Web::Controls::IWebDownloadListener* pDownloadListener)
+{
+ __pDownloadListener = const_cast< IWebDownloadListener* >(pDownloadListener);
+}
+
+
+Tizen::Web::Controls::_WebEvent*
+_WebDataHandler::GetWebEvent(void) const
+{
+ return __pWebEvent;
+}
+
+
+void
+_WebDataHandler::SetWebEvent(const Tizen::Web::Controls::_WebEvent* pWebEvent)
+{
+ __pWebEvent = const_cast<_WebEvent* >(pWebEvent);
+}
+
+
+void
+_WebDataHandler::OnTransactionReadyToRead(HttpSession& httpSession, HttpTransaction& httpTransaction, int availableBodyLen)
+{
+ SysLog(NID_WEB_CTRL, "The current value of totalReceivedSize is %d ", availableBodyLen);
+
+ ClearLastResult();
+ HttpResponse* pHttpResponse = httpTransaction.GetResponse();
+ SysTryReturnVoidResult(NID_WEB_CTRL, pHttpResponse != null, GetLastResult(), "[%s] Invalid Response.",GetErrorMessage(GetLastResult()));
+
+ HttpHeader* pHttpHeader = pHttpResponse->GetHeader();
+ SysTryReturnVoidResult(NID_WEB_CTRL, pHttpHeader != null, GetLastResult(), "[%s] Download Invalid Response header.",GetErrorMessage(GetLastResult()));
+
+ std::unique_ptr<ByteBuffer> pBuffer(pHttpResponse->ReadBodyN());
+ SysTryReturnVoidResult(NID_WEB_CTRL, pBuffer.get(), GetLastResult(), "[%s] Propogating. ReadBodyN failed.",GetErrorMessage(GetLastResult()));
+ __pDownloadListener->OnWebChunkedDataReceived(*pBuffer);
+}
+
+void
+_WebDataHandler::OnTransactionAborted(HttpSession& httpSession, HttpTransaction& httpTransaction, result r)
+{
+ LoadingErrorType errorType;
+
+ switch(r)
+ {
+ case E_OUT_OF_MEMORY :
+ errorType = WEB_OUT_OF_MEMORY;
+ break;
+
+ case E_IO :
+ errorType = WEB_FILE_ACCESS_FAILED;
+ break;
+
+ case E_TIMEOUT :
+ errorType = WEB_REQUEST_TIMEOUT;
+ break;
+
+ case E_NETWORK_UNAVAILABLE :
+ //fall through
+ case E_HOST_UNREACHABLE :
+ //fall through
+ case E_CONNECTION_RESET :
+ errorType = WEB_NO_CONNECTION;
+ break;
+
+ case E_NOT_RESPONDING :
+ errorType = WEB_REQUEST_MAX_EXCEEDED;
+ break;
+
+ case E_INVALID_CONTENT :
+ errorType = WEB_MIME_NOT_SUPPORTED; //check if it is bad url
+ break;
+
+ case E_HTTP_USER :
+ errorType = WEB_HTTP_RESPONSE;
+ break;
+
+ case E_NO_CERTIFICATE :
+ errorType = WEB_INVALID_CERTIFICATE;
+ break;
+
+ case E_RESOURCE_UNAVAILABLE :
+ errorType = WEB_FILE_ACCESS_FAILED;
+ break;
+
+ case E_UNSUPPORTED_SERVICE :
+ //fall through
+ case E_USER_AGENT_NOT_ALLOWED :
+ //fall through
+ case E_INVALID_ARG :
+ //fall through
+ case E_SYSTEM :
+ //fall through
+ case E_UNKNOWN :
+ //fall through
+ default:
+ errorType = WEB_ERROR_UNKNOWN;
+ break;
+ }
+
+ __pDownloadListener->OnWebDownloadFailed(errorType);
+ __pDownloadListener->OnWebDataDownloadCompleted();
+
+ delete &httpTransaction;
+ __pHttpSession.reset();
+}
+
+
+void
+_WebDataHandler::OnTransactionReadyToWrite(HttpSession& httpSession, HttpTransaction& httpTransaction, int recommendedChunkSize)
+{
+}
+
+
+void
+_WebDataHandler::OnTransactionHeaderCompleted(HttpSession& httpSession, HttpTransaction& httpTransaction, int headerLen, bool authRequired)
+{
+}
+
+
+void
+_WebDataHandler::OnTransactionCompleted(HttpSession& httpSession, HttpTransaction& httpTransaction)
+{
+ __pDownloadListener->OnWebDataDownloadCompleted();
+
+ delete &httpTransaction;
+ __pHttpSession.reset();
+}
+
+
+void
+_WebDataHandler::OnTransactionCertVerificationRequiredN(HttpSession& httpSession, HttpTransaction& httpTransaction, String* pCert)
+{
+ httpTransaction.Resume();
+
+ delete pCert;
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_WebDataHandler.h
+ * @brief The file contains the declaration of _WebDataHandler class.
+ *
+ * The file contains the declaration of _WebDataHandler class.
+ */
+#ifndef _FWEB_CTRL_INTERNAL_WEBDATA_HANDLER_H_
+#define _FWEB_CTRL_INTERNAL_WEBDATA_HANDLER_H_
+
+#include <unique_ptr.h>
+#include <FBaseObject.h>
+#include <FBaseString.h>
+#include <FNetHttpHttpSession.h>
+#include <FNetHttpHttpTransaction.h>
+#include <FNetHttpIHttpTransactionEventListener.h>
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+class IWebDownloadListener;
+class _WebEvent;
+
+class _WebDataHandler
+ : public Tizen::Net::Http::IHttpTransactionEventListener
+{
+public:
+ _WebDataHandler(void);
+ virtual ~_WebDataHandler(void);
+
+ //IHttpTransactionEventListener
+ virtual void OnTransactionReadyToRead(Tizen::Net::Http::HttpSession& httpSession, Tizen::Net::Http::HttpTransaction& httpTransaction, int availableBodyLen);
+ virtual void OnTransactionAborted(Tizen::Net::Http::HttpSession& httpSession, Tizen::Net::Http::HttpTransaction& httpTransaction, result r);
+ virtual void OnTransactionReadyToWrite(Tizen::Net::Http::HttpSession& httpSession, Tizen::Net::Http::HttpTransaction& httpTransaction, int recommendedChunkSize);
+ virtual void OnTransactionHeaderCompleted(Tizen::Net::Http::HttpSession& httpSession, Tizen::Net::Http::HttpTransaction& httpTransaction, int headerLen, bool bAuthRequired);
+ virtual void OnTransactionCertVerificationRequiredN(Tizen::Net::Http::HttpSession& httpSession, Tizen::Net::Http::HttpTransaction& httpTransaction, Tizen::Base::String* pCert);
+ virtual void OnTransactionCompleted(Tizen::Net::Http::HttpSession& httpSession, Tizen::Net::Http::HttpTransaction& httpTransaction);
+
+ Tizen::Web::Controls::_WebEvent* GetWebEvent(void) const;
+ void SetWebEvent(const Tizen::Web::Controls::_WebEvent* pWebEvent);
+
+ Tizen::Web::Controls::IWebDownloadListener* GetDownloadListener(void) const;
+ void SetDownloadListener(const Tizen::Web::Controls::IWebDownloadListener* pDownloadListener);
+
+ result StartDownload(const Tizen::Base::String& url);
+
+private:
+ Tizen::Web::Controls::IWebDownloadListener* __pDownloadListener;
+ Tizen::Web::Controls::_WebEvent* __pWebEvent;
+ std::unique_ptr<Tizen::Net::Http::HttpSession> __pHttpSession;
+
+}; // _WebDataHandler
+
+}}} //Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_WEBDATA_HANDLER_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_WebImpl.cpp
+ * @brief The file contains the definition of _WebImpl class.
+ *
+ * The file contains the definition of _WebImpl class.
+ */
+#include <FBaseRtIEventListener.h>
+#include <FBaseSysLog.h>
+#include "FWebCtrl_WebEvent.h"
+#include "FWebCtrl_WebEventArg.h"
+
+
+using namespace Tizen::Base::Runtime;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+_WebEvent::_WebEvent(void)
+{
+}
+
+
+_WebEvent::~_WebEvent(void)
+{
+}
+
+
+result
+_WebEvent::Construct(const _IWebEventListener& listener)
+{
+ result r = E_SUCCESS;
+
+ r = Initialize();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Failed to initialize _WebEvent", GetErrorMessage(r));
+
+ r = AddListener(listener);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Failed to add _IWebEventListener.", GetErrorMessage(r));
+
+ return r;
+}
+
+
+void
+_WebEvent::FireImpl(Tizen::Base::Runtime::IEventListener& listener, const Tizen::Base::Runtime::IEventArg& arg)
+{
+ IEventArg* pArg = const_cast< IEventArg* >(&arg);
+ _IWebEventListener* pWebListener = static_cast< _IWebEventListener* >(&listener);
+ result r = E_SUCCESS;
+
+ _WebEventArg* pEventArg = dynamic_cast< _WebEventArg* >(pArg);
+ SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "[%s] Invalid argument(s) is used. arg is not _WebEventArg type." , GetErrorMessage(E_INVALID_ARG));
+
+ int eventGroup = pEventArg->GetEventGroup();
+ SysLog(NID_WEB_CTRL, "The current value of event group is %d", eventGroup);
+
+ switch (eventGroup)
+ {
+ case WEB_EVENT_REQUEST_SERVICE:
+// r = pWebListener->LaunchAppControl(arg);
+ break;
+
+ case WEB_EVENT_DELIVER_JSBRIDGE_REQUEST:
+ r = pWebListener->OnHandleJavaScriptRequestByEventArg(arg);
+ break;
+
+ case WEB_EVENT_LOADINGLISTENER:
+ r = pWebListener->OnHandleLoadingEvent(arg);
+ break;
+
+ case WEB_EVENT_WEBDOWNLOADLISTENER:
+ r = pWebListener->OnHandleWebDownloadEvent(arg);
+ break;
+
+ case WEB_EVENT_WEBUIEVENTLISTENER:
+ r = pWebListener->OnHandleWebUiEvent(arg);
+ break;
+
+ case WEB_EVENT_WEBUIEVENTLISTENER_FLOAT:
+ r = pWebListener->OnHandleWebUiEventF(arg);
+ break;
+
+ case WEB_EVENT_TEXTSEARCHLISTENER:
+ r = pWebListener->OnHandleTextSearchEvent(arg);
+ break;
+
+ default:
+ SysAssert(false);
+ break;
+ }
+}
+
+
+result
+_WebEvent::AddWebEventListener(const _IWebEventListener& listener)
+{
+ return AddListener(listener);
+}
+
+
+result
+_WebEvent::RemoveWebEventListener(const _IWebEventListener& listener)
+{
+ return RemoveListener(listener);
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_WebEvent.h
+ * @brief This is the header file for the _WebEvent class.
+ *
+ * This file contains the declarations of _WebEvent.
+ */
+#ifndef _FWEB_CTRL_INTERNAL_WEB_EVENT_H_
+#define _FWEB_CTRL_INTERNAL_WEB_EVENT_H_
+
+#include <FBaseRt_Event.h>
+#include "FWebCtrl_IWebEventListener.h"
+
+namespace Tizen { namespace Base { namespace Runtime
+{
+class IEventListener;
+}}} // Tizen::Base::Runtime
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+/**
+ * @class _WebEvent
+ * @brief This class provides methods for delivering an event with an argument synchronously and asynchronously.
+ *
+ */
+class _WebEvent
+ : public Tizen::Base::Runtime::_Event
+{
+public:
+ /**
+ * This is the default constructor for this class.
+ *
+ * @since 2.0
+ */
+ _WebEvent(void);
+
+ /**
+ * This is the destructor for this class.
+ *
+ * @since 2.0
+ */
+ virtual ~_WebEvent(void);
+ result Construct(const _IWebEventListener& listener);
+
+ result AddWebEventListener(const _IWebEventListener& listener);
+ result RemoveWebEventListener(const _IWebEventListener& listener);
+ /**
+ * Implement to call the corresponding event listener's method.
+ *
+ * @since 2.0
+ * @param[in] listener The listener instance which is currently processing
+ * @param[in] arg The event argument that is fired
+ */
+ virtual void FireImpl(Tizen::Base::Runtime::IEventListener& listener, const Tizen::Base::Runtime::IEventArg& arg);
+
+}; // _WebEvent
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_WEB_EVENT_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_WebEventArg.cpp
+ * @brief The file contains the definition of _WebEventArg class.
+ *
+ * The file contains the definition of _WebEventArg class.
+ */
+#include <new>
+#include <FBaseInteger.h>
+#include <FBaseSysLog.h>
+#include "FWebCtrl_WebEventArg.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+//// _WebEventArg /////////////
+_WebEventArg::_WebEventArg(int eventType, const Tizen::Base::String& message)
+ : __eventType(eventType)
+ , __message(message)
+{
+}
+
+
+_WebEventArg::~_WebEventArg(void)
+{
+}
+
+
+int
+_WebEventArg::GetEventType(void) const
+{
+ return __eventType;
+}
+
+
+int
+_WebEventArg::GetEventGroup(void) const
+{
+ return (0xf00 & __eventType);
+}
+
+
+Tizen::Base::String
+_WebEventArg::GetEventMessage(void) const
+{
+ return __message;
+}
+
+
+//// _JsBridgeArg/////////////
+_JsBridgeArg::_JsBridgeArg(void)
+ : _WebEventArg(WEB_EVENT_DELIVER_JSBRIDGE_REQUEST, L"")
+ , __pJsonText(null)
+{
+}
+
+
+_JsBridgeArg::~_JsBridgeArg(void)
+{
+}
+
+
+result
+_JsBridgeArg::Construct(const char* pJsonText)
+{
+ SysTryReturnResult(NID_WEB_CTRL, pJsonText, E_INVALID_ARG, "[%s] Invalid argument(s) is used. json text is null." , GetErrorMessage(E_INVALID_ARG));
+
+ result r = E_SUCCESS;
+ int length = 0;
+
+ std::unique_ptr<Tizen::Base::ByteBuffer> pNewJsonText(new (std::nothrow) ByteBuffer());
+ SysTryReturn(NID_WEB_CTRL, pNewJsonText.get(), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ length = strlen(pJsonText);
+ r = pNewJsonText->Construct(length);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Failed to construct bytebuffer for jsonText.", GetErrorMessage(r));
+
+ r = pNewJsonText->SetArray(reinterpret_cast< const byte* >(pJsonText), 0, length);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Failed to set json text to ByteBuffer. ", GetErrorMessage(r));
+
+ __pJsonText = std::move(pNewJsonText);
+
+ return r;
+}
+
+
+const Tizen::Base::ByteBuffer*
+_JsBridgeArg::GetJsonData(void) const
+{
+ return __pJsonText.get();
+}
+
+
+_LoadingEventArg::_LoadingEventArg(int loadingEvent)
+ : _WebEventArg(loadingEvent, L"")
+ , __pEventInfo(null)
+{
+}
+
+
+_LoadingEventArg::~_LoadingEventArg(void)
+{
+}
+
+
+result
+_LoadingEventArg::SetEventInfo(EventInfoKey key, const Tizen::Base::Object& value)
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr<Integer> pKey(new (std::nothrow) Integer(key));
+ SysTryReturn(NID_WEB_CTRL, pKey.get(), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ if (__pEventInfo.get() == null)
+ {
+ std::unique_ptr<HashMap, AllElementsDeleter> pEventInfo(new (std::nothrow) HashMap());
+ SysTryReturn(NID_WEB_CTRL, pEventInfo.get(), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pEventInfo->Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pEventInfo = std::move(pEventInfo);
+ }
+
+ r = __pEventInfo->Add(*pKey.get(), value);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pKey.release();
+
+ return r;
+
+}
+
+
+const Tizen::Base::Object*
+_LoadingEventArg::GetEventInfo(EventInfoKey key) const
+{
+ SysTryReturn(NID_WEB_CTRL, __pEventInfo.get(), null, E_OBJ_NOT_FOUND, "[%s] The required instance is not available.", GetErrorMessage(E_OBJ_NOT_FOUND));
+ Integer int_key(key);
+
+ return __pEventInfo->GetValue(int_key);
+}
+
+
+_WebDownloadEventArg::_WebDownloadEventArg(int webDonwloadEvent)
+ : _WebEventArg(webDonwloadEvent, L"")
+ , __pEventInfo(null)
+{
+}
+
+
+_WebDownloadEventArg::~_WebDownloadEventArg(void)
+{
+}
+
+
+result
+_WebDownloadEventArg::SetEventInfo(EventInfoKey key, const Tizen::Base::Object& value)
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr<Integer> pKey(new (std::nothrow) Integer(key));
+ SysTryReturn(NID_WEB_CTRL, pKey.get(), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ if (__pEventInfo.get() == null)
+ {
+ std::unique_ptr<HashMap, AllElementsDeleter> pEventInfo(new (std::nothrow) HashMap());
+ SysTryReturn(NID_WEB_CTRL, pEventInfo.get(), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pEventInfo->Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pEventInfo = std::move(pEventInfo);
+ }
+
+ r = __pEventInfo->Add(*pKey.get(), value);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pKey.release();
+
+ return r;
+}
+
+
+const Tizen::Base::Object*
+_WebDownloadEventArg::GetEventInfo(EventInfoKey key) const
+{
+ SysTryReturn(NID_WEB_CTRL, __pEventInfo.get(), null, E_OBJ_NOT_FOUND, "[%s] The required instance is not available.", GetErrorMessage(E_OBJ_NOT_FOUND));
+ Integer int_key(key);
+
+ return __pEventInfo->GetValue(int_key);
+}
+
+
+_WebUiEventArg::_WebUiEventArg(int webUiEvent)
+ : _WebEventArg(webUiEvent, L"")
+ , __pEventInfo(null)
+{
+}
+
+
+_WebUiEventArg::~_WebUiEventArg(void)
+{
+}
+
+
+result
+_WebUiEventArg::SetEventInfo(EventInfoKey key, const Tizen::Base::Object& value)
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr<Integer> pKey(new (std::nothrow) Integer(key));
+ SysTryReturn(NID_WEB_CTRL, pKey.get(), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ if (__pEventInfo.get() == null)
+ {
+ std::unique_ptr<HashMap, AllElementsDeleter> pEventInfo(new (std::nothrow) HashMap());
+ SysTryReturn(NID_WEB_CTRL, pEventInfo.get(), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pEventInfo->Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pEventInfo = std::move(pEventInfo);
+ }
+
+ r = __pEventInfo->Add(*pKey.get(), value);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pKey.release();
+
+ return r;
+}
+
+
+const Tizen::Base::Object*
+_WebUiEventArg::GetEventInfo(EventInfoKey key) const
+{
+ SysTryReturn(NID_WEB_CTRL, __pEventInfo.get(), null, E_OBJ_NOT_FOUND, "[%s] The required instance is not available.", GetErrorMessage(E_OBJ_NOT_FOUND));
+ Integer int_key(key);
+
+ return __pEventInfo->GetValue(int_key);
+}
+
+
+_TextSearchEventArg::_TextSearchEventArg(int textSearchEvent)
+ : _WebEventArg(textSearchEvent, L"")
+ , __pEventInfo(null)
+{
+}
+
+
+_TextSearchEventArg::~_TextSearchEventArg(void)
+{
+}
+
+
+result
+_TextSearchEventArg::SetEventInfo(EventInfoKey key, const Tizen::Base::Object& value)
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr<Integer> pKey(new (std::nothrow) Integer(key));
+ SysTryReturn(NID_WEB_CTRL, pKey.get(), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ if (__pEventInfo.get() == null)
+ {
+ std::unique_ptr<HashMap, AllElementsDeleter> pEventInfo(new (std::nothrow) HashMap());
+ SysTryReturn(NID_WEB_CTRL, pEventInfo.get(), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pEventInfo->Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pEventInfo = std::move(pEventInfo);
+ }
+
+ r = __pEventInfo->Add(*pKey.get(), value);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pKey.release();
+
+ return r;
+}
+
+
+const Tizen::Base::Object*
+_TextSearchEventArg::GetEventInfo(EventInfoKey key) const
+{
+ SysTryReturn(NID_WEB_CTRL, __pEventInfo.get(), null, E_OBJ_NOT_FOUND, "[%s] The required instance is not available.", GetErrorMessage(E_OBJ_NOT_FOUND));
+ Integer int_key(key);
+
+ return __pEventInfo->GetValue(int_key);
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_WebEventArg.h
+ * @brief The file contains the declaration of _WebEventArg class.
+ *
+ * The file contains the declaration of _WebEvent class.
+ */
+#ifndef _FWEB_CTRL_INTERNAL_WEB_EVENT_ARG_H_
+#define _FWEB_CTRL_INTERNAL_WEB_EVENT_ARG_H_
+
+#include <unique_ptr.h>
+#include <FBaseColAllElementsDeleter.h>
+#include <FBaseColHashMap.h>
+#include <FBaseObject.h>
+#include <FBaseByteBuffer.h>
+#include <FBaseString.h>
+#include <FBaseRtIEventArg.h>
+
+
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+enum _WebEventType
+{
+ WEB_EVENT_REQUEST_SERVICE = 0x000,
+ WEB_EVENT_REQUEST_RTSP,
+ WEB_EVENT_REQUEST_EMAIL,
+ WEB_EVENT_REQUEST_TEL,
+ WEB_EVENT_REQUEST_SMS,
+ WEB_EVENT_REQUEST_MMS,
+ WEB_EVENT_REQUEST_UNKNOWN,
+
+ WEB_EVENT_DELIVER_JSBRIDGE_REQUEST = 0x100,
+
+ WEB_EVENT_LOADINGLISTENER = 0x200,
+ WEB_EVENT_LOADINGLISTENER_STARTED,
+ WEB_EVENT_LOADINGLISTENER_PROGRESS,
+ WEB_EVENT_LOADINGLISTENER_PAGETITLE_RECEIVED,
+ WEB_EVENT_LOADINGLISTENER_CANCELED,
+ WEB_EVENT_LOADINGLISTENER_ERROR_OCCURRED,
+ WEB_EVENT_LOADINGLISTENER_COMPLETED,
+ WEB_EVENT_LOADINGLISTENER_AUTHENTICATION_REQUESTED,
+ WEB_EVENT_LOADINGLISTENER_AUTHENTICATION_CANCELED,
+ WEB_EVENT_LOADINGLISTENER_FAVICON_RECEIVED,
+
+ WEB_EVENT_WEBDOWNLOADLISTENER = 0x300,
+ WEB_EVENT_WEBDOWNLOADLISTENER_DATA_RECEIVED,
+ WEB_EVENT_WEBDOWNLOADLISTENER_COMPLETED,
+ WEB_EVENT_WEBDOWNLOADLISTENER_FAILED,
+
+ WEB_EVENT_WEBUIEVENTLISTENER = 0x400,
+ WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED,
+ WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED,
+ WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED,
+ WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED,
+
+ WEB_EVENT_WEBUIEVENTLISTENER_FLOAT = 0x500,
+ WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED_FLOAT,
+ WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED_FLOAT,
+ WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED_FLOAT,
+ WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED_FLOAT,
+
+ WEB_EVENT_TEXTSEARCHLISTENER = 0x600,
+ WEB_EVENT_TEXTSEARCHLISTENER_TEXT_FOUND
+};
+
+class _WebEventArg
+ : public Tizen::Base::Object
+ , public Tizen::Base::Runtime::IEventArg
+{
+public:
+ _WebEventArg(int eventType, const Tizen::Base::String& message);
+ virtual ~_WebEventArg(void);
+
+ int GetEventType(void) const;
+ int GetEventGroup(void) const;
+ Tizen::Base::String GetEventMessage(void) const;
+
+private:
+ int __eventType;
+ Tizen::Base::String __message;
+}; // _WebEventArg
+
+class _JsBridgeArg
+ : public _WebEventArg
+{
+public:
+ _JsBridgeArg(void);
+ virtual ~_JsBridgeArg(void);
+
+ result Construct(const char* pJsonText);
+
+ const Tizen::Base::ByteBuffer* GetJsonData(void) const;
+
+private:
+ // Copy constructor
+ _JsBridgeArg(const _JsBridgeArg& bridge);
+
+ // Assignment operator
+ _JsBridgeArg& operator =(const _JsBridgeArg& bridge);
+
+private:
+ std::unique_ptr<Tizen::Base::ByteBuffer> __pJsonText;
+}; // _JsBridgeArg
+
+class _LoadingEventArg
+ : public _WebEventArg
+{
+public:
+ _LoadingEventArg(int loadingEvent);
+ virtual ~_LoadingEventArg(void);
+
+ enum EventInfoKey
+ {
+ ESTIMATED_PROGRESS,
+ PAGE_TITLE,
+ ERROR_TYPE,
+ ERROR_MESSAGE,
+ AUTHENTICATION_HOST,
+ AUTHENTICATION_REALM,
+ AUTHENTICATION_CHALLENGE
+ };
+
+ result SetEventInfo(EventInfoKey key, const Tizen::Base::Object& value);
+ const Tizen::Base::Object* GetEventInfo(EventInfoKey key) const;
+
+private:
+ // Copy constructor
+ _LoadingEventArg(const _LoadingEventArg& rhs);
+
+ // Assignment operator
+ _LoadingEventArg& operator =(const _LoadingEventArg& rhs);
+
+private:
+ std::unique_ptr<Tizen::Base::Collection::HashMap, Tizen::Base::Collection::AllElementsDeleter> __pEventInfo;
+
+}; // _LoadingEventArg
+
+class _WebDownloadEventArg
+ : public _WebEventArg
+{
+public:
+ _WebDownloadEventArg(int webDownloadEvent);
+ virtual ~_WebDownloadEventArg(void);
+
+ enum EventInfoKey
+ {
+ CHUNKED_DATA,
+ ERROR_TYPE
+ };
+
+ result SetEventInfo(EventInfoKey key, const Tizen::Base::Object& value);
+ const Tizen::Base::Object* GetEventInfo(EventInfoKey key) const;
+
+private:
+ // Copy constructor
+ _WebDownloadEventArg(const _WebDownloadEventArg& rhs);
+
+ // Assignment operator
+ _WebDownloadEventArg& operator =(const _WebDownloadEventArg& rhs);
+
+private:
+ std::unique_ptr<Tizen::Base::Collection::HashMap, Tizen::Base::Collection::AllElementsDeleter> __pEventInfo;
+
+}; // _WebDownloadEventArg
+
+class _WebUiEventArg
+ : public _WebEventArg
+{
+public:
+ _WebUiEventArg(int webUiEvent);
+ virtual ~_WebUiEventArg(void);
+
+ enum EventInfoKey
+ {
+ BLOCK_START,
+ BLOCK_END,
+ PREVENT_DEFAULT
+ };
+
+ result SetEventInfo(EventInfoKey key, const Tizen::Base::Object& value);
+ const Tizen::Base::Object* GetEventInfo(EventInfoKey key) const;
+
+private:
+ // Copy constructor
+ _WebUiEventArg(const _WebUiEventArg& rhs);
+
+ // Assignment operator
+ _WebUiEventArg& operator =(const _WebUiEventArg& rhs);
+
+private:
+ std::unique_ptr<Tizen::Base::Collection::HashMap, Tizen::Base::Collection::AllElementsDeleter> __pEventInfo;
+
+}; // _WebUiEventArg
+
+class _TextSearchEventArg
+ : public _WebEventArg
+{
+public:
+ _TextSearchEventArg(int textFoundEvent);
+ virtual ~_TextSearchEventArg(void);
+
+ enum EventInfoKey
+ {
+ TOTAL_COUNT,
+ CURRENT_ORDINAL
+ };
+
+ result SetEventInfo(EventInfoKey key, const Tizen::Base::Object& value);
+ const Tizen::Base::Object* GetEventInfo(EventInfoKey key) const;
+
+private:
+ // Copy constructor
+ _TextSearchEventArg(const _TextSearchEventArg& rhs);
+
+ // Assignment operator
+ _TextSearchEventArg& operator =(const _TextSearchEventArg& rhs);
+
+private:
+ std::unique_ptr<Tizen::Base::Collection::HashMap, Tizen::Base::Collection::AllElementsDeleter> __pEventInfo;
+
+}; // _TextSearchEventArg
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_WEB_EVENT_ARG_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_WebImpl.cpp
+ * @brief The file contains the definition of _WebImpl class.
+ *
+ * The file contains the definition of _WebImpl class.
+ */
+#include <Ecore_IMF_Evas.h>
+#include <Ecore_Evas.h>
+#include <elm_config.h>
+#include <elm_win.h>
+#include <EWebKit2.h>
+#include <ewk_popup_menu_item.h>
+#include <libsoup/soup-status.h>
+#include <FAppApp.h>
+#include <FAppAppControl.h>
+#include <FAppIAppControlListener.h>
+#include <FBaseColAllElementsDeleter.h>
+#include <FBaseColHashMapT.h>
+#include <FBaseRtMutex.h>
+#include <FBaseRtMutexGuard.h>
+#include <FBaseSysLog.h>
+#include <FBaseUtilUri.h>
+#include <FGrpColor.h>
+#include <FGrpPoint.h>
+#include <FGrpRectangle.h>
+#include <FIoDbEnumerator.h>
+#include <FIoDbStatement.h>
+#include <FIoFile.h>
+#include <FMediaImage.h>
+#include <FMediaImageTypes.h>
+#include <FNetHttpHttpHeader.h>
+#include <FSysVibrator.h>
+#include <FUiControl.h>
+#include <FUiCtrlKeypad.h>
+#include <FWebCtrlHitElementResult.h>
+#include <FWebCtrlITextSearchListener.h>
+#include <FWebCtrlIWebDownloadListener.h>
+#include <FWebCtrlIWebUiEventListener.h>
+#include <FWebCtrlIWebUiEventListenerF.h>
+#include <FWebCtrlIWebKeypadEventListener.h>
+#include <FWebCtrlIJavaScriptBridge.h>
+#include <FWebCtrlPageNavigationList.h>
+#include <FWebCtrlAuthenticationChallenge.h>
+#include <FWebCtrlWeb.h>
+#include <FWebCtrlWebSetting.h>
+#include <FWebHistoryItem.h>
+#include <FWebJsonJsonObject.h>
+#include <FWebJsonJsonParser.h>
+#include <FWebJsonJsonString.h>
+#include <FApp_AppControlImpl.h>
+#include <FApp_AppControlManager.h>
+#include <FApp_AppInfo.h>
+#include <FApp_AppManagerImpl.h>
+#include <FBase_StringConverter.h>
+#include <FGrp_CoordinateSystem.h>
+#include <FGrp_Screen.h>
+#include <FIo_DatabaseImpl.h>
+#include <FIo_NormalFile.h>
+#include <FSys_SettingInfoImpl.h>
+#include <FSys_SystemResource.h>
+#include <FUi_Control.h>
+#include <FUi_CoordinateSystemUtils.h>
+#include <FUi_EcoreEvasMgr.h>
+#include <FUi_EcoreEvas.h>
+#include <FUi_ResourceManager.h>
+#include <FUi_ResourceSizeInfo.h>
+#include <FUi_Window.h>
+#include <FUiAnim_EflNode.h>
+#include <FUiAnim_VisualElement.h>
+#include <FUiCtrl_FooterImpl.h>
+#include <FUiCtrl_FormImpl.h>
+#include "FWeb_HistoryItemImpl.h"
+#include "FWebCtrl_AppControlListener.h"
+#include "FWebCtrl_AuthConfirmPopup.h"
+#include "FWebCtrl_AuthenticationChallengeImpl.h"
+#include "FWebCtrl_EflWebkit.h"
+#include "FWebCtrl_FormDataWindow.h"
+#include "FWebCtrl_GeolocationPermissionManagerImpl.h"
+#include "FWebCtrl_HitElementResultImpl.h"
+#include "FWebCtrl_InputPickerPopup.h"
+#include "FWebCtrl_WebNotification.h"
+#include "FWebCtrl_PageNavigationListImpl.h"
+#include "FWebCtrl_PromptPopup.h"
+#include "FWebCtrl_SelectBox.h"
+#include "FWebCtrl_Utility.h"
+#include "FWebCtrl_Web.h"
+#include "FWebCtrl_WebDataHandler.h"
+#include "FWebCtrl_WebEvent.h"
+#include "FWebCtrl_WebEventArg.h"
+#include "FWebCtrl_WebImpl.h"
+#include "FWebCtrl_WebManager.h"
+#include "FWebCtrl_WebPresenter.h"
+#include "FWebCtrl_WebSettingImpl.h"
+
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Base::Runtime;
+using namespace Tizen::Base::Utility;
+using namespace Tizen::Content;
+using namespace Tizen::Graphics;
+using namespace Tizen::Io;
+using namespace Tizen::Media;
+using namespace Tizen::Net::Http;
+using namespace Tizen::System;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Animations;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Web::Json;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+static const char WEB_CTRL[] = "webcontrol";
+static const char PARENT_WEB_CTRL[] = "parentwebcontrol";
+
+
+static const float MIN_ZOOM_LEVEL = 0.3;
+static const float MAX_ZOOM_LEVEL = 2;
+
+
+static const int REDIRECTION_HEADER_GROUP = 300;
+
+
+static const int MAX_TEXT_MATCH = pow(2, 31) - 1;
+
+
+static const int PORTRAIT_KEYPAD_HEIGHT = 444;
+static const int LANDSCAPE_KEYPAD_HEIGHT = 316;
+static const int DEFAULT_LIST_ITEM_COUNT = 5;
+
+
+Eina_Bool
+AddHttpAttributeData(const Eina_Hash* pHash, const void* pKey, void* pValue, void* pUserData)
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr<String> pAttrKey(new (std::nothrow) String(reinterpret_cast< char* >(const_cast< void* >(pKey))));
+ std::unique_ptr<String> pAttrValue(new (std::nothrow) String(reinterpret_cast< char* >(pValue)));
+ SysTryReturn(NID_WEB_CTRL, pAttrKey.get() && pAttrValue.get(), EINA_FALSE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ SysSecureLog(NID_WEB_CTRL, "The current value of key is %ls, value is %ls", pAttrKey->GetPointer(), pAttrValue->GetPointer());
+
+ r = reinterpret_cast< HashMap* >(pUserData)->Add(*pAttrKey, *pAttrValue);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+ pAttrKey.release();
+ pAttrValue.release();
+
+ return EINA_TRUE;
+}
+
+
+void
+FreeCharArray(void* pData)
+{
+ delete[] reinterpret_cast<char*>(pData);
+}
+
+
+LoadingErrorType
+ConvertErrorCode(int error)
+{
+ LoadingErrorType errorCode = WEB_ERROR_UNKNOWN;
+
+ switch (error)
+ {
+ case EWK_ERROR_NETWORK_STATUS_CANCELLED:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_CANT_RESOLVE:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_CANT_RESOLVE_PROXY:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_CANT_CONNECT:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_CANT_CONNECT_PROXY:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_IO_ERROR:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_MALFORMED:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_TRY_AGAIN:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_TOO_MANY_REDIRECTS:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_TLS_FAILED:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_INTERNAL_SERVER_ERROR:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_BAD_GATEWAY:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_SERVICE_UNAVAILABLE:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_GATEWAY_TIMEOUT:
+ errorCode = WEB_NO_CONNECTION;
+ break;
+
+ case EWK_ERROR_NETWORK_STATUS_BAD_REQUEST:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_REQUEST_URI_TOO_LONG:
+ errorCode = WEB_BAD_URL;
+ break;
+
+ case EWK_ERROR_NETWORK_STATUS_FORBIDDEN:
+ errorCode = WEB_FILE_ACCESS_FAILED;
+ break;
+
+ case EWK_ERROR_NETWORK_STATUS_REQUEST_TIMEOUT:
+ errorCode = WEB_REQUEST_TIMEOUT;
+ break;
+
+ case EWK_ERROR_NETWORK_STATUS_UNSUPPORTED_MEDIA_TYPE:
+ errorCode = WEB_MIME_NOT_SUPPORTED;
+ break;
+
+ case EWK_ERROR_NETWORK_STATUS_INSUFFICIENT_STORAGE:
+ errorCode = WEB_OUT_OF_MEMORY;
+ break;
+
+ case EWK_ERROR_NETWORK_STATUS_REQUEST_ENTITY_TOO_LARGE:
+ errorCode = WEB_REQUEST_MAX_EXCEEDED;
+ break;
+
+ case EWK_ERROR_NETWORK_STATUS_CONTINUE:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_SWITCHING_PROTOCOLS:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_PROCESSING:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_OK:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_CREATED:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_ACCEPTED:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_NON_AUTHORITATIVE:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_NO_CONTENT:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_RESET_CONTENT:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_PARTIAL_CONTENT:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_MULTI_STATUS:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_MULTIPLE_CHOICES:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_MOVED_PERMANENTLY:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_FOUND:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_SEE_OTHER:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_NOT_MODIFIED:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_USE_PROXY:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_NOT_APPEARING_IN_THIS_PROTOCOL:
+ //fall through
+ case EWK_ERROR_NETWORK_STATUS_TEMPORARY_REDIRECT:
+ errorCode = WEB_HTTP_RESPONSE;
+ break;
+
+ case EWK_ERROR_NETWORK_STATUS_SSL_FAILED:
+ errorCode = WEB_INVALID_CERTIFICATE;
+ break;
+
+ default:
+ errorCode = WEB_ERROR_UNKNOWN;
+ break;
+ }
+
+ return errorCode;
+}
+
+
+result
+FireLoadingErrorOccurredEvent(_WebImpl* pImpl, int code, const char* pDescription)
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr<Integer> pErrorCode(new (std::nothrow) Integer(code));
+ std::unique_ptr<String> pErrorDescription(new (std::nothrow) String(pDescription));
+ std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_ERROR_OCCURRED));
+ SysTryReturnResult(NID_WEB_CTRL, pErrorCode.get() && pErrorDescription.get() && pEventArg.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ r = pEventArg->SetEventInfo(_LoadingEventArg::ERROR_TYPE, *pErrorCode.get());
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ pErrorCode.release();
+
+ r = pEventArg->SetEventInfo(_LoadingEventArg::ERROR_MESSAGE, *pErrorDescription.get());
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ pErrorDescription.release();
+
+ r = pImpl->GetWebEvent()->FireAsync(*pEventArg);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ pEventArg.release();
+
+ return E_SUCCESS;
+}
+
+
+Eina_Bool
+OnScriptAlertRequested(Evas_Object* pView, const char* pMessage, void* pUserData)
+{
+ SysLog(NID_WEB_CTRL, "The current value of message is %s", pMessage);
+
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ String msg(pMessage);
+
+ result r = pImpl->ShowUserConfirmPopupAsync(USER_SCRIPT_ALERT, pView, msg);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ return EINA_TRUE;
+
+CATCH:
+ ewk_view_javascript_alert_reply(pView);
+ return EINA_TRUE;
+}
+
+
+Eina_Bool
+OnScriptConfirmRequested(Evas_Object* pView, const char* pMessage, void* pUserData)
+{
+ SysLog(NID_WEB_CTRL, "The current value of message is %s", pMessage);
+
+ result r = E_SUCCESS;
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ String msg(pMessage);
+
+ r = pImpl->ShowUserConfirmPopupAsync(USER_SCRIPT_CONFIRM, pView, msg);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ return EINA_TRUE;
+
+CATCH:
+ ewk_view_javascript_confirm_reply(pView, EINA_FALSE);
+ return EINA_TRUE;
+}
+
+
+Eina_Bool
+OnScriptPromptRequested(Evas_Object* pView, const char* pMessage, const char* pDefaultValue, void* pUserData)
+{
+ SysLog(NID_WEB_CTRL, "The current value of message is %s, defaulValue is %s", pMessage, pDefaultValue);
+
+ result r = E_SUCCESS;
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+
+ String msg(pMessage);
+ String defVal(pDefaultValue);
+
+ r = pImpl->ShowPromptPopup(msg, defVal);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return EINA_TRUE;
+
+CATCH:
+ ewk_view_javascript_prompt_reply(pView, null);
+
+ return EINA_TRUE;
+}
+
+
+Eina_Bool
+_WebImpl::OnBeforeUnloadConfirmRequested(Evas_Object* pView, const char* pMessage, void* pUserData)
+{
+ _WebImpl* pWebImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pWebImpl, "Failed to request");
+ result r = E_SUCCESS;
+
+ String msg(pMessage);
+
+ r = pWebImpl->ShowUserConfirmPopupAsync(USER_BEFORE_UNLOAD_CONFIRM, pView, msg);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ return EINA_TRUE;
+
+CATCH:
+ ewk_view_javascript_confirm_reply(pView, EINA_FALSE);
+ return EINA_TRUE;
+}
+
+
+void
+OnCertificateRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ Ewk_Certificate_Policy_Decision* pPolicy = reinterpret_cast< Ewk_Certificate_Policy_Decision* >(pEventInfo);
+ SysAssertf(pImpl && pPolicy, "Failed to request");
+
+ _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
+
+ switch (pImpl->GetSetting().GetCertificateErrorHandlingMode())
+ {
+ case WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM:
+ {
+ if (pImpl->IsCertificateRequested())
+ {
+ ewk_certificate_policy_decision_allowed_set(pPolicy, static_cast< Eina_Bool >(pImpl->IsCertificateConfirmed()));
+ return;
+ }
+
+ result r = E_SUCCESS;
+
+ std::unique_ptr<DbEnumerator> pEnum;
+
+ String certificatePath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
+ String table(CERTIFICATE_TABLE_NAME);
+ _DatabaseImpl db;
+
+ String pem(ewk_certificate_policy_decision_certificate_pem_get(pPolicy));
+
+ r = db.Construct(certificatePath, "r", null);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pEnum = std::unique_ptr<DbEnumerator>(db.QueryN(L"Select allow From " + table + L" Where pem = '" + pem + L"'"));
+ if (pEnum.get())
+ {
+ r = pEnum->MoveNext();
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ int allow = 0;
+ r = pEnum->GetIntAt(0, allow);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ SysLog(NID_WEB_CTRL, "The current value of allow is %d", allow);
+
+ ewk_certificate_policy_decision_allowed_set(pPolicy, static_cast < Eina_Bool >(allow));
+ pImpl->SetCertificateConfirmed(static_cast < bool >(allow));
+ }
+ else
+ {
+ r = pImpl->ShowCertificateConfirmPopup(CERTIFICATE_POPUP_MODE_USER_CONFIRM, pPolicy);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ ewk_view_resume(pWebCore->GetWebNativeNode());
+ }
+
+ if (pImpl)
+ {
+ pImpl->SetCertificateRequested(true);
+ }
+ break;
+ }
+ case WEB_CERTIFICATE_ERROR_HANDLING_MODE_CANCEL:
+ ewk_certificate_policy_decision_allowed_set(pPolicy, EINA_FALSE);
+ break;
+ case WEB_CERTIFICATE_ERROR_HANDLING_MODE_CONTINUE :
+ ewk_certificate_policy_decision_allowed_set(pPolicy, EINA_TRUE);
+ break;
+ default:
+ SysAssert(false);
+ }
+
+ return;
+
+CATCH:
+ ewk_certificate_policy_decision_allowed_set(pPolicy, EINA_FALSE);
+ pImpl->SetCertificateConfirmed(false);
+ pImpl->SetCertificateRequested(true);
+
+ ewk_view_resume(pWebCore->GetWebNativeNode());
+}
+
+
+void
+OnHttpAuthenticationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ Ewk_Auth_Challenge* pChallenge = reinterpret_cast< Ewk_Auth_Challenge* >(pEventInfo);
+ SysAssertf(pImpl && pChallenge, "Failed to request");
+
+ result r = E_SUCCESS;
+
+ r = pImpl->HttpAuthenticationRequested(pChallenge);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ return;
+
+CATCH:
+ ewk_auth_challenge_credential_cancel(pChallenge);
+ evas_object_smart_callback_call(pView, "authentication,canceled", NULL);
+}
+
+
+void
+OnHttpAuthenticationCanceled(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pImpl , "Failed to request");
+
+ if (pImpl->GetLoadingListener())
+ {
+ result r = E_SUCCESS;
+
+ std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_AUTHENTICATION_CANCELED));
+ SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ pEventArg.release();
+ }
+}
+
+Eina_Bool
+OnApplicationCachePermissionRequested(Evas_Object* pView, Ewk_Security_Origin* pSecOrigin, void* pUserData)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pImpl , "Failed to request");
+
+ _SystemResource* pSysResource = _SystemResource::GetInstance();
+ SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
+
+ result r = E_SUCCESS;
+
+ String message(L"");
+ r = message.Format(512,
+ pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_P1SS_HP2SS_IS_REQUESTING_PERMISSION_TO_STORE_DATA_ON_YOUR_DEVICE_FOR_OFFLINE_USE").GetPointer(),
+ _StringConverter::CopyToCharArrayN(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_THIS_WEBPAGE")),
+ ewk_security_origin_host_get(pSecOrigin));
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_APP_CACHE, pView, message);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return EINA_TRUE;
+
+CATCH:
+ ewk_view_application_cache_permission_reply(pView, EINA_FALSE);
+ return EINA_TRUE;
+}
+
+
+Eina_Bool
+OnIndexedDatabaseQuotaExceeded(Evas_Object* pView, Ewk_Security_Origin* pSecOrigin, long long currentQuota, void* pUserData)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pImpl , "Failed to request");
+
+ _SystemResource* pSysResource = _SystemResource::GetInstance();
+ SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
+
+ result r = E_SUCCESS;
+
+ String message(L"");
+ r = message.Format(512,
+ pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_P1SS_HP2SS_IS_ATTEMPTING_TO_STORE_A_LARGE_AMOUNT_OF_DATA_ON_YOUR_DEVICE_FOR_OFFLINE_USE").GetPointer(),
+ _StringConverter::CopyToCharArrayN(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_THIS_WEBPAGE")),
+ ewk_security_origin_host_get(pSecOrigin));
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_INDEXED_DB_QUOTA_EXCEDED, pView, message);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return EINA_TRUE;
+
+CATCH:
+ ewk_view_exceeded_indexed_database_quota_reply(pView, EINA_FALSE);
+ return EINA_TRUE;
+}
+
+
+Eina_Bool
+OnDatabaseQuotaExceeded(Evas_Object* pView, Ewk_Security_Origin* pSecOrigin, const char* database_name, unsigned long long expectedQuota, void* pUserData)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pImpl , "Failed to request");
+
+ _SystemResource* pSysResource = _SystemResource::GetInstance();
+ SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
+
+ result r = E_SUCCESS;
+
+ String message(L"");
+ r = message.Format(512,
+ pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_P1SS_HP2SS_IS_ATTEMPTING_TO_STORE_A_LARGE_AMOUNT_OF_DATA_ON_YOUR_DEVICE_FOR_OFFLINE_USE").GetPointer(),
+ _StringConverter::CopyToCharArrayN(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_THIS_WEBPAGE")),
+ ewk_security_origin_host_get(pSecOrigin));
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_DB_QUOTA_EXCEDED, pView, message);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return EINA_TRUE;
+
+CATCH:
+ ewk_view_exceeded_database_quota_reply(pView, EINA_FALSE);
+ return EINA_TRUE;
+}
+
+
+Eina_Bool
+OnLocalFileSystemQuotaExceeded(Evas_Object* pView, Ewk_Security_Origin* pSecOrigin, long long currentQuota, void* pUserData)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pImpl , "Failed to request");
+
+ _SystemResource* pSysResource = _SystemResource::GetInstance();
+ SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
+
+ result r = E_SUCCESS;
+
+ String message(L"");
+ r = message.Format(512,
+ pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_P1SS_HP2SS_IS_ATTEMPTING_TO_STORE_A_LARGE_AMOUNT_OF_DATA_ON_YOUR_DEVICE_FOR_OFFLINE_USE").GetPointer(),
+ _StringConverter::CopyToCharArrayN(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_THIS_WEBPAGE")),
+ ewk_security_origin_host_get(pSecOrigin));
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_LOCAL_FS_QUOTA_EXCEDED, pView, message);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return EINA_TRUE;
+
+CATCH:
+ ewk_view_exceeded_local_file_system_quota_reply(pView, EINA_FALSE);
+ return EINA_TRUE;
+}
+
+
+void
+OnGeolocationPermissionRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
+ Ewk_Geolocation_Permission_Request* pPermissionRequest = reinterpret_cast< Ewk_Geolocation_Permission_Request* >(pEventInfo);
+ SysAssertf(pImpl && pPermissionRequest, "Failed to request");
+
+ if (pImpl->GetSetting().IsGeolocationEnabled())
+ {
+ result r = E_SUCCESS;
+
+ std::unique_ptr<DbEnumerator> pEnum;
+
+ String geolocationPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
+ String table(GEOLOCATION_TABLE_NAME);
+ _DatabaseImpl db;
+
+ const Ewk_Security_Origin* pSecurityOrigin = ewk_geolocation_permission_request_origin_get(pPermissionRequest);
+ String origin = _Utility::CreateOrigin(pSecurityOrigin);
+
+ r = db.Construct(geolocationPath, "r", null);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pEnum = std::unique_ptr<DbEnumerator>(db.QueryN(L"Select permission From " + table + L" Where origin = '" + origin + L"'"));
+ if (pEnum.get())
+ {
+ r = pEnum->MoveNext();
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ int permission = 0;
+ r = pEnum->GetIntAt(0, permission);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ SysLog(NID_WEB_CTRL, "The current value of permission is %d", permission);
+
+ ewk_geolocation_permission_request_set(pPermissionRequest, static_cast < Eina_Bool >(permission));
+ }
+ else
+ {
+ ewk_geolocation_permission_request_suspend(pPermissionRequest);
+
+ r = pImpl->ShowUserConfirmPopupAsync(USER_CONFIRM_GEOLOCATION, pPermissionRequest);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+
+ return;
+ }
+
+CATCH:
+ ewk_geolocation_permission_request_set(pPermissionRequest, EINA_FALSE);
+}
+
+
+void
+OnGetUserMediaPermissionRequsted(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
+ Ewk_User_Media_Permission_Request* pPermissionRequest = reinterpret_cast< Ewk_User_Media_Permission_Request* >(pEventInfo);
+ SysAssertf(pImpl && pPermissionRequest, "Failed to request");
+
+ result r = pImpl->ShowUserConfirmPopupAsync(USER_CONFIRM_USERMEDIA, pEventInfo);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ return;
+
+CATCH:
+ ewk_user_media_permission_request_set(pPermissionRequest, EINA_FALSE);
+}
+
+
+void
+OnNotificationPermissionRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ result r = E_SUCCESS;
+ _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
+
+ Ewk_Notification_Permission_Request* pPermissionRequest = reinterpret_cast< Ewk_Notification_Permission_Request* >(pEventInfo);
+ SysAssertf(pImpl && pPermissionRequest, "Failed to request");
+
+ ewk_notification_permission_request_suspend(pPermissionRequest);
+
+ r = pImpl->ShowUserConfirmPopupAsync(USER_CONFIRM_NOTIFICATION, pPermissionRequest);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ return;
+
+CATCH:
+ ewk_notification_permission_request_set(pPermissionRequest, EINA_FALSE);
+}
+
+
+void
+OnNotificationShow(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
+ Ewk_Notification* pNotification = reinterpret_cast< Ewk_Notification* >(pEventInfo);
+ SysAssertf(pImpl && pNotification, "Failed to request");
+
+ result r = E_SUCCESS;
+ Ewk_Context* pContext = ewk_view_context_get(pView);
+ SysAssertf(pContext, "Failed to get webkit instance.");
+ uint64_t notificationId = ewk_notification_id_get(pNotification);
+
+ //ewk_notification_security_origin_get(pNotification)
+
+ const char* text = ewk_notification_body_get(pNotification);
+ SysSecureLog(NID_WEB_CTRL, "The current value of icon path is %s",ewk_notification_icon_url_get(pNotification));
+
+ std::unique_ptr<_WebNotification> pNotificationWindow( new (std::nothrow) _WebNotification());
+ SysTryReturnVoidResult(NID_WEB_CTRL, pNotificationWindow.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pNotificationWindow->Construct(pContext, notificationId, pImpl);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Error propogated.", GetErrorMessage(r));
+
+ pNotificationWindow->SetText(String(text));
+ pNotificationWindow->LaunchNotification();
+ pImpl->SetWebNotification(pNotificationWindow.release());
+
+ ewk_notification_showed(pContext, notificationId);
+}
+
+
+void
+OnNotificationCancel(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
+ uint64_t* pNotificationID = reinterpret_cast< uint64_t* >(pEventInfo);
+ SysAssertf(pImpl && pNotificationID, "Failed to request");
+
+ //ToDo : Where is ewk API for cancel operation?
+}
+
+
+void
+OnProtocolHandlerRegistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ result r = E_SUCCESS;
+ _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
+ SysAssertf(pImpl, "Failed to request");
+
+ r = pImpl->ShowUserConfirmPopup(USER_PROTOCOL_HANDLER, pEventInfo);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+}
+
+
+void
+OnIsProtocolHandlerRegistered(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ int checkHandler = 0;
+ _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
+ Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
+ SysAssertf(pImpl && pHandlerData, "Failed to request");
+
+ checkHandler = pImpl->SearchHandler(pHandlerData, false);
+ SysTryReturnVoidResult(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+ switch (checkHandler)
+ {
+ case -1:
+ return;
+ case 0:
+ ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_DECLINED);
+ break;
+ case 1:
+ ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_REGISTERED);
+ break;
+ case 2:
+ ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_NEW);
+ break;
+ default:
+ SysAssert(false);
+ }
+}
+
+void
+OnProtocolHandlerUnregistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ result r = E_SUCCESS;
+ _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
+ Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
+ SysAssertf(pImpl && pHandlerData, "Failed to request");
+
+ r = pImpl->UnregistrationHandler(pHandlerData, false);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+}
+
+
+void
+OnContentHandlerRegistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ result r = E_SUCCESS;
+ _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
+ SysAssertf(pImpl, "Failed to request");
+
+ r = pImpl->ShowUserConfirmPopup(USER_CONTENT_HANDLER, pEventInfo);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+}
+
+
+void
+OnIsContentHandlerRegistered(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ int checkHandler = 0;
+ _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
+ Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
+ SysAssertf(pImpl && pHandlerData, "Failed to request");
+
+ checkHandler = pImpl->SearchHandler(pHandlerData, true);
+ SysTryReturnVoidResult(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ switch (checkHandler)
+ {
+ case -1:
+ return;
+ case 0:
+ ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_DECLINED);
+ break;
+ case 1:
+ ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_REGISTERED);
+ break;
+ case 2:
+ ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_NEW);
+ break;
+ default:
+ SysAssert(false);
+ }
+}
+
+
+void
+OnContentHandlerUnregistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ result r = E_SUCCESS;
+ _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
+ Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
+ SysAssertf(pImpl && pHandlerData, "Failed to request");
+
+ r = pImpl->UnregistrationHandler(pHandlerData, true);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+}
+
+
+void
+OnFullScreenEntered(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
+ SysAssertf(pImpl, "Failed to request");
+
+ _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
+ SysAssertf(pWebCore, "Failed to get Web core object");
+
+ pWebCore->SetFullScreenEntered(true);
+}
+
+
+void
+OnFullScreenExited(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
+ SysAssertf(pImpl, "Failed to request");
+
+ _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
+ SysAssertf(pWebCore, "Failed to get Web core object");
+
+ pWebCore->SetFullScreenEntered(false);
+}
+
+
+void
+OnFocusDownRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
+ SysAssertf(pImpl, "Failed to request");
+
+ _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
+ pWebCore->SetFocusEnd(true);
+}
+
+
+void
+OnFocusUpRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
+ SysAssertf(pImpl, "Failed to request");
+
+ _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
+ pWebCore->SetFocusEnd(true);
+}
+
+
+void
+OnVibrationRequested(uint64_t duration, void* pUserData)
+{
+ result r = E_SUCCESS;
+
+ _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
+ SysAssertf(pImpl, "Failed to request");
+
+ r = pImpl->VibrationRequested(duration);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+}
+
+
+void
+OnVibrationCanceled(void* pUserData)
+{
+ _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
+ SysAssertf(pImpl, "Failed to request");
+
+ pImpl->VibrationCanceled();
+}
+
+
+void
+OnLoadingRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ Ewk_Policy_Decision* pPolicy = reinterpret_cast< Ewk_Policy_Decision* >(pEventInfo);
+ SysAssertf(pImpl && pPolicy, "Failed to request");
+
+ String url(ewk_policy_decision_url_get(pPolicy));
+ SysSecureLog(NID_WEB_CTRL, "The current value of url is %ls", url.GetPointer());
+
+ if (ewk_frame_is_main_frame(ewk_policy_decision_frame_get(pPolicy))
+ && !pImpl->IsRedirectRequested())
+ {
+ _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
+ SysAssertf(pWebCore, "Failed to get Web core object");
+
+ pWebCore->SetFullScreenEntered(false);
+
+ pImpl->SetCertificateRequested(false);
+
+ if (pImpl->GetTextSearchListener())
+ {
+ pImpl->DisableAsyncSearch();
+ }
+
+ ILoadingListener* pLoadingListener = pImpl->GetLoadingListener();
+ if (pLoadingListener)
+ {
+ WebNavigationType navigationType = WEB_NAVIGATION_OTHER;
+ Ewk_Policy_Navigation_Type ewkNavigationType = ewk_policy_decision_navigation_type_get(pPolicy);
+
+ switch (ewkNavigationType)
+ {
+ case EWK_POLICY_NAVIGATION_TYPE_LINK_CLICKED:
+ navigationType = WEB_NAVIGATION_LINK_CLICKED;
+ break;
+ case EWK_POLICY_NAVIGATION_TYPE_FORM_SUBMITTED:
+ navigationType = WEB_NAVIGATION_FORM_SUBMITTED;
+ break;
+ case EWK_POLICY_NAVIGATION_TYPE_BACK_FORWARD:
+ navigationType = WEB_NAVIGATION_BACKFORWARD;
+ break;
+ case EWK_POLICY_NAVIGATION_TYPE_RELOAD:
+ navigationType = WEB_NAVIGATION_RELOAD;
+ break;
+ case EWK_POLICY_NAVIGATION_TYPE_FORM_RESUBMITTED:
+ navigationType = WEB_NAVIGATION_FORM_RESUBMITTED;
+ break;
+ case EWK_POLICY_NAVIGATION_TYPE_OTHER:
+ navigationType = WEB_NAVIGATION_OTHER;
+ break;
+ default:
+ SysAssert(false);
+ }
+
+ if (pLoadingListener->OnLoadingRequested(url, navigationType))
+ {
+ ewk_policy_decision_ignore(pPolicy);
+
+ return;
+ }
+ }
+ }
+
+ if (url == L"about:blank")
+ {
+ ewk_policy_decision_use(pPolicy);
+
+ return;
+ }
+
+ String currentUrl(pImpl->GetUrl());
+ String redirectUrl(pImpl->GetProtocolFromUri(url, currentUrl));
+ if (redirectUrl != L"")
+ {
+ ewk_policy_decision_ignore(pPolicy);
+
+ pImpl->LoadUrl(redirectUrl);
+
+ return;
+ }
+
+ Uri uri;
+ uri.SetUri(url);
+
+ String uriScheme(uri.GetScheme());
+ SysSecureLog(NID_WEB_CTRL, "The current value of scheme is %ls", uriScheme.GetPointer());
+
+ if ((uriScheme != L"http") && (uriScheme != L"https") && (uriScheme != L"file") && (uriScheme != L""))
+ {
+ result r = E_SUCCESS;
+
+ if (uriScheme == L"tel")
+ {
+ String operationId(L"http://tizen.org/appcontrol/operation/dial");
+ r = _AppControlImpl::FindAndStart(operationId, &url, null, null, null, null);
+ }
+ else if (uriScheme == L"mailto" || uriScheme == L"sms" || uriScheme == L"smsto" || uriScheme == L"mms" || uriScheme == L"mmsto" )
+ {
+ String operationId(L"http://tizen.org/appcontrol/operation/compose");
+ r = _AppControlImpl::FindAndStart(operationId, &url, null, null, null, null);
+ }
+ else
+ {
+ String operationId(L"http://tizen.org/appcontrol/operation/view");
+ r = _AppControlImpl::FindAndStart(operationId, &url, null, null, null, null);
+ }
+
+ if (r == E_SUCCESS)
+ {
+ ewk_policy_decision_ignore(pPolicy);
+
+ return;
+ }
+ }
+
+ ewk_policy_decision_use(pPolicy);
+}
+
+
+void
+OnLoadingStarted(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pImpl, "Failed to request");
+
+ if (pImpl->GetLoadingListener())
+ {
+ result r = E_SUCCESS;
+
+ std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_STARTED));
+ SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ pEventArg.release();
+ }
+}
+
+
+void
+OnPageTitleReceived(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ char* pTitle = reinterpret_cast< char* >(pEventInfo);
+ SysAssertf(pImpl, "Failed to request");
+
+ SysLog(NID_WEB_CTRL, "The current value of title is %s", pTitle);
+
+ if (pImpl->GetLoadingListener())
+ {
+ result r = E_SUCCESS;
+
+ std::unique_ptr<String> pPageTitle(new (std::nothrow) String(pTitle));
+ std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_PAGETITLE_RECEIVED));
+ SysTryReturnVoidResult(NID_WEB_CTRL, pPageTitle.get() && pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pEventArg->SetEventInfo(_LoadingEventArg::PAGE_TITLE, *pPageTitle.get());
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ pPageTitle.release();
+
+ r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ pEventArg.release();
+ }
+}
+
+
+void
+OnEstimatedProgress(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ double* pProgress = reinterpret_cast< double* >(pEventInfo);
+ SysAssertf(pImpl, "Failed to request");
+
+ SysLog(NID_WEB_CTRL, "The current value of progress is %lf", *pProgress);
+
+ if (pImpl->GetLoadingListener())
+ {
+ result r = E_SUCCESS;
+
+ std::unique_ptr<Integer> pProgressPercentage(new (std::nothrow) Integer(static_cast< int >(*pProgress * 100)));
+ std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_PROGRESS));
+ SysTryReturnVoidResult(NID_WEB_CTRL, pProgressPercentage.get() && pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pEventArg->SetEventInfo(_LoadingEventArg::ESTIMATED_PROGRESS, *pProgressPercentage.get());
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ pProgressPercentage.release();
+
+ r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ pEventArg.release();
+ }
+}
+
+
+void
+OnWebDataReceived(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ Ewk_Policy_Decision* pPolicy = reinterpret_cast< Ewk_Policy_Decision* >(pEventInfo);
+ SysAssertf(pImpl && pPolicy, "Failed to request");
+
+ result r = E_SUCCESS;
+
+ int code = ewk_policy_decision_response_status_code_get(pPolicy);
+ String url(ewk_policy_decision_url_get(pPolicy));
+ String mime(ewk_policy_decision_response_mime_get(pPolicy));
+ SysSecureLog(NID_WEB_CTRL, "code : %d, url : %ls, mime : %ls", code, url.GetPointer(), mime.GetPointer());
+
+ if (ewk_frame_is_main_frame(ewk_policy_decision_frame_get(pPolicy)))
+ {
+ if (code >= REDIRECTION_HEADER_GROUP && code < REDIRECTION_HEADER_GROUP + 100)
+ {
+ pImpl->SetRedirectRequested(true);
+ }
+
+ ILoadingListener* pLoadingListener = pImpl->GetLoadingListener();
+ if (pLoadingListener)
+ {
+ HttpHeader httpHeader;
+
+ Eina_Iterator* iterator = eina_hash_iterator_tuple_new(ewk_policy_decision_response_headers_get(pPolicy));
+ if (iterator)
+ {
+ Eina_Hash_Tuple *tuple = null;
+
+ EINA_ITERATOR_FOREACH(iterator, tuple)
+ {
+ String key(reinterpret_cast< const char* >(tuple->key));
+ String value(reinterpret_cast< char* >(tuple->data));
+
+ SysSecureLog(NID_WEB_CTRL, "The current value of key is %ls, value is %ls", key.GetPointer(), value.GetPointer());
+
+ r = httpHeader.AddField(key, value);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, eina_iterator_free(iterator), r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+
+ eina_iterator_free(iterator);
+ }
+
+ pImpl->SetPolicyDecision(pLoadingListener->OnWebDataReceived(mime, httpHeader));
+ }
+ else
+ {
+ pImpl->SetPolicyDecision(WEB_DECISION_CONTINUE);
+ }
+ }
+
+ switch (pImpl->GetPolicyDecision())
+ {
+ case WEB_DECISION_CONTINUE:
+ {
+ String currentUrl(pImpl->GetUrl());
+ String redirectUrl(pImpl->GetRedirectUri(url, currentUrl, mime));
+ if (redirectUrl != L"")
+ {
+ ewk_policy_decision_ignore(pPolicy);
+
+ pImpl->LoadUrl(redirectUrl);
+
+ return;
+ }
+
+ if (ewk_policy_decision_type_get(pPolicy) == EWK_POLICY_DECISION_USE)
+ {
+ break;
+ }
+ else
+ {
+ ewk_policy_decision_ignore(pPolicy);
+
+ String operationId(L"http://tizen.org/appcontrol/operation/view");
+
+ r = _AppControlImpl::FindAndStart(operationId, &url, &mime, null, null, null);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS || r == E_OBJ_NOT_FOUND, r, "[%s] Propagating.", GetErrorMessage(r));
+ if (r == E_OBJ_NOT_FOUND)
+ {
+ String operationId(L"http://tizen.org/appcontrol/operation/download");
+
+ r = _AppControlImpl::FindAndStart(operationId, &url, null, null, null, null);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+
+ return;
+ }
+ break;
+ }
+
+ case WEB_DECISION_DOWNLOAD:
+ {
+ ewk_policy_decision_ignore(pPolicy);
+
+ _WebDataHandler* pDownloadHandler = pImpl->GetDownloadHandler();
+ SysTryReturnVoidResult(NID_WEB_CTRL, pDownloadHandler, E_SYSTEM, "[%s] A system error has been occurred. Failed to get DownloadHandler.", GetErrorMessage(E_SYSTEM));
+
+ Ewk_Context* pContext = ewk_view_context_get(pView);
+ SysAssertf(pContext, "Failed to get webkit instance.");
+
+ pDownloadHandler->StartDownload(url);
+
+ return;
+ }
+
+ case WEB_DECISION_IGNORE:
+ {
+ ewk_policy_decision_ignore(pPolicy);
+
+ return;
+ }
+
+ default:
+ {
+ SysAssert(false);
+ }
+ }
+
+ ewk_policy_decision_use(pPolicy);
+
+ return;
+
+CATCH:
+ ewk_policy_decision_ignore(pPolicy);
+}
+
+
+void
+OnProgressCompleted(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pImpl, "Failed to request");
+
+ if (pImpl->IsRedirectRequested())
+ {
+ pImpl->SetRedirectRequested(false);
+ }
+
+ if (pImpl->IsLoadingErrorOccurred())
+ {
+ pImpl->SetLoadingErrorOccurred(false);
+ evas_object_smart_callback_call(pView, "load,finished", NULL);
+ }
+}
+
+
+void
+OnLoadingErrorOccurred(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ Ewk_Error* pErrorData = reinterpret_cast< Ewk_Error* >(pEventInfo);
+ SysAssertf(pImpl && pErrorData, "Failed to request");
+
+ int code = ewk_error_code_get(pErrorData);
+ const char* pDescription = ewk_error_description_get(pErrorData);
+
+ SysLog(NID_WEB_CTRL, "The current value of code is %d, description is %s", code, pDescription);
+
+ switch (code)
+ {
+ case EWK_ERROR_CODE_FRAMELOADINTERRUPTEDBYPOLICYCHANGE:
+ pImpl->SetLoadingErrorOccurred(true);
+ break;
+
+ case EWK_ERROR_CODE_PLUGINWILLHANDLELOAD:
+ evas_object_smart_callback_call(pView, "load,finished", NULL);
+ break;
+
+ case EWK_ERROR_NETWORK_STATUS_CANCELLED:
+ pImpl->SetLoadingErrorOccurred(true);
+ evas_object_smart_callback_call(pView, "load,stop", NULL);
+ break;
+
+ default:
+ pImpl->SetLoadingErrorOccurred(true);
+ if (pImpl->GetLoadingListener())
+ {
+ result r = E_SUCCESS;
+
+ r = FireLoadingErrorOccurredEvent(pImpl, code, pDescription);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ break;
+ }
+}
+
+
+void
+OnLoadingCanceled(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pImpl, "Failed to request");
+
+ if (pImpl->GetLoadingListener())
+ {
+ result r = E_SUCCESS;
+
+ std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_CANCELED));
+ SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ pEventArg.release();
+ }
+
+}
+
+
+void
+OnLoadingCompleted(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pImpl, "Failed to request");
+
+ if (pImpl->GetLoadingListener())
+ {
+ result r = E_SUCCESS;
+
+ std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_COMPLETED));
+ SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ pEventArg.release();
+ }
+}
+
+
+void
+OnLoadingCommitted(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ evas_object_focus_set(pView, EINA_FALSE);
+}
+
+
+void
+OnFaviconReceived(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pImpl, "Failed to request");
+
+ if (pImpl->GetLoadingListener())
+ {
+ result r = E_SUCCESS;
+
+ std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_FAVICON_RECEIVED));
+ SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ pEventArg.release();
+ }
+
+}
+
+
+void
+OnDidStartDownloadCallback(const char* pUrl, void* pUserData)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pUrl && pImpl != null, "Failed to request");
+
+ SysSecureLog(NID_WEB_CTRL, "The current value of url is %s", pUrl);
+}
+
+
+result
+FireWebPageShowRequestedEvent(_WebImpl* pImpl, int event)
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(event));
+ SysTryReturnResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ pEventArg.release();
+
+ return E_SUCCESS;
+}
+
+
+void
+OnWebPageShowRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pImpl, "Failed to request");
+
+ if (pImpl->GetUiEventListener())
+ {
+ result r = E_SUCCESS;
+
+ r = FireWebPageShowRequestedEvent(pImpl, WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ if (pImpl->GetUiEventListenerF())
+ {
+ result r = E_SUCCESS;
+
+ r = FireWebPageShowRequestedEvent(pImpl, WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED_FLOAT);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+}
+
+
+void
+OnWebWindowCreateRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pParentImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ Evas_Object** pChildView = reinterpret_cast< Evas_Object** >(pEventInfo);
+ SysAssertf(pParentImpl && pChildView, "Failed to request");
+
+ IWebUiEventListener* pUserUiListener = pParentImpl->GetUiEventListener();
+ IWebUiEventListenerF* pUserUiListenerF = pParentImpl->GetUiEventListenerF();
+ if (pUserUiListener)
+ {
+ Web* pWeb = pUserUiListener->OnWebWindowCreateRequested();
+ if (pWeb)
+ {
+ _WebImpl* pChildImpl = _WebImpl::GetInstance(pWeb);
+ SysTryReturnVoidResult(NID_WEB_CTRL, pChildImpl, E_SYSTEM, "[%s] A system error has been occurred. Failed to get ChildImpl object.", GetErrorMessage(E_SYSTEM));
+
+ *pChildView = dynamic_cast< _Web* >(&pChildImpl->GetCore())->GetWebNativeNode();
+ evas_object_data_set(*pChildView, PARENT_WEB_CTRL, pParentImpl);
+ }
+ }
+ if (pUserUiListenerF)
+ {
+ Web* pWeb = pUserUiListenerF->OnWebWindowCreateRequested();
+ if (pWeb)
+ {
+ _WebImpl* pChildImpl = _WebImpl::GetInstance(pWeb);
+ SysTryReturnVoidResult(NID_WEB_CTRL, pChildImpl, E_SYSTEM, "[%s] A system error has been occurred. Failed to get ChildImpl object.", GetErrorMessage(E_SYSTEM));
+
+ *pChildView = dynamic_cast< _Web* >(&pChildImpl->GetCore())->GetWebNativeNode();
+ evas_object_data_set(*pChildView, PARENT_WEB_CTRL, pParentImpl);
+ }
+ }
+}
+
+
+result
+FireWebWindowClosedRequestedEvent(_WebImpl* pImpl, int event)
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(event));
+ SysTryReturnResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ pEventArg.release();
+
+ return E_SUCCESS;
+}
+
+
+void
+OnWebWindowClosedRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pChildImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pChildImpl, "Failed to request");
+
+ _WebImpl* pParentImpl = reinterpret_cast< _WebImpl* >(evas_object_data_get(pView, PARENT_WEB_CTRL));
+ if (pParentImpl == null)
+ {
+ return;
+ }
+
+ if (pParentImpl->GetUiEventListener())
+ {
+ result r = E_SUCCESS;
+
+ r = FireWebWindowClosedRequestedEvent(pChildImpl, WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ if (pParentImpl->GetUiEventListenerF())
+ {
+ result r = E_SUCCESS;
+
+ r = FireWebWindowClosedRequestedEvent(pChildImpl, WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED_FLOAT);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+}
+
+
+result
+FireWebPreventDefaultTriggeredEvent(_WebImpl* pImpl, int event, bool trigger)
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr<Boolean> pPreventTrigger(new (std::nothrow) Boolean(trigger));
+ std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(event));
+ SysTryReturnResult(NID_WEB_CTRL, pPreventTrigger.get() && pEventArg.get(), E_OUT_OF_MEMORY, " Memory allocation failed." );
+
+ r = pEventArg->SetEventInfo(_WebUiEventArg::PREVENT_DEFAULT, *pPreventTrigger.get());
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ pPreventTrigger.release();
+
+ r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ pEventArg.release();
+
+ return E_SUCCESS;
+}
+
+
+void
+OnWebPreventDefaultTriggered(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ Eina_Bool* pTrigger = reinterpret_cast< Eina_Bool* >(pEventInfo);
+ SysAssertf(pImpl && pTrigger, "Failed to request");
+
+ if (pImpl->GetUiEventListener())
+ {
+ result r = E_SUCCESS;
+
+ r = FireWebPreventDefaultTriggeredEvent(pImpl, WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED, static_cast< bool >(*pTrigger));
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ if (pImpl->GetUiEventListenerF())
+ {
+ result r = E_SUCCESS;
+
+ r = FireWebPreventDefaultTriggeredEvent(pImpl, WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED_FLOAT, static_cast< bool >(*pTrigger));
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+}
+
+
+result
+FireWebPageBlockSelectedEvent(_WebImpl* pImpl)
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr<Point> startPoint(new (std::nothrow) Point());
+ std::unique_ptr<Point> endPoint(new (std::nothrow) Point());
+ SysTryReturnResult(NID_WEB_CTRL, startPoint.get() && endPoint.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ pImpl->GetBlockRange(*startPoint.get(), *endPoint.get());
+
+ if ((endPoint->x != 0) && (endPoint->y != 0))
+ {
+ std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED));
+ SysTryReturnResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_START, *startPoint.get());
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ startPoint.release();
+
+ r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_END, *endPoint.get());
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ endPoint.release();
+
+ r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ pEventArg.release();
+ }
+
+ return E_SUCCESS;
+}
+
+
+result
+FireWebPageBlockSelectedEventF(_WebImpl* pImpl)
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr<FloatPoint> startPoint(new (std::nothrow) FloatPoint());
+ std::unique_ptr<FloatPoint> endPoint(new (std::nothrow) FloatPoint());
+
+ SysTryReturnResult(NID_WEB_CTRL, startPoint.get() && endPoint.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ pImpl->GetBlockRange(*startPoint.get(), *endPoint.get());
+ if ((endPoint->x != 0.0f) && (endPoint->y != 0.0f))
+ {
+ std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED_FLOAT));
+ SysTryReturnResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_START, *startPoint.get());
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ startPoint.release();
+
+ r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_END, *endPoint.get());
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ endPoint.release();
+
+ r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ pEventArg.release();
+ }
+
+ return E_SUCCESS;
+}
+
+
+void
+OnWebPageBlockSelected(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pImpl, "Failed to request");
+
+ if (pImpl->GetUiEventListener())
+ {
+ result r = E_SUCCESS;
+
+ r = FireWebPageBlockSelectedEvent(pImpl);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ if (pImpl->GetUiEventListenerF())
+ {
+ result r = E_SUCCESS;
+
+ r = FireWebPageBlockSelectedEventF(pImpl);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+}
+
+
+void
+OnHandleJavaScriptRequest(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ char* pJsonText = reinterpret_cast< char* >(pEventInfo);
+ SysAssertf(pImpl && pJsonText, "Failed to request");
+
+ result r = E_SUCCESS;
+
+ SysLog(NID_WEB_CTRL, "The current value of jsontext is %s", pJsonText);
+
+ std::unique_ptr<_JsBridgeArg> pEventArg(new (std::nothrow) _JsBridgeArg());
+ SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pEventArg->Construct(pJsonText);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ pEventArg.release();
+}
+
+
+void
+OnWebKeypadStateChanged(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ Eina_Rectangle* pEinaRect = reinterpret_cast< Eina_Rectangle* >(pEventInfo);
+ SysAssertf(pImpl && pEinaRect, "Failed to request");
+
+ if (pImpl->GetSetting().GetInputStyle() == INPUT_STYLE_OVERLAY)
+ {
+ _ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetInverseTransformer();
+ SysAssertf(pXformer, "Failed to get CoordinateTransformer");
+
+ Rectangle rect(pEinaRect->x, pEinaRect->y, pEinaRect->w, pEinaRect->h);
+
+ if (rect.height == 0)
+ {
+ return;
+ }
+
+ _FormImpl* pFormImpl = pImpl->GetParentFormImpl(dynamic_cast< _ControlImpl* >(pImpl));
+ if (pFormImpl)
+ {
+ pFormImpl->DeflateClientRectHeight(pXformer->TransformVertical(rect.height));
+
+ pFormImpl->Invalidate(false);
+ }
+
+ if (pImpl->GetWebKeypadEventListener())
+ {
+ if (pImpl->IsKeypadVisible() == true)
+ {
+ if ((pImpl->GetPreviousKeypadBounds().width == rect.width) && (pImpl->GetPreviousKeypadBounds().height != rect.height))
+ {
+ pImpl->GetWebKeypadEventListener()->OnWebKeypadBoundsChanged(*dynamic_cast< Web* >(&pImpl->GetPublic()));
+ }
+ }
+ else
+ {
+ pImpl->GetWebKeypadEventListener()->OnWebKeypadWillOpen(*dynamic_cast< Web* >(&pImpl->GetPublic()));
+ }
+ }
+
+ pImpl->SetPreviousKeypadBounds(rect);
+ }
+ else
+ {
+ result r = pImpl->SetFullScreenKeypad();
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+}
+
+
+void
+OnWebKeypadOpened(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pImpl, "Failed to request");
+
+ pImpl->SetKeypadVisibleState(true);
+
+ _FormImpl* pFormImpl = pImpl->GetParentFormImpl(dynamic_cast< _ControlImpl* >(pImpl));
+ if (pFormImpl)
+ {
+ _ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetInverseTransformer();
+ SysAssertf(pXformer, "Failed to get CoordinateTransformer");
+
+ pFormImpl->DeflateClientRectHeight(pXformer->TransformVertical(pImpl->GetPreviousKeypadBounds().height));
+
+ if (pFormImpl->HasFooter())
+ {
+ pFormImpl->GetCore().SetKeypadShowState(true);
+ pFormImpl->Draw();
+ }
+ }
+
+ if (pImpl->GetWebKeypadEventListener())
+ {
+ pImpl->GetWebKeypadEventListener()->OnWebKeypadOpened(*static_cast< Web* >(&pImpl->GetPublic()));
+ }
+}
+
+
+void
+OnWebKeypadClosed(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pImpl, "Failed to request");
+
+ _FormImpl* pFormImpl = pImpl->GetParentFormImpl(dynamic_cast< _ControlImpl* >(pImpl));
+ if (pFormImpl)
+ {
+ pFormImpl->DeflateClientRectHeight(0);
+
+ pFormImpl->Invalidate(false);
+
+ if (pFormImpl->HasFooter())
+ {
+ pFormImpl->GetCore().SetKeypadShowState(false);
+ pFormImpl->Draw();
+ }
+ }
+
+ if (pImpl->GetWebKeypadEventListener())
+ {
+ pImpl->GetWebKeypadEventListener()->OnWebKeypadClosed(*dynamic_cast< Web* >(&pImpl->GetPublic()));
+ }
+
+ pImpl->SetKeypadVisibleState(false);
+}
+
+
+void
+OnWindowObjectFocusLost(void* pUserData, Evas_Object* pWin, void* pEvent_info)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pImpl, "Failed to request");
+
+ pImpl->SetWinFocusLost(true);
+}
+
+
+void
+OnWindowObjectFocusGained(void* pUserData, Evas_Object* pWin, void* pEvent_info)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pImpl, "Failed to request");
+
+ if (pImpl->IsVisible() == true && pImpl->IsFocused() == true)
+ {
+ _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
+ SysAssertf(pWebCore, "Failed to get Web core object");
+
+ if (pImpl->IsWinFocusLost() == true)
+ {
+ Ewk_Settings* pSettings = ewk_view_settings_get(pWebCore->GetWebNativeNode());
+ SysAssertf(pSettings, "Failed to get settings instance.");
+
+ if (ewk_settings_clear_text_selection_automatically_get(pSettings) == EINA_FALSE)
+ {
+ ewk_settings_clear_text_selection_automatically_set(pSettings, EINA_TRUE);
+
+ evas_object_focus_set(pWebCore->GetWebNativeNode(), EINA_TRUE);
+ }
+ else if (pImpl->IsKeypadOpened() == true)
+ {
+ evas_object_focus_set(pWebCore->GetWebNativeNode(), EINA_TRUE);
+ }
+ }
+ }
+
+ pImpl->SetWinFocusLost(false);
+}
+
+
+void
+OnWebNativeNodeFocusGained(void* pUserData, Evas* pCanvas, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pImpl, "Failed to request");
+
+ if (pImpl->IsKeypadOpened() == true)
+ {
+ pImpl->SetKeypadOpened(false);
+ }
+ else if (pImpl->IsWinFocusLost() == true && pImpl->IsFocused() == false)
+ {
+ _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
+ SysAssertf(pWebCore, "Failed to get Web core object");
+
+ evas_object_focus_set(pWebCore->GetWebNativeNode(), EINA_FALSE);
+ }
+}
+
+
+void
+OnWebNativeNodeFocusLost(void* pUserData, Evas* pCanvas, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pImpl, "Failed to request");
+
+ _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
+ SysAssertf(pWebCore, "Failed to get Web core object");
+
+ Eina_Rectangle leftHandle;
+ Eina_Rectangle rightHandle;
+
+ EINA_RECTANGLE_SET(&leftHandle, 0, 0, 0, 0);
+ EINA_RECTANGLE_SET(&rightHandle, 0, 0, 0, 0);
+
+ if (pImpl->IsWinFocusLost() == true && ewk_view_text_selection_range_get(pWebCore->GetWebNativeNode(), &leftHandle, &rightHandle))
+ {
+ Ewk_Settings* pSettings = ewk_view_settings_get(pWebCore->GetWebNativeNode());
+ SysAssertf(pSettings, "Failed to get settings instance.");
+
+ ewk_settings_clear_text_selection_automatically_set(pSettings, EINA_FALSE);
+ }
+}
+
+
+Eina_Bool
+OnColorPickerProviderRequested(Ewk_View_Smart_Data* pSmartData, int red, int green, int blue, int alpha)
+{
+ SysAssertf(pSmartData, "invalid smartdata");
+ _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
+ SysAssertf(pWebImpl, "Failed to get Impl");
+
+ result r = E_SUCCESS;
+
+ if (pWebImpl->GetColorpicker())
+ {
+ return EINA_FALSE;
+ }
+
+ Color color;
+
+ r = pWebImpl->ShowColorPicker(red, green, blue, alpha, color);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Memory allocation failed.", GetErrorMessage(r));
+
+ byte r1, g1, b1, a1;
+ color.GetColorComponents(r1, g1, b1, a1);
+ ewk_view_color_picker_color_set(pSmartData->self, r1, g1, b1, a1);
+
+ return EINA_TRUE;
+}
+
+
+Eina_Bool
+OnColorPickerProviderDismissed(Ewk_View_Smart_Data* pSmartData)
+{
+ SysAssertf(pSmartData, "invalid smartdata");
+
+ _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
+ SysAssertf(pWebImpl, "Failed to get Impl");
+
+ return pWebImpl->HideColorPicker();
+}
+
+
+Eina_Bool
+OnDatePickerProviderRequested(Ewk_View_Smart_Data* pSmartData, Ewk_Input_Type inputType, const char* inputValue)
+{
+ SysAssertf(pSmartData, "Failed to request");
+ _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
+ SysAssertf(pWebImpl, "Failed to get Impl");
+
+ result r = E_SUCCESS;
+
+ if (pWebImpl->GetDatepicker())
+ {
+ ewk_view_focused_input_element_value_set(pSmartData->self, inputValue);
+
+ return EINA_FALSE;
+ }
+
+ String dateStr;
+
+ r = pWebImpl->ShowDatePicker(inputType, inputValue, dateStr);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Memory allocation failed.", GetErrorMessage(r));
+
+ std::unique_ptr<char[]> pDateStr(_StringConverter::CopyToCharArrayN(dateStr));
+ SysTryReturn(NID_WEB_CTRL, pDateStr.get(), EINA_FALSE, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ ewk_view_focused_input_element_value_set(pSmartData->self, pDateStr.get());
+
+ return EINA_TRUE;
+}
+
+
+Eina_Bool
+OnSelectBoxRequested(Ewk_View_Smart_Data* pSmartData, Eina_Rectangle rect, Ewk_Text_Direction textDirection, double pageScaleFactor, Eina_List* pItems, int selectedIndex)
+{
+ SysAssertf(pSmartData, "Failed to request");
+
+ _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
+ SysAssertf(pWebImpl, "Failed to get Impl");
+
+ result r = pWebImpl->ShowSelectBoxPopup(false, L"", pItems, pSmartData->self, selectedIndex);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return EINA_TRUE;
+}
+
+
+Eina_Bool
+OnMultiSelectBoxRequested(Ewk_View_Smart_Data* pSmartData, Eina_Rectangle rect, Ewk_Text_Direction text_direction, double page_scale_factor, Eina_List* pItems)
+{
+ SysAssertf(pSmartData, "Failed to request");
+
+ _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
+ SysAssertf(pWebImpl, "Failed to get Impl");
+
+ result r = pWebImpl->ShowSelectBoxPopup(true, L"", pItems, pSmartData->self, 0);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return EINA_TRUE;
+}
+
+
+Eina_Bool
+OnSelectBoxClosed(Ewk_View_Smart_Data* pSmartData)
+{
+ SysAssertf(pSmartData, "invalid smartdata");
+
+ _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
+ SysAssertf(pWebImpl, "Failed to get Impl");
+
+ result r = pWebImpl->ClearSelectBoxPopup();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return EINA_TRUE;
+}
+
+
+Eina_Bool
+OnSelectBoxUpdateRequested(Ewk_View_Smart_Data *pSmartData, Eina_Rectangle rect, Ewk_Text_Direction textDirection, Eina_List* pItems, int selectedIndex)
+{
+ SysAssertf(pSmartData, "invalid smartdata");
+
+ _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
+ SysAssertf(pWebImpl, "Failed to get Impl");
+
+ result r = pWebImpl->UpdateSelectBoxPopup(pItems, selectedIndex, false);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return EINA_TRUE;
+}
+
+
+Eina_Bool
+OnFormDataCandidateShow(Ewk_View_Smart_Data *pSmartData, int x, int y, int w, int h)
+{
+ SysAssertf(pSmartData, "Failed to request");
+
+ _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
+ SysAssertf(pWebImpl, "Failed to get Impl");
+
+ Rectangle windowRect(x, y, w, h);
+ result r = pWebImpl->ShowFormDataWindow(windowRect, pSmartData->self);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return EINA_TRUE;
+}
+
+
+Eina_Bool
+OnFormDataCandidateHide(Ewk_View_Smart_Data *pSmartData)
+{
+ SysAssertf(pSmartData, "Failed to request");
+
+ _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
+ SysAssertf(pWebImpl, "Failed to get Impl");
+
+ if (pWebImpl->IsFormDataWindowVisible())
+ {
+ pWebImpl->HideFormDataWindow();
+ }
+
+ return EINA_TRUE;
+}
+
+
+Eina_Bool
+OnFormDataCandidateUpdate(Ewk_View_Smart_Data *pSmartData, Eina_List *pDataList)
+{
+ SysAssertf(pSmartData, "Failed to request");
+
+ _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
+ SysAssertf(pWebImpl, "Failed to get Impl");
+
+ pWebImpl->SetFormDataList(pDataList);
+
+ return EINA_TRUE;
+}
+
+
+Eina_Bool
+OnFormDataCandidateIsShowing(Ewk_View_Smart_Data *pSmartData)
+{
+ SysAssertf(pSmartData, "Failed to request");
+
+ _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
+ SysAssertf(pWebImpl, "Failed to get Impl");
+
+ if (pWebImpl->IsFormDataWindowVisible())
+ {
+ return EINA_TRUE;
+ }
+ else
+ {
+ return EINA_FALSE;
+ }
+}
+
+
+void
+OnCookiesPolicyGot(Ewk_Cookie_Accept_Policy policy, Ewk_Web_Error *pError, void *pUserData)
+{
+ _WebPresenter* pPresenter = reinterpret_cast< _WebPresenter* >(pUserData);
+ SysAssertf(pPresenter && !pError, "Failed to request");
+
+ bool ret = EINA_TRUE;
+
+ switch (policy)
+ {
+ case EWK_COOKIE_ACCEPT_POLICY_ALWAYS:
+ //fall through
+ case EWK_COOKIE_ACCEPT_POLICY_NO_THIRD_PARTY:
+ ret = EINA_TRUE;
+ break;
+
+ case EWK_COOKIE_ACCEPT_POLICY_NEVER:
+ //fall through
+ ret = EINA_FALSE;
+ break;
+
+ default:
+ SysAssert(false);
+ }
+
+ SysLog(NID_WEB_CTRL, "The current value of policy is %d", ret);
+
+ pPresenter->EndAsyncProcess(ret);
+}
+
+
+void
+OnScriptExecuted(Evas_Object* pView, const char* pResult, void* pUserData)
+{
+ _WebPresenter* pPresenter = reinterpret_cast< _WebPresenter* >(pUserData);
+ SysAssertf(pPresenter, "Failed to request");
+
+ String result(pResult);
+ SysLog(NID_WEB_CTRL, "result : %ls", result.GetPointer());
+
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(evas_object_data_get(pView, WEB_CTRL));
+ _WebManager* pWebManager = _WebManager::GetInstance();
+ if (pWebManager->IsValidCallback(reinterpret_cast< int >(pImpl), reinterpret_cast< int >(pPresenter)))
+ {
+ pPresenter->EndAsyncProcess(result);
+ }
+}
+
+
+void
+OnTextFound(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pImpl, "Failed to request");
+
+ int* pTotalCount = reinterpret_cast< int* >(pEventInfo);
+ SysLog(NID_WEB_CTRL, "The current value of totalCount is %d", *pTotalCount);
+
+ _WebPresenter* pWebPresenter = pImpl->GetSearchPresenter();
+
+ if (pWebPresenter)
+ {
+ pWebPresenter->EndAsyncProcess(*pTotalCount);
+ }
+ else
+ {
+ if (pImpl->GetTextSearchListener())
+ {
+ result r = E_SUCCESS;
+
+ int ordinal = 0;
+
+ if (*pTotalCount > 0)
+ {
+ ordinal = pImpl->GetAsyncSearchOrdinal();
+ pImpl->SetAsyncSearchResult(*pTotalCount);
+ }
+
+ if (pImpl->GetPendingAsyncSearchCount() > 0)
+ {
+ return;
+ }
+
+ std::unique_ptr<Integer> pCount(new (std::nothrow) Integer(*pTotalCount));
+ std::unique_ptr<Integer> pOrdinal(new (std::nothrow) Integer(ordinal));
+ std::unique_ptr<_TextSearchEventArg> pEventArg(new (std::nothrow) _TextSearchEventArg(WEB_EVENT_TEXTSEARCHLISTENER_TEXT_FOUND));
+ SysTryReturnVoidResult(NID_WEB_CTRL, pCount.get() && pOrdinal.get() && pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pEventArg->SetEventInfo(_TextSearchEventArg::TOTAL_COUNT, *pCount.get());
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ pCount.release();
+
+ r = pEventArg->SetEventInfo(_TextSearchEventArg::CURRENT_ORDINAL, *pOrdinal.get());
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ pOrdinal.release();
+
+ r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ pEventArg.release();
+ }
+ }
+}
+
+
+class _JsBridgeHashCodeProvider
+ : public Tizen::Base::Collection::IHashCodeProviderT< Tizen::Base::String >
+{
+public:
+ _JsBridgeHashCodeProvider(){}
+ virtual ~_JsBridgeHashCodeProvider(void) {}
+
+
+ int GetHashCode(const Tizen::Base::String& obj) const
+ {
+ return obj.GetHashCode();
+ }
+
+};
+
+
+//Comparer implementation
+class _JsBridgeComparer
+ : public Tizen::Base::Collection::IComparerT< Tizen::Base::String >
+{
+public:
+ _JsBridgeComparer(){}
+ virtual ~_JsBridgeComparer(void) {}
+
+
+ result Compare(const Tizen::Base::String& obj1, const Tizen::Base::String& obj2, int& cmp) const
+ {
+ if (obj1 == obj2)
+ {
+ cmp = 0;
+ }
+ else
+ {
+ cmp = 1;
+ }
+
+ return E_SUCCESS;
+ }
+
+};
+
+
+_WebImpl::_WebImpl(Web* pWeb, Tizen::Ui::_Control* pCore)
+ : _ContainerImpl(pWeb, pCore)
+ , __isFooterVisible(false)
+ , __isKeypadVisible(false)
+ , __isKeypadOpened(false)
+ , __isWinFocusLost(false)
+ , __isLoadingErrorOccurred(false)
+ , __isRedirectRequested(false)
+ , __isCertificateRequested(false)
+ , __isCertificateConfirmed(false)
+ , __isFormDataVisible(false)
+ , __keypadBounds(0, 0, 0, 0)
+ , __pWebCore(null)
+ , __pUserLoadingListener(null)
+ , __pUserUiListener(null)
+ , __pUserUiListenerF(null)
+ , __pUserKeypadEventListener(null)
+ , __pTextSearchListener(null)
+ , __pKeypad(null)
+ , __pJsBridgeList(null)
+ , __pJsProvider(null)
+ , __pJsComparer(null)
+ , __pWebDownloadHandler(null)
+ , __pWebEvent(null)
+ , __pAuthChallenge(null)
+ , __pAuthPopup(null)
+ , __pUserMediaConfirmPopup(null)
+ , __pContentHandlerConfirmPopup(null)
+ , __pProtocolHandlerConfirmPopup(null)
+ , __pGeolocationConfirmPopup(null)
+ , __pNotificationConfirmPopup(null)
+ , __pScriptAlertConfirmPopup(null)
+ , __pScriptConfirmPopup(null)
+ , __pBeforeUnloadConfirmPopup(null)
+ , __pAppCacheConfirmPopup(null)
+ , __pDbQuotaConfirmPopup(null)
+ , __pLocalFsQuotaConfirmPopup(null)
+ , __pIndexedDbQuotaConfirmPopup(null)
+ , __pPromptPopup(null)
+ , __pCertConfirmPopup(null)
+ , __pSelectBox(null)
+ , __pDatePicker(null)
+ , __pColorPicker(null)
+ , __pFormDataWindow(null)
+ , __pVibrator(null)
+ , __policy(WEB_DECISION_CONTINUE)
+ , __defaultUserAgent(L"")
+ , __pFormDataList(null)
+ , __popupClosed(false)
+{
+ __textSearch.__searchAll = false;
+ __textSearch.__searchForward = true;
+ __textSearch.__caseSensitive = false;
+ __textSearch.__pending = 0;
+ __textSearch.__currentIndex = 1;
+ __textSearch.__totalCount = -1;
+ __textSearch.__text = L"";
+}
+
+
+_WebImpl::~_WebImpl()
+{
+ _WebManager* pWebManager = _WebManager::GetInstance();
+ SysTryCatch(NID_WEB_CTRL, pWebManager, , E_SYSTEM, "[%s] Failed to get the _ControlManager instance.", GetErrorMessage(E_SYSTEM));
+ pWebManager->RemoveWeb(reinterpret_cast< int >(this));
+
+CATCH:
+ _SettingInfoImpl::RemoveSettingEventListener(*this);
+ RemoveEventListenerCallback();
+}
+
+
+_WebImpl*
+_WebImpl::CreateWebImplN(Web* pControl, const Rectangle& bounds)
+{
+ result r = E_SUCCESS;
+
+ r = GET_SIZE_INFO(Web).CheckInitialSizeValid(Dimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ _Web* pCore = _Web::CreateWebN();
+ SysTryReturn(NID_WEB_CTRL, pCore, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ _WebImpl* pImpl = new (std::nothrow) _WebImpl(pControl, pCore);
+
+ r = CheckConstruction(pCore, pImpl);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pImpl->InitializeBoundsProperties(GET_SIZE_INFO(Web), bounds, pCore->GetOrientation());
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pImpl->Construct();
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return pImpl;
+
+CATCH:
+ delete pImpl;
+
+ return null;
+}
+
+
+_WebImpl*
+_WebImpl::CreateWebImplN(Web* pControl, const FloatRectangle& bounds)
+{
+ result r = E_SUCCESS;
+
+ r = GET_SIZE_INFO(Web).CheckInitialSizeValidF(FloatDimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ _Web* pCore = _Web::CreateWebN();
+ SysTryReturn(NID_WEB_CTRL, pCore, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ _WebImpl* pImpl = new (std::nothrow) _WebImpl(pControl, pCore);
+
+ r = CheckConstruction(pCore, pImpl);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pImpl->InitializeBoundsPropertiesF(GET_SIZE_INFO(Web), bounds, pCore->GetOrientation());
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pImpl->Construct();
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return pImpl;
+
+CATCH:
+ delete pImpl;
+
+ return null;
+}
+
+
+result
+_WebImpl::Construct(void)
+{
+ result r = E_SUCCESS;
+
+ r = __mutex.Create();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = __textSearch.__searchQueue.Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = __webNotificationList.Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = InitJsBridgeList();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = InitWebEvent();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pWebCore = dynamic_cast< _Web* >(&(GetCore()));
+ SysTryReturnResult(NID_WEB_CTRL, __pWebCore, E_SYSTEM, "A system error has been occurred. Failed to get web control");
+
+ return E_SUCCESS;
+}
+
+
+result
+_WebImpl::InitializeSetting(void)
+{
+ result r = E_SUCCESS;
+
+ WebSetting* pWebSetting = __pWebCore->GetSetting();
+ _WebSettingImpl* pWebSettingImpl = _WebSettingImpl::GetInstance(pWebSetting);
+
+ SetCookieEnabled(pWebSettingImpl->IsCookieEnabled());
+ SetPrivateBrowsingEnabled(pWebSettingImpl->IsPrivateBrowsingEnabled());
+
+ __defaultUserAgent = pWebSettingImpl->GetUserAgent();
+
+ r = SetSetting(*pWebSetting);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ SetEventListenerCallback();
+
+ return E_SUCCESS;
+}
+
+
+bool
+_WebImpl::IsLayoutable(void) const
+{
+ return true;
+}
+
+
+result
+_WebImpl::InitWebEvent(void)
+{
+ __pWebEvent = std::unique_ptr<_WebEvent>(new (std::nothrow) _WebEvent());
+ SysTryReturnResult(NID_WEB_CTRL, __pWebEvent.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ return __pWebEvent->Construct(*this);
+}
+
+
+_WebEvent*
+_WebImpl::GetWebEvent(void) const
+{
+ return __pWebEvent.get();
+}
+
+
+Eina_Hash*
+_WebImpl::ConvertToSlpHeaderN(const HttpHeader& header) const
+{
+ Eina_Hash* pHttpHeader = null;
+
+ std::unique_ptr<IList> pFieldNameList(header.GetFieldNamesN());
+ if (pFieldNameList.get())
+ {
+ pHttpHeader = eina_hash_string_small_new(FreeCharArray);
+ SysTryReturn(NID_WEB_CTRL, pHttpHeader, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ int count = pFieldNameList->GetCount();
+
+ for (int i = 0; i < count; i++)
+ {
+ String* pFieldName = dynamic_cast< String* >(pFieldNameList->GetAt(i));
+ SysTryCatch(NID_WEB_CTRL, pFieldName, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ std::unique_ptr<char[]> pKey(_StringConverter::CopyToCharArrayN(*pFieldName));
+ SysTryCatch(NID_WEB_CTRL, pKey.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ std::unique_ptr<IEnumerator> pFieldValueEnum(header.GetFieldValuesN(*pFieldName));
+ SysTryCatch(NID_WEB_CTRL, pFieldValueEnum.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ while (pFieldValueEnum->MoveNext() == E_SUCCESS)
+ {
+ Eina_Bool ret = false;
+
+ String* pFieldValue = dynamic_cast< String* >(pFieldValueEnum->GetCurrent());
+ SysTryCatch(NID_WEB_CTRL, pFieldValue, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ std::unique_ptr<char[]> pValue(_StringConverter::CopyToCharArrayN(*pFieldValue));
+ SysTryCatch(NID_WEB_CTRL, pValue.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ ret = eina_hash_add(pHttpHeader, pKey.get(), pValue.release());
+ SysTryCatch(NID_WEB_CTRL, ret == EINA_TRUE, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+ }
+ }
+ }
+ return pHttpHeader;
+
+CATCH:
+ eina_hash_free(pHttpHeader);
+
+ return null;
+}
+
+
+result
+_WebImpl::LoadUrl(const String& url) const
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return E_SUCCESS;
+ }
+
+ std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
+ SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ ewk_view_url_set(pWebview, pUrl.get());
+
+ return E_SUCCESS;
+}
+
+
+result
+_WebImpl::LoadUrl(const String& url, const HttpHeader& header)
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return E_SUCCESS;
+ }
+
+ std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
+ SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ Eina_Hash* pHttpHeader = ConvertToSlpHeaderN(header);
+
+ ewk_view_url_request_set(pWebview, pUrl.get(), EWK_HTTP_METHOD_GET, pHttpHeader, null);
+
+ eina_hash_free(pHttpHeader);
+
+ return E_SUCCESS;
+}
+
+
+result
+_WebImpl::LoadUrlWithPostRequest(const String& url, const HttpHeader& header, const ByteBuffer& body) const
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return E_SUCCESS;
+ }
+
+ std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
+ SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ Eina_Hash* pHttpHeader = ConvertToSlpHeaderN(header);
+
+ ewk_view_url_request_set(pWebview, pUrl.get(), EWK_HTTP_METHOD_POST, pHttpHeader, reinterpret_cast< const char* >(body.GetPointer()));
+
+ eina_hash_free(pHttpHeader);
+
+ return E_SUCCESS;
+}
+
+
+result
+_WebImpl::LoadData(const String& baseUrl, const ByteBuffer& content, const String& mime, const String& encoding) const
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return E_SUCCESS;
+ }
+
+ SysTryReturnResult(NID_WEB_CTRL, content.GetLimit() > 0, E_INVALID_ARG, "The content buffer is empty.");
+
+ std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(baseUrl));
+ std::unique_ptr<char[]> pMime(_StringConverter::CopyToCharArrayN(mime));
+ std::unique_ptr<char[]> pEncoding(_StringConverter::CopyToCharArrayN(encoding));
+ SysTryReturn(NID_WEB_CTRL, pUrl.get() && pMime.get() && pEncoding.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ ewk_view_contents_set(pWebview, reinterpret_cast< const char* >(content.GetPointer()), content.GetLimit(), pMime.get(), pEncoding.get(), pUrl.get());
+
+ return E_SUCCESS;
+}
+
+
+void
+_WebImpl::Pause(void)
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return;
+ }
+
+ ewk_view_suspend(pWebview);
+}
+
+
+void
+_WebImpl::Resume(void)
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return;
+ }
+
+ ewk_view_resume(pWebview);
+}
+
+
+result
+_WebImpl::ShowSelectBoxPopup(bool isMultiSelect, const String& title, Eina_List* pItems, Evas_Object* pWebView, int selectedIndex)
+{
+ __pSelectBox.reset();
+
+ SysTryReturnResult(NID_WEB_CTRL, eina_list_count(pItems) > 0, E_SYSTEM, "ItemCount is invalid.");
+
+ result r = E_SUCCESS;
+
+ std::unique_ptr<_SelectBox> pSelectBox(new (std::nothrow) _SelectBox());
+ SysTryReturnResult(NID_WEB_CTRL, pSelectBox.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ int itemCount = eina_list_count(pItems);
+ int defaultCount = (itemCount < DEFAULT_LIST_ITEM_COUNT) ? itemCount : (isMultiSelect ? (DEFAULT_LIST_ITEM_COUNT - 1) : DEFAULT_LIST_ITEM_COUNT);
+ r = pSelectBox->Construct(this, isMultiSelect, title, defaultCount, pWebView);
+
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pSelectBox->UpdateList(pItems, selectedIndex, false, false);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pSelectBox = std::move(pSelectBox);
+
+ return __pSelectBox->ShowPopup();
+}
+
+
+result
+_WebImpl::UpdateSelectBoxPopup(Eina_List* pItems, int selectedIndex, bool isGroupedList)
+{
+ SysTryReturnResult(NID_WEB_CTRL, __pSelectBox.get(), E_SYSTEM, "SlectBox instance does not exist.");
+
+ return __pSelectBox->UpdateList(pItems, selectedIndex, true, isGroupedList);
+}
+
+
+result
+_WebImpl::ClearSelectBoxPopup(void)
+{
+ SysTryReturnResult(NID_WEB_CTRL, __pSelectBox.get(), E_SYSTEM, "SlectBox instance does not exist.");
+
+ __pSelectBox.reset();
+
+ Resume();
+
+ return E_SUCCESS;
+}
+
+
+_InputPickerPopup*
+_WebImpl::GetDatepicker(void)
+{
+ _InputPickerPopup* pInputPicker =null;
+ if (__pDatePicker)
+ {
+ pInputPicker = __pDatePicker.get();
+ }
+ return pInputPicker;
+}
+
+
+_InputPickerPopup*
+_WebImpl::GetColorpicker(void)
+{
+ _InputPickerPopup* pInputPicker =null;
+ if (__pColorPicker)
+ {
+ pInputPicker = __pColorPicker.get();
+ }
+ return pInputPicker;
+}
+
+
+bool
+_WebImpl::CanGoBack(void) const
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return false;
+ }
+
+ return static_cast< bool >(ewk_view_back_possible(pWebview));
+}
+
+
+bool
+_WebImpl::CanGoForward(void) const
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return false;
+ }
+
+ return static_cast< bool >(ewk_view_forward_possible(pWebview));
+}
+
+
+void
+_WebImpl::GoBack(void) const
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return;
+ }
+
+ ewk_view_back(pWebview);
+}
+
+
+void
+_WebImpl::GoForward(void) const
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return;
+ }
+
+ ewk_view_forward(pWebview);
+}
+
+
+Tizen::Base::String
+_WebImpl::GetUrl(void) const
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return L"";
+ }
+
+ return ewk_view_url_get(pWebview);
+}
+
+
+Tizen::Base::String
+_WebImpl::GetTitle(void) const
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return L"";
+ }
+
+ return ewk_view_title_get(pWebview);
+}
+
+
+void
+_WebImpl::StopLoading(void) const
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return;
+ }
+
+ ewk_view_stop(pWebview);
+}
+
+
+void
+_WebImpl::Reload(void) const
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return;
+ }
+
+ ewk_view_reload(pWebview);
+}
+
+
+String*
+_WebImpl::EvaluateJavascriptN(const String& scriptCode)
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return null;
+ }
+
+ std::unique_ptr<char[]> pScript(_StringConverter::CopyToCharArrayN(scriptCode));
+ SysTryReturn(NID_WEB_CTRL, pScript.get(), null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
+ SysTryReturn(NID_WEB_CTRL, pPresenter.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ ewk_view_script_execute(pWebview, pScript.get(), OnScriptExecuted, pPresenter.get());
+
+ String* pResult = new (std::nothrow) String(L"");
+ SysTryReturn(NID_WEB_CTRL, pResult, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ pPresenter->WaitAsyncProcess(*pResult);
+
+ return pResult;
+}
+
+
+result
+_WebImpl::SetZoomLevel(float level)
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return E_SUCCESS;
+ }
+
+ SysTryReturnResult(NID_WEB_CTRL, level >= MIN_ZOOM_LEVEL && level <= MAX_ZOOM_LEVEL, E_OUT_OF_RANGE, "The level(%f) must be between 0.3 and 2.0(%f).", level, level);
+
+ ewk_view_scale_set(pWebview, static_cast< double >(level), 0, 0);
+
+ return E_SUCCESS;
+}
+
+
+float
+_WebImpl::GetZoomLevel(void) const
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return -1.0f;
+ }
+
+ return static_cast< float >(ewk_view_scale_get(pWebview));
+}
+
+
+const PageNavigationList*
+_WebImpl::GetBackForwardListN(void) const
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return null;
+ }
+
+ result r = E_SUCCESS;
+
+ _PageNavigationListImpl* pNavigationListImpl = null;
+ _HistoryItemImpl* pHistoryItemImpl = null;
+
+ std::unique_ptr<PageNavigationList> pNavigationList;
+ std::unique_ptr<ArrayList, AllElementsDeleter> pHistoryList;
+
+ int backCount = 0;
+ int forwardCount = 0;
+
+ String url(L"");
+ String title(L"");
+
+ Ewk_History* pEwkHistoryList = ewk_view_history_get(pWebview);
+ SysTryReturn(NID_WEB_CTRL, pEwkHistoryList, null, E_SYSTEM, "[%s] A system error has been occurred. Failed to get full history.", GetErrorMessage(E_SYSTEM));
+
+ Ewk_History_Item* pEwkItem = ewk_history_nth_item_get(pEwkHistoryList, 0);
+ SysTryCatch(NID_WEB_CTRL, pEwkItem, , E_DATA_NOT_FOUND, "[%s] There is no history.", GetErrorMessage(E_DATA_NOT_FOUND));
+
+ pNavigationList = std::unique_ptr<PageNavigationList>(new (std::nothrow) PageNavigationList());
+ SysTryCatch(NID_WEB_CTRL, pNavigationList.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ pNavigationListImpl = _PageNavigationListImpl::GetInstance(pNavigationList.get());
+ SysTryCatch(NID_WEB_CTRL, pNavigationListImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ pHistoryList = std::unique_ptr<ArrayList, AllElementsDeleter>(new (std::nothrow) ArrayList());
+ SysTryCatch(NID_WEB_CTRL, pHistoryList.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pHistoryList->Construct();
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ backCount = ewk_history_back_list_length_get(pEwkHistoryList);
+ forwardCount = ewk_history_forward_list_length_get(pEwkHistoryList);
+ SysLog(NID_WEB_CTRL, "The current value of backCount is %d, forwardCount is %d", backCount, forwardCount);
+
+ for (int i = -backCount; i < forwardCount + 1; i++)
+ {
+ std::unique_ptr<HistoryItem> pHistoryItem(new (std::nothrow) HistoryItem());
+ SysTryCatch(NID_WEB_CTRL, pHistoryItem.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ pHistoryItemImpl = _HistoryItemImpl::GetInstance(pHistoryItem.get());
+ SysTryCatch(NID_WEB_CTRL, pHistoryItemImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ pEwkItem = ewk_history_nth_item_get(pEwkHistoryList, i);
+ SysTryCatch(NID_WEB_CTRL, pEwkItem, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ url = ewk_history_item_uri_get(pEwkItem);
+ title = ewk_history_item_title_get(pEwkItem);
+ SysSecureLog(NID_WEB_CTRL, "The current value of url is %s, title is %s", url.GetPointer(), title.GetPointer());
+
+ pHistoryItemImpl->SetHistoryItem(url, title);
+
+ r = pHistoryList->Add(*pHistoryItem.get());
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ pHistoryItem.release();
+ }
+
+ pNavigationListImpl->SetPageNavigationList(pHistoryList.release(), backCount);
+
+ ewk_history_free(pEwkHistoryList);
+
+ return pNavigationList.release();
+
+CATCH:
+ ewk_history_free(pEwkHistoryList);
+
+ return null;
+}
+
+
+bool
+_WebImpl::SearchText(const String& text, bool searchForward)
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return false;
+ }
+
+ result r = E_SUCCESS;
+
+ Ewk_Find_Options condition = static_cast< Ewk_Find_Options >(EWK_FIND_OPTIONS_SHOW_HIGHLIGHT | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
+
+ if (!searchForward)
+ {
+ condition = static_cast < Ewk_Find_Options >(condition | EWK_FIND_OPTIONS_BACKWARDS);
+ }
+
+ std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
+ SysTryReturn(NID_WEB_CTRL, pPresenter.get(), false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = SynchronizeSearch(SEARCH_SYNC, pWebview, condition, text, searchForward, false, pPresenter.get());
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ int result = 0;
+ pPresenter->WaitAsyncProcess(result);
+
+ return static_cast < bool >(result);
+}
+
+
+result
+_WebImpl::SearchTextAllAsync(const Tizen::Base::String& text, bool caseSensitive)
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return E_SUCCESS;
+ }
+
+ result r = E_SUCCESS;
+
+ Ewk_Find_Options condition = EWK_FIND_OPTIONS_SHOW_HIGHLIGHT;
+
+ if (!caseSensitive)
+ {
+ condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
+ }
+
+ r = SynchronizeSearch(SEARCH_ALL_ASYNC, pWebview, condition, text, true, caseSensitive);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return E_SUCCESS;
+}
+
+
+result
+_WebImpl::SearchNextAsync(bool searchForward)
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return E_SUCCESS;
+ }
+
+ SysTryReturnResult(NID_WEB_CTRL, __textSearch.__searchAll && __textSearch.__totalCount > -1, E_INVALID_OPERATION, "The SearchTextAllAsync() method is not called or completed.");
+ SysTryReturnResult(NID_WEB_CTRL, (searchForward && __textSearch.__currentIndex < __textSearch.__totalCount) || (!searchForward && __textSearch.__currentIndex > 1)
+ , E_OBJ_NOT_FOUND, "The Next instance is not available.");
+
+ result r = E_SUCCESS;
+
+ Ewk_Find_Options condition = EWK_FIND_OPTIONS_SHOW_HIGHLIGHT;
+
+ if (!__textSearch.__caseSensitive)
+ {
+ condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
+ }
+
+ if (!searchForward)
+ {
+ condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_BACKWARDS);
+ }
+
+ r = SynchronizeSearch(SEARCH_NEXT_ASYNC, pWebview, condition, __textSearch.__text, searchForward);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return E_SUCCESS;
+}
+
+
+result
+_WebImpl::SynchronizeSearch(_SearchType type, Evas_Object* pView, Ewk_Find_Options condition, const Tizen::Base::String& text, bool searchForward, bool caseSensitive, _WebPresenter* pWebPresenter)
+{
+ MutexGuard lock(__mutex);
+
+ std::unique_ptr<char[]> pText(_StringConverter::CopyToCharArrayN(text));
+ SysTryReturn(NID_WEB_CTRL, pText.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ switch (type)
+ {
+ case SEARCH_SYNC:
+ if (__textSearch.__searchAll)
+ {
+ DisableAsyncSearch();
+
+ __textSearch.__searchQueue.Enqueue(this);
+ __textSearch.__searchQueue.Enqueue(pWebPresenter);
+
+ ewk_view_text_find(pView, "", condition, MAX_TEXT_MATCH);
+ ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
+ }
+ else
+ {
+ __textSearch.__searchQueue.Enqueue(pWebPresenter);
+
+ ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
+ }
+ break;
+
+ case SEARCH_ALL_ASYNC:
+ __textSearch.__searchAll = true;
+ __textSearch.__text = text;
+ __textSearch.__searchForward = true;
+ __textSearch.__caseSensitive = caseSensitive;
+ __textSearch.__totalCount = -1;
+ __textSearch.__currentIndex = 1;
+
+ __textSearch.__searchQueue.Enqueue(this);
+ __textSearch.__searchQueue.Enqueue(this);
+
+ ewk_view_text_find(pView, "", condition, MAX_TEXT_MATCH);
+ ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
+ break;
+
+ case SEARCH_NEXT_ASYNC:
+ __textSearch.__searchForward = searchForward;
+
+ CalculateAsyncSearchOrdinal();
+
+ __textSearch.__searchQueue.Enqueue(this);
+
+ ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
+ break;
+
+ default:
+ SysAssert(false);
+ }
+
+ return E_SUCCESS;
+}
+
+
+void
+_WebImpl::SetAsyncSearchResult(int totalCount)
+{
+ __textSearch.__totalCount = totalCount;
+}
+
+
+_WebPresenter*
+_WebImpl::GetSearchPresenter(void)
+{
+ MutexGuard lock(__mutex);
+
+ return dynamic_cast< _WebPresenter* >(__textSearch.__searchQueue.Dequeue());
+}
+
+
+ int
+ _WebImpl::GetPendingAsyncSearchCount(void) const
+{
+ return __textSearch.__searchQueue.GetCount();
+}
+
+
+void
+_WebImpl::CalculateAsyncSearchOrdinal(void)
+{
+ if (__textSearch.__searchForward)
+ {
+ __textSearch.__currentIndex++;
+ }
+ else
+ {
+ __textSearch.__currentIndex--;
+ }
+}
+
+
+ int
+ _WebImpl::GetAsyncSearchOrdinal(void) const
+{
+ return __textSearch.__currentIndex;
+}
+
+
+ void
+ _WebImpl::DisableAsyncSearch(void)
+{
+ __textSearch.__searchAll = false;
+}
+
+
+result
+_WebImpl::SetSetting(const WebSetting& setting)
+{
+ if (__pWebCore->GetWebNativeNode())
+ {
+ Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
+ Ewk_Settings* pSettings = ewk_view_settings_get(__pWebCore->GetWebNativeNode());
+ SysAssertf(pContext && pSettings, "Failed to get webkit instance.");
+
+ std::unique_ptr<char[]> pEncoding(_StringConverter::CopyToCharArrayN(setting.GetDefaultTextEncoding()));
+ SysTryReturn(NID_WEB_CTRL, pEncoding.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ ewk_settings_default_encoding_set(pSettings, pEncoding.get());
+
+ switch (setting.GetCacheControl())
+ {
+ case WEB_CACHE_VALIDATED:
+ ewk_context_cache_disabled_set(pContext, EINA_FALSE);
+ break;
+
+ case WEB_CACHE_IGNORE:
+ ewk_context_cache_disabled_set(pContext, EINA_TRUE);
+ break;
+
+ default:
+ SysAssert(false);
+ }
+
+ if (setting.GetInputStyle() == INPUT_STYLE_OVERLAY)
+ {
+ ewk_settings_default_keypad_enabled_set(pSettings, EINA_TRUE);
+ }
+ else
+ {
+ ewk_settings_default_keypad_enabled_set(pSettings, EINA_FALSE);
+ }
+
+ ewk_settings_font_default_size_set(pSettings, static_cast< Eina_Bool >(setting.GetFontSize()));
+
+ ewk_settings_javascript_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsJavascriptEnabled()));
+
+ ewk_settings_loads_images_automatically_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoImageLoadEnabled()));
+
+ if (__defaultUserAgent != setting.GetUserAgent())
+ {
+ std::unique_ptr<char[]> pAgent(_StringConverter::CopyToCharArrayN(setting.GetUserAgent()));
+ SysTryReturn(NID_WEB_CTRL, pAgent.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ ewk_view_user_agent_set(__pWebCore->GetWebNativeNode(), pAgent.get());
+ }
+
+ ewk_settings_auto_fitting_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoFittingEnabled()));
+
+ ewk_settings_scripts_window_open_set(pSettings, static_cast< Eina_Bool >(setting.IsJavaScriptPopupEnabled()));
+
+ ewk_settings_form_candidate_data_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoFormDataShowEnabled()));
+
+ ewk_settings_autofill_password_form_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoLoginFormFillEnabled()));
+ }
+
+ _WebSettingImpl* pWebSettingImpl = _WebSettingImpl::GetInstance(__pWebCore->GetSetting());
+
+ pWebSettingImpl->SetCertificateErrorHandlingMode(setting.GetCertificateErrorHandlingMode());
+ pWebSettingImpl->SetDefaultTextEncoding(setting.GetDefaultTextEncoding());
+ pWebSettingImpl->SetCacheControl(setting.GetCacheControl());
+ pWebSettingImpl->SetFontSize(setting.GetFontSize());
+ pWebSettingImpl->SetJavascriptEnabled(setting.IsJavascriptEnabled());
+ pWebSettingImpl->SetAutoImageLoadEnabled(setting.IsAutoImageLoadEnabled());
+ pWebSettingImpl->SetInputStyle(setting.GetInputStyle());
+ pWebSettingImpl->SetUserAgent(setting.GetUserAgent());
+ pWebSettingImpl->SetAutoFittingEnabled(setting.IsAutoFittingEnabled());
+ pWebSettingImpl->SetJavaScriptPopupEnabled(setting.IsJavaScriptPopupEnabled());
+ pWebSettingImpl->SetGeolocationEnabled(setting.IsGeolocationEnabled());
+ pWebSettingImpl->SetAutoFormDataShowEnabled(setting.IsAutoFormDataShowEnabled());
+ pWebSettingImpl->SetAutoLoginFormFillEnabled(setting.IsAutoLoginFormFillEnabled());
+
+ return E_SUCCESS;
+}
+
+
+WebSetting
+_WebImpl::GetSetting(void) const
+{
+ return *__pWebCore->GetSetting();
+}
+
+
+const HitElementResult*
+_WebImpl::GetElementByPointN(const Point& point) const
+{
+ return GetElementByPointN(_CoordinateSystemUtils::ConvertToFloat(point));
+}
+
+
+const HitElementResult*
+_WebImpl::GetElementByPointN(const FloatPoint& point) const
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return null;
+ }
+
+ SysTryReturn(NID_WEB_CTRL, Contains(point), null, E_INVALID_ARG, "[%s] The point must be contained in the bounds of a web control.", GetErrorMessage(E_INVALID_ARG));
+
+ result r = E_SUCCESS;
+
+ _HitElementResultImpl* pHitElementResultImpl = null;
+
+ std::unique_ptr<HitElementResult> pHitElementResult;
+ std::unique_ptr<Bitmap> pImage;
+ std::unique_ptr<HashMap, AllElementsDeleter> pAttributeMap;
+
+ Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(point)));
+
+ Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pWebview, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
+ SysTryReturn(NID_WEB_CTRL, pEwkHitTest, null, E_SYSTEM, "[%s] Failed to get hit test.", GetErrorMessage(E_SYSTEM));
+
+ Eina_Hash* pAttrHash = ewk_hit_test_attribute_hash_get(pEwkHitTest);
+ Ewk_Hit_Test_Result_Context context = ewk_hit_test_result_context_get(pEwkHitTest);
+ String url(ewk_hit_test_link_uri_get(pEwkHitTest));
+ String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
+ String nodeValue(ewk_hit_test_node_value_get(pEwkHitTest));
+
+ SysSecureLog(NID_WEB_CTRL, "The current value of url is %ls, tag is %ls, value is %ls", url.GetPointer(), tagName.GetPointer(), nodeValue.GetPointer());
+
+ pHitElementResult = std::unique_ptr<HitElementResult>(new (std::nothrow) HitElementResult());
+ SysTryCatch(NID_WEB_CTRL, pHitElementResult.get(), , E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ pHitElementResultImpl = _HitElementResultImpl::GetInstance(pHitElementResult.get());
+ SysTryCatch(NID_WEB_CTRL, pHitElementResultImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ if (context & EWK_HIT_TEST_RESULT_CONTEXT_IMAGE)
+ {
+ ByteBuffer buf;
+ Image image;
+ ImageFormat format;
+
+ int imageLength = ewk_hit_test_image_buffer_length_get(pEwkHitTest);
+ void* pImageBuffer = ewk_hit_test_image_buffer_get(pEwkHitTest);
+ const char* pExtension = ewk_hit_test_image_file_name_extension_get(pEwkHitTest);
+ SysLog(NID_WEB_CTRL, "The current value of imageBuffer is %u, bufferLength is %d, extension is %s", pImageBuffer, imageLength, pExtension);
+
+ r = buf.Construct(imageLength);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = buf.SetArray(reinterpret_cast< byte* >(pImageBuffer), 0, imageLength);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ buf.Rewind();
+
+// ToDo : webkit doesn't support types such as IMG_FORMAT_WBMP and IMG_FORMAT_TIFF
+// webkit support types such as ico and vp8 additionally
+ if (strcmp(pExtension, "gif") == 0)
+ {
+ format = IMG_FORMAT_GIF;
+ }
+ else if (strcmp(pExtension, "jpg") == 0)
+ {
+ format = IMG_FORMAT_JPG;
+ }
+ else if (strcmp(pExtension, "png") == 0)
+ {
+ format = IMG_FORMAT_PNG;
+ }
+ else if (strcmp(pExtension, "bmp") == 0)
+ {
+ format = IMG_FORMAT_BMP;
+ }
+ else
+ {
+ SysLogException(NID_WEB_CTRL, E_UNSUPPORTED_FORMAT, "[%s] The %s format is not supported", GetErrorMessage(E_UNSUPPORTED_FORMAT), pExtension);
+ goto CATCH;
+ }
+
+ r = image.Construct();
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pImage = std::unique_ptr<Bitmap>(image.DecodeN(buf, format, BITMAP_PIXEL_FORMAT_RGB565));
+ SysTryCatch(NID_WEB_CTRL, pImage.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+ }
+
+ if (pAttrHash)
+ {
+ pAttributeMap = std::unique_ptr<HashMap, AllElementsDeleter>(new (std::nothrow) HashMap());
+ SysTryCatch(NID_WEB_CTRL, pAttributeMap.get(), , E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pAttributeMap->Construct(eina_hash_population(pAttrHash));
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ eina_hash_foreach(pAttrHash, AddHttpAttributeData, pAttributeMap.get());
+ SysTryCatch(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+ }
+
+ pHitElementResultImpl->SetHitElementResult(pAttributeMap.release(), pImage.release(), tagName, nodeValue, url);
+
+ ewk_hit_test_free(pEwkHitTest);
+
+ return pHitElementResult.release();
+
+CATCH:
+ ewk_hit_test_free(pEwkHitTest);
+
+ return null;
+}
+
+
+bool
+_WebImpl::IsLoading(void) const
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return false;
+ }
+
+ double percent = ewk_view_load_progress_get(pWebview);
+
+ if (Double::Compare(percent, 0.0) > 0 && Double::Compare(percent, 1.0) < 0)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+
+String
+_WebImpl::GetTextFromBlock(void) const
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return L"";
+ }
+
+ return ewk_view_text_selection_text_get(pWebview);
+}
+
+
+bool
+_WebImpl::IsPrivateBrowsingEnabled(void) const
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsPrivateBrowsingEnabled();
+ }
+
+ Ewk_Settings* pSettings = ewk_view_settings_get(pWebview);
+ SysAssertf(pSettings, "Failed to get webkit instance.");
+
+ return static_cast< bool >(ewk_settings_private_browsing_enabled_get(pSettings));
+}
+
+
+void
+_WebImpl::SetPrivateBrowsingEnabled(bool enable)
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetPrivateBrowsingEnabled(enable);
+
+ return;
+ }
+
+ Ewk_Settings* pSettings = ewk_view_settings_get(pWebview);
+ SysAssertf(pSettings, "Failed to get webkit instance.");
+
+ ewk_settings_private_browsing_enabled_set(pSettings, static_cast< Eina_Bool >(enable));
+}
+
+
+void
+_WebImpl::ClearHistory(void)
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return;
+ }
+
+ ewk_view_back_forward_list_clear(pWebview);
+}
+
+
+void
+_WebImpl::ClearCache(void)
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return;
+ }
+
+ Ewk_Context* pContext = ewk_view_context_get(pWebview);
+
+ ewk_context_cache_clear(pContext);
+}
+
+
+void
+_WebImpl::ClearCookie(void)
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return;
+ }
+
+ Ewk_Context* pContext = ewk_view_context_get(pWebview);
+ Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
+
+ ewk_cookie_manager_cookies_clear(pCookieManager);
+}
+
+
+void
+_WebImpl::ClearFormData(void)
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return;
+ }
+
+ Ewk_Context* pContext = ewk_view_context_get(pWebview);
+
+ ewk_context_form_candidate_data_clear(pContext);
+}
+
+
+void
+_WebImpl::ClearLoginFormData(void)
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return;
+ }
+
+ Ewk_Context* pContext = ewk_view_context_get(pWebview);
+
+ ewk_context_form_password_data_clear(pContext);
+}
+
+
+bool
+_WebImpl::IsCookieEnabled(void) const
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsCookieEnabled();
+ }
+
+ Ewk_Context* pContext = ewk_view_context_get(pWebview);
+ Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
+ SysAssertf(pCookieManager, "Failed to get webkit instance.");
+
+ std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
+ SysTryReturn(NID_WEB_CTRL, pPresenter.get(), false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ ewk_cookie_manager_async_accept_policy_get(pCookieManager, OnCookiesPolicyGot, pPresenter.get());
+
+ bool result = false;
+ pPresenter->WaitAsyncProcess(result);
+
+ return result;
+}
+
+
+void
+_WebImpl::SetCookieEnabled(bool enable)
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetCookiEnabled(enable);
+
+ return;
+ }
+
+ Ewk_Context* pContext = ewk_view_context_get(pWebview);
+ Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
+ SysAssertf(pCookieManager, "Failed to get webkit instance.");
+
+ if (enable)
+ {
+ ewk_cookie_manager_accept_policy_set(pCookieManager, EWK_COOKIE_ACCEPT_POLICY_ALWAYS);
+ }
+ else
+ {
+ ewk_cookie_manager_accept_policy_set(pCookieManager, EWK_COOKIE_ACCEPT_POLICY_NEVER);
+ ewk_cookie_manager_cookies_clear(pCookieManager);
+ }
+}
+
+
+result
+_WebImpl::SavePageAsPdf(const String& filePath, const Dimension* pSize) const
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return E_SUCCESS;
+ }
+
+ result r = E_SUCCESS;
+
+ std::unique_ptr<char[]> pFilePath(_StringConverter::CopyToCharArrayN(filePath));
+ SysTryReturn(NID_WEB_CTRL, pFilePath.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ String dirPath;
+ String fileExtension = File::GetFileExtension(filePath);
+ int pathLength = filePath.GetLength();
+ int index = 0;
+
+ SysTryReturnResult(NID_WEB_CTRL, fileExtension.Equals("pdf", false), E_INVALID_ARG, "Invalid argument(s) is used. File extension is not pdf.");
+
+ r = filePath.LastIndexOf(L"/", pathLength - 1, index);
+ SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_INVALID_ARG, "Invalid argument(s) is used. Directory path is invalid.");
+ r = filePath.SubString(0, index + 1, dirPath);
+ SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_INVALID_ARG, "Invalid argument(s) is used. Directory path is invalid.");
+
+ std::unique_ptr<char[]> pDirPath(_StringConverter::CopyToCharArrayN(dirPath));
+ SysTryReturnResult(NID_WEB_CTRL, access(pDirPath.get(), W_OK) == 0, E_INACCESSIBLE_PATH, "Directory permission is read-only.");
+
+ if (pSize)
+ {
+ SysTryReturnResult(NID_WEB_CTRL, pSize->width > 0 && pSize->height > 0, E_INVALID_ARG, "Invalid argument(s) is used. Size of pdf file is invalid.");
+
+ ewk_view_contents_pdf_get(pWebview, pSize->width, pSize->height, pFilePath.get());
+ }
+ else
+ {
+ Evas_Coord contentsWidth;
+ Evas_Coord contentsHeight;
+
+ ewk_view_contents_size_get(pWebview, &contentsWidth, &contentsHeight);
+ ewk_view_contents_pdf_get(pWebview, contentsWidth, contentsHeight, pFilePath.get());
+ }
+
+ return E_SUCCESS;
+}
+
+
+bool
+_WebImpl::IsMimeSupported(const String& mime) const
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return false;
+ }
+
+ std::unique_ptr<char[]> pMime(_StringConverter::CopyToCharArrayN(mime));
+ SysTryReturn(NID_WEB_CTRL, pMime.get(), false, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ return static_cast< bool >(ewk_frame_can_show_mime_type(ewk_view_main_frame_get(pWebview), pMime.get()));
+}
+
+
+void
+_WebImpl::SetLoadingListener(ILoadingListener* pLoadingListener)
+{
+ __pUserLoadingListener = const_cast< ILoadingListener* >(pLoadingListener);
+}
+
+
+void
+_WebImpl::SetWebUiEventListener(IWebUiEventListener* pUiEventListener)
+{
+ __pUserUiListener = pUiEventListener;
+}
+
+
+void
+_WebImpl::SetWebUiEventListenerF(IWebUiEventListenerF* pUiEventListener)
+{
+ __pUserUiListenerF = pUiEventListener;
+}
+
+
+void
+_WebImpl::SetWebKeypadEventListener(IWebKeypadEventListener* pKeypadEventListener)
+{
+ __pUserKeypadEventListener = pKeypadEventListener;
+}
+
+
+void
+_WebImpl::SetDownloadListener(IWebDownloadListener* pDownLoadListener)
+{
+ if (__pWebDownloadHandler.get() == null)
+ {
+ __pWebDownloadHandler = std::unique_ptr<_WebDataHandler>(new (std::nothrow) _WebDataHandler());
+ SysTryReturnVoidResult(NID_WEB_CTRL, __pWebDownloadHandler.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ }
+
+ __pWebDownloadHandler->SetDownloadListener(pDownLoadListener);
+ __pWebDownloadHandler->SetWebEvent(__pWebEvent.get());
+}
+
+
+void
+_WebImpl::SetTextSearchListener(ITextSearchListener* pTextSearchListener)
+{
+ __pTextSearchListener = pTextSearchListener;
+}
+
+
+void
+_WebImpl::SetScrollEnabled(bool enable)
+{
+ _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetScrollEnabled(enable);
+}
+
+
+bool
+_WebImpl::IsScrollEnabled(void) const
+{
+ return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsScrollEnabled();
+}
+
+
+result
+_WebImpl::InitJsBridgeList(void)
+{
+ result r = E_SUCCESS;
+
+ __pJsProvider = std::unique_ptr<_JsBridgeHashCodeProvider>(new (std::nothrow) _JsBridgeHashCodeProvider());
+ SysTryReturnResult(NID_WEB_CTRL, __pJsProvider.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ __pJsComparer = std::unique_ptr<_JsBridgeComparer>(new (std::nothrow) _JsBridgeComparer());
+ SysTryReturnResult(NID_WEB_CTRL, __pJsComparer.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ std::unique_ptr<HashMapT< String, IJavaScriptBridge* > > pJsBridgeList(new (std::nothrow) HashMapT< String, IJavaScriptBridge* >);
+ SysTryReturnResult(NID_WEB_CTRL, pJsBridgeList.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ r = pJsBridgeList->Construct(0, 0, *__pJsProvider.get(), *__pJsComparer.get());
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pJsBridgeList = std::move(pJsBridgeList);
+
+ return E_SUCCESS;
+}
+
+
+result
+_WebImpl::AddJavaScriptBridge(const IJavaScriptBridge& jsBridge)
+{
+ result r = E_SUCCESS;
+
+ IJavaScriptBridge* pJsBridge = const_cast< IJavaScriptBridge* >(&jsBridge);
+ String key(pJsBridge->GetName());
+
+ r = __pJsBridgeList->Add(key, pJsBridge);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return E_SUCCESS;
+}
+
+
+result
+_WebImpl::RemoveJavaScriptBridge(const IJavaScriptBridge& jsBridge)
+{
+ result r = E_SUCCESS;
+
+ IJavaScriptBridge* pJsBridge = const_cast< IJavaScriptBridge* >(&jsBridge);
+ String key(pJsBridge->GetName());
+
+ r = __pJsBridgeList->Remove(key);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return E_SUCCESS;
+}
+
+
+IJavaScriptBridge*
+_WebImpl::FindJsInterface(const IJsonValue* pValue) const
+{
+ result r = E_SUCCESS;
+
+ IJsonValue* pJsonValue = null;
+ IJavaScriptBridge* pJsBridge = null;
+
+ String key(L"name");
+
+ const JsonObject* pJsonObject = dynamic_cast< const JsonObject* >(pValue);
+ SysTryReturn(NID_WEB_CTRL, pJsonObject, null, E_INVALID_ARG, "[%s] Invalid argument(s) is used. Json text must be Json Object type." , GetErrorMessage(E_INVALID_ARG));
+
+ r = pJsonObject->GetValue(&key, pJsonValue);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS && pJsonValue, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ JsonString* pBridgeName = dynamic_cast< JsonString* >(pJsonValue);
+ SysTryReturn(NID_WEB_CTRL, pBridgeName, null, E_INVALID_ARG, "[%s] Invalid argument(s) is used. name key is missing." , GetErrorMessage(E_INVALID_ARG));
+
+ r = __pJsBridgeList->GetValue(static_cast< String >(*pBridgeName), pJsBridge);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return pJsBridge;
+}
+
+
+ILoadingListener*
+_WebImpl::GetLoadingListener(void) const
+{
+ return __pUserLoadingListener;
+}
+
+
+IWebUiEventListener*
+_WebImpl::GetUiEventListener(void) const
+{
+ return __pUserUiListener;
+}
+
+
+IWebUiEventListenerF*
+_WebImpl::GetUiEventListenerF(void) const
+{
+ return __pUserUiListenerF;
+}
+
+
+IWebKeypadEventListener*
+_WebImpl::GetWebKeypadEventListener(void) const
+{
+ return __pUserKeypadEventListener;
+}
+
+
+ITextSearchListener*
+_WebImpl::GetTextSearchListener(void) const
+{
+ return __pTextSearchListener;
+}
+
+
+void
+_WebImpl::SetEventListenerCallback(void) const
+{
+ Evas_Object* pWebNativeNode = __pWebCore->GetWebNativeNode();
+ if (pWebNativeNode)
+ {
+ _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
+ SysAssertf(pEcoreEvas, "Failed to get Ui ecore evas");
+
+ Evas_Object* pWinObject = pEcoreEvas->GetWindowObject();
+ SysAssertf(pWinObject, "Failed to get Ui window evas object");
+
+ Ewk_View_Smart_Data* pSmartData = (Ewk_View_Smart_Data*) evas_object_smart_data_get(pWebNativeNode);
+ SysAssertf(pSmartData, "Failed to request");
+
+ Ewk_View_Smart_Class *pSmart = const_cast<Ewk_View_Smart_Class*>(pSmartData->api);
+ SysAssertf(pSmart, "Failed to request");
+
+ pSmart->popup_menu_show = OnSelectBoxRequested;
+ pSmart->multiple_popup_menu_show = OnMultiSelectBoxRequested;
+ pSmart->popup_menu_hide = OnSelectBoxClosed;
+ pSmart->popup_menu_update = OnSelectBoxUpdateRequested;
+
+ pSmart->input_picker_show = OnDatePickerProviderRequested;
+ pSmart->input_picker_color_request = OnColorPickerProviderRequested;
+ pSmart->input_picker_color_dismiss = OnColorPickerProviderDismissed;
+
+ pSmart->formdata_candidate_show = OnFormDataCandidateShow;
+ pSmart->formdata_candidate_hide = OnFormDataCandidateHide;
+ pSmart->formdata_candidate_update_data = OnFormDataCandidateUpdate;
+ pSmart->formdata_candidate_is_showing = OnFormDataCandidateIsShowing;
+
+ evas_object_data_set(pWebNativeNode, WEB_CTRL, this);
+
+ // add loading event callbacks for ILoadingListener
+ evas_object_smart_callback_add(pWebNativeNode, "create,window", OnWebWindowCreateRequested, this);
+ evas_object_smart_callback_add(pWebNativeNode, "close,window", OnWebWindowClosedRequested, this);
+
+ evas_object_smart_callback_add(pWebNativeNode, "policy,navigation,decide", OnLoadingRequested, this);
+ evas_object_smart_callback_add(pWebNativeNode, "load,started", OnLoadingStarted, this);
+ evas_object_smart_callback_add(pWebNativeNode, "load,finished", OnLoadingCompleted, this);
+ evas_object_smart_callback_add(pWebNativeNode, "load,progress", OnEstimatedProgress, this);
+ evas_object_smart_callback_add(pWebNativeNode, "load,progress,finished", OnProgressCompleted, this);
+ evas_object_smart_callback_add(pWebNativeNode, "load,stop", OnLoadingCanceled, this);
+ evas_object_smart_callback_add(pWebNativeNode, "load,error", OnLoadingErrorOccurred, this);
+ evas_object_smart_callback_add(pWebNativeNode, "title,changed", OnPageTitleReceived, this);
+ evas_object_smart_callback_add(pWebNativeNode, "load,committed", OnLoadingCommitted, this);
+
+ evas_object_smart_callback_add(pWebNativeNode, "requestToNative,json", OnHandleJavaScriptRequest, this);
+
+ evas_object_smart_callback_add(pWinObject, "focus,in", OnWindowObjectFocusGained, this);
+ evas_object_smart_callback_add(pWinObject, "focus,out", OnWindowObjectFocusLost, this);
+
+ evas_object_smart_callback_add(pWebNativeNode, "inputmethod,changed", OnWebKeypadStateChanged, this);
+ evas_object_smart_callback_add(pWebNativeNode, "editorclient,ime,opened", OnWebKeypadOpened, this);
+ evas_object_smart_callback_add(pWebNativeNode, "editorclient,ime,closed", OnWebKeypadClosed, this);
+
+ evas_object_smart_callback_add(pWebNativeNode, "authentication,challenge", OnHttpAuthenticationRequested, this);
+ evas_object_smart_callback_add(pWebNativeNode, "authentication,canceled", OnHttpAuthenticationCanceled, this);
+
+ evas_object_smart_callback_add(pWebNativeNode, "geolocation,permission,request", OnGeolocationPermissionRequested, this);
+
+ ewk_view_javascript_alert_callback_set(pWebNativeNode, OnScriptAlertRequested, const_cast< _WebImpl* >(this));
+ ewk_view_javascript_prompt_callback_set(pWebNativeNode, OnScriptPromptRequested, const_cast< _WebImpl* >(this));
+ ewk_view_javascript_confirm_callback_set(pWebNativeNode, OnScriptConfirmRequested, const_cast< _WebImpl* >(this));
+ ewk_view_before_unload_confirm_panel_callback_set(pWebNativeNode, OnBeforeUnloadConfirmRequested, const_cast< _WebImpl* >(this));
+
+ evas_object_smart_callback_add(pWebNativeNode, "policy,response,decide", OnWebDataReceived, this);
+
+ evas_object_smart_callback_add(pWebNativeNode, "load,nonemptylayout,finished", OnWebPageShowRequested, this);
+ evas_object_smart_callback_add(pWebNativeNode, "request,certificate,confirm", OnCertificateRequested, this);
+ evas_object_smart_callback_add(pWebNativeNode, "usermedia,permission,request", OnGetUserMediaPermissionRequsted, this);
+
+ evas_object_smart_callback_add(pWebNativeNode, "notification,permission,request", OnNotificationPermissionRequested, this);
+ evas_object_smart_callback_add(pWebNativeNode, "notification,show", OnNotificationShow, this);
+ evas_object_smart_callback_add(pWebNativeNode, "notification,cancel", OnNotificationCancel, this);
+
+ evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,registration,requested", OnProtocolHandlerRegistrationRequested, this);
+ evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,isregistered", OnIsProtocolHandlerRegistered, this);
+ evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,unregistration,requested", OnProtocolHandlerUnregistrationRequested, this);
+
+ evas_object_smart_callback_add(pWebNativeNode, "contenthandler,registration,requested", OnContentHandlerRegistrationRequested, this);
+ evas_object_smart_callback_add(pWebNativeNode, "contenthandler,isregistered", OnIsContentHandlerRegistered, this);
+ evas_object_smart_callback_add(pWebNativeNode, "contenthandler,unregistration,requested", OnContentHandlerUnregistrationRequested, this);
+ evas_object_smart_callback_add(pWebNativeNode, "text,found", OnTextFound, this);
+
+ evas_object_smart_callback_add(pWebNativeNode, "touchmove,handled", OnWebPreventDefaultTriggered, this);
+ evas_object_smart_callback_add(pWebNativeNode, "icon,received", OnFaviconReceived, this);
+
+ evas_object_smart_callback_add(pWebNativeNode, "magnifier,hide", OnWebPageBlockSelected, this);
+
+ evas_object_smart_callback_add(pWebNativeNode, "fullscreen,enterfullscreen", OnFullScreenEntered, this);
+ evas_object_smart_callback_add(pWebNativeNode, "fullscreen,exitfullscreen", OnFullScreenExited, this);
+
+ evas_object_smart_callback_add(pWebNativeNode, "keyevent,down,not,handled", OnFocusDownRequested, this);
+ evas_object_smart_callback_add(pWebNativeNode, "keyevent,up,not,handled", OnFocusUpRequested, this);
+
+ Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
+ SysAssertf(pContext, "Failed to get webkit instance.");
+ ewk_context_did_start_download_callback_set(pContext, OnDidStartDownloadCallback, const_cast< _WebImpl* >(this));
+ ewk_context_vibration_client_callbacks_set(pContext, OnVibrationRequested, OnVibrationCanceled, const_cast< _WebImpl* >(this));
+
+ ewk_view_application_cache_permission_callback_set(pWebNativeNode, OnApplicationCachePermissionRequested, const_cast< _WebImpl* >(this));
+ ewk_view_exceeded_indexed_database_quota_callback_set(pWebNativeNode, OnIndexedDatabaseQuotaExceeded, const_cast< _WebImpl* >(this));
+ ewk_view_exceeded_database_quota_callback_set(pWebNativeNode, OnDatabaseQuotaExceeded, const_cast< _WebImpl* >(this));
+ ewk_view_exceeded_local_file_system_quota_callback_set(pWebNativeNode, OnLocalFileSystemQuotaExceeded, const_cast< _WebImpl* >(this));
+
+ evas_object_event_callback_add(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained, this);
+ evas_object_event_callback_add(pWebNativeNode, EVAS_CALLBACK_FOCUS_OUT, OnWebNativeNodeFocusLost, this);
+ }
+}
+
+
+void
+_WebImpl::RemoveEventListenerCallback(void) const
+{
+ Evas_Object* pWebNativeNode = __pWebCore->GetWebNativeNode();
+ if (pWebNativeNode)
+ {
+ _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
+ SysAssertf(pEcoreEvas, "Failed to get Ui ecore evas");
+
+ Evas_Object* pWinObject = pEcoreEvas->GetWindowObject();
+ SysAssertf(pWinObject, "Failed to get Ui window evas object");
+
+ evas_object_smart_callback_del(pWebNativeNode, "create,window", OnWebWindowCreateRequested);
+ evas_object_smart_callback_del(pWebNativeNode, "close,window", OnWebWindowClosedRequested);
+
+ evas_object_smart_callback_del(pWebNativeNode, "policy,navigation,decide", OnLoadingRequested);
+ evas_object_smart_callback_del(pWebNativeNode, "load,started", OnLoadingStarted);
+ evas_object_smart_callback_del(pWebNativeNode, "load,finished", OnLoadingCompleted);
+ evas_object_smart_callback_del(pWebNativeNode, "load,progress", OnEstimatedProgress);
+ evas_object_smart_callback_del(pWebNativeNode, "load,progress,finished", OnProgressCompleted);
+ evas_object_smart_callback_del(pWebNativeNode, "load,stop", OnLoadingCanceled);
+ evas_object_smart_callback_del(pWebNativeNode, "load,error", OnLoadingErrorOccurred);
+ evas_object_smart_callback_del(pWebNativeNode, "title,changed", OnPageTitleReceived);
+ evas_object_smart_callback_del(pWebNativeNode, "load,committed", OnLoadingCommitted);
+
+ evas_object_smart_callback_del(pWebNativeNode, "requestToNative,json", OnHandleJavaScriptRequest);
+
+ evas_object_smart_callback_del_full(pWinObject, "focus,in", OnWindowObjectFocusGained, this);
+ evas_object_smart_callback_del_full(pWinObject, "focus,out", OnWindowObjectFocusLost, this);
+
+ evas_object_smart_callback_del(pWebNativeNode, "inputmethod,changed", OnWebKeypadStateChanged);
+ evas_object_smart_callback_del(pWebNativeNode, "editorclient,ime,opened", OnWebKeypadOpened);
+ evas_object_smart_callback_del(pWebNativeNode, "editorclient,ime,closed", OnWebKeypadClosed);
+
+ evas_object_smart_callback_del(pWebNativeNode, "authentication,challenge", OnHttpAuthenticationRequested);
+ evas_object_smart_callback_del(pWebNativeNode, "authentication,canceled", OnHttpAuthenticationCanceled);
+
+ evas_object_smart_callback_del(pWebNativeNode, "geolocation,permission,request", OnGeolocationPermissionRequested);
+
+ ewk_view_javascript_alert_callback_set(pWebNativeNode, null, null);
+ ewk_view_javascript_prompt_callback_set(pWebNativeNode, null, null);
+ ewk_view_javascript_confirm_callback_set(pWebNativeNode, null, null);
+ ewk_view_before_unload_confirm_panel_callback_set(pWebNativeNode, null, null);
+
+ evas_object_smart_callback_del(pWebNativeNode, "policy,response,decide", OnWebDataReceived);
+
+ evas_object_smart_callback_del(pWebNativeNode, "load,nonemptylayout,finished", OnWebPageShowRequested);
+ evas_object_smart_callback_del(pWebNativeNode, "request,certificate,confirm", OnCertificateRequested);
+ evas_object_smart_callback_del(pWebNativeNode, "usermedia,permission,request", OnGetUserMediaPermissionRequsted);
+
+ evas_object_smart_callback_del(pWebNativeNode, "notification,permission,request", OnNotificationPermissionRequested);
+ evas_object_smart_callback_del(pWebNativeNode, "notification,show", OnNotificationShow);
+ evas_object_smart_callback_del(pWebNativeNode, "notification,cancel", OnNotificationCancel);
+ evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,registration,requested", OnProtocolHandlerRegistrationRequested);
+ evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,isregistered", OnIsProtocolHandlerRegistered);
+ evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,unregistration,requested", OnProtocolHandlerUnregistrationRequested);
+
+ evas_object_smart_callback_del(pWebNativeNode, "contenthandler,registration,requested", OnContentHandlerRegistrationRequested);
+ evas_object_smart_callback_del(pWebNativeNode, "contenthandler,isregistered", OnIsContentHandlerRegistered);
+ evas_object_smart_callback_del(pWebNativeNode, "contenthandler,unregistration,requested", OnContentHandlerUnregistrationRequested);
+
+ evas_object_smart_callback_del(pWebNativeNode, "text,found", OnTextFound);
+
+ evas_object_smart_callback_del(pWebNativeNode, "touchmove,handled", OnWebPreventDefaultTriggered);
+ evas_object_smart_callback_del(pWebNativeNode, "icon,received", OnFaviconReceived);
+
+ evas_object_smart_callback_del(pWebNativeNode, "magnifier,hide", OnWebPageBlockSelected);
+
+ evas_object_smart_callback_del(pWebNativeNode, "fullscreen,enterfullscreen", OnFullScreenEntered);
+ evas_object_smart_callback_del(pWebNativeNode, "fullscreen,exitfullscreen", OnFullScreenExited);
+
+ evas_object_smart_callback_del(pWebNativeNode, "keyevent,down,not,handled", OnFocusDownRequested);
+ evas_object_smart_callback_del(pWebNativeNode, "keyevent,up,not,handled", OnFocusUpRequested);
+
+ Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
+ SysAssertf(pContext, "Failed to get webkit instance.");
+ ewk_context_vibration_client_callbacks_set(pContext, null, null, null);
+
+ ewk_view_application_cache_permission_callback_set(pWebNativeNode, null, null);
+ ewk_view_exceeded_indexed_database_quota_callback_set(pWebNativeNode, null, null);
+ ewk_view_exceeded_database_quota_callback_set(pWebNativeNode, null, null);
+ ewk_view_exceeded_local_file_system_quota_callback_set(pWebNativeNode, null, null);
+
+ evas_object_event_callback_del(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained);
+ evas_object_event_callback_del(pWebNativeNode, EVAS_CALLBACK_FOCUS_OUT, OnWebNativeNodeFocusLost);
+ }
+}
+
+
+result
+_WebImpl::SetBlockSelectionPosition(const Point& startPoint)
+{
+ return SetBlockSelectionPosition(_CoordinateSystemUtils::ConvertToFloat(startPoint));
+}
+
+
+result
+_WebImpl::SetBlockSelectionPosition(const FloatPoint& startPoint)
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return E_SUCCESS;
+ }
+
+ Ewk_View_Smart_Data* pSmartData = reinterpret_cast< Ewk_View_Smart_Data* >(evas_object_smart_data_get(pWebview));
+ SysAssertf(pSmartData && pSmartData->api, "Failed to get webkit instance.");
+ Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(startPoint)));
+
+ Eina_Bool ret = pSmartData->api->text_selection_down(pSmartData, absPoint.x, absPoint.y);
+ if (ret)
+ {
+ pSmartData->api->text_selection_up(pSmartData, absPoint.x, absPoint.y);
+
+ Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pWebview, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
+ SysTryReturnResult(NID_WEB_CTRL, pEwkHitTest, E_SYSTEM, "Failed to get hit test.");
+
+ String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
+
+ Eina_Hash* pAttrHash = ewk_hit_test_attribute_hash_get(pEwkHitTest);
+ char* pValue = reinterpret_cast< char* >(eina_hash_find(pAttrHash, "contenteditable"));
+ if (tagName.Equals(L"INPUT", false) || tagName.Equals(L"TEXTAREA", false) || pValue)
+ {
+ ewk_view_command_execute(pWebview, "SelectWord", null);
+ evas_object_smart_callback_call(pWebview, "magnifier,hide", NULL);
+ }
+ }
+
+ SysTryReturnResult(NID_WEB_CTRL, GetTextFromBlock().GetLength() > 0, E_INVALID_ARG, "Failed to set text selection up.");
+
+ return E_SUCCESS;
+}
+
+
+void
+_WebImpl::ReleaseBlock(void)
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return;
+ }
+
+ ewk_view_text_selection_range_clear(pWebview);
+}
+
+
+void
+_WebImpl::GetBlockRange(Point& startPoint, Point& endPoint) const
+{
+ FloatPoint tempStartPoint;
+ FloatPoint tempEndPoint;
+
+ GetBlockRange(tempStartPoint, tempEndPoint);
+
+ startPoint = _CoordinateSystemUtils::ConvertToInteger(tempStartPoint);
+ endPoint = _CoordinateSystemUtils::ConvertToInteger(tempEndPoint);
+}
+
+
+void
+_WebImpl::GetBlockRange(FloatPoint& startPoint, FloatPoint& endPoint) const
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ startPoint.x = startPoint.y = endPoint.x = endPoint.y = 0.0f;
+
+ }
+
+ Eina_Rectangle leftHandle;
+ Eina_Rectangle rightHandle;
+
+ EINA_RECTANGLE_SET(&leftHandle, 0, 0, 0, 0);
+ EINA_RECTANGLE_SET(&rightHandle, 0, 0, 0, 0);
+
+ ewk_view_text_selection_range_get(__pWebCore->GetWebNativeNode(), &leftHandle, &rightHandle);
+
+ startPoint.x = _CoordinateSystemUtils::ConvertToFloat(leftHandle.x);
+ startPoint.y = _CoordinateSystemUtils::ConvertToFloat(leftHandle.y);
+ endPoint.x = _CoordinateSystemUtils::ConvertToFloat(rightHandle.x + rightHandle.w);
+ endPoint.y = _CoordinateSystemUtils::ConvertToFloat(rightHandle.y + rightHandle.h);
+
+ if ((endPoint.x != 0.0f) && (endPoint.y != 0.0f))
+ {
+ startPoint = __pWebCore->GetRelativeCoordinate(startPoint);
+ endPoint = __pWebCore->GetRelativeCoordinate(endPoint);
+ }
+}
+
+
+Bitmap*
+_WebImpl::GetFaviconN(void) const
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return null;
+ }
+
+ result r = E_SUCCESS;
+
+ Ewk_Context* pContext = ewk_view_context_get(pWebview);
+ const char* pUrl = ewk_view_url_get(pWebview);
+ Evas* pEvas = evas_object_evas_get(pWebview);
+
+ Evas_Object* pFavicon = ewk_context_icon_database_icon_object_add(pContext, pUrl, pEvas);
+ if (!pFavicon)
+ {
+ return null;
+ }
+
+ Tizen::Graphics::BufferInfo bufferInfo;
+
+ r = _Utility::GetPixelBufferFromEvasObject(pFavicon, bufferInfo);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ const Dimension dimension(bufferInfo.width, bufferInfo.height);
+ Tizen::Base::ByteBuffer byteBuffer;
+
+ r = byteBuffer.Construct((byte*)bufferInfo.pPixels, 0, dimension.height * dimension.width * 32, dimension.height * dimension.width * 32 );
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ std::unique_ptr<Bitmap> pImage(new (std::nothrow) Bitmap());
+ SysTryReturn(NID_WEB_CTRL, pImage.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pImage->Construct(byteBuffer, dimension, BITMAP_PIXEL_FORMAT_ARGB8888);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return pImage.release();
+
+}
+
+
+void
+_WebImpl::ScrollBy(const Tizen::Graphics::Point& diff)
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return;
+ }
+
+ ewk_view_scroll_by(pWebview, diff.x, diff.y);
+}
+
+
+void
+_WebImpl::ScrollTo(const Tizen::Graphics::Point& dest)
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return;
+ }
+
+ ewk_view_scroll_set(pWebview, dest.x, dest.y);
+}
+
+
+Point
+_WebImpl::GetScrollPosition(void) const
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return Point(0, 0);
+ }
+
+ Point position;
+
+ ewk_view_scroll_pos_get(pWebview, &position.x, &position.y);
+
+ return position;
+}
+
+
+Dimension
+_WebImpl::GetPageSize(void) const
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return Dimension(0, 0);
+ }
+
+ Evas_Coord width = 0;
+ Evas_Coord height = 0;
+
+ ewk_view_contents_size_get(pWebview, &width, &height);
+
+ Dimension size(static_cast< int >(width), static_cast< int >(height));
+
+ return size;
+}
+
+
+void
+_WebImpl::SetLoadingErrorOccurred(bool arg)
+{
+ __isLoadingErrorOccurred = arg;
+}
+
+
+bool
+_WebImpl::IsLoadingErrorOccurred(void) const
+{
+ return __isLoadingErrorOccurred;
+}
+
+
+void
+_WebImpl::SetRedirectRequested(bool arg)
+{
+ __isRedirectRequested = arg;
+}
+
+
+bool
+_WebImpl::IsRedirectRequested(void) const
+{
+ return __isRedirectRequested;
+}
+
+
+void
+_WebImpl::SetPolicyDecision(DecisionPolicy policy)
+{
+ __policy = policy;
+}
+
+
+DecisionPolicy
+_WebImpl::GetPolicyDecision(void) const
+{
+ return __policy;
+}
+
+
+void
+_WebImpl::SetCertificateRequested(bool arg)
+{
+ __isCertificateRequested = arg;
+}
+
+
+bool
+_WebImpl::IsCertificateRequested(void) const
+{
+ return __isCertificateRequested;
+}
+
+
+void
+_WebImpl::SetCertificateConfirmed(bool arg)
+{
+ __isCertificateConfirmed = arg;
+}
+
+
+bool
+_WebImpl::IsCertificateConfirmed(void) const
+{
+ return __isCertificateConfirmed;
+}
+
+
+result
+_WebImpl::SetFullScreenKeypad(void)
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return E_SUCCESS;
+ }
+
+ result r = E_SUCCESS;
+
+ std::unique_ptr<Keypad> pKeypad(new (std::nothrow) Keypad());
+ SysTryReturnResult(NID_WEB_CTRL, pKeypad.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ r = pKeypad->Construct(KEYPAD_STYLE_NORMAL, 100);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(__pWebCore->GetTouchPosition())));
+
+ Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pWebview, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
+ SysTryReturnResult(NID_WEB_CTRL, pEwkHitTest, E_SYSTEM, "Failed to get hit test.");
+
+ String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
+ if (tagName.Equals(L"INPUT", false))
+ {
+ String text(ewk_view_focused_input_element_value_get(pWebview));
+ pKeypad->SetText(text);
+ }
+ else
+ {
+ String* pText = EvaluateJavascriptN(L"document.activeElement.value");
+ SysTryReturnResult(NID_WEB_CTRL, pText, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ pKeypad->SetText(*pText);
+ }
+
+ r = pKeypad->SetShowState(true);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pKeypad->Show();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pKeypad->AddTextEventListener(*this);
+
+ __pKeypad = std::move(pKeypad);
+
+ return E_SUCCESS;
+}
+
+
+void
+_WebImpl::RemoveFullScreenKeypad(void)
+{
+ __pKeypad->RemoveTextEventListener(*this);
+
+ __pKeypad.reset();
+}
+
+
+bool
+_WebImpl::IsFooterVisible(void) const
+{
+ return __isFooterVisible;
+}
+
+
+void
+_WebImpl::SetFooterVisibleState(bool isFooterVisible)
+{
+ __isFooterVisible = isFooterVisible;
+}
+
+
+bool
+_WebImpl::IsKeypadVisible(void) const
+{
+ return __isKeypadVisible;
+}
+
+
+void
+_WebImpl::SetKeypadVisibleState(bool isKeypadVisible)
+{
+ __isKeypadVisible = isKeypadVisible;
+}
+
+
+bool
+_WebImpl::IsKeypadOpened(void) const
+{
+ return __isKeypadOpened;
+}
+
+void
+_WebImpl::SetKeypadOpened(bool isKeypadOpened)
+{
+ __isKeypadOpened = isKeypadOpened;
+}
+
+
+bool
+_WebImpl::IsWinFocusLost(void) const
+{
+ return __isWinFocusLost;
+}
+
+
+void
+_WebImpl::SetWinFocusLost(bool isWinFocusLost)
+{
+ __isWinFocusLost = isWinFocusLost;
+}
+
+
+Rectangle
+_WebImpl::GetPreviousKeypadBounds(void) const
+{
+ return __keypadBounds;
+}
+
+
+void
+_WebImpl::SetPreviousKeypadBounds(Rectangle& bounds)
+{
+ __keypadBounds = bounds;
+}
+
+
+void
+_WebImpl::OnTextValueChangeCanceled(const Control& source)
+{
+ RemoveFullScreenKeypad();
+}
+
+
+void
+_WebImpl::OnTextValueChanged(const Control& source)
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return;
+ }
+
+ std::unique_ptr<char[]> pText(_StringConverter::CopyToCharArrayN(__pKeypad->GetText()));
+ SysTryReturnVoidResult(NID_WEB_CTRL, pText.get(), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+
+ Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(__pWebCore->GetTouchPosition())));
+
+ Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pWebview, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
+ SysTryReturnVoidResult(NID_WEB_CTRL, pEwkHitTest, E_SYSTEM, "[E_SYSTEM] Failed to get hit test.");
+
+ String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
+ if (tagName.Equals(L"INPUT", false))
+ {
+ ewk_view_focused_input_element_value_set(__pWebCore->GetWebNativeNode(), pText.get());
+ }
+ else
+ {
+ ewk_view_command_execute(pWebview, "SelectAll", null);
+ ewk_view_command_execute(pWebview, "Delete", null);
+ ewk_view_command_execute(pWebview, "InsertText", pText.get());
+ }
+
+ RemoveFullScreenKeypad();
+}
+
+
+result
+_WebImpl::OnHandleJavaScriptRequestByEventArg(const IEventArg& arg)
+{
+ const _JsBridgeArg* pEventArg = dynamic_cast< const _JsBridgeArg* >(&arg);
+ SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. arg is not _JsBridgeArg object.");
+
+ std::unique_ptr<IJsonValue> pJsonValue(JsonParser::ParseN(*(pEventArg->GetJsonData())));
+ SysTryReturn(NID_WEB_JSON, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ IJavaScriptBridge* pJsInterface = FindJsInterface(pJsonValue.get());
+ SysTryReturnResult(NID_WEB_CTRL, pJsInterface, E_OBJ_NOT_FOUND, "JsInterface instance is not available.");
+
+ pJsInterface->HandleJavaScriptRequestN(pJsonValue.release());
+
+ return E_SUCCESS;
+}
+
+
+result
+_WebImpl::OnHandleLoadingEvent(const IEventArg& arg)
+{
+ result r = E_SUCCESS;
+
+ const _LoadingEventArg* pEventArg = dynamic_cast< const _LoadingEventArg* >(&arg);
+ SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
+
+ SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
+
+ ILoadingListener* pLoadingListner = GetLoadingListener();
+ SysTryReturnResult(NID_WEB_CTRL, pLoadingListner, E_SYSTEM, "A system error has been occurred. Loading listener was not set or null.");
+
+ switch (pEventArg->GetEventType())
+ {
+ case WEB_EVENT_LOADINGLISTENER_STARTED:
+ {
+ pLoadingListner->OnLoadingStarted();
+ break;
+ }
+
+ case WEB_EVENT_LOADINGLISTENER_PROGRESS:
+ {
+ const Integer* pProgressPercentage = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_LoadingEventArg::ESTIMATED_PROGRESS));
+ SysTryReturn(NID_WEB_CTRL, pProgressPercentage, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ pLoadingListner->OnEstimatedProgress(pProgressPercentage->ToInt());
+ break;
+ }
+
+ case WEB_EVENT_LOADINGLISTENER_PAGETITLE_RECEIVED:
+ {
+ const String* pPageTitle = dynamic_cast< const String* >(pEventArg->GetEventInfo(_LoadingEventArg::PAGE_TITLE));
+ SysTryReturn(NID_WEB_CTRL, pPageTitle, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ pLoadingListner->OnPageTitleReceived(*pPageTitle);
+ break;
+ }
+
+ case WEB_EVENT_LOADINGLISTENER_CANCELED:
+ {
+ pLoadingListner->OnLoadingCanceled();
+ break;
+ }
+
+ case WEB_EVENT_LOADINGLISTENER_ERROR_OCCURRED:
+ {
+ const Integer* pErrorType = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_LoadingEventArg::ERROR_TYPE));
+ SysTryReturn(NID_WEB_CTRL, pErrorType, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ const String* pErrorMessage = dynamic_cast< const String* >(pEventArg->GetEventInfo(_LoadingEventArg::ERROR_MESSAGE));
+ SysTryReturn(NID_WEB_CTRL, pErrorMessage, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ LoadingErrorType errorType = ConvertErrorCode(pErrorType->ToInt());
+
+ pLoadingListner->OnLoadingErrorOccurred(errorType, *pErrorMessage);
+ break;
+ }
+
+ case WEB_EVENT_LOADINGLISTENER_COMPLETED:
+ {
+ pLoadingListner->OnLoadingCompleted();
+ break;
+ }
+
+ case WEB_EVENT_LOADINGLISTENER_AUTHENTICATION_CANCELED:
+ {
+ pLoadingListner->OnHttpAuthenticationCanceled();
+ break;
+ }
+
+ case WEB_EVENT_LOADINGLISTENER_FAVICON_RECEIVED:
+ {
+ std::unique_ptr<Bitmap> pFavicon(GetFaviconN());
+ SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ if (pFavicon.get())
+ {
+ pLoadingListner->OnFaviconReceived(*pFavicon.get());
+ }
+ break;
+ }
+
+ default:
+ {
+ SysAssert(false);
+ }
+ }
+
+ return r;
+}
+
+
+result
+_WebImpl::OnHandleWebDownloadEvent(const IEventArg& arg)
+{
+ result r = E_SUCCESS;
+
+ const _WebDownloadEventArg* pEventArg = dynamic_cast< const _WebDownloadEventArg* >(&arg);
+ SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
+
+ SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
+
+ IWebDownloadListener* pWebDownloadListener = __pWebDownloadHandler->GetDownloadListener();
+ SysTryReturnResult(NID_WEB_CTRL, pWebDownloadListener, E_SYSTEM, "A system error has been occurred. Web Downloading listener was not set or null.");
+
+ switch (pEventArg->GetEventType())
+ {
+ case WEB_EVENT_WEBDOWNLOADLISTENER_DATA_RECEIVED:
+ {
+ const ByteBuffer* pChunk = dynamic_cast< const ByteBuffer* >(pEventArg->GetEventInfo(_WebDownloadEventArg::CHUNKED_DATA));
+ SysTryReturn(NID_WEB_CTRL, pChunk, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ pWebDownloadListener->OnWebChunkedDataReceived(*pChunk);
+ break;
+ }
+
+ case WEB_EVENT_WEBDOWNLOADLISTENER_COMPLETED:
+ {
+ pWebDownloadListener->OnWebDataDownloadCompleted();
+ break;
+ }
+
+ case WEB_EVENT_WEBDOWNLOADLISTENER_FAILED:
+ {
+ const Integer* pErrorType = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_WebDownloadEventArg::ERROR_TYPE));
+ SysTryReturn(NID_WEB_CTRL, pErrorType, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ LoadingErrorType errorType = static_cast < LoadingErrorType >(pErrorType->ToInt());
+
+ pWebDownloadListener->OnWebDownloadFailed(errorType);
+ break;
+ }
+
+ default:
+ {
+ SysAssert(false);
+ }
+ }
+
+ return r;
+}
+
+
+result
+_WebImpl::OnHandleWebUiEvent(const IEventArg& arg)
+{
+ const _WebUiEventArg* pEventArg = dynamic_cast< const _WebUiEventArg* >(&arg);
+ SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
+
+ SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
+
+ SysTryReturnResult(NID_WEB_CTRL, __pUserUiListener, E_SYSTEM, "A system error has been occurred. Web UI listener was not set or null.");
+
+ switch (pEventArg->GetEventType())
+ {
+ case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED:
+ {
+ Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
+
+ Point* pStartPoint = const_cast< Point* >(dynamic_cast< const Point* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_START)));
+ SysTryReturn(NID_WEB_CTRL, pStartPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ Point* pEndPoint = const_cast< Point* >(dynamic_cast< const Point* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_END)));
+ SysTryReturn(NID_WEB_CTRL, pEndPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ __pUserUiListener->OnWebPageBlockSelected(*pWeb, *pStartPoint, *pEndPoint);
+ break;
+ }
+
+ case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED:
+ {
+ Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
+
+ __pUserUiListener->OnWebPageShowRequested(*pWeb);
+ break;
+ }
+
+ case WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED:
+ {
+ Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
+
+ __pUserUiListener->OnWebWindowCloseRequested(*pWeb);
+ break;
+ }
+
+ case WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED:
+ {
+ Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
+
+ Boolean* pTrigger = const_cast< Boolean* >(dynamic_cast< const Boolean* >(pEventArg->GetEventInfo(_WebUiEventArg::PREVENT_DEFAULT)));
+ SysTryReturn(NID_WEB_CTRL, pTrigger, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ __pUserUiListener->OnWebPreventDefaultTriggered(*pWeb, pTrigger->ToBool());
+ break;
+ }
+
+ default:
+ {
+ SysAssert(false);
+ }
+ }
+
+ return E_SUCCESS;
+}
+
+
+result
+_WebImpl::OnHandleWebUiEventF(const IEventArg& arg)
+{
+ const _WebUiEventArg* pEventArg = dynamic_cast< const _WebUiEventArg* >(&arg);
+ SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
+
+ SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
+
+ SysTryReturnResult(NID_WEB_CTRL, __pUserUiListenerF, E_SYSTEM, "A system error has been occurred. Web UI listener was not set or null.");
+
+ switch (pEventArg->GetEventType())
+ {
+ case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED_FLOAT:
+ {
+ Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
+
+ FloatPoint* pStartPoint = const_cast< FloatPoint* >(dynamic_cast< const FloatPoint* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_START)));
+ SysTryReturn(NID_WEB_CTRL, pStartPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ FloatPoint* pEndPoint = const_cast< FloatPoint* >(dynamic_cast< const FloatPoint* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_END)));
+ SysTryReturn(NID_WEB_CTRL, pEndPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ __pUserUiListenerF->OnWebPageBlockSelected(*pWeb, *pStartPoint, *pEndPoint);
+ break;
+ }
+
+ case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED_FLOAT:
+ {
+ Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
+
+ __pUserUiListenerF->OnWebPageShowRequested(*pWeb);
+ break;
+ }
+
+ case WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED_FLOAT:
+ {
+ Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
+
+ __pUserUiListenerF->OnWebWindowCloseRequested(*pWeb);
+ break;
+ }
+
+ case WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED_FLOAT:
+ {
+ Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
+
+ Boolean* pTrigger = const_cast< Boolean* >(dynamic_cast< const Boolean* >(pEventArg->GetEventInfo(_WebUiEventArg::PREVENT_DEFAULT)));
+ SysTryReturn(NID_WEB_CTRL, pTrigger, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ __pUserUiListenerF->OnWebPreventDefaultTriggered(*pWeb, pTrigger->ToBool());
+ break;
+ }
+
+ default:
+ {
+ SysAssert(false);
+ }
+ }
+
+ return E_SUCCESS;
+}
+
+
+result
+_WebImpl::OnHandleTextSearchEvent(const IEventArg& arg)
+{
+ result r = E_SUCCESS;
+
+ const _TextSearchEventArg* pEventArg = dynamic_cast< const _TextSearchEventArg* >(&arg);
+ SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
+
+ SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
+
+ ITextSearchListener* pTextSearchListner = GetTextSearchListener();
+ SysTryReturnResult(NID_WEB_CTRL, pTextSearchListner, E_SYSTEM, "A system error has been occurred. Web text search listener was not set or null.");
+
+ switch (pEventArg->GetEventType())
+ {
+ case WEB_EVENT_TEXTSEARCHLISTENER_TEXT_FOUND:
+ {
+ Integer* pTotalCount= dynamic_cast< Integer* >(const_cast< Object* >(pEventArg->GetEventInfo(_TextSearchEventArg::TOTAL_COUNT)));
+ SysTryReturn(NID_WEB_CTRL, pTotalCount, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ Integer* pCurrentOrdinal = dynamic_cast< Integer* >(const_cast< Object* >(pEventArg->GetEventInfo(_TextSearchEventArg::CURRENT_ORDINAL)));
+ SysTryReturn(NID_WEB_CTRL, pCurrentOrdinal, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ pTextSearchListner->OnTextFound(pTotalCount->ToInt(), pCurrentOrdinal->ToInt());
+ break;
+ }
+
+ default:
+ {
+ SysAssert(false);
+ }
+ }
+
+ return r;
+}
+
+
+result
+_WebImpl::VibrationRequested(uint64_t duration)
+{
+ result r = E_SUCCESS;
+
+ __pVibrator.reset();
+
+ std::unique_ptr<Vibrator> pVibrator(new (std::nothrow) Vibrator());
+ SysTryReturnResult(NID_WEB_CTRL, pVibrator.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ r = pVibrator->Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pVibrator = std::move(pVibrator);
+
+ IntensityDurationVibrationPattern pattern = {static_cast< int >(duration), -1};
+
+ r = __pVibrator->Start(&pattern, 1);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return E_SUCCESS;
+}
+
+
+void
+_WebImpl::VibrationCanceled(void)
+{
+ __pVibrator.reset();
+}
+
+
+result
+_WebImpl::HttpAuthenticationRequested(Ewk_Auth_Challenge* pChallenge)
+{
+ result r = E_SUCCESS;
+
+ String host(ewk_auth_challenge_url_get(pChallenge));
+ String realm(ewk_auth_challenge_realm_get(pChallenge));
+
+ std::unique_ptr<AuthenticationChallenge> pAuthChallenge(new (std::nothrow) AuthenticationChallenge());
+ SysTryReturnResult(NID_WEB_CTRL, pAuthChallenge, E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ _AuthenticationChallengeImpl* pAuthImpl = _AuthenticationChallengeImpl::GetInstance(pAuthChallenge.get());
+ SysTryReturn(NID_WEB_CTRL, pAuthImpl, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ pAuthImpl->SetAuthenticationChallengeHandler(pChallenge);
+ pAuthImpl->SetWebEvasObject(__pWebCore->GetWebNativeNode());
+
+ __pAuthChallenge = std::move(pAuthChallenge);
+
+ ewk_auth_challenge_suspend(pChallenge);
+ if (__pUserLoadingListener && __pUserLoadingListener->OnHttpAuthenticationRequestedN(host, realm, *__pAuthChallenge.get()))
+ {
+ __pAuthChallenge.release();
+ }
+ else
+ {
+ r = ShowAuthenticationPopup(host, realm, __pAuthChallenge.get());
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+
+ return E_SUCCESS;
+}
+
+
+result
+_WebImpl::ShowAuthenticationPopup(const String& host, const String& realm, AuthenticationChallenge* pAuthChallenge)
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr<_AuthConfirmPopup> pAuthPopup(new (std::nothrow) _AuthConfirmPopup());
+ SysTryReturnResult(NID_WEB_CTRL, pAuthPopup, E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ r = pAuthPopup->Construct(host, realm, this);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pAuthPopup = std::move(pAuthPopup);
+
+ r = __pAuthPopup->ShowPopup();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return E_SUCCESS;
+}
+
+
+result
+_WebImpl::ShowCertificateConfirmPopup(_CertificatePopupMode userConfirmMode, Ewk_Certificate_Policy_Decision* pPolicy)
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr<_CertificateConfirmPopup> pCertConfirmPopup(new (std::nothrow) _CertificateConfirmPopup());
+ SysTryReturnResult(NID_WEB_CTRL, pCertConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ r = pCertConfirmPopup->Construct(userConfirmMode, pPolicy);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pCertConfirmPopup = std::move(pCertConfirmPopup);
+
+ int modalResult = 0;
+
+ r = __pCertConfirmPopup->ShowAndWait(modalResult);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ if (__pCertConfirmPopup.get() && userConfirmMode == CERTIFICATE_POPUP_MODE_USER_CONFIRM)
+ {
+ __isCertificateConfirmed = __pCertConfirmPopup->GetConfirmResult();
+ }
+
+CATCH:
+ if (__pCertConfirmPopup.get())
+ {
+ __pCertConfirmPopup.reset();
+ }
+
+ return r;
+}
+
+
+result
+_WebImpl::ShowPromptPopup(String msg, String defVal)
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr< _PromptPopup > pPromptPopup(new (std::nothrow) _PromptPopup());
+ SysTryReturnResult(NID_WEB_CTRL, pPromptPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ r = pPromptPopup->Construct(msg, defVal, __pWebCore->GetWebNativeNode(), this);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pPromptPopup = std::move(pPromptPopup);
+
+ r = __pPromptPopup->ShowPopup();
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return E_SUCCESS;
+
+CATCH:
+ __pPromptPopup.reset();
+
+ return r;
+
+}
+
+
+result
+_WebImpl::ShowUserConfirmPopup(_UserConfirmMode userConfirmMode, void* pPolicy, String msg)
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr<_UserConfirmPopup> pUserConfirmPopup(new (std::nothrow) _UserConfirmPopup());
+ SysTryReturnResult(NID_WEB_CTRL, pUserConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, this, true, msg);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ int modalResult = 0;
+
+ switch(userConfirmMode)
+ {
+ case USER_CONTENT_HANDLER:
+ {
+ __pContentHandlerConfirmPopup = std::move(pUserConfirmPopup);
+
+ r = __pContentHandlerConfirmPopup->ShowAndWait(modalResult);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pContentHandlerConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pContentHandlerConfirmPopup.reset();
+
+ ewk_view_resume(__pWebCore->GetWebNativeNode());
+
+ break;
+ }
+ case USER_PROTOCOL_HANDLER:
+ {
+ __pProtocolHandlerConfirmPopup = std::move(pUserConfirmPopup);
+
+ r = __pProtocolHandlerConfirmPopup->ShowAndWait(modalResult);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pProtocolHandlerConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pProtocolHandlerConfirmPopup.reset();
+
+ ewk_view_resume(__pWebCore->GetWebNativeNode());
+
+ break;
+ }
+ case USER_CONFIRM_APP_CACHE:
+ {
+ __pAppCacheConfirmPopup = std::move(pUserConfirmPopup);
+
+ r = __pAppCacheConfirmPopup->ShowAndWait(modalResult);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pAppCacheConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pAppCacheConfirmPopup.reset();
+
+ ewk_view_resume(__pWebCore->GetWebNativeNode());
+
+ break;
+ }
+ case USER_CONFIRM_DB_QUOTA_EXCEDED:
+ {
+ __pDbQuotaConfirmPopup = std::move(pUserConfirmPopup);
+
+ r = __pDbQuotaConfirmPopup->ShowAndWait(modalResult);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pDbQuotaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pDbQuotaConfirmPopup.reset();
+
+ ewk_view_resume(__pWebCore->GetWebNativeNode());
+
+ break;
+ }
+ case USER_CONFIRM_LOCAL_FS_QUOTA_EXCEDED:
+ {
+ __pLocalFsQuotaConfirmPopup = std::move(pUserConfirmPopup);
+
+ r = __pLocalFsQuotaConfirmPopup->ShowAndWait(modalResult);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pLocalFsQuotaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pLocalFsQuotaConfirmPopup.reset();
+
+ ewk_view_resume(__pWebCore->GetWebNativeNode());
+
+ break;
+ }
+ case USER_CONFIRM_INDEXED_DB_QUOTA_EXCEDED:
+ {
+ __pIndexedDbQuotaConfirmPopup = std::move(pUserConfirmPopup);
+
+ r = __pIndexedDbQuotaConfirmPopup->ShowAndWait(modalResult);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pIndexedDbQuotaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pIndexedDbQuotaConfirmPopup.reset();
+
+ ewk_view_resume(__pWebCore->GetWebNativeNode());
+
+ break;
+ }
+ default:
+ break;
+ }
+CATCH:
+ return r;
+}
+
+
+result
+_WebImpl::ShowUserConfirmPopupAsync(_UserConfirmMode userConfirmMode, void* pPolicy, String msg)
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr<_UserConfirmPopup> pUserConfirmPopup(new (std::nothrow) _UserConfirmPopup());
+ SysTryReturnResult(NID_WEB_CTRL, pUserConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, this, false, msg);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ switch(userConfirmMode)
+ {
+ case USER_CONFIRM_USERMEDIA:
+ {
+ __pUserMediaConfirmPopup.reset();
+
+ __pUserMediaConfirmPopup = std::move(pUserConfirmPopup);
+
+ r = __pUserMediaConfirmPopup->ShowPopup();
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pUserMediaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ break;
+ }
+ case USER_CONFIRM_GEOLOCATION:
+ {
+ __pGeolocationConfirmPopup.reset();
+
+ __pGeolocationConfirmPopup = std::move(pUserConfirmPopup);
+
+ r = __pGeolocationConfirmPopup->ShowPopup();
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pGeolocationConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ break;
+ }
+ case USER_CONFIRM_NOTIFICATION:
+ {
+ __pNotificationConfirmPopup.reset();
+
+ __pNotificationConfirmPopup = std::move(pUserConfirmPopup);
+
+ r = __pNotificationConfirmPopup->ShowPopup();
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pNotificationConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ break;
+ }
+ case USER_SCRIPT_ALERT:
+ {
+ __pScriptAlertConfirmPopup.reset();
+
+ __pScriptAlertConfirmPopup = std::move(pUserConfirmPopup);
+
+ r = __pScriptAlertConfirmPopup->ShowPopup();
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pScriptAlertConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ break;
+ }
+ case USER_SCRIPT_CONFIRM:
+ {
+ __pScriptConfirmPopup.reset();
+
+ __pScriptConfirmPopup = std::move(pUserConfirmPopup);
+
+ r = __pScriptConfirmPopup->ShowPopup();
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pScriptConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ break;
+ }
+ case USER_BEFORE_UNLOAD_CONFIRM:
+ {
+ __pBeforeUnloadConfirmPopup.reset();
+
+ __pBeforeUnloadConfirmPopup = std::move(pUserConfirmPopup);
+
+ r = __pBeforeUnloadConfirmPopup->ShowPopup();
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pBeforeUnloadConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ break;
+ }
+ default:
+ break;
+ }
+
+ return E_SUCCESS;
+
+CATCH:
+ return r;
+}
+
+
+_FormImpl*
+_WebImpl::GetParentFormImpl(_ControlImpl* pControlImpl)
+{
+ String parentName;
+ _FormImpl* pFormImpl = null;
+
+ _ControlImpl* pParentControlImpl = dynamic_cast< _ControlImpl* >(pControlImpl->GetParent());
+ if (!pParentControlImpl)
+ {
+ return null;
+ }
+
+ pFormImpl = dynamic_cast< _FormImpl* >(pParentControlImpl);
+ if (pFormImpl)
+ {
+ return pFormImpl;
+ }
+
+ return GetParentFormImpl(pParentControlImpl);
+}
+
+
+bool
+_WebImpl::OnFocusGained(const _ControlImpl& source)
+{
+ return false;
+}
+
+
+bool
+_WebImpl::OnFocusLost(const _ControlImpl& source)
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return false;
+ }
+
+ if(IsKeypadVisible() == true)
+ {
+ SetKeypadOpened(true);
+ }
+
+ return false;
+}
+
+
+bool
+_WebImpl::HasValidNativeNode(void) const
+{
+ if (__pWebCore && __pWebCore->GetWebNativeNode())
+ {
+ return true;
+ }
+
+ return false;
+}
+
+
+result
+_WebImpl::OnPreAttachedToMainTree(void)
+{
+ result r = E_SUCCESS;
+
+ r = _ContainerImpl::OnPreAttachedToMainTree();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ if (!HasValidNativeNode())
+ {
+ r = __pWebCore->InitializeWebNativeNode();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ _ControlManager* pControlManager = _ControlManager::GetInstance();
+ SysTryReturnResult(NID_WEB_CTRL, pControlManager, E_SYSTEM, "Failed to get the _ControlManager instance.");
+ OnChangeLayout(pControlManager->GetScreenRotation());
+
+ r = InitializeSetting();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ _SettingInfoImpl::AddSettingEventListener(*this);
+
+ _WebManager* pWebManager = _WebManager::GetInstance();
+ SysTryReturnResult(NID_WEB_CTRL, pWebManager, E_SYSTEM, "Failed to get the _WebManager instance.");
+ pWebManager->AddWeb(reinterpret_cast< int >(this));
+ }
+
+ if (IsVisible() == true)
+ {
+ _WebManager* pWebManager = _WebManager::GetInstance();
+ SysTryReturnResult(NID_WEB_CTRL, pWebManager, E_SYSTEM, "Failed to get the _WebManager instance.");
+ pWebManager->SetActiveWeb(this);
+ }
+
+ return E_SUCCESS;
+}
+
+
+result
+_WebImpl::OnDetachingFromMainTree(void)
+{
+ result r = E_SUCCESS;
+
+ r = _ContainerImpl::OnDetachingFromMainTree();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ _WebManager* pWebManager = _WebManager::GetInstance();
+ SysTryReturnResult(NID_WEB_CTRL, pWebManager, E_SYSTEM, "Failed to get the _WebManager instance.");
+ pWebManager->RemoveActiveWeb(this);
+
+ return E_SUCCESS;
+}
+
+
+void
+_WebImpl::OnSettingChanged(String& key)
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return;
+ }
+
+ if (key == L"http://tizen.org/setting/font.type")
+ {
+ ewk_view_use_settings_font(pWebview);
+ }
+}
+
+
+void
+_WebImpl::OnChangeLayout(_ControlRotation rotation)
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return;
+ }
+
+ int degree = 0;
+
+ switch (rotation)
+ {
+ case _CONTROL_ROTATION_0:
+ degree = 0;
+ break;
+ case _CONTROL_ROTATION_90:
+ degree = -90;
+ break;
+ case _CONTROL_ROTATION_180:
+ degree = 180;
+ break;
+ case _CONTROL_ROTATION_270:
+ degree = 90;
+ break;
+ default:
+ SysAssert(false);
+ }
+ ewk_view_orientation_send(pWebview, degree);
+}
+
+
+void
+_WebImpl::OnChangeLayout(_ControlOrientation orientation)
+{
+ _ContainerImpl::OnChangeLayout(orientation);
+
+ if (__pColorPicker.get())
+ {
+ __pColorPicker->ChangeLayout(orientation);
+ }
+
+ HideFormDataWindow();
+
+ std::unique_ptr< IEnumerator > pEnum(__webNotificationList.GetEnumeratorN());
+ _WebNotification* pWebNotification = null;
+
+ while (pEnum->MoveNext() == E_SUCCESS)
+ {
+ pWebNotification = static_cast< _WebNotification* >(pEnum->GetCurrent());
+ pWebNotification->OnChangeLayout();
+ }
+
+ if (IsKeypadVisible())
+ {
+ _ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetInverseTransformer();
+ SysAssertf(pXformer, "Failed to get CoordinateTransformer");
+
+ _FormImpl* pFormImpl = GetParentFormImpl(dynamic_cast< _ControlImpl* >(this));
+ pFormImpl->DeflateClientRectHeight(pXformer->TransformVertical(GetPreviousKeypadBounds().height));
+ }
+}
+
+
+void
+_WebImpl::OnAncestorVisibleStateChanged(const _Control& control)
+{
+ Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+ if (!pWebview)
+ {
+ return;
+ }
+
+ _WebManager* pWebManager = _WebManager::GetInstance();
+ SysTryReturnVoidResult(NID_WEB_CTRL, pWebManager, E_SYSTEM, "[E_SYSTEM] Failed to get the _WebManager instance.");
+ if (IsVisible() == true)
+ {
+ pWebManager->SetActiveWeb(this);
+ if (IsLoading())
+ {
+// ewk_view_page_visibility_state_set(pWebview, EWK_PAGE_VISIBILITY_STATE_VISIBLE, true);
+ }
+ else
+ {
+// ewk_view_page_visibility_state_set(pWebview, EWK_PAGE_VISIBILITY_STATE_VISIBLE, false);
+ }
+ }
+ else
+ {
+ pWebManager->RemoveActiveWeb(this);
+ if (IsLoading())
+ {
+// ewk_view_page_visibility_state_set(pWebview, EWK_PAGE_VISIBILITY_STATE_HIDDEN, true);
+ }
+ else
+ {
+// ewk_view_page_visibility_state_set(pWebview, EWK_PAGE_VISIBILITY_STATE_HIDDEN, false);
+ }
+ }
+}
+
+
+void
+_WebImpl::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
+{
+ _ContainerImpl::OnUserEventReceivedN(requestId, pArgs);
+
+ switch (requestId)
+ {
+ case ID_AUTHENTICATION_CONFIRM_POPUP_CANCEL:
+ __pAuthPopup->RemoveAllControls();
+ __pAuthPopup.reset();
+ __pAuthChallenge->Cancel();
+ __pAuthChallenge.reset();
+ break;
+ case ID_AUTHENTICATION_CONFIRM_POPUP_PROCESS:
+ __pAuthPopup->RemoveAllControls();
+ __pAuthPopup.reset();
+ if (pArgs)
+ {
+ std::unique_ptr<ArrayList, AllElementsDeleter> pAuthValue(reinterpret_cast< ArrayList* >(pArgs));
+ __pAuthChallenge->Process(*reinterpret_cast< String* >(pAuthValue->GetAt(0)),*reinterpret_cast< String* >(pAuthValue->GetAt(1)));
+ }
+ __pAuthChallenge.reset();
+ break;
+ case ID_CERTIFICATE_CONFIRM_POPUP_CLOSE:
+ __pCertConfirmPopup.reset();
+ break;
+ case ID_PROMPT_POPUP_CLOSE:
+ __pPromptPopup.reset();
+ break;
+ case ID_USER_CONFIRM_USERMEDIA_CLOSE:
+ __pUserMediaConfirmPopup.reset();
+ break;
+ case ID_USER_CONFIRM_GEOLOCATION_CLOSE:
+ __pGeolocationConfirmPopup.reset();
+ break;
+ case ID_USER_CONFIRM_NOTIFICATION_CLOSE:
+ __pNotificationConfirmPopup.reset();
+ break;
+ case ID_USER_SCRIPT_ALERT_CLOSE:
+ __pScriptAlertConfirmPopup.reset();
+ break;
+ case ID_USER_SCRIPT_CONFIRM_CLOSE:
+ __pScriptConfirmPopup.reset();
+ break;
+
+ case ID_USER_BEFORE_UNLOAD_CONFIRM_CLOSE:
+ __pBeforeUnloadConfirmPopup.reset();
+ break;
+
+ case ID_USER_SCRIPT_SELECTBOX_CLOSE:
+ __pSelectBox.reset();
+ break;
+ default:
+ break;
+ }
+
+ Resume();
+}
+
+
+_WebDataHandler*
+_WebImpl::GetDownloadHandler(void) const
+{
+ return __pWebDownloadHandler.get();
+}
+
+
+Eina_Bool
+_WebImpl::HideColorPicker(void)
+{
+ __pColorPicker.reset();
+
+ Resume();
+
+ return EINA_TRUE;
+}
+
+
+result
+_WebImpl::ShowColorPicker(int red, int green, int blue, int alpha, Color& color)
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr<_InputPickerPopup> pColorHadler(new (std::nothrow) _InputPickerPopup());
+ SysTryReturnResult(NID_WEB_CTRL, pColorHadler.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ Tizen::Graphics::Color colorVal(static_cast< byte >(red), static_cast< byte >(green), static_cast< byte >(blue), static_cast< byte >(alpha));
+
+ r = pColorHadler->Construct(colorVal, this);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pColorPicker = std::move(pColorHadler);
+
+ int modalResult = 0;
+ r = __pColorPicker->ShowAndWait(modalResult);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ if (__pColorPicker)
+ {
+ color = __pColorPicker->GetColor();
+ }
+
+CATCH:
+ if (__pColorPicker)
+ {
+ __pColorPicker.reset();
+ Resume();
+ }
+
+ return r;
+}
+
+
+result
+_WebImpl::ShowDatePicker(Ewk_Input_Type inputType, const char* inputValue, String& dateStr)
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr<_InputPickerPopup> pInputPicker(new (std::nothrow) _InputPickerPopup());
+ SysTryReturnResult(NID_WEB_CTRL, pInputPicker.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ r = pInputPicker->Construct(String(inputValue), inputType, this);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pDatePicker = std::move(pInputPicker);
+
+ int modalResult = 0;
+ r = __pDatePicker->ShowAndWait(modalResult);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ if (__pDatePicker)
+ {
+ dateStr = __pDatePicker->GetDate();
+ }
+
+CATCH:
+ if (__pDatePicker)
+ {
+ __pDatePicker.reset();
+ Resume();
+ }
+
+ return r;
+}
+
+
+_WebImpl*
+_WebImpl::GetInstance(Web* pWeb)
+{
+ return dynamic_cast< _WebImpl* >(_ControlImpl::GetInstance(*pWeb));
+}
+
+
+const _WebImpl*
+_WebImpl::GetInstance(const Web* pWeb)
+{
+ return dynamic_cast< const _WebImpl* >(_ControlImpl::GetInstance(*pWeb));
+}
+
+
+int
+_WebImpl::SearchHandler(Ewk_Custom_Handlers_Data* pHandlerData, bool checkmime)
+{
+ int checkReturn = 0;
+ _DatabaseImpl db;
+ String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
+
+ String table;
+ if( checkmime == true)
+ {
+ table = CUSTOM_CONTENT_TABLE_NAME;
+ }
+ else
+ {
+ table = CUSTOM_PROTOCOL_TABLE_NAME;
+ }
+
+ String baseUri(ewk_custom_handlers_data_base_url_get(pHandlerData));
+ String uri(ewk_custom_handlers_data_url_get(pHandlerData));
+ String target(ewk_custom_handlers_data_target_get(pHandlerData));
+
+ SysSecureLog(NID_WEB_CTRL, "BaseUrl : %s, Url : %s, mime : %s", baseUri.GetPointer(), uri.GetPointer(), target.GetPointer());
+
+ result r = db.Construct(handlerPath, "r+", null);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ std::unique_ptr<DbEnumerator> pEnum(db.QueryN(L"Select allow From " + table + L" Where baseUrl = '" + baseUri + L"' AND url = '" + uri + L"' AND mime = '" + target + L"'"));
+ SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, -1, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ if(pEnum.get())
+ {
+ r = pEnum->MoveNext();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
+ r = pEnum->GetIntAt(0, checkReturn);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ else
+ {
+ checkReturn = 2;
+ }
+
+ return checkReturn;
+}
+
+
+result
+_WebImpl::UnregistrationHandler(Ewk_Custom_Handlers_Data* pHandlerData, bool checkmime)
+{
+ int checkId = 0;
+ _DatabaseImpl db;
+ String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
+
+ String table;
+ if( checkmime == true)
+ {
+ table = CUSTOM_CONTENT_TABLE_NAME;
+ }
+ else
+ {
+ table = CUSTOM_PROTOCOL_TABLE_NAME;
+ }
+
+ String baseUri(ewk_custom_handlers_data_base_url_get(pHandlerData));
+ String uri(ewk_custom_handlers_data_url_get(pHandlerData));
+ String target(ewk_custom_handlers_data_target_get(pHandlerData));
+
+ SysSecureLog(NID_WEB_CTRL, "BaseUrl : %s, Url : %s, mime : %s", baseUri.GetPointer(), uri.GetPointer(), target.GetPointer());
+
+ result r = db.Construct(handlerPath, "r+", null);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ std::unique_ptr<DbEnumerator> pEnum(db.QueryN(L"Select id From " + table + L" Where baseUrl = '" + baseUri + L"' AND url = '" + uri + L"' AND mime = '" + target + L"'"));
+ SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ if(pEnum.get())
+ {
+ r = pEnum->MoveNext();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ r = pEnum->GetIntAt(0, checkId);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ std::unique_ptr<DbStatement> pDeleteStmt(db.CreateStatementN(L"Delete From " + table + L" Where id = (?)"));
+ SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ r = pDeleteStmt->BindInt(0, checkId);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ db.BeginTransaction();
+
+ std::unique_ptr<DbEnumerator> pEnum(db.ExecuteStatementN(*pDeleteStmt));
+
+ db.CommitTransaction();
+ }
+
+ return E_SUCCESS;
+}
+
+
+const Tizen::Base::String
+_WebImpl::GetProtocolFromUri(const Tizen::Base::String& originUri, const Tizen::Base::String& currentUri)
+{
+ if (originUri == L"" || currentUri == L"")
+ {
+ return L"";
+ }
+
+ result r = E_SUCCESS;
+ String baseUri;
+ _DatabaseImpl db;
+ String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
+ String originReplace(originUri);
+ String table(CUSTOM_PROTOCOL_TABLE_NAME);
+ int found = 0;
+ int foundQuery = 0;
+
+ r = currentUri.LastIndexOf(L"/", currentUri.GetLength()-1, found);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = currentUri.SubString(0, found + 1, baseUri);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = db.Construct(handlerPath, "r+", null);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
+
+ std::unique_ptr<DbEnumerator> pEnum(db.QueryN(L"Select mime, url, allow From " + table + L" Where baseUrl = '" + baseUri + "'"));
+ SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, L"", GetLastResult(), "[%s] Propagating.", GetErrorMessage(r));
+
+ if(pEnum.get())
+ {
+ while (pEnum->MoveNext() == E_SUCCESS)
+ {
+ String protocol;
+ String queryUrl;
+ int allow;
+ String originScheme;
+
+ r = pEnum->GetStringAt(0, protocol);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pEnum->GetStringAt(1, queryUrl);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pEnum->GetIntAt(2, allow);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
+
+ if (allow == 0)
+ {
+ break;
+ }
+
+ String protocolScheme(protocol + L":");
+
+ r = originReplace.SubString(0, protocolScheme.GetLength(), originScheme);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
+
+ if ((originReplace.GetLength() >= protocolScheme.GetLength()) && originScheme.Equals(protocolScheme, false))
+ {
+ if (queryUrl.IndexOf(L"%s", 0, foundQuery) == E_SUCCESS)
+ {
+ r = originReplace.Replace(originScheme, "");
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
+
+ queryUrl.Replace("%s", originReplace, 0);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return queryUrl;
+ }
+ }
+ }
+ }
+
+ return L"";
+}
+
+
+const Tizen::Base::String
+_WebImpl::GetRedirectUri(const Tizen::Base::String& originUri, const Tizen::Base::String& currentUri, const Tizen::Base::String& mime)
+{
+ if (originUri == L"" || currentUri == L"" || mime == L"")
+ {
+ return L"";
+ }
+
+ result r = E_SUCCESS;
+ String baseUri;
+ String contentUrl;
+ String originUrlStr = originUri;
+ const String replaceStr = L"%s";
+ _DatabaseImpl db;
+ String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
+ String table(CUSTOM_CONTENT_TABLE_NAME);
+ int allow = 0;
+ int found = 0;
+
+ r = currentUri.LastIndexOf(L"/", currentUri.GetLength()-1, found);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = currentUri.SubString(0, found + 1, baseUri);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = db.Construct(handlerPath, "r+", null);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
+
+ std::unique_ptr<DbEnumerator> pEnum(db.QueryN(L"Select allow, url From " + table + L" Where baseUrl = '" + baseUri + "' AND mime = '" + mime + L"'"));
+
+ if (pEnum.get())
+ {
+ r = pEnum->MoveNext();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
+ r = pEnum->GetIntAt(0, allow);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
+ r = pEnum->GetStringAt(1, contentUrl);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
+
+ if (allow == 0)
+ {
+ return L"";
+ }
+ else
+ {
+ if (contentUrl != L"")
+ {
+ r = contentUrl.Replace(replaceStr, originUrlStr, 0);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return contentUrl;
+ }
+ }
+ }
+
+ return L"";
+}
+
+
+void
+_WebImpl::SetFormDataList(Eina_List* pFormDataList)
+{
+ __pFormDataList = pFormDataList;
+}
+
+
+bool
+_WebImpl::IsFormDataWindowVisible(void) const
+{
+ return __isFormDataVisible;
+}
+
+
+result
+_WebImpl::ShowFormDataWindow(const Rectangle& windowRect, Evas_Object* pWebView)
+{
+ Rectangle rect(_CoordinateSystemUtils::InverseTransform(Rectangle(windowRect.x, windowRect.y + windowRect.height, windowRect.width, windowRect.height)));
+
+ if (__isFormDataVisible)
+ {
+ result r = __pFormDataWindow->UpdateList(__pFormDataList, rect);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ else
+ {
+ __pFormDataWindow.reset();
+
+ std::unique_ptr<_FormDataWindow> pFormDataWindow( new (std::nothrow) _FormDataWindow());
+ SysTryReturnResult(NID_WEB_CTRL, pFormDataWindow.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ result r = pFormDataWindow->Construct(rect, this, pWebView);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pFormDataWindow->UpdateList(__pFormDataList, rect);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pFormDataWindow->LaunchFormDataWindow();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pFormDataWindow = std::move(pFormDataWindow);
+ __isFormDataVisible = true;
+ }
+
+ return E_SUCCESS;
+}
+
+
+void
+_WebImpl::HideFormDataWindow(bool delWindow)
+{
+ if (delWindow)
+ {
+ __pFormDataWindow.reset();
+ }
+
+ __isFormDataVisible = false;
+}
+
+
+void
+_WebImpl::ClearWebNotification(_WebNotification* pWebNotification)
+{
+ __webNotificationList.Remove(*pWebNotification);
+}
+
+
+void
+_WebImpl::SetWebNotification(_WebNotification* pWebNotification)
+{
+ __webNotificationList.Add(pWebNotification);
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtr_WebMaker.cpp
+ * @brief The file contains the definition of _WebMaker class.
+ *
+ * The file contains the definition of _WebMaker class.
+ */
+
+#include <unique_ptr.h>
+#include <FUiCtrlInputTypes.h>
+#include <FWebCtrlWeb.h>
+#include <FWebCtrlWebSetting.h>
+#include <FBaseSysLog.h>
+#include <FUi_UiBuilder.h>
+#include <FUi_CoordinateSystemUtils.h>
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Web::Controls;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+class _WebMaker
+ : public _UiBuilderControlMaker
+{
+public:
+ _WebMaker(_UiBuilder* pUibuilder)
+ : _UiBuilderControlMaker(pUibuilder){};
+ _WebMaker(){};
+ virtual ~_WebMaker(){};
+ static _UiBuilderControlMaker* GetInstance(_UiBuilder* pUibuilder)
+ {
+
+ std::unique_ptr<_WebMaker> pWebMaker(new (std::nothrow)_WebMaker(pUibuilder));
+ SysTryReturn(NID_WEB_CTRL, pWebMaker.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ return pWebMaker.release();
+ }
+
+protected:
+ virtual Tizen::Ui::Control* Make(_UiBuilderControl* pControl)
+ {
+ result r = E_FAILURE;
+ _UiBuilderControlLayout* pControlProperty = null;
+
+ WebSetting setting;
+ String elementString;
+
+ Rectangle webRect;
+
+ GetProperty(pControl, &pControlProperty);
+ SysTryReturn(NID_WEB_CTRL, pControlProperty != null, null, E_SYSTEM, "[%s] A system error has been occurred. Can't read attributes", GetErrorMessage(E_SYSTEM));
+
+ std::unique_ptr<Web> pWeb(new (std::nothrow)Web());
+ SysTryReturn(NID_WEB_CTRL, pWeb.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ webRect = pControlProperty->GetRect();
+ r = pWeb->Construct(webRect);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, E_SYSTEM, "[%s] A system error has been occurred. Web Control is not constructed.", GetErrorMessage(E_SYSTEM));
+
+ if (pControl->GetElement(L"cacheControl", elementString) || pControl->GetElement(L"CacheControl", elementString))
+ {
+ if (elementString.Equals(L"WEB_CACHE_IGNORE", false))
+ {
+ setting.SetCacheControl(WEB_CACHE_IGNORE);
+ }
+ else if (elementString.Equals(L"WEB_CACHE_VALIDATED", false))
+ {
+ setting.SetCacheControl(WEB_CACHE_VALIDATED);
+ }
+ }
+
+ if (pControl->GetElement(L"fontSize", elementString) || pControl->GetElement(L"FontSize", elementString))
+ {
+ float fontSize = _CoordinateSystemUtils::ConvertToFloat(elementString);
+ setting.SetFontSize(static_cast< int >(fontSize));
+ }
+
+ if (pControl->GetElement(L"defaultTextEncoding", elementString) || pControl->GetElement(L"DefaultTextEncoding", elementString))
+ {
+ setting.SetDefaultTextEncoding(elementString);
+ }
+
+ if (pControl->GetElement(L"javascriptEnabled", elementString) || pControl->GetElement(L"JavascriptEnabled", elementString))
+ {
+ if (elementString.Equals(L"true", false))
+ {
+ setting.SetJavascriptEnabled(true);
+ }
+ else
+ {
+ setting.SetJavascriptEnabled(false);
+ }
+ }
+
+ if (pControl->GetElement(L"autoImageLoadEnabled", elementString) || pControl->GetElement(L"AutoImageLoadEnabled", elementString))
+ {
+ if (elementString.Equals(L"true", false))
+ {
+ setting.SetAutoImageLoadEnabled(true);
+ }
+ else
+ {
+ setting.SetAutoImageLoadEnabled(false);
+ }
+ }
+
+ if (pControl->GetElement(L"inputStyle", elementString) || pControl->GetElement(L"InputStyle", elementString))
+ {
+ if (elementString.Equals(L"INPUT_STYLE_OVERLAY", false))
+ {
+ setting.SetInputStyle(INPUT_STYLE_OVERLAY);
+ }
+ else
+ {
+ setting.SetInputStyle(INPUT_STYLE_FULLSCREEN);
+ }
+ }
+
+ if (pControl->GetElement(L"certificateErrorHandlingMode", elementString))
+ {
+ if (elementString.Equals(L"WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM", false))
+ {
+ setting.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM);
+ }
+ else if (elementString.Equals(L"WEB_CERTIFICATE_ERROR_HANDLING_MODE_CANCEL", false))
+ {
+ setting.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_CANCEL);
+ }
+ else
+ {
+ setting.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_CONTINUE);
+ }
+ }
+
+ if (pControl->GetElement(L"cookieEnabled", elementString))
+ {
+ if (elementString.Equals(L"true", false))
+ {
+ r = pWeb->SetCookieEnabled(true);
+ }
+ else
+ {
+ r = pWeb->SetCookieEnabled(false);
+ }
+ }
+
+ if (pControl->GetElement(L"scrollEnabled", elementString))
+ {
+ if (elementString.Equals(L"true", false))
+ {
+ r = pWeb->SetScrollEnabled(true);
+ }
+ else
+ {
+ r = pWeb->SetScrollEnabled(false);
+ }
+ }
+
+ if (pControl->GetElement(L"privateBrowsing", elementString))
+ {
+ if (elementString.Equals(L"true", false))
+ {
+ r = pWeb->SetPrivateBrowsingEnabled(true);
+ }
+ else
+ {
+ r = pWeb->SetPrivateBrowsingEnabled(false);
+ }
+ }
+
+ if (pControl->GetElement(L"userAgent", elementString))
+ {
+ setting.SetUserAgent(elementString);
+ }
+
+ if (pControl->GetElement(L"autoFittingEnabled", elementString))
+ {
+ if (elementString.Equals(L"true", false))
+ {
+ setting.SetAutoFittingEnabled(true);
+ }
+ else
+ {
+ setting.SetAutoFittingEnabled(false);
+ }
+ }
+
+ if (pControl->GetElement(L"javaScriptPopupEnabled", elementString))
+ {
+ if (elementString.Equals(L"true", false))
+ {
+ setting.SetJavaScriptPopupEnabled(true);
+ }
+ else
+ {
+ setting.SetJavaScriptPopupEnabled(false);
+ }
+ }
+
+ if (pControl->GetElement(L"geolocationEnabled", elementString))
+ {
+ if (elementString.Equals(L"true", false))
+ {
+ setting.SetGeolocationEnabled(true);
+ }
+ else
+ {
+ setting.SetGeolocationEnabled(false);
+ }
+ }
+
+ if (pControl->GetElement(L"autoFormDataShowEnabled", elementString))
+ {
+ if (elementString.Equals(L"true", false))
+ {
+ setting.SetAutoFormDataShowEnabled(true);
+ }
+ else
+ {
+ setting.SetAutoFormDataShowEnabled(false);
+ }
+ }
+
+ if (pControl->GetElement(L"autoLoginFormFillEnabled", elementString))
+ {
+ if (elementString.Equals(L"true", false))
+ {
+ setting.SetAutoLoginFormFillEnabled(true);
+ }
+ else
+ {
+ setting.SetAutoLoginFormFillEnabled(false);
+ }
+ }
+
+
+ r = pWeb->SetSetting(setting);
+
+ return pWeb.release();
+ }
+
+private:
+}; // _WebMaker
+
+
+}}} // Tizen::Web::Controls
+
+
+namespace Tizen { namespace Ui { namespace Controls
+{
+
+
+_WebRegister::_WebRegister()
+{
+ _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
+ pUiBuilderControlTableManager->RegisterControl(L"Web", _WebMaker::GetInstance);
+}
+
+
+_WebRegister::~_WebRegister()
+{
+ _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
+ pUiBuilderControlTableManager->UnregisterControl(L"Web");
+}
+
+
+static _WebRegister WebRegisterToUIbuilder;
+
+
+}}} // Tizen::Ui::Controls
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FWebCtrl_WebManager.cpp\r
+ * @brief The file contains the definition of _WebManager class.\r
+ *\r
+ * The file contains the definition of _WebManager class.\r
+ */\r
+#include <pthread.h>\r
+#include <net_connection.h>\r
+#include <FAppApp.h>\r
+#include <FBaseSysLog.h>\r
+#include <FIoDbEnumerator.h>\r
+#include <FUiControl.h>\r
+#include <FIo_DirectoryImpl.h>\r
+#include <FIo_DatabaseImpl.h>\r
+#include <FIo_FileImpl.h>\r
+#include <FUiCtrl_FormImpl.h>\r
+#include <FIo_DirectoryImpl.h>\r
+#include <FIo_DatabaseImpl.h>\r
+#include <FIo_FileImpl.h>\r
+#include "FWebCtrl_EflWebkit.h"\r
+#include "FWebCtrl_Web.h"\r
+#include "FWebCtrl_WebImpl.h"\r
+#include "FWebCtrl_WebManager.h"\r
+#include "FWebCtrl_WebPopup.h"\r
+\r
+using namespace Tizen::Base;\r
+using namespace Tizen::Base::Collection;\r
+using namespace Tizen::Io;\r
+using namespace Tizen::Ui;\r
+using namespace Tizen::Ui::Controls;\r
+\r
+namespace Tizen { namespace Web { namespace Controls\r
+{\r
+\r
+\r
+_WebManager* _WebManager::__pInstance = null;\r
+\r
+\r
+extern const wchar_t CUSTOM_DB_DIRECTORY_PATH[] = L"data/.webkit/customDatabase/";\r
+extern const wchar_t USER_CONFIRM_DB_NAME[] = L"userConfirm.db";\r
+extern const wchar_t GEOLOCATION_TABLE_NAME[] = L"geolocationPermission";\r
+extern const wchar_t CUSTOM_PROTOCOL_TABLE_NAME[] = L"customProtocol";\r
+extern const wchar_t CUSTOM_CONTENT_TABLE_NAME[] = L"customContent";\r
+extern const wchar_t CERTIFICATE_TABLE_NAME[] = L"certificate";\r
+\r
+\r
+static const int CUSTOM_DB_TABLE_COUNT= 4;\r
+\r
+\r
+_WebManager::_WebManager(void)\r
+ : __pWebList(null)\r
+ , __pCallbackList(null)\r
+ , __pActivePopupList(null)\r
+ , __pActiveWeb(null)\r
+ , __pProxy(null)\r
+{\r
+}\r
+\r
+_WebManager::~_WebManager(void)\r
+{\r
+ free(__pProxy);\r
+ ClearCertificateDb();\r
+}\r
+\r
+\r
+void\r
+_WebManager::InitWebManager(void)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ std::unique_ptr<_WebManager> pInstance(new (std::nothrow) _WebManager());\r
+ SysTryReturnVoidResult(NID_WEB_CTRL, pInstance.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));\r
+\r
+ r = pInstance->Construct();\r
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ __pInstance = pInstance.release();\r
+ std::atexit(DestroyWebManager);\r
+}\r
+\r
+\r
+void\r
+_WebManager::DestroyWebManager(void)\r
+{\r
+ delete __pInstance;\r
+ __pInstance = null;\r
+}\r
+\r
+\r
+_WebManager*\r
+_WebManager::GetInstance(void)\r
+{\r
+ static pthread_once_t onceBlock = PTHREAD_ONCE_INIT;\r
+ if (__pInstance== null)\r
+ {\r
+ ClearLastResult();\r
+ pthread_once(&onceBlock, InitWebManager);\r
+ result r = GetLastResult();\r
+ if (IsFailed(r))\r
+ {\r
+ onceBlock = PTHREAD_ONCE_INIT;\r
+ }\r
+ }\r
+\r
+ return __pInstance;\r
+}\r
+\r
+\r
+result\r
+_WebManager::Construct(void)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ std::unique_ptr<ArrayListT< int> > pWebList(new (std::nothrow) ArrayListT< int >());\r
+ SysTryReturnResult(NID_WEB_CTRL, pWebList.get(), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");\r
+ r = pWebList->Construct();\r
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ std::unique_ptr<MultiHashMapT< int, int > > pCallbackList(new (std::nothrow) MultiHashMapT< int, int >());\r
+ SysTryReturnResult(NID_WEB_CTRL, pCallbackList.get(), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");\r
+ r = pCallbackList->Construct();\r
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ std::unique_ptr<ArrayListT< int> > pActivePopupList(new (std::nothrow) ArrayListT< int >());\r
+ SysTryReturnResult(NID_WEB_CTRL, pActivePopupList.get(), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");\r
+ r = pActivePopupList->Construct();\r
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ r = InitializeProxyAddress();\r
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ r = CreateResourceDirectory();\r
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ r = InitializeCustomDb();\r
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ __pWebList = std::move(pWebList);\r
+ __pCallbackList = std::move(pCallbackList);\r
+ __pActivePopupList = std::move(pActivePopupList);\r
+\r
+ return E_SUCCESS;\r
+}\r
+\r
+\r
+void\r
+_WebManager::ClearCertificateDb(void)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ String certificatePath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);\r
+ String table(CERTIFICATE_TABLE_NAME);\r
+ _DatabaseImpl db;\r
+\r
+ r = db.Construct(certificatePath, "r+", null);\r
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ db.BeginTransaction();\r
+\r
+ r = db.ExecuteSql(L"Delete From " + table, true);\r
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ db.CommitTransaction();\r
+\r
+ return;\r
+\r
+CATCH:\r
+ db.RollbackTransaction();\r
+}\r
+\r
+\r
+result\r
+_WebManager::InitializeProxyAddress(void)\r
+{\r
+ int ret = -1;\r
+ connection_h handle = null;\r
+ char* pProxy = null;\r
+\r
+ ret = connection_create(&handle);\r
+ SysTryReturnResult(NID_WEB_CTRL, ret == CONNECTION_ERROR_NONE, E_SYSTEM, "A system error has been occurred. Failed to create connection.");\r
+\r
+ connection_address_family_e family = CONNECTION_ADDRESS_FAMILY_IPV4;\r
+\r
+ ret = connection_get_proxy(handle, family, &pProxy);\r
+ SysTryReturnResult(NID_WEB_CTRL, ret == CONNECTION_ERROR_NONE, E_SYSTEM, "A system error has been occurred. Failed to get proxy address.");\r
+\r
+ ret = connection_destroy(handle);\r
+ SysTryReturnResult(NID_WEB_CTRL, ret == CONNECTION_ERROR_NONE, E_SYSTEM, "A system error has been occurred. Failed to destroy connection.");\r
+\r
+ __pProxy = pProxy;\r
+\r
+ return E_SUCCESS;\r
+}\r
+\r
+\r
+result\r
+_WebManager::CreateResourceDirectory(void) const\r
+{\r
+ String html5FeaturesPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH);\r
+\r
+ if (!_FileImpl::IsFileExist(html5FeaturesPath))\r
+ {\r
+ result r = E_SUCCESS;\r
+\r
+ r = _DirectoryImpl::Create(html5FeaturesPath, true);\r
+ SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_SYSTEM, "A system error has been occurred. create html5 features directory.");\r
+ }\r
+\r
+ return E_SUCCESS;\r
+}\r
+\r
+\r
+result\r
+_WebManager::InitializeCustomDb(void) const\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ _DatabaseImpl db;\r
+ String path(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);\r
+ String geolocationTable(GEOLOCATION_TABLE_NAME);\r
+ String protocolTable(CUSTOM_PROTOCOL_TABLE_NAME);\r
+ String contentTable(CUSTOM_CONTENT_TABLE_NAME);\r
+ String certificateTable(CERTIFICATE_TABLE_NAME);\r
+\r
+ r = db.Construct(path, "a+", null);\r
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ std::unique_ptr<DbEnumerator> pEnum(db.QueryN(L"Select count(name) from sqlite_master Where type='table' And name in ('" + geolocationTable + L"', '" + protocolTable + L"', '" + contentTable + L"', '" + certificateTable + L"')"));\r
+ if (pEnum.get())\r
+ {\r
+ int count = 0;\r
+\r
+ r = pEnum->MoveNext();\r
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ r = pEnum->GetIntAt(0, count);\r
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ if (count == CUSTOM_DB_TABLE_COUNT)\r
+ {\r
+ return E_SUCCESS;\r
+ }\r
+ }\r
+\r
+ pEnum.reset();\r
+ pEnum = std::unique_ptr<DbEnumerator>(db.QueryN(L"Select name from sqlite_master Where type='table' And name = '" + geolocationTable + L"'"));\r
+ if (!pEnum.get())\r
+ {\r
+ r = db.ExecuteSql(\r
+ L"CREATE TABLE IF NOT EXISTS " + geolocationTable + L"(id INTEGER PRIMARY KEY AUTOINCREMENT, origin TEXT, permission INTEGER)",\r
+ true);\r
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));\r
+ }\r
+\r
+ pEnum.reset();\r
+ pEnum = std::unique_ptr<DbEnumerator>(db.QueryN(L"Select name from sqlite_master Where type='table' And name = '" + protocolTable + L"'"));\r
+ if (!pEnum.get())\r
+ {\r
+ r = db.ExecuteSql(\r
+ L"CREATE TABLE IF NOT EXISTS " + protocolTable + L"(id INTEGER PRIMARY KEY AUTOINCREMENT, baseUrl TEXT, url TEXT, mime TEXT, allow INTEGER)",\r
+ true);\r
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));\r
+ }\r
+\r
+ pEnum.reset();\r
+ pEnum = std::unique_ptr<DbEnumerator>(db.QueryN(L"Select name from sqlite_master Where type='table' And name = '" + contentTable + L"'"));\r
+ if (!pEnum.get())\r
+ {\r
+ r = db.ExecuteSql(\r
+ L"CREATE TABLE IF NOT EXISTS " + contentTable + L"(id INTEGER PRIMARY KEY AUTOINCREMENT, baseUrl TEXT, url TEXT, mime TEXT, allow INTEGER)",\r
+ true);\r
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));\r
+ }\r
+\r
+ pEnum.reset();\r
+ pEnum = std::unique_ptr<DbEnumerator>(db.QueryN(L"Select name from sqlite_master Where type='table' And name = '" + certificateTable + L"'"));\r
+ if (!pEnum.get())\r
+ {\r
+ r = db.ExecuteSql(\r
+ L"CREATE TABLE IF NOT EXISTS " + certificateTable + L"(id INTEGER PRIMARY KEY AUTOINCREMENT, pem TEXT, allow INTEGER)",\r
+ true);\r
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));\r
+ }\r
+\r
+ return E_SUCCESS;\r
+}\r
+\r
+\r
+result\r
+_WebManager::AddWeb(int webAdress)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(webAdress);\r
+ _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));\r
+\r
+ r = pWebCore->GetEflWebkit()->SetProxyAddress(__pProxy);\r
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ r = __pWebList->Add(webAdress);\r
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ return E_SUCCESS;\r
+}\r
+\r
+\r
+result\r
+_WebManager::RemoveWeb(int webAdress)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ r = __pWebList->Remove(webAdress);\r
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ __pCallbackList->Remove(webAdress);\r
+\r
+ return E_SUCCESS;\r
+}\r
+\r
+\r
+bool\r
+_WebManager::IsValidWeb(int webAdress) const\r
+{\r
+ return __pWebList->Contains(webAdress);\r
+}\r
+\r
+\r
+result\r
+_WebManager::AddCallback(int callerAdress, int callbackAdress)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ r = __pCallbackList->Add(callerAdress, callbackAdress);\r
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ return E_SUCCESS;\r
+}\r
+\r
+\r
+result\r
+_WebManager::RemoveCallback(int callerAdress, int callbackAdress)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ r = __pCallbackList->Remove(callerAdress, callbackAdress);\r
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ return E_SUCCESS;\r
+}\r
+\r
+\r
+bool\r
+_WebManager::IsValidCallback(int callerAdress, int callbackAdress) const\r
+{\r
+ bool ret = true;\r
+\r
+ result r = __pCallbackList->Contains(callerAdress, callbackAdress, ret);\r
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, true, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ return ret;\r
+}\r
+\r
+\r
+void\r
+_WebManager::SetActiveWeb(Tizen::Web::Controls::_WebImpl* pWebAddress)\r
+{\r
+ if (__pActiveWeb == null)\r
+ {\r
+ __pActiveWeb = pWebAddress;\r
+ }\r
+ else\r
+ {\r
+ if (__pActiveWeb->IsVisible() == true)\r
+ {\r
+ return;\r
+ }\r
+ __pActiveWeb = pWebAddress;\r
+ }\r
+\r
+ for (int i = 0; i < __pActivePopupList->GetCount(); i++)\r
+ {\r
+ int activePopupAddr = 0;\r
+ __pActivePopupList->GetAt(i, activePopupAddr);\r
+ _WebPopup* pActivePopup = reinterpret_cast< _WebPopup* >(activePopupAddr);\r
+\r
+ if (pActivePopup != null)\r
+ {\r
+ pActivePopup->SetShowState(false);\r
+\r
+ _FormImpl* pFormImpl = __pActiveWeb->GetParentFormImpl(__pActiveWeb);\r
+\r
+ if (pFormImpl != null)\r
+ {\r
+ pActivePopup->SetOwner(&pFormImpl->GetPublic());\r
+ }\r
+ else\r
+ {\r
+ pActivePopup->SetOwner(&__pActiveWeb->GetPublic());\r
+ }\r
+\r
+ pActivePopup->SetShowState(true);\r
+ pActivePopup->Show();\r
+ }\r
+ }\r
+}\r
+\r
+\r
+void\r
+_WebManager::RemoveActiveWeb(Tizen::Web::Controls::_WebImpl* pWebAddress)\r
+{\r
+ if (__pActiveWeb == pWebAddress)\r
+ {\r
+ __pActiveWeb = null;\r
+ }\r
+}\r
+\r
+\r
+result\r
+_WebManager::SetActivePopup(int popupAddress)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ r = __pActivePopupList->Add(popupAddress);\r
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ return r;\r
+}\r
+\r
+\r
+result\r
+_WebManager::RemoveActivePopup(int popupAddress)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ r = __pActivePopupList->Remove(popupAddress);\r
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ return r;\r
+}\r
+\r
+\r
+} } }\r
--- /dev/null
+//\r
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FWebCtrl_WebManager.h\r
+ * @brief This is the header file for the %_WebManager class.\r
+ *\r
+ * This header file contains the declarations of the %_WebManager class.\r
+ */\r
+ \r
+#ifndef _FWEB_CTRL_INTERNAL_WEB_MANAGER_H_\r
+#define _FWEB_CTRL_INTERNAL_WEB_MANAGER_H_\r
+\r
+#include <unique_ptr.h>\r
+#include <FBaseColArrayListT.h>\r
+#include <FBaseColMultiHashMapT.h>\r
+\r
+namespace Tizen { namespace Web { namespace Controls\r
+{\r
+\r
+_OSP_EXPORT_ extern const wchar_t CUSTOM_DB_DIRECTORY_PATH[];\r
+_OSP_EXPORT_ extern const wchar_t USER_CONFIRM_DB_NAME[];\r
+_OSP_EXPORT_ extern const wchar_t GEOLOCATION_TABLE_NAME[];\r
+_OSP_EXPORT_ extern const wchar_t CUSTOM_PROTOCOL_TABLE_NAME[];\r
+_OSP_EXPORT_ extern const wchar_t CUSTOM_CONTENT_TABLE_NAME[];\r
+_OSP_EXPORT_ extern const wchar_t CERTIFICATE_TABLE_NAME[];\r
+\r
+class _WebImpl;\r
+class _WebPopup;\r
+\r
+class _WebManager\r
+ : public Tizen::Base::Object\r
+{\r
+public:\r
+ virtual ~_WebManager(void);\r
+ \r
+ result AddWeb(int webAdress);\r
+ result RemoveWeb(int webAdress);\r
+ bool IsValidWeb(int webAdress) const;\r
+\r
+ result AddCallback(int callerAdress, int callbackAdress);\r
+ result RemoveCallback(int callerAdress, int callbackAdress);\r
+ bool IsValidCallback(int callerAdress, int callbackAdress) const;\r
+\r
+ void SetActiveWeb(Tizen::Web::Controls::_WebImpl* pWebAddress);\r
+ void RemoveActiveWeb(Tizen::Web::Controls::_WebImpl* pWebAddress);\r
+ result SetActivePopup(int popupAddress);\r
+ result RemoveActivePopup(int popupAddress);\r
+\r
+ static _WebManager* GetInstance(void);\r
+\r
+private:\r
+ _WebManager(void);\r
+ _WebManager(const _WebManager& rhs);\r
+\r
+ result Construct(void);\r
+\r
+ static void InitWebManager(void);\r
+ static void DestroyWebManager(void);\r
+\r
+ void ClearCertificateDb(void);\r
+ result InitializeProxyAddress(void);\r
+ result CreateResourceDirectory(void) const;\r
+ result InitializeCustomDb(void) const;\r
+\r
+ _WebManager& operator=(const _WebManager& rhs);\r
+\r
+private:\r
+ std::unique_ptr<Tizen::Base::Collection::ArrayListT< int > > __pWebList;\r
+ std::unique_ptr<Tizen::Base::Collection::MultiHashMapT< int, int > > __pCallbackList;\r
+ std::unique_ptr<Tizen::Base::Collection::ArrayListT< int > > __pActivePopupList;\r
+\r
+ _WebImpl* __pActiveWeb;\r
+ char* __pProxy;\r
+\r
+ static _WebManager* __pInstance;\r
+};\r
+\r
+} } }\r
+#endif\r
+\r
+ \r
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_WebNotification.cpp
+ * @brief The file contains the definition of _WebNotification class.
+ */
+#include <FBaseRtTimer.h>
+#include <FBaseSysLog.h>
+#include <FSysVibrator.h>
+#include <FSys_VibratorImpl.h>
+#include <FUiAnimControlAnimator.h>
+#include <FUiAnimPointAnimation.h>
+#include <FUiAnimFloatAnimation.h>
+#include <FUiAnimAnimationTransaction.h>
+#include <FUiAnimVisualElementPropertyAnimation.h>
+#include <FUiCtrlButton.h>
+#include "FWebCtrl_WebImpl.h"
+#include "FWebCtrl_WebNotificationHandler.h"
+#include "FWebCtrl_WebNotification.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Runtime;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Animations;
+using namespace Tizen::Ui::Controls;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+_WebNotification::_WebNotification(void)
+ : __pNotificationHandler(null)
+ , __pContext(null)
+ , __notificationId(0)
+ , __pTimer(null)
+ , __pWebImpl(null)
+{
+}
+
+
+_WebNotification::~_WebNotification(void)
+{
+}
+
+
+result
+_WebNotification::Construct(Ewk_Context *pContext, uint64_t notificationId, Tizen::Web::Controls::_WebImpl* pImpl)
+{
+ Rectangle rect(NOTIFCATION_RECT_AREA);
+ result r = E_SUCCESS;
+
+ __pContext = pContext;
+ __notificationId = notificationId;
+
+ r = Window::Construct(rect, true, true);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Error Propogating.", GetErrorMessage(r));
+ SetBounds(rect);
+
+ Window::SetOwner(&pImpl->GetPublic());
+ __pNotificationHandler = std::unique_ptr<_WebNotificationHandler>(new (std::nothrow) _WebNotificationHandler());
+ SysTryReturnResult(NID_WEB_CTRL, __pNotificationHandler.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ r = __pNotificationHandler->Construct(this);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Error Propogating.", GetErrorMessage(r));
+
+ SetPropagatedTouchEventListener(__pNotificationHandler.get());
+ __pTimer = std::unique_ptr<Timer>( new (std::nothrow) Timer());
+ SysTryReturnResult(NID_WEB_CTRL, __pTimer.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ r = __pTimer->Construct(*this);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Error Propogating.", GetErrorMessage(r));
+
+ __pWebImpl = pImpl;
+
+ return r;
+}
+
+
+void
+_WebNotification::SetText(const String& text)
+{
+ __pNotificationHandler->SetText(text);
+}
+
+
+String
+_WebNotification::GetText(void) const
+{
+ return __pNotificationHandler->GetText();
+}
+
+
+result
+_WebNotification::OnDraw(void)
+{
+ result r = E_SUCCESS;
+ SysTryReturnResult(NID_WEB_CTRL, __pNotificationHandler.get(), E_SYSTEM, "Failed to find Impl Instance.");
+
+ std::unique_ptr<Canvas> pCanvas(GetCanvasN());
+ SysTryReturnResult(NID_WEB_CTRL, pCanvas.get(), GetLastResult(), "[%s] Error Propagated.", GetErrorMessage(GetLastResult()));
+
+ r = __pNotificationHandler->DrawNotification(*pCanvas);
+
+ return r;
+}
+
+
+void
+_WebNotification::OnClicked()
+{
+ SysTryReturnVoidResult(NID_WEB_CTRL, __pContext != null, E_SYSTEM, "[E_SYSTEM] Context instance not found.");
+ ewk_notification_clicked(__pContext,__notificationId);
+}
+
+
+void
+_WebNotification::OnChangeLayout(void)
+{
+ SetShowState(false);
+ SetShowState(true);
+ Window::Show();
+}
+
+
+result
+_WebNotification::LaunchNotification()
+{
+ result r = E_SUCCESS;
+ std::unique_ptr<Button> pButton( new (std::nothrow) Button());
+ SysTryReturnResult(NID_WEB_CTRL, pButton.get(), E_OUT_OF_MEMORY, "Memory Allocation Failed.");
+
+ r = pButton->Construct(Rectangle(NOTIFCATION_BUTTON_AREA));
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Error Propogating.", GetErrorMessage(r));
+
+ pButton->SetText(L"x"); //Need to add bitmap
+ pButton->AddActionEventListener(*this);
+
+ r = AddControl(pButton.get());
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Error Propogating.", GetErrorMessage(r));
+ pButton.release();
+
+ SetShowState(true);
+ r = Window::Show();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Error Propogating.", GetErrorMessage(r));
+
+ FloatRectangle rect(static_cast< float >(NOTIFCATION_RECT_AREA.x),static_cast< float >(NOTIFCATION_RECT_AREA.y),static_cast< float >(NOTIFCATION_RECT_AREA.width),static_cast< float >(NOTIFCATION_RECT_AREA.height));
+
+ FloatRectangle __endRect = rect;
+ FloatRectangle __startRect = FloatRectangle(rect.x, rect.height - 200, rect.width, rect.height);
+
+ std::unique_ptr<VisualElementPropertyAnimation> pAnimation(new (std::nothrow) VisualElementPropertyAnimation());
+ SysTryReturnResult(NID_WEB_CTRL, pAnimation.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ pAnimation->SetPropertyName(L"bounds");
+ pAnimation->SetStartValue(Variant(__startRect));
+ pAnimation->SetEndValue(Variant(__endRect));
+ pAnimation->SetDuration(2000);
+ this->GetVisualElement()->AddAnimation(L"bounds", *pAnimation);
+
+ __pTimer->Start(15000);
+ return E_SUCCESS;
+}
+
+
+void
+_WebNotification::OnTimerExpired(Timer& timer)
+{
+ float start = 1.0f;
+ float end = 0.0f;
+
+ std::unique_ptr<VisualElementPropertyAnimation> pAnimation(new (std::nothrow) VisualElementPropertyAnimation());
+ SysTryReturnVoidResult(NID_WEB_CTRL, pAnimation.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ pAnimation->SetPropertyName(L"opacity");
+ pAnimation->SetStartValue(Variant(start));
+ pAnimation->SetEndValue(Variant(end));
+ pAnimation->SetDuration(2000);
+ this->GetVisualElement()->AddAnimation(L"opacity", *pAnimation);
+}
+
+
+void
+_WebNotification::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
+{
+ SetShowState(false);
+
+ __pWebImpl->ClearWebNotification(this);
+
+ delete this;
+}
+
+
+}}}
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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» » FWebCtrl_WebNotification.h
+* @brief» » The file contains the declaration of _WebNotification class.
+*
+* The file contains the declaration of _WebNotification class.
+*/
+#ifndef _FWEB_CTRL_INTERNAL_WEB_NOTIFCATION_H_
+#define _FWEB_CTRL_INTERNAL_WEB_NOTIFCATION_H_
+
+#include <EWebKit2.h>
+#include <FBaseRtITimerEventListener.h>
+#include <FBaseString.h>
+#include <FGrpDimension.h>
+#include <FGrpRectangle.h>
+#include <FUiControl.h>
+#include <FUiIActionEventListener.h>
+#include <FUiWindow.h>
+
+
+
+namespace Tizen { namespace Base { namespace Runtime {
+
+class Timer;
+}}} //Tizen::Base::Runtime
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+// forward declaration
+class _WebNotification;
+class _WebNotificationHandler;
+class _WebImpl;
+
+class _WebNotification
+ : public Tizen::Ui::Window
+ , public Tizen::Base::Runtime::ITimerEventListener
+ , public Tizen::Ui::IActionEventListener
+{
+// Life-cycle
+public:
+ _WebNotification(void);
+ virtual ~_WebNotification(void);
+
+ result Construct(Ewk_Context *pContext, uint64_t notificationId, _WebImpl* pImpl);
+ void SetText(const Tizen::Base::String& text);
+ Tizen::Base::String GetText(void) const;
+ virtual result OnDraw(void);
+
+ result LaunchNotification();
+ void OnClicked();
+
+ void OnChangeLayout(void);
+
+private:
+ void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
+ void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+
+private:
+ std::unique_ptr<_WebNotificationHandler> __pNotificationHandler;
+ Ewk_Context *__pContext;
+ uint64_t __notificationId;
+ std::unique_ptr<Tizen::Base::Runtime::Timer> __pTimer;
+ Tizen::Graphics::Dimension __screenRect;
+ _WebImpl* __pWebImpl;
+}; // _WebNotification
+
+}}}
+#endif // _FWEB_CTRL_INTERNAL_WEB_NOTIFCATION_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_WebNotificationHandler.cpp
+ * @brief The file contains the definition of _WebNotificationHandler class.
+ */
+
+#include "FWebCtrl_WebNotification.h"
+#include "FWebCtrl_WebNotificationHandler.h"
+#include <FBaseSysLog.h>
+
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+_WebNotificationHandler::_WebNotificationHandler(void)
+ : __pNotification(null)
+ , __state(NOTIFCATION_STATE_NORMAL)
+{
+}
+
+_WebNotificationHandler::~_WebNotificationHandler(void)
+{
+}
+
+
+result
+_WebNotificationHandler::Construct(_WebNotification* pNotification)
+{
+
+ SysTryReturnResult(NID_WEB_CTRL, pNotification != null, E_INVALID_ARG, "Notification instancce cannot be null.");
+
+ __pNotification = pNotification;
+ __pallete[NOTIFCATION_COLOR_BG_NORMAL] = NOTIFCATION_NORMAL_BLACKGROUND_COLOR;
+ __pallete[NOTIFCATION_COLOR_FG_NORMAL] = NOTIFCATION_NORMAL_FOREGROUND_COLOR;
+
+ __bounds = __pNotification->GetBounds();
+ return E_SUCCESS;
+}
+
+
+int
+_WebNotificationHandler::GetState(void) const
+{
+ return __state;
+}
+
+
+void
+_WebNotificationHandler::SetState(int newState)
+{
+ __state = newState;
+}
+
+
+bool
+_WebNotificationHandler::OnPreviewTouchMoved(Control &source, const TouchEventInfo &touchEventInfo)
+{
+ return false;
+}
+
+
+bool
+_WebNotificationHandler::OnPreviewTouchPressed(Control &source, const TouchEventInfo &touchEventInfo)
+{
+ return false;
+}
+
+
+bool
+_WebNotificationHandler::OnPreviewTouchReleased(Control &source, const TouchEventInfo &touchEventInfo)
+{
+ return false;
+}
+
+
+bool
+_WebNotificationHandler::OnTouchCanceled(Control &source, const TouchEventInfo &touchEventInfo)
+{
+ if (GetState() == NOTIFCATION_STATE_PRESSED)
+ {
+ SetState(NOTIFCATION_STATE_NORMAL);
+ __pNotification->Invalidate(false);
+ }
+ return true;
+}
+
+
+bool
+_WebNotificationHandler::OnTouchMoved(Control &source, const TouchEventInfo &touchEventInfo)
+{
+ return false;
+}
+
+
+bool
+_WebNotificationHandler::OnTouchPressed(Control &source, const TouchEventInfo &touchEventInfo)
+{
+ if (GetState() == NOTIFCATION_STATE_NORMAL)
+ {
+ SetState(NOTIFCATION_STATE_PRESSED);
+ __pNotification->Invalidate(false);
+ }
+ return true;
+}
+
+
+bool
+_WebNotificationHandler::OnTouchReleased(Control &source, const TouchEventInfo &touchEventInfo)
+{
+ if (GetState() == NOTIFCATION_STATE_PRESSED)
+ {
+ SetState(NOTIFCATION_STATE_NORMAL);
+ __pNotification->Invalidate(false);
+
+ __pNotification->OnClicked();
+ }
+ return true;
+}
+
+
+result
+_WebNotificationHandler::DrawNotification(Canvas& canvas)
+{
+ canvas.SetBackgroundColor(Color(0, 0, 0, 0));
+ canvas.Clear();
+ canvas.FillRoundRectangle(__pallete[NOTIFCATION_COLOR_BG_NORMAL], Rectangle(0, 0 , __bounds.width, __bounds.height), Dimension(5, 5));
+
+ EnrichedText enriched;
+ enriched.Construct(Dimension(__bounds.width, __bounds.height));
+ enriched.SetVerticalAlignment(TEXT_ALIGNMENT_MIDDLE);
+ enriched.SetHorizontalAlignment(TEXT_ALIGNMENT_CENTER);
+
+ TextElement element;
+ element.Construct(__text);
+// element.SetTextColor(__pallete[NOTIFCATION_COLOR_FG_NORMAL]);
+
+ enriched.Add(element);
+ canvas.DrawText(Point(0, 0), enriched);
+ enriched.RemoveAll(false);
+
+ return E_SUCCESS;
+}
+
+
+String
+_WebNotificationHandler::GetText(void) const
+{
+ return __text;
+}
+
+
+void
+_WebNotificationHandler::SetText(const String& text)
+{
+
+ __text = text;
+}
+
+}}}
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_WebNotificationImpl.h
+ * @brief The file contains the declaration of _WebNotificationHandler class.
+ *
+ * The file contains the declaration of _WebNotificationHandler class.
+ */
+#ifndef _FWEB_CTRL_INTERNAL_WEB_NOTIFCATION_Handler_H_
+#define _FWEB_CTRL_INTERNAL_WEB_NOTIFCATION_Handler_H_
+
+
+#include <FBaseString.h>
+#include <FGrpDimension.h>
+#include <FGrpRectangle.h>
+#include <FUiControl.h>
+#include <FUiIPropagatedTouchEventListener.h>
+#include <FUiTouchEventInfo.h>
+
+const Tizen::Graphics::Color NOTIFCATION_NORMAL_BLACKGROUND_COLOR = Tizen::Graphics::Color(255, 255, 255, 255);
+const Tizen::Graphics::Color NOTIFCATION_NORMAL_FOREGROUND_COLOR = Tizen::Graphics::Color(0, 0, 0, 255);
+const Tizen::Graphics::Rectangle NOTIFCATION_RECT_AREA = Tizen::Graphics::Rectangle(0,0,600,150);
+const Tizen::Graphics::Rectangle NOTIFCATION_BUTTON_AREA = Tizen::Graphics::Rectangle(550,0,50,50);
+
+const int NOTIFCATION_STATE_NORMAL = 0;
+const int NOTIFCATION_STATE_PRESSED = 1;
+const int NOTIFCATION_STATE_MAX = 2;
+
+const int NOTIFCATION_COLOR_BG_NORMAL = 0;
+const int NOTIFCATION_COLOR_FG_NORMAL = 1;
+const int NOTIFCATION_COLOR_MAX = 2;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+// forward declaration
+class _WebNotification;
+class _WebNotificationHandler;
+
+class _WebNotificationHandler
+ : public Tizen::Ui::IPropagatedTouchEventListener
+{
+// Life-cycle
+public:
+ _WebNotificationHandler(void);
+ virtual ~_WebNotificationHandler(void);
+
+ result Construct(_WebNotification* pnotification);
+
+ int GetState(void) const;
+ void SetState(int newState);
+
+ bool OnPreviewTouchMoved(Tizen::Ui::Control &source, const Tizen::Ui::TouchEventInfo &touchEventInfo);
+ bool OnPreviewTouchPressed(Tizen::Ui::Control &source, const Tizen::Ui::TouchEventInfo &touchEventInfo);
+ bool OnPreviewTouchReleased(Tizen::Ui::Control &source, const Tizen::Ui::TouchEventInfo &touchEventInfo);
+ bool OnTouchCanceled(Tizen::Ui::Control &source, const Tizen::Ui::TouchEventInfo &touchEventInfo);
+ bool OnTouchMoved(Tizen::Ui::Control &source, const Tizen::Ui::TouchEventInfo &touchEventInfo);
+ bool OnTouchPressed(Tizen::Ui::Control &source, const Tizen::Ui::TouchEventInfo &touchEventInfo);
+ bool OnTouchReleased(Tizen::Ui::Control &source, const Tizen::Ui::TouchEventInfo &touchEventInfo);
+
+ virtual result DrawNotification(Tizen::Graphics::Canvas& canvas);
+ void SetText(const Tizen::Base::String& text);
+ Tizen::Base::String GetText(void) const;
+
+
+protected:
+ _WebNotification* __pNotification;
+ int __state;
+ Tizen::Base::String __text;
+ Tizen::Graphics::Rectangle __bounds;
+ Tizen::Graphics::Color __pallete[NOTIFCATION_COLOR_MAX];
+}; // _WebNotificationHandler
+
+}}}
+#endif // _FWEB_CTRL_INTERNAL_WEB_NOTIFCATION_Handler_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_WebPopup.cpp
+ * @brief The file contains the definition of _WebPopup class.
+ */
+#include <FBaseColIList.h>
+#include <FBaseSysLog.h>
+#include <FGrpColor.h>
+#include <FUiCtrlButton.h>
+#include <FUiCtrlPanel.h>
+#include <FUiVerticalBoxLayout.h>
+#include <FUi_ResourceManager.h>
+#include "FWebCtrl_WebManager.h"
+#include "FWebCtrl_WebPopup.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Graphics;
+using namespace Tizen::Io;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+std::unique_ptr<_WebPopupData> _WebPopup::__pWebPopupData(null);
+
+_WebPopup::_WebPopup(void)
+ : __isModal(false)
+ , __modal(0)
+{
+}
+
+
+_WebPopup::~_WebPopup(void)
+{
+ _WebManager* pWebManager = _WebManager::GetInstance();
+ pWebManager->RemoveActivePopup(reinterpret_cast< int >(this));
+
+ if (IsModalPopup())
+ {
+ HidePopup();
+ }
+ __pWebPopupData.reset();
+}
+
+
+result
+_WebPopup::Construct(bool hasTitle, const Dimension& popupDim)
+{
+ VerticalBoxLayout layout;
+
+ Dimension dim(popupDim);
+
+ if (hasTitle)
+ {
+ dim.height += __pWebPopupData->titleHeight;
+ }
+
+ result r = layout.Construct(VERTICAL_DIRECTION_DOWNWARD);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = Popup::Construct(layout, layout, hasTitle, dim);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return E_SUCCESS;
+}
+
+
+void
+_WebPopup::OnActionPerformed(const Control& source, int actionId)
+{
+ switch (actionId)
+ {
+ case ID_BUTTON_COMMON_CLOSE:
+ HidePopup();
+ break;
+ default:
+ SysAssertf(false, "unknown action ID used");
+ break;
+ }
+
+ delete this;
+}
+
+
+result
+_WebPopup::ShowPopup(void)
+{
+ result r = E_SUCCESS;
+
+ _WebManager* pWebManager = _WebManager::GetInstance();
+ pWebManager->SetActivePopup(reinterpret_cast< int >(this));
+
+ r = SetShowState(true);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = Show();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return E_SUCCESS;
+}
+
+
+result
+_WebPopup::HidePopup(int modalResult)
+{
+ result r = E_SUCCESS;
+
+ r = SetShowState(false);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ if (__isModal)
+ {
+ __modal = modalResult;
+ __isModal = false;
+
+ r = EndModal(__modal);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+
+ return E_SUCCESS;
+}
+
+
+result
+_WebPopup::ShowAndWait(int& modalResult)
+{
+ _WebManager* pWebManager = _WebManager::GetInstance();
+ pWebManager->SetActivePopup(reinterpret_cast< int >(this));
+
+ __isModal = true;
+
+ return DoModal(modalResult);
+}
+
+
+Panel*
+_WebPopup::CreateAndAddPanel(void)
+{
+ std::unique_ptr<Panel> pPanel(new (std::nothrow) Panel());
+ SysTryReturn(NID_WEB_CTRL, pPanel.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ Rectangle panelRect(0, 0, GetSize().width, __pWebPopupData->panelHeight);
+
+ result r = pPanel->Construct(panelRect, GROUP_STYLE_BOTTOM);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ Color buttonBgColor(0x00000000);
+ GET_COLOR_CONFIG(MESSAGEBOX::BOTTOM_BG_NORMAL, buttonBgColor);
+ pPanel->SetBackgroundColor(buttonBgColor);
+
+ r = AddControl(*pPanel);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return pPanel.release();
+}
+
+
+result
+_WebPopup::CreateAndAddButtons(const IList& buttonIds, const IList& buttonTitles, Panel* pPanel)
+{
+ SysTryReturnResult(NID_WEB_CTRL, pPanel, E_INVALID_ARG, "[%s] Panel Pointer is null.", GetErrorMessage(E_INVALID_ARG));
+
+ _WebPopup* pParent = dynamic_cast<_WebPopup*>(pPanel->GetParent());
+ SysTryReturnResult(NID_WEB_CTRL, pParent == this, E_INVALID_ARG, "[E_INVALID_ARG] Panel not attached to popup.");
+
+ int idCount = buttonIds.GetCount();
+ int titleCount = buttonTitles.GetCount();
+ SysTryReturnResult(NID_WEB_CTRL, idCount > 0 && titleCount > 0 && idCount == titleCount, E_INVALID_DATA, "[E_INVALID_DATA] mismatch in count of Ids and Ttitles.");
+
+ int buttonMargin = __pWebPopupData->spacePad/2;
+ if (idCount == 1)
+ {
+ GET_SHAPE_CONFIG(MESSAGEBOX::BUTTON_SIDE_MARGIN_01, _CONTROL_ORIENTATION_PORTRAIT, buttonMargin);
+ }
+ int buttonWidth = (GetSize().width - buttonMargin*(idCount+1)) / idCount;
+ int buttonTopMargin = (__pWebPopupData->panelHeight - __pWebPopupData->btnDim.height)/2;
+
+ result r = E_SUCCESS;
+
+ //Button Colors
+ Color buttonColorNormal(0x00000000);
+ Color buttonColorPressed(0x00000000);
+ Color buttonColorDisabled(0x00000000);
+ Color buttonColorHighlighted(0x00000000);
+ Color buttonTextNormal(0x00000000);
+ Color buttonTextPressed(0x00000000);
+ Color buttonTextDisabled(0x00000000);
+ Color buttonTextHighlighted(0x00000000);
+
+ Bitmap* pComposedButtonBgNormal = null;
+ Bitmap* pComposedButtonBgPressed = null;
+ Bitmap* pComposedButtonBgDisabled = null;
+ Bitmap* pComposedButtonBgHighlighted = null;
+
+ GET_COLOR_CONFIG(MESSAGEBOX::BOTTOM_BUTTON_BG_NORMAL, buttonColorNormal);
+ GET_COLOR_CONFIG(MESSAGEBOX::BOTTOM_BUTTON_BG_PRESSED, buttonColorPressed);
+ GET_COLOR_CONFIG(MESSAGEBOX::BOTTOM_BUTTON_BG_DISABLED, buttonColorDisabled);
+ GET_COLOR_CONFIG(MESSAGEBOX::BOTTOM_BUTTON_BG_HIGHLIGHTED, buttonColorHighlighted);
+
+ GET_COLOR_CONFIG(MESSAGEBOX::BOTTOM_BUTTON_TEXT_NORMAL, buttonTextNormal);
+ GET_COLOR_CONFIG(MESSAGEBOX::BOTTOM_BUTTON_TEXT_PRESSED, buttonTextPressed);
+ GET_COLOR_CONFIG(MESSAGEBOX::BOTTOM_BUTTON_TEXT_DISABLED, buttonTextDisabled);
+ GET_COLOR_CONFIG(MESSAGEBOX::BOTTOM_BUTTON_TEXT_HIGHLIGHTED, buttonTextHighlighted);
+
+ r = GET_REPLACED_BITMAP_CONFIG_N(MESSAGEBOX::BOTTOM_BUTTON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, buttonColorNormal, pComposedButtonBgNormal);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ std::unique_ptr< Bitmap > pComposedBtnBgNormal(pComposedButtonBgNormal);
+
+ r = GET_REPLACED_BITMAP_CONFIG_N(MESSAGEBOX::BOTTOM_BUTTON_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, buttonColorPressed, pComposedButtonBgPressed);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ std::unique_ptr< Bitmap > pComposedBtnBgPressed(pComposedButtonBgPressed);
+
+ r = GET_REPLACED_BITMAP_CONFIG_N(MESSAGEBOX::BOTTOM_BUTTON_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, buttonColorDisabled, pComposedButtonBgDisabled);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ std::unique_ptr< Bitmap > pComposedBtnBgDisabled(pComposedButtonBgDisabled);
+
+ r = GET_REPLACED_BITMAP_CONFIG_N(MESSAGEBOX::BOTTOM_BUTTON_BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, buttonColorHighlighted, pComposedButtonBgHighlighted);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ std::unique_ptr< Bitmap > pComposedBtnBgHighlighted(pComposedButtonBgHighlighted);
+
+ for (int i = 0; i < idCount; i++)
+ {
+ const Integer* pButtonId = static_cast<const Integer*>(buttonIds.GetAt(i));
+ const String* pButtonTitle = static_cast<const String*>(buttonTitles.GetAt(i));
+ SysTryReturn(NID_WEB_CTRL, pButtonId && pButtonTitle, r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ //Create button
+ std::unique_ptr<Button> pButton(new (std::nothrow) Button());
+ SysTryReturnResult(NID_WEB_CTRL, pButton.get(), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory Allocation failed.");
+
+ r = pButton->Construct(Rectangle((buttonMargin*(i+1))+(buttonWidth*i), buttonTopMargin, buttonWidth, __pWebPopupData->btnDim.height), *pButtonTitle);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pButton->SetActionId(pButtonId->ToInt());
+
+ pButton->SetNormalBackgroundBitmap(*pComposedBtnBgNormal);
+ pButton->SetPressedBackgroundBitmap(*pComposedBtnBgPressed);
+ pButton->SetDisabledBackgroundBitmap(*pComposedBtnBgDisabled);
+ pButton->SetHighlightedBackgroundBitmap(*pComposedBtnBgHighlighted);
+ pButton->SetTextColor(buttonTextNormal);
+ pButton->SetPressedTextColor(buttonTextPressed);
+ pButton->SetDisabledTextColor(buttonTextDisabled);
+ pButton->SetHighlightedTextColor(buttonTextHighlighted);
+
+ //Add button to panel
+ r = pPanel->AddControl(*pButton);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pButton->AddActionEventListener(*this);
+ pButton.release();
+ }
+
+ return r;
+}
+
+
+bool
+_WebPopup::IsModalPopup(void)
+{
+ return __isModal;
+}
+
+
+_WebPopupData*
+_WebPopup::GetPopupData(bool refresh)
+{
+ if (!refresh && __pWebPopupData.get())
+ {
+ return __pWebPopupData.get();
+ }
+
+ __pWebPopupData.reset();
+
+ __pWebPopupData = std::unique_ptr<_WebPopupData> (new (std::nothrow) _WebPopupData());
+ SysTryReturn(NID_WEB_CTRL, __pWebPopupData.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ _ControlOrientation orientation = _CONTROL_ORIENTATION_PORTRAIT;
+
+ GET_SHAPE_CONFIG(MESSAGEBOX::DEFAULT_WIDTH, orientation, __pWebPopupData->popupDim.width);
+ GET_SHAPE_CONFIG(MESSAGEBOX::MAX_HEIGHT, orientation, __pWebPopupData->popupDim.height);
+ GET_SHAPE_CONFIG(POPUP::SIDE_BORDER, orientation, __pWebPopupData->sideMargin);
+ GET_SHAPE_CONFIG(POPUP::BOTTOM_BORDER, orientation, __pWebPopupData->bottomMargin);
+ GET_SHAPE_CONFIG(POPUP::TITLE_HEIGHT, orientation, __pWebPopupData->titleHeight);
+
+ GET_SHAPE_CONFIG(MESSAGEBOX::BUTTON_HEIGHT, orientation, __pWebPopupData->btnDim.height);
+ GET_SHAPE_CONFIG(MESSAGEBOX::BUTTON_SIDE_MARGIN_02, orientation, __pWebPopupData->spacePad);
+ GET_SHAPE_CONFIG(MESSAGEBOX::BOTTOM_HEIGHT, orientation, __pWebPopupData->panelHeight);
+
+ GET_SHAPE_CONFIG(LABEL::TEXT_FONT_SIZE, orientation, __pWebPopupData->labelFontSize);
+ GET_DIMENSION_CONFIG(CHECKBUTTON::MIN_DIMENSION, orientation, __pWebPopupData->checkDim);
+
+ GET_DIMENSION_CONFIG(EDIT::MIN_SIZE, orientation, __pWebPopupData->editDim);
+
+ __pWebPopupData->labelDim.width = __pWebPopupData->popupDim.width - 2*__pWebPopupData->sideMargin;
+ __pWebPopupData->labelDim.height = 3*__pWebPopupData->labelFontSize;
+
+ return __pWebPopupData.get();
+}
+
+
+result
+_WebPopup::OnTerminating(void)
+{
+ return E_SUCCESS;
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_WebImpl.cpp
+ * @brief The file contains the definition of _WebImpl class.
+ *
+ * The file contains the definition of _WebImpl class.
+ */
+#include <FBaseSysLog.h>
+#include <FApp_AppImpl.h>
+#include "FWebCtrl_WebManager.h"
+#include "FWebCtrl_WebPresenter.h"
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+_WebPresenter::_WebPresenter(const Object* callerAddress)
+ : __stopState(false)
+ , __boolean(false)
+ , __string(L"")
+ , __integer(0)
+ , __pIList(null)
+ , __longInteger(0)
+ , __callerAddress(reinterpret_cast< int >(callerAddress))
+{
+ _WebManager* pWebManager = _WebManager::GetInstance();
+ pWebManager->AddCallback(__callerAddress, reinterpret_cast< int >(this));
+}
+
+
+_WebPresenter::~_WebPresenter(void)
+{
+ __stopState = false;
+
+ _WebManager* pWebManager = _WebManager::GetInstance();
+ pWebManager->RemoveCallback(__callerAddress, reinterpret_cast< int >(this));
+}
+
+
+void
+_WebPresenter::WaitAsyncProcess(bool& result)
+{
+ ProcessEvent();
+
+ result = __boolean;
+}
+
+
+void
+_WebPresenter::WaitAsyncProcess(Tizen::Base::String& result)
+{
+ ProcessEvent();
+
+ result = __string;
+}
+
+
+void
+_WebPresenter::WaitAsyncProcess(int& result)
+{
+ ProcessEvent();
+
+ result = __integer;
+}
+
+
+Eina_List*
+_WebPresenter::WaitAsyncProcess()
+{
+ ProcessEvent();
+
+ return __pIList;
+}
+
+
+void
+_WebPresenter::WaitAsyncProcess(long& result)
+{
+ ProcessEvent();
+
+ result = __longInteger;
+}
+
+
+void
+_WebPresenter::ProcessEvent(void)
+{
+ while (true)
+ {
+ if (__stopState)
+ {
+ break;
+ }
+
+ if (Tizen::App::_AppImpl::IsTerminationRequested())
+ {
+ break;
+ }
+
+ ecore_main_loop_iterate();
+ }
+}
+
+
+void
+_WebPresenter::EndAsyncProcess(const Tizen::Base::String& result)
+{
+ __string = const_cast< Tizen::Base::String& >(result);
+ __stopState = true;
+}
+
+
+void
+_WebPresenter::EndAsyncProcess(bool result)
+{
+ __boolean = result;
+ __stopState = true;
+}
+
+
+void
+_WebPresenter::EndAsyncProcess(int result)
+{
+ __integer = result;
+ __stopState = true;
+}
+
+
+void
+_WebPresenter::EndAsyncProcess(const Eina_List* result)
+{
+ __pIList = const_cast<Eina_List*>(result);
+ __stopState = true;
+}
+
+
+void
+_WebPresenter::EndAsyncProcess(long result)
+{
+ __longInteger = result;
+ __stopState = true;
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_WebImpl.h
+ * @brief The file contains the declaration of _WebImpl class.
+ *
+ * The file contains the declaration of _WebImpl class.
+ */
+#ifndef _FWEB_CTRL_INTERNAL_WEB_PRESENTER_H_
+#define _FWEB_CTRL_INTERNAL_WEB_PRESENTER_H_
+
+#include <Ecore.h>
+#include <FBaseString.h>
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+class _WebPresenter
+ : public Tizen::Base::Object
+{
+// Lifecycle
+public:
+ _WebPresenter(const Tizen::Base::Object* callerAddress);
+
+ virtual ~_WebPresenter(void);
+
+// Operations
+public:
+ void WaitAsyncProcess(bool& result);
+ void WaitAsyncProcess(Tizen::Base::String& result);
+ void WaitAsyncProcess(int& result);
+ void WaitAsyncProcess(long& result);
+ Eina_List* WaitAsyncProcess(void);
+
+ void EndAsyncProcess(bool result);
+ void EndAsyncProcess(const Tizen::Base::String& result);
+ void EndAsyncProcess(int result);
+ void EndAsyncProcess(long result);
+ void EndAsyncProcess(const Eina_List* result);
+
+private:
+ _WebPresenter(const _WebPresenter& rhs);
+
+ _WebPresenter& operator =(const _WebPresenter& rhs);
+
+ void ProcessEvent(void);
+//Attribute
+private:
+ bool __stopState;
+
+ bool __boolean;
+ Tizen::Base::String __string;
+ int __integer;
+ Eina_List* __pIList;
+ long __longInteger;
+
+ int __callerAddress;
+};
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_WEB_PRESENTER_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrlWebSetting.cpp
+ * @brief The file contains the definition of WebSetting class.
+ *
+ * The file contains the definition of WebSetting class.
+ */
+#include <unique_ptr.h>
+#include <vconf.h>
+#include <FBaseBoolean.h>
+#include <FBaseInteger.h>
+#include <FWebCtrlWebSetting.h>
+#include <FBaseSysLog.h>
+#include "FWebCtrl_WebSettingImpl.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Ui::Controls;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+static const wchar_t* DEFAULT_ENCODING_MODE = L"UTF-8";
+static const int DEFAULT_FONT_SIZE = 16;
+static const float DEFAULT_ZOOM_LEVEL = 2.0f;
+static const wchar_t* DEFAULT_USER_AGENT = L"Mozilla/5.0 (Linux; Tizen 2.2; sdk) AppleWebKit/537.3 (KHTML, like Gecko) Version/2.2 Mobile Safari/537.3";
+
+
+_WebSettingImpl::_WebSettingImpl(void)
+ : __cacheMode(WEB_CACHE_VALIDATED)
+ , __encoding(DEFAULT_ENCODING_MODE)
+ , __fontSize(DEFAULT_FONT_SIZE)
+ , __javascriptEnabled(true)
+ , __autoImageEnabled(true)
+ , __isScrollEnabled(true)
+ , __isPrivateBrowsingEnabled(false)
+ , __isCookieEnabled(true)
+ , __zoomLevel(DEFAULT_ZOOM_LEVEL)
+ , __inputStyle(INPUT_STYLE_FULLSCREEN)
+ , __certificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM)
+ , __autoFittingEnabled(true)
+ , __javaScriptPopupEnabled(true)
+ , __geolocationEnabled(true)
+ , __autoFormDataEnabled(true)
+ , __autoLoginFormEnabled(true)
+{
+ char* pUserAgent = vconf_get_str(VCONFKEY_BROWSER_USER_AGENT);
+ if(pUserAgent)
+ {
+ __userAgent = pUserAgent;
+ free(pUserAgent);
+ }
+ else
+ {
+ __userAgent = DEFAULT_USER_AGENT;
+ }
+}
+
+
+_WebSettingImpl::~_WebSettingImpl(void)
+{
+}
+
+
+void
+_WebSettingImpl::SetCacheControl(CacheMode mode)
+{
+ __cacheMode = mode;
+}
+
+
+CacheMode
+_WebSettingImpl::GetCacheControl(void) const
+{
+ return __cacheMode;
+}
+
+
+void
+_WebSettingImpl::SetFontSize(int fontSize)
+{
+ __fontSize = fontSize;
+}
+
+
+int
+_WebSettingImpl::GetFontSize(void) const
+{
+ return __fontSize;
+}
+
+
+void
+_WebSettingImpl::SetDefaultTextEncoding(const Tizen::Base::String& encoding)
+{
+ __encoding = encoding;
+}
+
+
+Tizen::Base::String
+_WebSettingImpl::GetDefaultTextEncoding(void) const
+{
+ return __encoding;
+}
+
+
+void
+_WebSettingImpl::SetJavascriptEnabled(bool enable)
+{
+ __javascriptEnabled = enable;
+}
+
+
+void
+_WebSettingImpl::SetAutoImageLoadEnabled(bool enable)
+{
+ __autoImageEnabled = enable;
+}
+
+
+bool
+_WebSettingImpl::IsJavascriptEnabled(void) const
+{
+ return __javascriptEnabled;
+}
+
+
+bool
+_WebSettingImpl::IsAutoImageLoadEnabled(void) const
+{
+ return __autoImageEnabled;
+}
+
+
+void
+_WebSettingImpl::SetInputStyle(Tizen::Ui::Controls::InputStyle inputStyle)
+{
+ __inputStyle = inputStyle;
+}
+
+
+Tizen::Ui::Controls::InputStyle
+_WebSettingImpl::GetInputStyle(void) const
+{
+ return __inputStyle;
+}
+
+
+void
+_WebSettingImpl::SetCertificateErrorHandlingMode(CertificateErrorHandlingMode mode)
+{
+ __certificateErrorHandlingMode = mode;
+}
+
+
+CertificateErrorHandlingMode
+_WebSettingImpl::GetCertificateErrorHandlingMode(void) const
+{
+ return __certificateErrorHandlingMode;
+}
+
+
+void
+_WebSettingImpl::SetUserAgent(const Tizen::Base::String& agent)
+{
+ __userAgent = agent;
+}
+
+
+Tizen::Base::String
+_WebSettingImpl::GetUserAgent(void) const
+{
+ return __userAgent;
+}
+
+
+void
+_WebSettingImpl::SetScrollEnabled(bool enable)
+{
+ __isScrollEnabled = enable;
+}
+
+
+bool
+_WebSettingImpl::IsScrollEnabled(void) const
+{
+ return __isScrollEnabled;
+}
+
+
+void
+_WebSettingImpl::SetPrivateBrowsingEnabled(bool enable)
+{
+ __isPrivateBrowsingEnabled = enable;
+}
+
+
+bool
+_WebSettingImpl::IsPrivateBrowsingEnabled(void) const
+{
+ return __isPrivateBrowsingEnabled;
+}
+
+
+void
+_WebSettingImpl::SetCookiEnabled(bool enable)
+{
+ __isCookieEnabled = enable;
+}
+
+
+bool
+_WebSettingImpl::IsCookieEnabled(void) const
+{
+ return __isCookieEnabled;
+}
+
+
+void
+_WebSettingImpl::SetZoomLevel(float level)
+{
+ __zoomLevel = level;
+}
+
+
+float
+_WebSettingImpl::GetZoomLevel(void) const
+{
+ return __zoomLevel;
+}
+
+
+void
+_WebSettingImpl::SetAutoFittingEnabled(bool enable)
+{
+ __autoFittingEnabled = enable;
+}
+
+
+bool
+_WebSettingImpl::IsAutoFittingEnabled(void) const
+{
+ return __autoFittingEnabled;
+}
+
+
+void
+_WebSettingImpl::SetJavaScriptPopupEnabled(bool enable)
+{
+ __javaScriptPopupEnabled = enable;
+}
+
+
+bool
+_WebSettingImpl::IsJavaScriptPopupEnabled(void) const
+{
+ return __javaScriptPopupEnabled;
+}
+
+
+void
+_WebSettingImpl::SetGeolocationEnabled(bool enable)
+{
+ __geolocationEnabled = enable;
+}
+
+
+bool
+_WebSettingImpl::IsGeolocationEnabled(void) const
+{
+ return __geolocationEnabled;
+}
+
+
+void
+_WebSettingImpl::SetAutoFormDataShowEnabled(bool enable)
+{
+ __autoFormDataEnabled = enable;
+}
+
+
+bool
+_WebSettingImpl::IsAutoFormDataShowEnabled(void) const
+{
+ return __autoFormDataEnabled;
+}
+
+
+void
+_WebSettingImpl::SetAutoLoginFormFillEnabled(bool enable)
+{
+ __autoLoginFormEnabled = enable;
+}
+
+
+bool
+_WebSettingImpl::IsAutoLoginFormFillEnabled(void) const
+{
+ return __autoLoginFormEnabled;
+}
+
+
+bool
+_WebSettingImpl::Equals(const Object& obj) const
+{
+ const _WebSettingImpl* pRhs = dynamic_cast< const _WebSettingImpl* >(&obj);
+ if (pRhs == null)
+ {
+ return false;
+ }
+
+ return __cacheMode == pRhs->__cacheMode && __encoding == pRhs->__encoding && __fontSize == pRhs->__fontSize
+ && __javascriptEnabled == pRhs->__javascriptEnabled && __autoImageEnabled == pRhs->__autoImageEnabled
+ && __isScrollEnabled == pRhs->__isScrollEnabled && __inputStyle == pRhs->__inputStyle
+ && __certificateErrorHandlingMode == pRhs->__certificateErrorHandlingMode && __userAgent == pRhs->__userAgent
+ && __autoFittingEnabled == pRhs->__autoFittingEnabled && __javaScriptPopupEnabled == pRhs->__javaScriptPopupEnabled
+ && __geolocationEnabled == pRhs->__geolocationEnabled && __autoFormDataEnabled == pRhs->__autoFormDataEnabled
+ && __autoLoginFormEnabled == pRhs->__autoLoginFormEnabled;
+}
+
+
+int
+_WebSettingImpl::GetHashCode(void) const
+{
+ return Integer(__cacheMode).GetHashCode() + __encoding.GetHashCode() + Integer(__fontSize).GetHashCode()
+ + Boolean(__javascriptEnabled).GetHashCode() + Boolean(__autoImageEnabled).GetHashCode()
+ + Boolean(__isScrollEnabled).GetHashCode() + Integer(__inputStyle).GetHashCode()
+ + Integer(__certificateErrorHandlingMode).GetHashCode() + __userAgent.GetHashCode()
+ + Boolean(__autoFittingEnabled).GetHashCode() + Boolean(__javaScriptPopupEnabled).GetHashCode()
+ + Boolean(__geolocationEnabled).GetHashCode() + Boolean(__autoFormDataEnabled).GetHashCode()
+ + Boolean(__autoLoginFormEnabled).GetHashCode();
+}
+
+
+_WebSettingImpl*
+_WebSettingImpl::GetInstance(WebSetting* pWebSetting)
+{
+ return pWebSetting->__pWebSettingImpl;
+}
+
+
+const _WebSettingImpl*
+_WebSettingImpl::GetInstance(const WebSetting* pWebSetting)
+{
+ return pWebSetting->__pWebSettingImpl;
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_WebSettingImpl.h
+ * @brief The file contains the declaration of _WebSettingImpl class.
+ *
+ * The file contains the declaration of _WebSettingImpl class.
+ */
+#ifndef _FWEB_CTRL_INTERNAL_WEB_SETTING_IMPL_H_
+#define _FWEB_CTRL_INTERNAL_WEB_SETTING_IMPL_H_
+
+#include <FBaseObject.h>
+#include <FUiCtrlInputTypes.h>
+#include <FWebCtrlWebSetting.h>
+
+namespace Tizen { namespace Web { namespace Controls
+{
+class WebSetting;
+
+
+class _WebSettingImpl
+ : public Tizen::Base::Object
+{
+
+public:
+ _WebSettingImpl(void);
+
+ virtual ~_WebSettingImpl(void);
+
+ void SetCacheControl(CacheMode mode);
+
+ CacheMode GetCacheControl(void) const;
+
+ void SetFontSize(int fontSize);
+
+ int GetFontSize(void) const;
+
+ void SetDefaultTextEncoding(const Tizen::Base::String& encoding);
+
+ Tizen::Base::String GetDefaultTextEncoding(void) const;
+
+ void SetJavascriptEnabled(bool enable);
+
+ void SetAutoImageLoadEnabled(bool enable);
+
+ bool IsJavascriptEnabled(void) const;
+
+ bool IsAutoImageLoadEnabled(void) const;
+
+ void SetInputStyle(Tizen::Ui::Controls::InputStyle inputStyle);
+
+ Tizen::Ui::Controls::InputStyle GetInputStyle(void) const;
+
+ void SetCertificateErrorHandlingMode(CertificateErrorHandlingMode mode);
+
+ CertificateErrorHandlingMode GetCertificateErrorHandlingMode(void) const;
+
+ void SetUserAgent(const Tizen::Base::String& agent);
+
+ Tizen::Base::String GetUserAgent(void) const;
+
+ void SetScrollEnabled(bool enable);
+
+ bool IsScrollEnabled(void) const;
+
+ void SetPrivateBrowsingEnabled(bool enable);
+
+ bool IsPrivateBrowsingEnabled(void) const;
+
+ void SetCookiEnabled(bool enable);
+
+ bool IsCookieEnabled(void) const;
+
+ void SetZoomLevel(float level);
+
+ float GetZoomLevel(void) const;
+
+ void SetAutoFittingEnabled(bool enable);
+
+ bool IsAutoFittingEnabled(void) const;
+
+ void SetJavaScriptPopupEnabled(bool enable);
+
+ bool IsJavaScriptPopupEnabled(void) const;
+
+ void SetGeolocationEnabled(bool enable);
+
+ bool IsGeolocationEnabled(void) const;
+
+ void SetAutoFormDataShowEnabled(bool enable);
+
+ bool IsAutoFormDataShowEnabled(void) const;
+
+ void SetAutoLoginFormFillEnabled(bool enable);
+
+ bool IsAutoLoginFormFillEnabled(void) const;
+
+ virtual bool Equals(const Object& obj) const;
+
+ virtual int GetHashCode(void) const;
+
+ static _WebSettingImpl* GetInstance(WebSetting* pWebSetting);
+
+ static const _WebSettingImpl* GetInstance(const WebSetting* pWebSetting);
+
+private:
+ CacheMode __cacheMode;
+
+ Tizen::Base::String __encoding;
+
+ int __fontSize;
+
+ bool __javascriptEnabled;
+
+ bool __autoImageEnabled;
+
+ bool __isScrollEnabled;
+
+ bool __isPrivateBrowsingEnabled;
+
+ bool __isCookieEnabled;
+
+ float __zoomLevel;
+
+ Tizen::Ui::Controls::InputStyle __inputStyle;
+
+ CertificateErrorHandlingMode __certificateErrorHandlingMode;
+
+ Tizen::Base::String __userAgent;
+
+ bool __autoFittingEnabled;
+
+ bool __javaScriptPopupEnabled;
+
+ bool __geolocationEnabled;
+
+ bool __autoFormDataEnabled;
+
+ bool __autoLoginFormEnabled;
+}; // _WebSettingImpl
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_WEB_SETTING_IMPL_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_WebStorageManagerImpl.cpp
+ * @brief The file contains the definition of _WebStorageManagerImpl class.
+ */
+#include <EWebKit2.h>
+#include <FBaseColAllElementsDeleter.h>
+#include <FBaseColArrayList.h>
+#include <FBaseColIList.h>
+#include <FBaseSysLog.h>
+#include "FWebCtrl_Utility.h"
+#include "FWebCtrl_WebPresenter.h"
+#include "FWebCtrl_WebStorageManagerImpl.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+void
+OnOriginReceived(Eina_List* pOrigins, void* pUserData)
+{
+ _WebPresenter* pPresenter = reinterpret_cast< _WebPresenter* >(pUserData);
+
+ pPresenter->EndAsyncProcess(pOrigins);
+}
+
+
+void
+OnIntReceived(int64_t integer, void* pUserData)
+{
+ _WebPresenter* pPresenter = reinterpret_cast< _WebPresenter* >(pUserData);
+
+ pPresenter->EndAsyncProcess((long)integer);
+}
+
+
+void
+OnUIntReceived(uint64_t integer, void* pUserData)
+{
+ _WebPresenter* pPresenter = reinterpret_cast< _WebPresenter* >(pUserData);
+
+ pPresenter->EndAsyncProcess((long)integer);
+}
+
+
+_WebStorageManagerImpl::_WebStorageManagerImpl(void)
+{
+}
+
+
+_WebStorageManagerImpl::~_WebStorageManagerImpl(void)
+{
+}
+
+
+IList*
+_WebStorageManagerImpl::GetOriginListN(WebStorageType storageType)
+{
+ result r = E_SUCCESS;
+
+ Ewk_Context* pDefaultContext = ewk_context_default_get();
+
+ std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
+ SysTryReturn(NID_WEB_CTRL, pPresenter.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ switch (storageType)
+ {
+ case WEB_STORAGE_TYPE_APPLICATION_CACHE:
+ ewk_context_application_cache_origins_get(pDefaultContext, OnOriginReceived, pPresenter.get());
+ break;
+
+ case WEB_STORAGE_TYPE_WEB_SQL_DATABASE:
+ ewk_context_web_database_origins_get(pDefaultContext, OnOriginReceived, pPresenter.get());
+ break;
+
+ case WEB_STORAGE_TYPE_WEB_STORAGE:
+ ewk_context_web_storage_origins_get(pDefaultContext, OnOriginReceived, pPresenter.get());
+ break;
+
+ case WEB_STORAGE_TYPE_FILE_SYSTEM:
+ ewk_context_local_file_system_origins_get(pDefaultContext, OnOriginReceived, pPresenter.get());
+ break;
+
+ default:
+ break;
+ }
+
+ Eina_List* pOriginEinaList = pPresenter->WaitAsyncProcess();
+ if (!pOriginEinaList)
+ {
+ return null;
+ }
+
+ std::unique_ptr<ArrayList, AllElementsDeleter> pOriginList(new (std::nothrow) ArrayList());
+ SysTryReturn(NID_WEB_CTRL, pOriginList.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pOriginList->Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ for (; pOriginEinaList; pOriginEinaList = eina_list_next(pOriginEinaList))
+ {
+ Ewk_Security_Origin* pOrigin = static_cast<Ewk_Security_Origin*>(eina_list_data_get(pOriginEinaList));
+ std::unique_ptr<String> pStringOrigin(new (std::nothrow) String(_Utility::CreateOrigin(pOrigin)));
+ SysTryReturn(NID_WEB_CTRL, pStringOrigin.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pOriginList->Add(pStringOrigin.get());
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+ pStringOrigin.release();
+ }
+
+ return pOriginList.release();
+}
+
+
+result
+_WebStorageManagerImpl::SetQuotaForOrigin(WebStorageType storageType, const String& origin, long quota)
+{
+ Ewk_Context* pDefaultContext = ewk_context_default_get();
+ Ewk_Security_Origin* pOrigin = null;
+
+ switch (storageType)
+ {
+ case WEB_STORAGE_TYPE_APPLICATION_CACHE:
+ pOrigin = CompareOrigin(WEB_STORAGE_TYPE_APPLICATION_CACHE, origin);
+ SysTryReturnResult(NID_WEB_CTRL, pOrigin, E_INVALID_ARG, "This origin does not exist.");
+
+ ewk_context_application_cache_quota_for_origin_set(pDefaultContext, pOrigin, quota);
+ break;
+
+ case WEB_STORAGE_TYPE_WEB_SQL_DATABASE:
+ pOrigin = CompareOrigin(WEB_STORAGE_TYPE_WEB_SQL_DATABASE, origin);
+ SysTryReturnResult(NID_WEB_CTRL, pOrigin, E_INVALID_ARG, "This origin does not exist.");
+
+ ewk_context_web_database_quota_for_origin_set(pDefaultContext, pOrigin, quota);
+ break;
+
+ default:
+ SysLogException(NID_WEB_CTRL, E_UNSUPPORTED_TYPE, "This storage type %d is not supported.", storageType);
+ return E_UNSUPPORTED_TYPE;
+ }
+ return E_SUCCESS;
+}
+
+
+long
+_WebStorageManagerImpl::GetQuotaForOrigin(WebStorageType storageType, const String& origin)
+{
+ Ewk_Context* pDefaultContext = ewk_context_default_get();
+ long quota = 0;
+
+ SysTryReturn(NID_WEB_CTRL, storageType == WEB_STORAGE_TYPE_WEB_SQL_DATABASE, -1, E_UNSUPPORTED_TYPE, "[%s] This storage type is not supported.", GetErrorMessage(E_UNSUPPORTED_TYPE));
+
+ Ewk_Security_Origin* pOrigin = CompareOrigin(storageType, origin);
+ SysTryReturn(NID_WEB_CTRL, pOrigin, -1.0, E_INVALID_ARG, "[%s] This origin does not exist.", GetErrorMessage(E_INVALID_ARG));
+
+ std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
+ SysTryReturn(NID_WEB_CTRL, pPresenter.get(), -1.0, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ ewk_context_web_database_quota_for_origin_get(pDefaultContext, OnUIntReceived, pPresenter.get(), pOrigin);
+
+ pPresenter->WaitAsyncProcess(quota);
+
+ return quota;
+}
+
+
+long
+_WebStorageManagerImpl::GetUsageForOrigin(WebStorageType storageType, const String& origin)
+{
+ Ewk_Context* pDefaultContext = ewk_context_default_get();
+ long usage = 0;
+
+ SysTryReturn(NID_WEB_CTRL, (storageType != WEB_STORAGE_TYPE_INDEXED_DATABASE) && (storageType != WEB_STORAGE_TYPE_FILE_SYSTEM), -1, E_UNSUPPORTED_TYPE, "[%s] This storage type is not supported.", GetErrorMessage(E_UNSUPPORTED_TYPE));
+
+ Ewk_Security_Origin* pOrigin = CompareOrigin(storageType, origin);
+ SysTryReturn(NID_WEB_CTRL, pOrigin, -1, E_INVALID_ARG, "[%s] This origin does not exist.", GetErrorMessage(E_INVALID_ARG));
+
+ std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
+ SysTryReturn(NID_WEB_CTRL, pPresenter.get(), -1.0, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ switch (storageType)
+ {
+ case WEB_STORAGE_TYPE_APPLICATION_CACHE:
+// ewk_context_application_cache_usage_for_origin_get(pDefaultContext, pOrigin, OnIntReceived, pPresenter.get());
+ break;
+
+ case WEB_STORAGE_TYPE_WEB_SQL_DATABASE:
+ ewk_context_web_database_usage_for_origin_get(pDefaultContext, OnUIntReceived, pPresenter.get(), pOrigin);
+ break;
+
+ case WEB_STORAGE_TYPE_WEB_STORAGE :
+ ewk_context_web_storage_usage_for_origin_get(pDefaultContext, pOrigin, OnUIntReceived, pPresenter.get());
+ break;
+
+ default:
+ break;
+ }
+
+ pPresenter->WaitAsyncProcess(usage);
+
+ return usage;
+}
+
+
+result
+_WebStorageManagerImpl::Remove(WebStorageType storageType, const String& origin)
+{
+ Ewk_Context* pDefaultContext = ewk_context_default_get();
+
+ SysTryReturnResult(NID_WEB_CTRL, storageType != WEB_STORAGE_TYPE_INDEXED_DATABASE, E_UNSUPPORTED_TYPE, "This storage type is not supported.");
+
+ Ewk_Security_Origin* pOrigin = CompareOrigin(storageType, origin);
+ SysTryReturnResult(NID_WEB_CTRL, pOrigin, E_INVALID_ARG, "This origin does not exist.");
+
+ switch (storageType)
+ {
+ case WEB_STORAGE_TYPE_APPLICATION_CACHE:
+ ewk_context_application_cache_delete(pDefaultContext, pOrigin);
+ break;
+
+ case WEB_STORAGE_TYPE_WEB_SQL_DATABASE:
+ ewk_context_web_database_delete(pDefaultContext, pOrigin);
+ break;
+
+ case WEB_STORAGE_TYPE_WEB_STORAGE :
+ ewk_context_web_storage_origin_delete(pDefaultContext, pOrigin);
+ break;
+
+ case WEB_STORAGE_TYPE_FILE_SYSTEM:
+ ewk_context_local_file_system_delete(pDefaultContext, pOrigin);
+ break;
+
+ default:
+ break;
+ }
+
+ return E_SUCCESS;
+}
+
+
+result
+_WebStorageManagerImpl::RemoveAll(WebStorageType storageType)
+{
+ Ewk_Context* pDefaultContext = ewk_context_default_get();
+
+ switch (storageType)
+ {
+ case WEB_STORAGE_TYPE_APPLICATION_CACHE:
+ ewk_context_application_cache_delete_all(pDefaultContext);
+ break;
+
+ case WEB_STORAGE_TYPE_INDEXED_DATABASE :
+ ewk_context_web_indexed_database_delete_all(pDefaultContext);
+ break;
+
+ case WEB_STORAGE_TYPE_WEB_SQL_DATABASE:
+ ewk_context_web_database_delete_all(pDefaultContext);
+ break;
+
+ case WEB_STORAGE_TYPE_WEB_STORAGE :
+ ewk_context_web_storage_delete_all(pDefaultContext);
+ break;
+
+ case WEB_STORAGE_TYPE_FILE_SYSTEM:
+ ewk_context_local_file_system_all_delete(pDefaultContext);
+ break;
+
+ default:
+ break;
+ }
+
+ return E_SUCCESS;
+}
+
+
+Ewk_Security_Origin*
+_WebStorageManagerImpl::CompareOrigin(WebStorageType storageType, const String& origin)
+{
+ Ewk_Context* pDefaultContext = ewk_context_default_get();
+
+ std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
+ SysTryReturn(NID_WEB_CTRL, pPresenter.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ switch (storageType)
+ {
+ case WEB_STORAGE_TYPE_APPLICATION_CACHE:
+ ewk_context_application_cache_origins_get(pDefaultContext, OnOriginReceived, pPresenter.get());
+ break;
+
+ case WEB_STORAGE_TYPE_WEB_SQL_DATABASE:
+ ewk_context_web_database_origins_get(pDefaultContext, OnOriginReceived, pPresenter.get());
+ break;
+
+ case WEB_STORAGE_TYPE_WEB_STORAGE:
+ ewk_context_web_storage_origins_get(pDefaultContext, OnOriginReceived, pPresenter.get());
+ break;
+
+ case WEB_STORAGE_TYPE_FILE_SYSTEM:
+ ewk_context_local_file_system_origins_get(pDefaultContext, OnOriginReceived, pPresenter.get());
+ break;
+
+ default:
+ break;
+ }
+
+ Eina_List* pOriginList = pPresenter->WaitAsyncProcess();
+ if (!pOriginList)
+ {
+ return null;
+ }
+
+ for (; pOriginList; pOriginList = eina_list_next(pOriginList))
+ {
+ Ewk_Security_Origin* pOrigin = static_cast<Ewk_Security_Origin*>(eina_list_data_get(pOriginList));
+ SysTryReturn(NID_WEB_CTRL, pOrigin, null, E_INVALID_ARG, "[%s] This origin does not exist.", GetErrorMessage(E_INVALID_ARG));
+
+ int cmp = origin.CompareTo(_Utility::CreateOrigin(pOrigin));
+
+ if (cmp ==0)
+ {
+ return pOrigin;
+ }
+ }
+
+ return null;
+}
+}}} // Tizen::Web::Controls
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FWebCtrl_WebStorageManagerImpl.h\r
+ * @brief The file contains the declaration of _WebStorageManagerImpl class.\r
+ *\r
+ * The file contains the declaration of _WebStorageManagerImpl class.\r
+ */\r
+#ifndef _FWEB_CTRL_INTERNAL_WEB_STORAGE_MANAGER_IMPL_H_\r
+#define _FWEB_CTRL_INTERNAL_WEB_STORAGE_MANAGER_IMPL_H_\r
+\r
+#include <ewk_security_origin.h>\r
+#include <FBaseString.h>\r
+#include <FWebCtrlWebStorageManager.h>\r
+\r
+namespace Tizen { namespace Base { namespace Collection\r
+{\r
+class IList;\r
+}}}\r
+\r
+namespace Tizen { namespace Web { namespace Controls\r
+{\r
+\r
+class _WebStorageManagerImpl\r
+ : public Tizen::Base::Object\r
+{\r
+public:\r
+ _WebStorageManagerImpl(void);\r
+\r
+ virtual ~_WebStorageManagerImpl(void);\r
+\r
+ Tizen::Base::Collection::IList* GetOriginListN(WebStorageType storageType);\r
+\r
+ result SetQuotaForOrigin(WebStorageType storageType, const Tizen::Base::String& origin, long quota);\r
+\r
+ long GetQuotaForOrigin(WebStorageType storageType, const Tizen::Base::String& origin);\r
+\r
+ long GetUsageForOrigin(WebStorageType storageType, const Tizen::Base::String& origin);\r
+\r
+ result Remove(WebStorageType storageType, const Tizen::Base::String& origin);\r
+\r
+ result RemoveAll(WebStorageType storageType);\r
+\r
+ Ewk_Security_Origin* CompareOrigin(WebStorageType storageType, const Tizen::Base::String& origin);\r
+\r
+private:\r
+ _WebStorageManagerImpl(const _WebStorageManagerImpl& rhs);\r
+\r
+ _WebStorageManagerImpl& operator=(const _WebStorageManagerImpl& rhs);\r
+\r
+};\r
+\r
+}}} // Tizen::Web::Controls\r
+#endif // _FWEB_CTRL_INTERNAL_WEB_STORAGE_MANAGER_IMPL_H_
\ No newline at end of file
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_CertificateConfirmPopup.h
+ * @brief The file contains the definition of _CertificateConfirmPopup class.
+ */
+
+#ifndef _FWEB_CTRL_INTERNAL_CERTIFICATE_CONFIRM_POPUP_H_
+#define _FWEB_CTRL_INTERNAL_CERTIFICATE_CONFIRM_POPUP_H_
+
+#include <EWebKit2.h>
+#include <unique_ptr.h>
+#include <FBaseColIList.h>
+#include <FBaseString.h>
+#include <FUiIPropagatedKeyEventListener.h>
+#include "FWebCtrl_WebPopup.h"
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+class _WebImpl;
+
+enum _IdButtonCertificatePopup
+{
+ ID_BUTTON_CERTIFICATE_ALLOW,
+ ID_BUTTON_CERTIFICATE_CANCEL,
+ ID_BUTTON_CERTIFICATE_VIEW,
+ ID_BUTTON_CERTIFICATE_CLOSE
+};
+
+enum _CertificatePopupMode
+{
+ CERTIFICATE_POPUP_MODE_USER_CONFIRM,
+ CERTIFICATE_POPUP_MODE_VIEW
+};
+
+class _CertificateConfirmPopup
+ : public _WebPopup
+ , public Tizen::Ui::IPropagatedKeyEventListener
+{
+
+public:
+ /**
+ * Constructor
+ */
+ _CertificateConfirmPopup(void);
+
+ /**
+ * Destructor
+ */
+ virtual ~_CertificateConfirmPopup(void);
+
+ result Construct(_CertificatePopupMode certPopupMode, Ewk_Certificate_Policy_Decision* pPolicy, Tizen::Web::Controls::_CertificateConfirmPopup* pParent = null);
+
+ void HandleUserAction(bool allow);
+
+ bool GetConfirmResult() const;
+
+ void AddCertificateDb(const Tizen::Base::String& pem, bool allow);
+
+ virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+
+ virtual bool OnKeyPressed (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
+ virtual bool OnKeyReleased (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
+ virtual bool OnPreviewKeyPressed (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
+ virtual bool OnPreviewKeyReleased (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
+ virtual bool TranslateKeyEventInfo (Tizen::Ui::Control &source, Tizen::Ui::KeyEventInfo &keyEventInfo);
+
+private:
+ _CertificateConfirmPopup(const _CertificateConfirmPopup&);
+
+ _CertificateConfirmPopup& operator =(const _CertificateConfirmPopup&);
+
+ result GetMessageFromPolicy(Tizen::Base::String& message);
+
+ result GenerateCertifiate(Tizen::Base::String& certString);
+
+ Tizen::Base::String GetStringOfToken(const Tizen::Base::String& parseString, const Tizen::Base::String& parseToken);
+
+ virtual void OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs);
+
+private:
+ _CertificatePopupMode __certPopupMode;
+ bool __confirm;
+ bool __reaction;
+
+ Ewk_Certificate_Policy_Decision* __pCertificatePolicyData;
+ _CertificateConfirmPopup* __pParent;
+ std::unique_ptr<_CertificateConfirmPopup> __pCertificatePopup;
+}; // _CertificateConfirmPopup
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_CERTIFICATE_CONFIRM_POPUP_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_WebEvent.h
+ * @brief This is the header file for the _WebEvent class.
+ *
+ * This file contains the declarations of _WebEvent.
+ */
+#ifndef _FWEB_CTRL_INTERNAL_IWEB_EVENT_LISTENER_H_
+#define _FWEB_CTRL_INTERNAL_IWEB_EVENT_LISTENER_H_
+
+#include <FBaseRtIEventListener.h>
+#include <FBaseRtIEventArg.h>
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+/**
+ * @class _WebEventListener
+ * @brief This class methods for handling events delivered to Web control
+ *
+ */
+class _IWebEventListener
+ : public Tizen::Base::Runtime::IEventListener
+{
+public:
+ virtual ~_IWebEventListener(void) {};
+ virtual result OnHandleJavaScriptRequestByEventArg(const Tizen::Base::Runtime::IEventArg& arg) = 0;
+ virtual result OnHandleLoadingEvent(const Tizen::Base::Runtime::IEventArg& arg) = 0;
+ virtual result OnHandleWebDownloadEvent(const Tizen::Base::Runtime::IEventArg& arg) = 0;
+ virtual result OnHandleWebUiEvent(const Tizen::Base::Runtime::IEventArg& arg) = 0;
+ virtual result OnHandleWebUiEventF(const Tizen::Base::Runtime::IEventArg& arg) = 0;
+ virtual result OnHandleTextSearchEvent(const Tizen::Base::Runtime::IEventArg& arg) = 0;
+
+}; // _IWebEventListener
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_IWEB_EVENT_LISTENER_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_UserConfirmPopup.h
+ * @brief The file contains the definition of _UserConfirmPopup class.
+ */
+#ifndef _FWEB_CTRL_INTERNAL_USER_CONFIRM_POPUP_H_
+#define _FWEB_CTRL_INTERNAL_USER_CONFIRM_POPUP_H_
+
+#include <unique_ptr.h>
+#include <EWebKit2.h>
+#include <FBaseString.h>
+#include <FUiIPropagatedKeyEventListener.h>
+#include "FWebCtrl_WebPopup.h"
+
+namespace Tizen { namespace Ui { namespace Controls
+{
+class CheckButton;
+}}}
+
+namespace Tizen { namespace Web { namespace Controls
+{
+class _WebImpl;
+
+enum _UserConfirmPopupButtonId
+{
+ ID_BUTTON_USER_ALLOW,
+ ID_BUTTON_USER_CANCEL,
+ ID_BUTTON_USER_NEVER
+};
+
+enum _UserConfirmMode
+{
+ USER_CONFIRM_USERMEDIA,
+ USER_PROTOCOL_HANDLER,
+ USER_CONTENT_HANDLER,
+ USER_CONFIRM_GEOLOCATION,
+ USER_CONFIRM_NOTIFICATION,
+ USER_SCRIPT_ALERT,
+ USER_SCRIPT_CONFIRM,
+ USER_BEFORE_UNLOAD_CONFIRM,
+ USER_CONFIRM_APP_CACHE,
+ USER_CONFIRM_DB_QUOTA_EXCEDED,
+ USER_CONFIRM_LOCAL_FS_QUOTA_EXCEDED,
+ USER_CONFIRM_INDEXED_DB_QUOTA_EXCEDED
+};
+
+class _UserConfirmPopup
+ : public _WebPopup
+ , public Tizen::Ui::IPropagatedKeyEventListener
+{
+
+public:
+ /**
+ * Constructor
+ */
+ _UserConfirmPopup(void);
+
+ /**
+ * Destructor
+ */
+ virtual ~_UserConfirmPopup(void);
+
+ result Construct(_UserConfirmMode userConfirmMode, void* pEventInfo, Tizen::Web::Controls::_WebImpl* pImpl, bool sync = false, Tizen::Base::String msg = L"");
+
+ virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+
+ virtual bool OnKeyPressed (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
+ virtual bool OnKeyReleased (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
+ virtual bool OnPreviewKeyPressed (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
+ virtual bool OnPreviewKeyReleased (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
+ virtual bool TranslateKeyEventInfo (Tizen::Ui::Control &source, Tizen::Ui::KeyEventInfo &keyEventInfo);
+
+private:
+ _UserConfirmPopup(const _UserConfirmPopup&);
+
+ _UserConfirmPopup& operator =(const _UserConfirmPopup&);
+
+ Tizen::Base::String GetMessageFromPolicy(void);
+
+ void HandleUserAction(Eina_Bool allow);
+
+ void RegisterHandler(bool checkhandler, Eina_Bool allow);
+ result AddGeolocationDb(Ewk_Geolocation_Permission_Request* pPolicy, bool enable);
+
+private:
+ void* __pUserPolicyData;
+ _UserConfirmMode __userConfirmMode;
+ Tizen::Ui::Controls::CheckButton* __pCheckButton;
+ bool __isUserActionNeeded;
+
+ bool __sync;
+ Tizen::Web::Controls::_WebImpl* __pImpl;
+}; // _UserConfirmPopup
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_USER_CONFIRM_POPUP_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_WebImpl.h
+ * @brief The file contains the declaration of _WebImpl class.
+ *
+ * The file contains the declaration of _WebImpl class.
+ */
+#ifndef _FWEB_CTRL_INTERNAL_WEB_IMPL_H_
+#define _FWEB_CTRL_INTERNAL_WEB_IMPL_H_
+
+#include <unique_ptr.h>
+#include <EWebKit2.h>
+#include <FBaseColArrayList.h>
+#include <FBaseString.h>
+#include <FSysISettingEventListener.h>
+#include <FUiIActionEventListener.h>
+#include <FUiIOrientationEventListener.h>
+#include <FUiITextEventListener.h>
+#include <FWebCtrlILoadingListener.h>
+#include <FUi_ContainerImpl.h>
+#include "FWebCtrl_CertificateConfirmPopup.h"
+#include "FWebCtrl_IWebEventListener.h"
+#include "FWebCtrl_UserConfirmPopup.h"
+
+namespace Tizen { namespace Base { namespace Collection
+{
+template< class KeyType, class ValueType > class HashMapT;
+}}} // Tizen::Base::Collection
+
+namespace Tizen { namespace Base { namespace Runtime
+{
+class Mutex;
+}}} // Tizen::Base::Runtime
+
+namespace Tizen { namespace Graphics
+{
+class Dimension;
+class Point;
+class Rectangle;
+}} // Tizen::Graphics
+
+namespace Tizen { namespace Net { namespace Http {
+class HttpHeader;
+}}} // Tizen::Net::Http
+
+namespace Tizen { namespace System
+{
+class Vibrator;
+}} // Tizen::Sytem
+
+namespace Tizen { namespace Ui
+{
+class Control;
+class _Control;
+class _ControlImpl;
+}} // Tizen::Ui
+
+namespace Tizen { namespace Ui { namespace Controls
+{
+class Keypad;
+class _FormImpl;
+}}} // Tizen::Ui::Controls
+
+namespace Tizen { namespace Web { namespace Json
+{
+class IJsonValue;
+}}} // Tizen::Web::Json
+
+namespace Tizen { namespace Web { namespace Controls
+{
+class IJavaScriptBridge;
+class ILoadingListener;
+class ITextSearchListener;
+class IWebDownloadListener;
+class IWebKeypadEventListener;
+class IWebUiEventListener;
+class IWebUiEventListenerF;
+class AuthenticationChallenge;
+class HitElementResult;
+class PageNavigationList;
+class Web;
+class WebSetting;
+class _Web;
+class _JsBridgeArg;
+class _WebEvent;
+class _WebPresenter;
+class _JsBridgeComparer;
+class _JsBridgeHashCodeProvider;
+class _AuthConfirmPopup;
+class _PromptPopup;
+class _GeolocationConfirmPopup;
+class _WebDataHandler;
+class _SelectBox;
+class _InputPickerPopup;
+class _FormDataWindow;
+class _WebNotification;
+
+struct _TextSearch
+{
+ bool __searchAll;
+ bool __searchForward;
+ bool __caseSensitive;
+ int __pending;
+ int __currentIndex;
+ int __totalCount;
+ Tizen::Base::String __text;
+ Tizen::Base::Collection::Queue __searchQueue;
+};
+
+enum _SearchType {
+ SEARCH_SYNC,
+ SEARCH_ALL_ASYNC,
+ SEARCH_NEXT_ASYNC
+};
+
+enum _WebPopupCloseId
+{
+ ID_AUTHENTICATION_CONFIRM_POPUP_CANCEL,
+ ID_AUTHENTICATION_CONFIRM_POPUP_PROCESS,
+ ID_CERTIFICATE_CONFIRM_POPUP_CLOSE,
+ ID_PROMPT_POPUP_CLOSE,
+ ID_USER_CONFIRM_USERMEDIA_CLOSE,
+ ID_USER_CONFIRM_GEOLOCATION_CLOSE,
+ ID_USER_CONFIRM_NOTIFICATION_CLOSE,
+ ID_USER_SCRIPT_ALERT_CLOSE,
+ ID_USER_SCRIPT_CONFIRM_CLOSE,
+ ID_USER_BEFORE_UNLOAD_CONFIRM_CLOSE,
+ ID_USER_SCRIPT_SELECTBOX_CLOSE
+};
+
+class _OSP_EXPORT_ _WebImpl
+ : public Tizen::Ui::_ContainerImpl
+ , public Tizen::Ui::ITextEventListener
+ , public Tizen::Web::Controls::_IWebEventListener
+ , public Tizen::System::ISettingEventListener
+{
+public:
+ _WebImpl(Web* pWeb, Tizen::Ui::_Control* pCore);
+
+ virtual ~_WebImpl(void);
+
+ result Construct(void);
+
+ bool HasValidNativeNode(void) const;
+
+ result SetZoomLevel(float level);
+
+ float GetZoomLevel(void) const;
+
+ result LoadUrl(const Tizen::Base::String& url) const;
+
+ result LoadUrl(const Tizen::Base::String& url, const Tizen::Net::Http::HttpHeader& header);
+
+ result LoadUrlWithPostRequest(const Tizen::Base::String& url, const Tizen::Net::Http::HttpHeader& header, const Tizen::Base::ByteBuffer& body) const;
+
+ result LoadData(const Tizen::Base::String& baseUrl, const Tizen::Base::ByteBuffer& content, const Tizen::Base::String& mime, const Tizen::Base::String& encoding) const;
+
+ bool CanGoBack(void) const;
+
+ bool CanGoForward(void) const;
+
+ void GoBack(void) const;
+
+ void GoForward(void) const;
+
+ bool IsLoading(void) const;
+
+ void StopLoading(void) const;
+
+ void Reload(void) const;
+
+ bool SearchText(const Tizen::Base::String& word, bool searchForward);
+
+ result SetSetting(const Tizen::Web::Controls::WebSetting& setting);
+
+ Tizen::Web::Controls::WebSetting GetSetting(void) const;
+
+ Tizen::Base::String GetUrl(void) const;
+
+ Tizen::Base::String GetTitle(void) const;
+
+ result SetBlockSelectionPosition(const Tizen::Graphics::Point& startPoint);
+
+ result SetBlockSelectionPosition(const Tizen::Graphics::FloatPoint& startPoint);
+
+ void ReleaseBlock(void);
+
+ void GetBlockRange(Tizen::Graphics::Point& startPoint, Tizen::Graphics::Point& endPoint) const;
+
+ void GetBlockRange(Tizen::Graphics::FloatPoint& startPoint, Tizen::Graphics::FloatPoint& endPoint) const;
+
+ Tizen::Base::String GetTextFromBlock(void) const;
+
+ Tizen::Base::String* EvaluateJavascriptN(const Tizen::Base::String& scriptCode);
+
+ bool IsPrivateBrowsingEnabled(void) const;
+
+ void SetPrivateBrowsingEnabled(bool enable);
+
+ void ClearHistory(void);
+
+ void ClearCache(void);
+
+ void ClearCookie(void);
+
+ void ClearFormData(void);
+
+ void ClearLoginFormData(void);
+
+ bool IsCookieEnabled(void) const;
+
+ void SetCookieEnabled(bool enable);
+
+ result SavePageAsPdf(const Tizen::Base::String& filePath, const Tizen::Graphics::Dimension* pSize) const;
+
+ bool IsMimeSupported(const Tizen::Base::String& mime) const;
+
+ result SearchTextAllAsync(const Tizen::Base::String& text, bool caseSensitive);
+
+ result SearchNextAsync(bool searchForward);
+
+ result SynchronizeSearch(_SearchType type, Evas_Object* pView, Ewk_Find_Options condition, const Tizen::Base::String& text
+ , bool searchForward, bool caseSensitive = false, _WebPresenter* pWebPresenter = null);
+
+ void SetAsyncSearchResult(int totalCount);
+
+ _WebPresenter* GetSearchPresenter(void);
+
+ int GetPendingAsyncSearchCount(void) const;
+
+ void CalculateAsyncSearchOrdinal(void);
+
+ int GetAsyncSearchOrdinal(void) const;
+
+ void DisableAsyncSearch(void);
+
+ void SetTextSearchListener(Tizen::Web::Controls::ITextSearchListener* pTextSearchListener);
+
+ void SetLoadingListener(Tizen::Web::Controls::ILoadingListener* pLoadingListener);
+
+ void SetWebUiEventListener(Tizen::Web::Controls::IWebUiEventListener* pUiEventListener);
+
+ void SetWebUiEventListenerF(Tizen::Web::Controls::IWebUiEventListenerF* pUiEventListener);
+
+ void SetWebKeypadEventListener(IWebKeypadEventListener* pKeypadEventListener);
+
+ void SetDownloadListener(Tizen::Web::Controls::IWebDownloadListener* pDownLoadListener);
+
+ Tizen::Web::Controls::ILoadingListener* GetLoadingListener(void) const;
+
+ Tizen::Web::Controls::IWebUiEventListener* GetUiEventListener(void) const;
+
+ Tizen::Web::Controls::IWebUiEventListenerF* GetUiEventListenerF(void) const;
+
+ Tizen::Web::Controls::ITextSearchListener* GetTextSearchListener(void) const;
+
+ Tizen::Web::Controls::IWebKeypadEventListener* GetWebKeypadEventListener(void) const;
+
+ const Tizen::Web::Controls::PageNavigationList* GetBackForwardListN(void) const;
+
+ const Tizen::Web::Controls::HitElementResult* GetElementByPointN(const Tizen::Graphics::Point& point) const;
+
+ const Tizen::Web::Controls::HitElementResult* GetElementByPointN(const Tizen::Graphics::FloatPoint& point) const;
+
+ result AddJavaScriptBridge(const IJavaScriptBridge& jsBridge);
+
+ result RemoveJavaScriptBridge(const IJavaScriptBridge& jsBridge);
+
+ void SetScrollEnabled(bool enable);
+
+ bool IsScrollEnabled(void) const;
+
+ Tizen::Graphics::Bitmap* GetFaviconN(void) const;
+
+ void Pause(void);
+
+ void Resume(void);
+
+ void ScrollBy(const Tizen::Graphics::Point& diff);
+
+ void ScrollTo(const Tizen::Graphics::Point& dest);
+
+ Tizen::Graphics::Point GetScrollPosition(void) const;
+
+ Tizen::Graphics::Dimension GetPageSize(void) const;
+
+ virtual bool IsLayoutable(void) const;
+
+ void SetEventListenerCallback(void) const;
+
+ void RemoveEventListenerCallback(void) const;
+
+ _WebEvent* GetWebEvent(void) const;
+
+ _WebDataHandler* GetDownloadHandler(void) const;
+
+ result SetFullScreenKeypad(void);
+
+ void RemoveFullScreenKeypad(void);
+
+ void SetCurrentEvent(Tizen::Base::Runtime::IEventArg* arg);
+
+ void SetLoadingErrorOccurred(bool arg);
+
+ bool IsLoadingErrorOccurred(void) const;
+
+ void SetRedirectRequested(bool arg);
+
+ bool IsRedirectRequested(void) const;
+
+ void SetCertificateRequested(bool arg);
+ bool IsCertificateRequested(void) const;
+ void SetCertificateConfirmed(bool arg);
+ bool IsCertificateConfirmed(void) const;
+
+ void SetOrientationChanged(bool arg);
+ bool IsOrientationChanged(void) const;
+
+ result VibrationRequested(uint64_t duration);
+ void VibrationCanceled(void);
+
+ bool IsFooterVisible(void) const;
+
+ void SetFooterVisibleState(bool isFooterVisible);
+
+ bool IsKeypadVisible(void) const;
+
+ void SetKeypadVisibleState(bool isKeypadVisible);
+
+ bool IsKeypadOpened(void) const;
+
+ void SetKeypadOpened(bool isKeypadOpened);
+
+ bool IsWinFocusLost(void) const;
+
+ void SetWinFocusLost(bool isWinFocusLost);
+
+ Tizen::Graphics::Rectangle GetPreviousKeypadBounds(void) const;
+
+ void SetPreviousKeypadBounds(Tizen::Graphics::Rectangle& bounds);
+
+ result HttpAuthenticationRequested(Ewk_Auth_Challenge* pChallenge);
+
+ result ShowCertificateConfirmPopup(_CertificatePopupMode userConfirmMode, Ewk_Certificate_Policy_Decision *pPolicy);
+
+ result ShowPromptPopup(Tizen::Base::String msg = L"", Tizen::Base::String defVal = L"");
+
+ result ShowUserConfirmPopup(_UserConfirmMode userConfirmMode, void* pPolicy, Tizen::Base::String msg = L"");
+ result ShowUserConfirmPopupAsync(_UserConfirmMode userConfirmMode, void* pPolicy, Tizen::Base::String msg = L"");
+
+ Tizen::Ui::Controls::_FormImpl* GetParentFormImpl(Tizen::Ui::_ControlImpl* pControlImpl);
+
+ result ShowSelectBoxPopup(bool isMultiSelect, const Tizen::Base::String& title, Eina_List* pItems, Evas_Object* pWebView, int selectedIndex);
+ result UpdateSelectBoxPopup(Eina_List* pItems, int selectedIndex, bool isGroupedList);
+ result ClearSelectBoxPopup(void);
+
+ result ShowColorPicker(int r, int g, int b, int a,Tizen::Graphics::Color& color);
+ Eina_Bool HideColorPicker(void);
+ _InputPickerPopup* GetColorpicker(void);
+
+ result ShowDatePicker(Ewk_Input_Type inputType, const char* inputValue,Tizen::Base::String& dateStr);
+ _InputPickerPopup* GetDatepicker(void);
+
+
+ void SetPolicyDecision(DecisionPolicy policy);
+
+ DecisionPolicy GetPolicyDecision(void) const;
+
+ virtual bool OnFocusGained(const Tizen::Ui::_ControlImpl& source);
+
+ virtual bool OnFocusLost(const Tizen::Ui::_ControlImpl& source);
+
+ virtual void OnTextValueChangeCanceled(const Tizen::Ui::Control& source);
+
+ virtual void OnTextValueChanged(const Tizen::Ui::Control& source);
+
+ virtual result OnPreAttachedToMainTree(void);
+
+ virtual result OnDetachingFromMainTree(void);
+
+ virtual void OnChangeLayout(Tizen::Ui::_ControlRotation rotation);
+
+ virtual void OnChangeLayout(Tizen::Ui::_ControlOrientation orientation);
+
+ virtual void OnAncestorVisibleStateChanged(const Tizen::Ui::_Control& control);
+
+ virtual void OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs);
+
+ static _WebImpl* CreateWebImplN(Web* pControl, const Tizen::Graphics::Rectangle& bounds);
+
+ static _WebImpl* CreateWebImplN(Web* pControl, const Tizen::Graphics::FloatRectangle& bounds);
+
+ static _WebImpl* GetInstance(Web* pWeb);
+
+ static const _WebImpl* GetInstance(const Web* pWeb);
+
+ int SearchHandler(Ewk_Custom_Handlers_Data* pHandlerData, bool checkmime);
+
+ result UnregistrationHandler(Ewk_Custom_Handlers_Data* pHandlerData, bool checkmime);
+
+ const Tizen::Base::String GetProtocolFromUri(const Tizen::Base::String& originuri, const Tizen::Base::String& currenturi);
+
+ const Tizen::Base::String GetRedirectUri(const Tizen::Base::String& originuri, const Tizen::Base::String& currenturi, const Tizen::Base::String& mime);
+
+ void SetFormDataList(Eina_List* pFormDataList);
+
+ bool IsFormDataWindowVisible(void) const;
+
+ result ShowFormDataWindow(const Tizen::Graphics::Rectangle& windowRect, Evas_Object* pWebView);
+
+ void HideFormDataWindow(bool delWindow = true);
+
+ void SetWebNotification(_WebNotification* pWebNotification);
+
+ void ClearWebNotification(_WebNotification* pWebNotification);
+
+private:
+ result InitializeSetting(void);
+ result InitJsBridgeList(void);
+ result InitWebEvent(void);
+
+ IJavaScriptBridge* FindJsInterface(const Tizen::Web::Json::IJsonValue* pValue) const;
+
+ result ShowAuthenticationPopup(const Tizen::Base::String& host, const Tizen::Base::String& realm, AuthenticationChallenge* pAuthChallenge);
+
+ Eina_Hash* ConvertToSlpHeaderN(const Tizen::Net::Http::HttpHeader& header) const;
+
+ result OnHandleJavaScriptRequestByEventArg(const Tizen::Base::Runtime::IEventArg& arg);
+ result OnHandleLoadingEvent(const Tizen::Base::Runtime::IEventArg& arg);
+ result OnHandleWebDownloadEvent(const Tizen::Base::Runtime::IEventArg& arg);
+ result OnHandleWebUiEvent(const Tizen::Base::Runtime::IEventArg& arg);
+ result OnHandleWebUiEventF(const Tizen::Base::Runtime::IEventArg& arg);
+ result OnHandleTextSearchEvent(const Tizen::Base::Runtime::IEventArg& arg);
+
+ virtual void OnSettingChanged(Tizen::Base::String& key);
+
+ static Eina_Bool OnBeforeUnloadConfirmRequested(Evas_Object* pView, const char* pMessage, void* pUserData);
+private:
+ bool __isFooterVisible;
+ bool __isKeypadVisible;
+ bool __isKeypadOpened;
+ bool __isWinFocusLost;
+ bool __isLoadingErrorOccurred;
+ bool __isRedirectRequested;
+ bool __isCertificateRequested;
+ bool __isCertificateConfirmed;
+ bool __isFormDataVisible;
+ Tizen::Graphics::Rectangle __keypadBounds;
+
+ _Web* __pWebCore;
+
+ ILoadingListener* __pUserLoadingListener;
+ IWebUiEventListener* __pUserUiListener;
+ IWebUiEventListenerF* __pUserUiListenerF;
+ IWebKeypadEventListener* __pUserKeypadEventListener;
+ ITextSearchListener* __pTextSearchListener;
+
+ std::unique_ptr<Tizen::Ui::Controls::Keypad> __pKeypad;
+
+ std::unique_ptr<Tizen::Base::Collection::HashMapT< Tizen::Base::String, IJavaScriptBridge* > > __pJsBridgeList;
+ std::unique_ptr<_JsBridgeHashCodeProvider> __pJsProvider;
+ std::unique_ptr<_JsBridgeComparer> __pJsComparer;
+
+ std::unique_ptr<_WebDataHandler> __pWebDownloadHandler;
+
+ std::unique_ptr<_WebEvent> __pWebEvent;
+
+ std::unique_ptr<AuthenticationChallenge> __pAuthChallenge;
+ std::unique_ptr<_AuthConfirmPopup> __pAuthPopup;
+
+ std::unique_ptr<_UserConfirmPopup> __pUserMediaConfirmPopup;
+ std::unique_ptr<_UserConfirmPopup> __pContentHandlerConfirmPopup;
+ std::unique_ptr<_UserConfirmPopup> __pProtocolHandlerConfirmPopup;
+ std::unique_ptr<_UserConfirmPopup> __pGeolocationConfirmPopup;
+ std::unique_ptr<_UserConfirmPopup> __pNotificationConfirmPopup;
+ std::unique_ptr<_UserConfirmPopup> __pScriptAlertConfirmPopup;
+ std::unique_ptr<_UserConfirmPopup> __pScriptConfirmPopup;
+ std::unique_ptr<_UserConfirmPopup> __pBeforeUnloadConfirmPopup;
+ std::unique_ptr<_UserConfirmPopup> __pAppCacheConfirmPopup;
+ std::unique_ptr<_UserConfirmPopup> __pDbQuotaConfirmPopup;
+ std::unique_ptr<_UserConfirmPopup> __pLocalFsQuotaConfirmPopup;
+ std::unique_ptr<_UserConfirmPopup> __pIndexedDbQuotaConfirmPopup;
+
+ std::unique_ptr< _PromptPopup > __pPromptPopup;
+ std::unique_ptr<_CertificateConfirmPopup> __pCertConfirmPopup;
+
+ std::unique_ptr<_SelectBox> __pSelectBox;
+ std::unique_ptr<_InputPickerPopup> __pDatePicker;
+ std::unique_ptr<_InputPickerPopup> __pColorPicker;
+ std::unique_ptr<_FormDataWindow> __pFormDataWindow;
+
+ std::unique_ptr<Tizen::System::Vibrator> __pVibrator;
+
+ Tizen::Base::Runtime::Mutex __mutex;
+
+ _TextSearch __textSearch;
+
+ Tizen::Base::Collection::ArrayList __webNotificationList;
+
+ DecisionPolicy __policy;
+
+ Tizen::Base::String __defaultUserAgent;
+
+ Eina_List* __pFormDataList;
+
+ bool __popupClosed;
+}; // _WebImpl
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_WEB_IMPL_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_WebPopup.h
+ * @brief The file contains the declaration of _WebPopup class.
+ *
+ * The file contains the declaration of _WebPopup class.
+ */
+#ifndef _FWEB_CTRL_INTERNAL_WEB_POPUP_H_
+#define _FWEB_CTRL_INTERNAL_WEB_POPUP_H_
+
+#include <unique_ptr.h>
+#include <FUiCtrlPopup.h>
+
+
+namespace Tizen { namespace Base { namespace Collection
+{
+class IList;
+}}} // Tizen::Base::Collection
+
+namespace Tizen { namespace Graphics
+{
+class Dimension;
+}} // Tizen::Graphics
+
+namespace Tizen { namespace Ui
+{
+class IActionEventListener;
+}} // Tizen::Ui
+
+namespace Tizen { namespace Ui { namespace Controls
+{
+class Button;
+class Panel;
+class Popup;
+}}} // Tizen::Ui::Controls
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+enum _WebPopupButtonId
+{
+ ID_BUTTON_COMMON_CLOSE
+};
+
+struct _WebPopupData
+{
+ Tizen::Graphics::Dimension btnDim;
+ Tizen::Graphics::Dimension editDim;
+ Tizen::Graphics::Dimension popupDim;
+ Tizen::Graphics::Dimension dateDim;
+ Tizen::Graphics::Dimension colorDim;
+ Tizen::Graphics::Dimension checkDim;
+ Tizen::Graphics::Dimension labelDim;
+
+ int labelFontSize;
+ int spacePad;
+ int sideMargin;
+ int titleHeight;
+ int bottomMargin;
+ int panelHeight;
+};
+
+class _WebPopup
+ : public Tizen::Ui::Controls::Popup
+ , virtual public Tizen::Ui::IActionEventListener
+{
+public:
+ /**
+ * Constructor
+ */
+ _WebPopup(void);
+
+ /**
+ * Destructor
+ */
+ virtual ~_WebPopup(void);
+
+ result Construct(bool hasTitle, const Tizen::Graphics::Dimension& popupDim);
+
+ virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+
+ /**
+ * This function launches non modal (asynchronous) popup
+ */
+ result ShowPopup(void);
+
+ result HidePopup(int modalResult = 0);
+
+ /**
+ * This function launches modal (synchronous) popup
+ */
+ result ShowAndWait(int& modalResult);
+
+ Tizen::Ui::Controls::Panel* CreateAndAddPanel(void);
+
+ result CreateAndAddButtons(const Tizen::Base::Collection::IList& buttonIds,
+ const Tizen::Base::Collection::IList& buttonTitles,
+ Tizen::Ui::Controls::Panel* pPanel);
+
+ bool IsModalPopup(void);
+
+protected:
+ static _WebPopupData* GetPopupData(bool refresh = false);
+
+private:
+ _WebPopup(const _WebPopup& source);
+
+ _WebPopup& operator =(const _WebPopup& source);
+
+ virtual result OnTerminating(void);
+
+private:
+ static std::unique_ptr<_WebPopupData> __pWebPopupData;
+ bool __isModal;
+ int __modal;
+
+}; // _WebPopup
+
+}}} //Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_WEB_POPUP_H_
--- /dev/null
+SET (this_target web-js-bridge-plugin-deprecated)
+
+INCLUDE_DIRECTORIES(
+ /usr/include/ewebkit2-0
+ /usr/include/osp
+ /usr/include/osp/base
+ /usr/include/osp/ui
+ )
+
+SET (${this_target}_SOURCE_FILES
+ FWebCtrl_JsBridgePlugin.cpp
+)
+
+
+SET_SOURCE_FILES_PROPERTIES(${this_target}_HEADER_FILES
+ PROPERTIES HEADER_FILE_ONLY TRUE)
+LIST(APPEND ${this_target}_SOURCE_FILES ${${this_target}_HEADER_FILES})
+
+## SET EXTRA COMPILER FLAGS
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fPIC" )
+
+## SET C COMPILER FLAGS
+SET(CMAKE_C_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## SET CPP COMPILER FLAGS
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
+SET(CMAKE_CXX_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## Create Library
+ADD_LIBRARY (${this_target} SHARED ${${this_target}_SOURCE_FILES})
+# SET LINKER FLAGS
+TARGET_LINK_LIBRARIES(${this_target} "" )
+TARGET_LINK_LIBRARIES(${this_target} ${pkgs_LDFLAGS} ${OSP_LD_PATH_FLAGS} ${OSP_LD_FLAGS} ${OSP_LINKER_FLAGS})
+
+ADD_CUSTOM_COMMAND(TARGET ${this_target}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy ${LIBRARY_OUTPUT_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX} ${LIBRARY_OUTPUT_PATH}/debug/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX}
+ COMMAND ${CMAKE_STRIP} --strip-unneeded --remove-section .comment ${LIBRARY_OUTPUT_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX}
+ COMMENT "strip ${this_target}"
+ )
+
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_JsBridgePlugin.cpp
+ * @brief The file contains the implmentation of npapi plugin callbacks.
+ *
+ * The file contains the implmentation of npapi plugin callbacks.
+ */
+
+#define XP_TIZEN 1
+#define XP_UNIX 1
+#define MOZ_X11 1
+#define ENABLE_TIZEN_JSBRIDGE_PLUGIN 1
+#define HAS_SCRIPT_SUPPORT 1
+
+#include <string.h>
+#include "FWebCtrl_JsBridgePlugin.h"
+
+#ifdef __PLUGIN_DEBUG_PRINT
+#include <dlog.h>
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "JsBridgePlugin"
+#define __PLUGIN_DEBUG_TRACE(format, ARG...) \
+ { \
+ LOGD(format "[%d]", ## ARG, __LINE__); \
+ }
+#else
+#define __PLUGIN_DEBUG_TRACE(format, ARG...);
+#endif
+
+static NPObject*
+_CreateScriptPlayer(NPP instance, NPClass* pNPClass)
+{
+
+ // set up our our instance data
+ requestToNativeScriptPlayer = g_pBrowserFuncs->getstringidentifier("requestToNative");
+ RuntimeObject* pObject = (RuntimeObject*) g_pBrowserFuncs->memalloc(sizeof(RuntimeObject));
+ if (pObject != NULL)
+ {
+ pObject->instance = instance;
+ instance->pdata = pObject;
+ }
+
+ return (NPObject*) pObject;
+}
+
+static void
+_DestroyScriptPlayer(NPObject* pNPobj)
+{
+ RuntimeObject* pObj = (RuntimeObject*) pNPobj;
+ if (pObj)
+ {
+ pObj->instance->pdata = NULL;
+ g_pBrowserFuncs->memfree(pObj);
+ }
+}
+
+static bool
+_HasMethod(NPObject* pNPobj, NPIdentifier name)
+{
+ return name == requestToNativeScriptPlayer;
+}
+
+static bool
+_Invoke(NPObject* pNPobj, NPIdentifier name, const NPVariant* pArgs, uint32_t argCount, NPVariant* result)
+{
+ if (pArgs->type == NPVariantType_String)
+ {
+ char* pString = (char*) g_pBrowserFuncs->memalloc(pArgs->value.stringValue.UTF8Length + 1);
+
+ if (pString != NULL)
+ {
+ memset(pString, 0x00, pArgs->value.stringValue.UTF8Length + 1);
+ memcpy(pString, pArgs->value.stringValue.UTF8Characters, pArgs->value.stringValue.UTF8Length);
+
+ RuntimeObject* pObj = (RuntimeObject*) pNPobj;
+ g_pBrowserFuncs->setvalue(pObj->instance, NPPAppNotify, pString);
+ g_pBrowserFuncs->memfree(pString);
+ }
+ }
+
+ return true;
+}
+
+#ifdef OJI
+JRIGlobalRef
+GetJavaClassOfPlugin(void)
+{
+ jref clazz = NULL; //NPP_GetJavaClass();
+ if (clazz)
+ {
+ JRIEnv* pEnv = g_pBrowserFuncs->getJavaEnv();
+ return JRI_NewGlobalRef(pEnv, clazz);
+ }
+ return NULL;
+}
+#endif
+
+struct NPClass classScriptPlayer = {
+ NP_CLASS_STRUCT_VERSION, /* uint32_t structVersion; */
+ _CreateScriptPlayer, /* NPAllocateFunctionPtr allocate; */
+ _DestroyScriptPlayer, /* NPDeallocateFunctionPtr deallocate; */
+ NULL, /* NPInvalidateFunctionPtr invalidate; */
+ _HasMethod, /* NPHasMethodFunctionPtr hasMethod; */
+ _Invoke, /* NPInvokeFunctionPtr invoke; */
+ NULL, /* NPInvokeDefaultFunctionPtr invokeDefault; */
+ NULL, /* NPHasPropertyFunctionPtr hasProperty; */
+ NULL, /* NPGetPropertyFunctionPtr getProperty; */
+ NULL, /* NPSetPropertyFunctionPtr setProperty; */
+ NULL, /* NPRemovePropertyFunctionPtr removeProperty; */
+};
+
+NPError
+NP_Initialize(NPNetscapeFuncs* pNsTable, NPPluginFuncs* pFuncs)
+{
+
+ __PLUGIN_DEBUG_TRACE("%s", __FUNCTION__);
+ NPError err = NPERR_INVALID_PARAM;
+
+ if (pNsTable != NULL && pFuncs != NULL)
+ {
+ g_pBrowserFuncs = pNsTable;
+
+ //
+ // Set up the plugin function table that Netscape will use to
+ // call us. Netscape needs to know about our version and size
+ // and have a UniversalProcPointer for every function we
+ // implement.
+ //
+ pFuncs->version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
+ pFuncs->size = sizeof(NPPluginFuncs);
+ pFuncs->newp = Plugin_New;
+ pFuncs->destroy = Plugin_Destroy;
+ pFuncs->setwindow = Plugin_SetWindow;
+ pFuncs->newstream = Plugin_NewStream;
+ pFuncs->destroystream = Plugin_DestroyStream;
+ pFuncs->asfile = Plugin_StreamAsFile;
+ pFuncs->writeready = Plugin_WriteReady;
+ pFuncs->write = Plugin_Write;
+ pFuncs->print = Plugin_Print;
+ pFuncs->event = Plugin_HandleEvent;
+ pFuncs->urlnotify = Plugin_URLNotify;
+
+#ifdef OJI
+ pFuncs->javaClass = GetJavaClassOfPlugin();
+#endif
+ pFuncs->getvalue = Plugin_GetValue;
+ pFuncs->setvalue = Plugin_SetValue;
+ err = NPERR_NO_ERROR;
+ }
+ return err;
+}
+
+char*
+NP_GetMIMEDescription()
+{
+ __PLUGIN_DEBUG_TRACE("%s", __FUNCTION__);
+ return (char*) "application/x-osp-jsbridge:jsb:SamsungJsBridgePlugin";
+}
+
+NPError
+NP_GetValue(void* pFuture, NPPVariable variable, void* pValue)
+{
+ __PLUGIN_DEBUG_TRACE("%s", __FUNCTION__);
+ return Plugin_GetValue(static_cast< NPP_t* >(pFuture), variable, pValue);
+}
+
+NPError
+NP_Shutdown(void)
+{
+ __PLUGIN_DEBUG_TRACE("%s", __FUNCTION__);
+ return NPERR_NO_ERROR;
+}
+
+NPError
+Plugin_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved)
+{
+ __PLUGIN_DEBUG_TRACE("%s", __FUNCTION__);
+ if (instance != NULL)
+ {
+ instance->pdata = NULL;
+ }
+ g_pBrowserFuncs->setvalue(instance, NPPVpluginWindowBool, (void*)false);
+ return NPERR_NO_ERROR;
+}
+
+NPError
+Plugin_Destroy(NPP instance, NPSavedData** save)
+{
+ __PLUGIN_DEBUG_TRACE("%s", __FUNCTION__);
+ NPObject* pObj = (NPObject*) instance->pdata;
+
+ if (pObj)
+ {
+ g_pBrowserFuncs->releaseobject(pObj);
+ }
+ return NPERR_NO_ERROR;
+}
+
+NPError
+Plugin_SetWindow(NPP instance, NPWindow* window)
+{
+ __PLUGIN_DEBUG_TRACE("%s", __FUNCTION__);
+ return NPERR_NO_ERROR;
+}
+
+NPError
+Plugin_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype)
+{
+ return NPERR_NO_ERROR;
+}
+
+NPError
+Plugin_DestroyStream(NPP instance, NPStream* stream, NPReason reason)
+{
+ return NPERR_NO_ERROR;
+}
+
+int32_t
+Plugin_WriteReady(NPP instance, NPStream* stream)
+{
+ return 0;
+}
+
+int32_t
+Plugin_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer)
+{
+ return 0;
+}
+
+void
+Plugin_StreamAsFile(NPP instance, NPStream* stream, const char* fname)
+{
+
+}
+
+void
+Plugin_Print(NPP instance, NPPrint* platformPrint)
+{
+
+}
+
+int16_t
+Plugin_HandleEvent(NPP instance, void* event)
+{
+ return 1;
+}
+
+void
+Plugin_URLNotify(NPP instance, const char* URL, NPReason reason, void* notifyData)
+{
+
+}
+
+NPError
+Plugin_GetValue(NPP instance, NPPVariable variable, void* pValue)
+{
+ __PLUGIN_DEBUG_TRACE("%s", __FUNCTION__);
+
+ NPObject* pNPObject = NULL;
+ NPError retErr = NPERR_INVALID_PARAM;
+
+ if (pValue != NULL)
+ {
+ retErr = NPERR_NO_ERROR;
+ switch (variable)
+ {
+ case NPPVpluginNeedsXEmbed:
+ {
+ *((bool*) pValue) = true;
+ break;
+ }
+
+ case NPPVpluginNameString:
+ {
+ static char name[] = "x-osp-jsbridge";
+ *((char**) pValue) = name;
+ break;
+ }
+
+ case NPPVpluginDescriptionString:
+ {
+ static char desc[] = "The Plugin for x-osp-jsbridge";
+ *((char**) pValue) = desc;
+ break;
+ }
+
+ case NPPVpluginScriptableNPObject:
+ {
+ pNPObject = g_pBrowserFuncs->createobject(instance, &classScriptPlayer);
+ g_pBrowserFuncs->retainobject(pNPObject);
+ *((NPObject**) pValue) = pNPObject;
+ break;
+ }
+
+ default:
+ {
+ retErr = NPERR_INVALID_PARAM;
+ break;
+ }
+ }
+ }
+ return retErr;
+}
+
+NPError
+Plugin_SetValue(NPP instance, NPNVariable variable, void* value)
+{
+ return NPERR_NO_ERROR;
+}
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_JsBridgePlugin.h
+ * @brief The file contains the implmentation of npapi plugin callbacks.
+ *
+ * The file contains the implmentation of npapi plugin callbacks.
+ */
+
+#ifndef FWEBCTRL_JSBRIDGEPLUGIN_H_
+#define FWEBCTRL_JSBRIDGEPLUGIN_H_
+
+#include <NPAPI/npapi.h>
+#include <NPAPI/npfunctions.h>
+#include <FOspConfig.h>
+
+static NPNetscapeFuncs* g_pBrowserFuncs = NULL;
+static NPIdentifier requestToNativeScriptPlayer = NULL;
+
+typedef struct _RuntimeObject
+{
+ NPObject object;
+ NPP instance;
+} RuntimeObject;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+_OSP_EXPORT_ NPError NP_Initialize(NPNetscapeFuncs* pBrowserFuncs, NPPluginFuncs* pFuncs);
+_OSP_EXPORT_ NPError NP_Shutdown(void);
+_OSP_EXPORT_ char* NP_GetMIMEDescription(void);
+_OSP_EXPORT_ NPError NP_GetValue(void* pFuture, NPPVariable variable, void* pValue);
+
+NPError Plugin_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData * saved);
+NPError Plugin_Destroy(NPP instance, NPSavedData** save);
+NPError Plugin_SetWindow(NPP instance, NPWindow* window);
+NPError Plugin_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype);
+NPError Plugin_DestroyStream(NPP instance, NPStream* stream, NPReason reason);
+
+int32_t Plugin_WriteReady(NPP instance, NPStream* stream);
+int32_t Plugin_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer);
+void Plugin_StreamAsFile(NPP instance, NPStream* stream, const char* fname);
+void Plugin_Print(NPP instance, NPPrint* platformPrint);
+int16_t Plugin_HandleEvent(NPP instance, void* event);
+void Plugin_URLNotify(NPP instance, const char* URL, NPReason reason, void* notifyData);
+NPError Plugin_GetValue(NPP instance, NPPVariable variable, void* value);
+NPError Plugin_SetValue(NPP instance, NPNVariable variable, void* value);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // FWEBCTRL_JSBRIDGEPLUGIN_H_
--- /dev/null
+SET (this_target web-js-bridge-plugin-tizen)
+
+INCLUDE_DIRECTORIES(
+ /usr/include/ewebkit2-0
+ /usr/include/osp
+ /usr/include/osp/base
+ /usr/include/osp/ui
+ )
+
+SET (${this_target}_SOURCE_FILES
+ FWebCtrl_JsBridgePlugin.cpp
+)
+
+
+SET_SOURCE_FILES_PROPERTIES(${this_target}_HEADER_FILES
+ PROPERTIES HEADER_FILE_ONLY TRUE)
+LIST(APPEND ${this_target}_SOURCE_FILES ${${this_target}_HEADER_FILES})
+
+## SET EXTRA COMPILER FLAGS
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fPIC" )
+
+## SET C COMPILER FLAGS
+SET(CMAKE_C_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## SET CPP COMPILER FLAGS
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
+SET(CMAKE_CXX_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## Create Library
+ADD_LIBRARY (${this_target} SHARED ${${this_target}_SOURCE_FILES})
+# SET LINKER FLAGS
+TARGET_LINK_LIBRARIES(${this_target} "" )
+TARGET_LINK_LIBRARIES(${this_target} ${pkgs_LDFLAGS} ${OSP_LD_PATH_FLAGS} ${OSP_LD_FLAGS} ${OSP_LINKER_FLAGS})
+
+ADD_CUSTOM_COMMAND(TARGET ${this_target}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy ${LIBRARY_OUTPUT_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX} ${LIBRARY_OUTPUT_PATH}/debug/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX}
+ COMMAND ${CMAKE_STRIP} --strip-unneeded --remove-section .comment ${LIBRARY_OUTPUT_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX}
+ COMMENT "strip ${this_target}"
+ )
+
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_JsBridgePlugin.cpp
+ * @brief The file contains the implmentation of npapi plugin callbacks.
+ *
+ * The file contains the implmentation of npapi plugin callbacks.
+ */
+
+#define XP_TIZEN 1
+#define XP_UNIX 1
+#define MOZ_X11 1
+#define ENABLE_TIZEN_JSBRIDGE_PLUGIN 1
+#define HAS_SCRIPT_SUPPORT 1
+
+#include <string.h>
+#include "FWebCtrl_JsBridgePlugin.h"
+
+#ifdef __PLUGIN_DEBUG_PRINT
+#include <dlog.h>
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "JsBridgePlugin"
+#define __PLUGIN_DEBUG_TRACE(format, ARG...) \
+ { \
+ LOGD(format "[%d]", ## ARG, __LINE__); \
+ }
+#else
+#define __PLUGIN_DEBUG_TRACE(format, ARG...);
+#endif
+
+static NPObject*
+_CreateScriptPlayer(NPP instance, NPClass* pNPClass)
+{
+
+ // set up our our instance data
+ requestToNativeScriptPlayer = g_pBrowserFuncs->getstringidentifier("requestToNative");
+ RuntimeObject* pObject = (RuntimeObject*) g_pBrowserFuncs->memalloc(sizeof(RuntimeObject));
+ if (pObject != NULL)
+ {
+ pObject->instance = instance;
+ instance->pdata = pObject;
+ }
+
+ return (NPObject*) pObject;
+}
+
+static void
+_DestroyScriptPlayer(NPObject* pNPobj)
+{
+ RuntimeObject* pObj = (RuntimeObject*) pNPobj;
+ if (pObj)
+ {
+ pObj->instance->pdata = NULL;
+ g_pBrowserFuncs->memfree(pObj);
+ }
+}
+
+static bool
+_HasMethod(NPObject* pNPobj, NPIdentifier name)
+{
+ return name == requestToNativeScriptPlayer;
+}
+
+static bool
+_Invoke(NPObject* pNPobj, NPIdentifier name, const NPVariant* pArgs, uint32_t argCount, NPVariant* result)
+{
+ if (pArgs->type == NPVariantType_String)
+ {
+ char* pString = (char*) g_pBrowserFuncs->memalloc(pArgs->value.stringValue.UTF8Length + 1);
+
+ if (pString != NULL)
+ {
+ memset(pString, 0x00, pArgs->value.stringValue.UTF8Length + 1);
+ memcpy(pString, pArgs->value.stringValue.UTF8Characters, pArgs->value.stringValue.UTF8Length);
+
+ RuntimeObject* pObj = (RuntimeObject*) pNPobj;
+ g_pBrowserFuncs->setvalue(pObj->instance, NPPAppNotify, pString);
+ g_pBrowserFuncs->memfree(pString);
+ }
+ }
+
+ return true;
+}
+
+#ifdef OJI
+JRIGlobalRef
+GetJavaClassOfPlugin(void)
+{
+ jref clazz = NULL; //NPP_GetJavaClass();
+ if (clazz)
+ {
+ JRIEnv* pEnv = g_pBrowserFuncs->getJavaEnv();
+ return JRI_NewGlobalRef(pEnv, clazz);
+ }
+ return NULL;
+}
+#endif
+
+struct NPClass classScriptPlayer = {
+ NP_CLASS_STRUCT_VERSION, /* uint32_t structVersion; */
+ _CreateScriptPlayer, /* NPAllocateFunctionPtr allocate; */
+ _DestroyScriptPlayer, /* NPDeallocateFunctionPtr deallocate; */
+ NULL, /* NPInvalidateFunctionPtr invalidate; */
+ _HasMethod, /* NPHasMethodFunctionPtr hasMethod; */
+ _Invoke, /* NPInvokeFunctionPtr invoke; */
+ NULL, /* NPInvokeDefaultFunctionPtr invokeDefault; */
+ NULL, /* NPHasPropertyFunctionPtr hasProperty; */
+ NULL, /* NPGetPropertyFunctionPtr getProperty; */
+ NULL, /* NPSetPropertyFunctionPtr setProperty; */
+ NULL, /* NPRemovePropertyFunctionPtr removeProperty; */
+};
+
+NPError
+NP_Initialize(NPNetscapeFuncs* pNsTable, NPPluginFuncs* pFuncs)
+{
+
+ __PLUGIN_DEBUG_TRACE("%s", __FUNCTION__);
+ NPError err = NPERR_INVALID_PARAM;
+
+ if (pNsTable != NULL && pFuncs != NULL)
+ {
+ g_pBrowserFuncs = pNsTable;
+
+ //
+ // Set up the plugin function table that Netscape will use to
+ // call us. Netscape needs to know about our version and size
+ // and have a UniversalProcPointer for every function we
+ // implement.
+ //
+ pFuncs->version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
+ pFuncs->size = sizeof(NPPluginFuncs);
+ pFuncs->newp = Plugin_New;
+ pFuncs->destroy = Plugin_Destroy;
+ pFuncs->setwindow = Plugin_SetWindow;
+ pFuncs->newstream = Plugin_NewStream;
+ pFuncs->destroystream = Plugin_DestroyStream;
+ pFuncs->asfile = Plugin_StreamAsFile;
+ pFuncs->writeready = Plugin_WriteReady;
+ pFuncs->write = Plugin_Write;
+ pFuncs->print = Plugin_Print;
+ pFuncs->event = Plugin_HandleEvent;
+ pFuncs->urlnotify = Plugin_URLNotify;
+
+#ifdef OJI
+ pFuncs->javaClass = GetJavaClassOfPlugin();
+#endif
+ pFuncs->getvalue = Plugin_GetValue;
+ pFuncs->setvalue = Plugin_SetValue;
+ err = NPERR_NO_ERROR;
+ }
+ return err;
+}
+
+char*
+NP_GetMIMEDescription()
+{
+ __PLUGIN_DEBUG_TRACE("%s", __FUNCTION__);
+ return (char*) "application/x-tizen-jsbridge:jsb:TizenJsBridgePlugin";
+}
+
+NPError
+NP_GetValue(void* pFuture, NPPVariable variable, void* pValue)
+{
+ __PLUGIN_DEBUG_TRACE("%s", __FUNCTION__);
+ return Plugin_GetValue(static_cast< NPP_t* >(pFuture), variable, pValue);
+}
+
+NPError
+NP_Shutdown(void)
+{
+ __PLUGIN_DEBUG_TRACE("%s", __FUNCTION__);
+ return NPERR_NO_ERROR;
+}
+
+NPError
+Plugin_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved)
+{
+ __PLUGIN_DEBUG_TRACE("%s", __FUNCTION__);
+ if (instance != NULL)
+ {
+ instance->pdata = NULL;
+ }
+ g_pBrowserFuncs->setvalue(instance, NPPVpluginWindowBool, (void*)false);
+ return NPERR_NO_ERROR;
+}
+
+NPError
+Plugin_Destroy(NPP instance, NPSavedData** save)
+{
+ __PLUGIN_DEBUG_TRACE("%s", __FUNCTION__);
+ NPObject* pObj = (NPObject*) instance->pdata;
+
+ if (pObj)
+ {
+ g_pBrowserFuncs->releaseobject(pObj);
+ }
+ return NPERR_NO_ERROR;
+}
+
+NPError
+Plugin_SetWindow(NPP instance, NPWindow* window)
+{
+ __PLUGIN_DEBUG_TRACE("%s", __FUNCTION__);
+ return NPERR_NO_ERROR;
+}
+
+NPError
+Plugin_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype)
+{
+ return NPERR_NO_ERROR;
+}
+
+NPError
+Plugin_DestroyStream(NPP instance, NPStream* stream, NPReason reason)
+{
+ return NPERR_NO_ERROR;
+}
+
+int32_t
+Plugin_WriteReady(NPP instance, NPStream* stream)
+{
+ return 0;
+}
+
+int32_t
+Plugin_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer)
+{
+ return 0;
+}
+
+void
+Plugin_StreamAsFile(NPP instance, NPStream* stream, const char* fname)
+{
+
+}
+
+void
+Plugin_Print(NPP instance, NPPrint* platformPrint)
+{
+
+}
+
+int16_t
+Plugin_HandleEvent(NPP instance, void* event)
+{
+ return 1;
+}
+
+void
+Plugin_URLNotify(NPP instance, const char* URL, NPReason reason, void* notifyData)
+{
+
+}
+
+NPError
+Plugin_GetValue(NPP instance, NPPVariable variable, void* pValue)
+{
+ __PLUGIN_DEBUG_TRACE("%s", __FUNCTION__);
+
+ NPObject* pNPObject = NULL;
+ NPError retErr = NPERR_INVALID_PARAM;
+
+ if (pValue != NULL)
+ {
+ retErr = NPERR_NO_ERROR;
+ switch (variable)
+ {
+ case NPPVpluginNeedsXEmbed:
+ {
+ *((bool*) pValue) = true;
+ break;
+ }
+
+ case NPPVpluginNameString:
+ {
+ static char name[] = "x-tizen-jsbridge";
+ *((char**) pValue) = name;
+ break;
+ }
+
+ case NPPVpluginDescriptionString:
+ {
+ static char desc[] = "The Plugin for x-tizen-jsbridge";
+ *((char**) pValue) = desc;
+ break;
+ }
+
+ case NPPVpluginScriptableNPObject:
+ {
+ pNPObject = g_pBrowserFuncs->createobject(instance, &classScriptPlayer);
+ g_pBrowserFuncs->retainobject(pNPObject);
+ *((NPObject**) pValue) = pNPObject;
+ break;
+ }
+
+ default:
+ {
+ retErr = NPERR_INVALID_PARAM;
+ break;
+ }
+ }
+ }
+ return retErr;
+}
+
+NPError
+Plugin_SetValue(NPP instance, NPNVariable variable, void* value)
+{
+ return NPERR_NO_ERROR;
+}
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 FWebCtrl_JsBridgePlugin.h
+ * @brief The file contains the implmentation of npapi plugin callbacks.
+ *
+ * The file contains the implmentation of npapi plugin callbacks.
+ */
+
+#ifndef FWEBCTRL_JSBRIDGEPLUGIN_H_
+#define FWEBCTRL_JSBRIDGEPLUGIN_H_
+
+#include <NPAPI/npapi.h>
+#include <NPAPI/npfunctions.h>
+#include <FOspConfig.h>
+
+static NPNetscapeFuncs* g_pBrowserFuncs = NULL;
+static NPIdentifier requestToNativeScriptPlayer = NULL;
+
+typedef struct _RuntimeObject
+{
+ NPObject object;
+ NPP instance;
+} RuntimeObject;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+_OSP_EXPORT_ NPError NP_Initialize(NPNetscapeFuncs* pBrowserFuncs, NPPluginFuncs* pFuncs);
+_OSP_EXPORT_ NPError NP_Shutdown(void);
+_OSP_EXPORT_ char* NP_GetMIMEDescription(void);
+_OSP_EXPORT_ NPError NP_GetValue(void* pFuture, NPPVariable variable, void* pValue);
+
+NPError Plugin_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData * saved);
+NPError Plugin_Destroy(NPP instance, NPSavedData** save);
+NPError Plugin_SetWindow(NPP instance, NPWindow* window);
+NPError Plugin_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype);
+NPError Plugin_DestroyStream(NPP instance, NPStream* stream, NPReason reason);
+
+int32_t Plugin_WriteReady(NPP instance, NPStream* stream);
+int32_t Plugin_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer);
+void Plugin_StreamAsFile(NPP instance, NPStream* stream, const char* fname);
+void Plugin_Print(NPP instance, NPPrint* platformPrint);
+int16_t Plugin_HandleEvent(NPP instance, void* event);
+void Plugin_URLNotify(NPP instance, const char* URL, NPReason reason, void* notifyData);
+NPError Plugin_GetValue(NPP instance, NPPVariable variable, void* value);
+NPError Plugin_SetValue(NPP instance, NPNVariable variable, void* value);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // FWEBCTRL_JSBRIDGEPLUGIN_H_