Tizen 2.0 Release 2.0
authorHyungKyu Song <hk76.song@samsung.com>
Fri, 15 Feb 2013 15:55:18 +0000 (00:55 +0900)
committerHyungKyu Song <hk76.song@samsung.com>
Fri, 15 Feb 2013 15:55:18 +0000 (00:55 +0900)
83 files changed:
AUTHORS [new file with mode: 0644]
CMakeLists.txt [new file with mode: 0755]
LICENSE.APLv2.0 [new file with mode: 0755]
NOTICE [new file with mode: 0755]
inc/FWeb.h [new file with mode: 0755]
inc/FWebControls.h [new file with mode: 0755]
inc/FWebCtrlAuthenticationChallenge.h [new file with mode: 0755]
inc/FWebCtrlGeolocationPermissionManager.h [new file with mode: 0755]
inc/FWebCtrlHitElementResult.h [new file with mode: 0755]
inc/FWebCtrlIJavaScriptBridge.h [new file with mode: 0644]
inc/FWebCtrlILoadingListener.h [new file with mode: 0755]
inc/FWebCtrlITextSearchListener.h [new file with mode: 0755]
inc/FWebCtrlIWebDownloadListener.h [new file with mode: 0755]
inc/FWebCtrlIWebKeypadEventListener.h [new file with mode: 0755]
inc/FWebCtrlIWebUiEventListener.h [new file with mode: 0644]
inc/FWebCtrlPageNavigationList.h [new file with mode: 0755]
inc/FWebCtrlWeb.h [new file with mode: 0755]
inc/FWebCtrlWebSetting.h [new file with mode: 0755]
inc/FWebHistoryItem.h [new file with mode: 0755]
inc/FWebWebHistory.h [new file with mode: 0755]
osp-web.manifest [new file with mode: 0644]
osp-web.pc.in [new file with mode: 0755]
packaging/osp-web.spec [new file with mode: 0755]
src/FWebHistoryItem.cpp [new file with mode: 0755]
src/FWebWebHistory.cpp [new file with mode: 0755]
src/FWeb_HistoryItemImpl.cpp [new file with mode: 0755]
src/FWeb_HistoryItemImpl.h [new file with mode: 0755]
src/FWeb_WebHistoryImpl.cpp [new file with mode: 0755]
src/FWeb_WebHistoryImpl.h [new file with mode: 0755]
src/controls/FWebCtrlAuthenticationChallenge.cpp [new file with mode: 0755]
src/controls/FWebCtrlGeolocationPermissionManager.cpp [new file with mode: 0755]
src/controls/FWebCtrlHitElementResult.cpp [new file with mode: 0755]
src/controls/FWebCtrlPageNavigationList.cpp [new file with mode: 0755]
src/controls/FWebCtrlWeb.cpp [new file with mode: 0755]
src/controls/FWebCtrlWebSetting.cpp [new file with mode: 0755]
src/controls/FWebCtrl_AppControlListener.cpp [new file with mode: 0755]
src/controls/FWebCtrl_AppControlListener.h [new file with mode: 0644]
src/controls/FWebCtrl_AuthConfirmPopup.cpp [new file with mode: 0755]
src/controls/FWebCtrl_AuthConfirmPopup.h [new file with mode: 0755]
src/controls/FWebCtrl_AuthenticationChallengeImpl.cpp [new file with mode: 0755]
src/controls/FWebCtrl_AuthenticationChallengeImpl.h [new file with mode: 0644]
src/controls/FWebCtrl_EflWebkit.cpp [new file with mode: 0755]
src/controls/FWebCtrl_EflWebkit.h [new file with mode: 0755]
src/controls/FWebCtrl_GeolocationConfirmPopup.cpp [new file with mode: 0755]
src/controls/FWebCtrl_GeolocationConfirmPopup.h [new file with mode: 0755]
src/controls/FWebCtrl_GeolocationPermissionManagerImpl.cpp [new file with mode: 0755]
src/controls/FWebCtrl_GeolocationPermissionManagerImpl.h [new file with mode: 0755]
src/controls/FWebCtrl_GestureState.cpp [new file with mode: 0755]
src/controls/FWebCtrl_GestureState.h [new file with mode: 0755]
src/controls/FWebCtrl_HitElementResultImpl.cpp [new file with mode: 0755]
src/controls/FWebCtrl_HitElementResultImpl.h [new file with mode: 0755]
src/controls/FWebCtrl_IWebEventListener.h [new file with mode: 0644]
src/controls/FWebCtrl_InputPickerPopup.cpp [new file with mode: 0755]
src/controls/FWebCtrl_InputPickerPopup.h [new file with mode: 0755]
src/controls/FWebCtrl_PageNavigationListImpl.cpp [new file with mode: 0755]
src/controls/FWebCtrl_PageNavigationListImpl.h [new file with mode: 0755]
src/controls/FWebCtrl_PromptPopup.cpp [new file with mode: 0755]
src/controls/FWebCtrl_PromptPopup.h [new file with mode: 0644]
src/controls/FWebCtrl_SelectBox.cpp [new file with mode: 0755]
src/controls/FWebCtrl_SelectBox.h [new file with mode: 0644]
src/controls/FWebCtrl_Utility.cpp [new file with mode: 0755]
src/controls/FWebCtrl_Utility.h [new file with mode: 0755]
src/controls/FWebCtrl_Web.cpp [new file with mode: 0755]
src/controls/FWebCtrl_Web.h [new file with mode: 0755]
src/controls/FWebCtrl_WebDataHandler.cpp [new file with mode: 0755]
src/controls/FWebCtrl_WebDataHandler.h [new file with mode: 0644]
src/controls/FWebCtrl_WebEvent.cpp [new file with mode: 0755]
src/controls/FWebCtrl_WebEvent.h [new file with mode: 0755]
src/controls/FWebCtrl_WebEventArg.cpp [new file with mode: 0755]
src/controls/FWebCtrl_WebEventArg.h [new file with mode: 0755]
src/controls/FWebCtrl_WebImpl.cpp [new file with mode: 0755]
src/controls/FWebCtrl_WebImpl.h [new file with mode: 0755]
src/controls/FWebCtrl_WebMaker.cpp [new file with mode: 0755]
src/controls/FWebCtrl_WebPresenter.cpp [new file with mode: 0755]
src/controls/FWebCtrl_WebPresenter.h [new file with mode: 0755]
src/controls/FWebCtrl_WebSettingImpl.cpp [new file with mode: 0755]
src/controls/FWebCtrl_WebSettingImpl.h [new file with mode: 0644]
src/controls/js-bridge-plugin-deprecated/CMakeLists.txt [new file with mode: 0755]
src/controls/js-bridge-plugin-deprecated/FWebCtrl_JsBridgePlugin.cpp [new file with mode: 0755]
src/controls/js-bridge-plugin-deprecated/FWebCtrl_JsBridgePlugin.h [new file with mode: 0644]
src/controls/js-bridge-plugin-tizen/CMakeLists.txt [new file with mode: 0755]
src/controls/js-bridge-plugin-tizen/FWebCtrl_JsBridgePlugin.cpp [new file with mode: 0755]
src/controls/js-bridge-plugin-tizen/FWebCtrl_JsBridgePlugin.h [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..f4eb641
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,5 @@
+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>
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..a4e01fe
--- /dev/null
@@ -0,0 +1,157 @@
+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
+       /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
+       )
+
+SET (${this_target}_SOURCE_FILES
+       src/FWebHistoryItem.cpp
+       src/FWeb_HistoryItemImpl.cpp
+       src/FWebWebHistory.cpp
+       src/FWeb_WebHistoryImpl.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_GeolocationConfirmPopup.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
+)
+## 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} "-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} "-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-*" PATTERN 
+                               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-*" PATTERN 
+                               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")
+
+# 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)
+
diff --git a/LICENSE.APLv2.0 b/LICENSE.APLv2.0
new file mode 100755 (executable)
index 0000000..d645695
--- /dev/null
@@ -0,0 +1,202 @@
+
+                                 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.
diff --git a/NOTICE b/NOTICE
new file mode 100755 (executable)
index 0000000..ccdad52
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,3 @@
+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.
diff --git a/inc/FWeb.h b/inc/FWeb.h
new file mode 100755 (executable)
index 0000000..d7f4157
--- /dev/null
@@ -0,0 +1,60 @@
+//
+// 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>
+
+//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
diff --git a/inc/FWebControls.h b/inc/FWebControls.h
new file mode 100755 (executable)
index 0000000..450316a
--- /dev/null
@@ -0,0 +1,61 @@
+//
+// 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 <FWebCtrlPageNavigationList.h>
+#include <FWebCtrlWeb.h>
+#include <FWebCtrlWebSetting.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 %Web::Controls namespace allows you to embed the %Web browser as a control within an application, to upload and download content, and retrieve the HyperText Markup Language (HTML) element and history details.
+ * @n
+ * 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_
diff --git a/inc/FWebCtrlAuthenticationChallenge.h b/inc/FWebCtrlAuthenticationChallenge.h
new file mode 100755 (executable)
index 0000000..69343db
--- /dev/null
@@ -0,0 +1,100 @@
+//
+// 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
+        *
+        * @privilege           %http://tizen.org/privilege/web.privacy
+        *
+        * @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.
+        * @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
+        *
+        * @privilege           %http://tizen.org/privilege/web.privacy
+        *
+        * @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.
+        */
+       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_
diff --git a/inc/FWebCtrlGeolocationPermissionManager.h b/inc/FWebCtrlGeolocationPermissionManager.h
new file mode 100755 (executable)
index 0000000..37dc548
--- /dev/null
@@ -0,0 +1,227 @@
+// 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
+ * @if         VISPARTNER-MANUFACTURER\r
+ * @file               FWebCtrlGeolocationPermissionManager.h\r
+ * @brief              This is the header file for the %GeolocationPermissionManager class.\r
+ * @visibility partner-manufacturer\r
+ *\r
+ * This header file contains the declarations of the %GeolocationPermissionManager class.\r
+ *\r
+ * @endif\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
+ * @if VISPARTNER-MANUFACTURER\r
+ * @class              GeolocationPermissionManager\r
+ * @brief              This class provides methods to manage geolocation permissions.\r
+ *\r
+ * @since              2.0\r
+ *\r
+ * @visibility partner-manufacturer\r
+ * @privilege  %http://tizen.org/privilege/web.privacy\r
+ *\r
+ * The %GeolocationPermissionManager class provides methods to manage geolocation permissions decided by a user from origins using html5 JavaScript geolocation APIs.\r
+ * @n\r
+ * Origin consists of the scheme, host, and port.\r
+ * @endif\r
+ */\r
+\r
+class _OSP_EXPORT_ GeolocationPermissionManager\r
+       : public Tizen::Base::Object\r
+{ \r
+public:\r
+\r
+       /**\r
+        * @if VISPARTNER-MANUFACTURER\r
+        * Gets the origin list stored at the geolocation database.\r
+        *\r
+        * @since               2.0\r
+        *\r
+        * @visibility  partner-manufacturer\r
+        * @privilege   %http://tizen.org/privilege/web.privacy\r
+        *\r
+        * @return      A pointer to IList containing 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_SERVICE_BUSY            The dedicated service module is too busy to handle another request.\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
+        * @endif\r
+        */\r
+        Tizen::Base::Collection::IList* GetOriginListN(void) const;\r
+\r
+       /**\r
+        * @if VISPARTNER-MANUFACTURER\r
+        * Checks whether geolocation permission is allowed or not for the specified @c origin.\r
+        *\r
+        * @since               2.0\r
+        *\r
+        * @visibility  partner-manufacturer\r
+        * @privilege   %http://tizen.org/privilege/web.privacy\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_SERVICE_BUSY            The dedicated service module is too busy to handle another request.\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
+        * @endif\r
+        */\r
+       bool IsPermissionAllowed(const Tizen::Base::String& origin) const;\r
+\r
+       /**\r
+        * @if VISPARTNER-MANUFACTURER\r
+        * Removes the geolocation data for the specified @c origin.\r
+        *\r
+        * @since               2.0\r
+        *\r
+        * @visibility  partner-manufacturer\r
+        * @privilege   %http://tizen.org/privilege/web.privacy\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_SERVICE_BUSY            The dedicated service module is too busy to handle another request.\r
+        * @exception E_PRIVILEGE_DENIED        The application does not have the privilege to call this method.\r
+        * @see RemoveAll()\r
+        * @endif\r
+        */\r
+       result Remove(const Tizen::Base::String& origin);\r
+\r
+       /**\r
+        * @if VISPARTNER-MANUFACTURER\r
+        * Removes all elements in the list.\r
+        * \r
+        * @since               2.0\r
+        *\r
+        * @visibility  partner-manufacturer\r
+        * @privilege   %http://tizen.org/privilege/web.privacy\r
+        *\r
+        * @return      An error code\r
+        * @exception E_SUCCESS                 The method is successful.\r
+        * @exception E_SERVICE_BUSY            The dedicated service module is too busy to handle another request.\r
+        * @exception E_PRIVILEGE_DENIED        The application does not have the privilege to call this method.\r
+        * @see Remove()\r
+        * @endif\r
+        */\r
+       result RemoveAll(void);\r
+\r
+       /**\r
+        * @if VISPARTNER-MANUFACTURER\r
+        * Gets the geolocation permission manager instance.\r
+        *\r
+        * @since               2.0\r
+        *\r
+        * @visibility  partner-manufacturer\r
+        * @privilege   %http://tizen.org/privilege/web.privacy\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_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
+        * @endif\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
diff --git a/inc/FWebCtrlHitElementResult.h b/inc/FWebCtrlHitElementResult.h
new file mode 100755 (executable)
index 0000000..171b658
--- /dev/null
@@ -0,0 +1,166 @@
+//
+// 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 from the HTML element, such as tag name, attributes and content.
+ * @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 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_
diff --git a/inc/FWebCtrlIJavaScriptBridge.h b/inc/FWebCtrlIJavaScriptBridge.h
new file mode 100644 (file)
index 0000000..f12b8d8
--- /dev/null
@@ -0,0 +1,125 @@
+//
+// 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.
+ * @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>.
+ *
+ */
+#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 native object.
+ *
+ * @since      2.0
+ *
+ * The %IJavaScriptBridge interface provides a communication channel between JavaScript and C++ object.
+ */
+class _OSP_EXPORT_ IJavaScriptBridge
+{
+public:
+       /**
+       * This polymorphic destructor should be overridden if required. 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 invocation request from JavaScript side through the requestToNative() method.
+        *
+        * @since                       2.0
+        *
+        * @param[in] pArg        The parameters delivered by JavaScript
+        */
+       virtual void HandleJavaScriptRequestN(Tizen::Web::Json::IJsonValue* pArg) = 0;
+
+       /**
+        * Provides 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_
diff --git a/inc/FWebCtrlILoadingListener.h b/inc/FWebCtrlILoadingListener.h
new file mode 100755 (executable)
index 0000000..3c39c7d
--- /dev/null
@@ -0,0 +1,267 @@
+//
+// 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 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 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 occurred 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. 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 occurred during loading
+       * @param[in]          reason                                        The reason for the loading failure, @n
+       *                               - WEB_HTTP_RESPONSE: The HTTP state code such as "404" @n
+       *                               - WEB_MIME_NOT_SUPPORTED: The Multipurpose Internet Mail Extensions (MIME) type such as "application/rdf+xml" is not supported @n
+       *                               - 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 [0~100]
+        */
+       virtual void OnEstimatedProgress(int progress) = 0;
+
+       /**
+        * Called when the title of the new page has been 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 canceled 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 indicating 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 WEB_DECISION_DOWNLOAD. The data is routed to IWebDownloadListener to be downloaded incrementally. @n
+        * - If an application returns WEB_DECISION_CONTINUE, the browser engine continues the downloading and tries to parse the data. @n
+        * - If an application returns WEB_DECISION_IGNORE, the browser engine cancels the downloading of the data.
+        *
+        * @since                               2.0
+        *
+        * @return                      DecisionPolicy                  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;
+
+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) {}
+
+       //
+       // 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_Reserved5(void) {}
+
+}; // ILoadingListener
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_ILOADING_LISTENER_H_
diff --git a/inc/FWebCtrlITextSearchListener.h b/inc/FWebCtrlITextSearchListener.h
new file mode 100755 (executable)
index 0000000..a436dc9
--- /dev/null
@@ -0,0 +1,87 @@
+//
+// 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. 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 matches
+        * @param[in]   currentOrdinal          The ordinal of currently selected match @n
+        *                                                              If there is no match, it will be 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_
diff --git a/inc/FWebCtrlIWebDownloadListener.h b/inc/FWebCtrlIWebDownloadListener.h
new file mode 100755 (executable)
index 0000000..9336c5f
--- /dev/null
@@ -0,0 +1,153 @@
+//
+// 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 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. 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 has occurred while downloading content.
+       *
+       * @since                  2.0
+       *
+       * @param[in]          error                           The type of error that occurred 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_
diff --git a/inc/FWebCtrlIWebKeypadEventListener.h b/inc/FWebCtrlIWebKeypadEventListener.h
new file mode 100755 (executable)
index 0000000..7318aa3
--- /dev/null
@@ -0,0 +1,148 @@
+//
+// 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. 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
+        * @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 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 side 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_
diff --git a/inc/FWebCtrlIWebUiEventListener.h b/inc/FWebCtrlIWebUiEventListener.h
new file mode 100644 (file)
index 0000000..43d1839
--- /dev/null
@@ -0,0 +1,147 @@
+//
+// 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. 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 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;
+
+
+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) {};
+
+       //
+       // 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_Reserved5(void) {};
+}; // IWebUiEventListener
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_IWEB_UI_EVENT_LISTENER_H_
diff --git a/inc/FWebCtrlPageNavigationList.h b/inc/FWebCtrlPageNavigationList.h
new file mode 100755 (executable)
index 0000000..28ff019
--- /dev/null
@@ -0,0 +1,140 @@
+//
+// 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 pointed to by the specified @c index.
+        *
+        * @since               2.0
+        *
+        * @return              A pointer to the history item at the specified @c index
+        * @param[in]   index           The index of an 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 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 the 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_
diff --git a/inc/FWebCtrlWeb.h b/inc/FWebCtrlWeb.h
new file mode 100755 (executable)
index 0000000..b2a1b2e
--- /dev/null
@@ -0,0 +1,771 @@
+//
+// 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 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 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 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;
+
+    __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");
+
+    __pWeb->LoadUrl(url);
+}
+ *     @endcode
+ *
+ */
+class _OSP_EXPORT_ Web
+       : public Tizen::Ui::Container
+{
+public:
+       /**
+        * The object is not fully constructed after this constructor is called. 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
+        *
+        * @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_OPERATION     The control has not been constructed as yet.
+        * @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.
+        */
+       result Construct(const Tizen::Graphics::Rectangle& rect);
+
+       /**
+        * Loads the resource specified by the URL.
+        *
+        * @since               2.0
+        *
+        * @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.
+        * @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 with the given header of HTTP request.
+        *
+        * @since 2.0
+        *
+        * @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_ARG           The url or the header is invalid.
+        * @exception           E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
+        */
+       result LoadUrl(const Tizen::Base::String& url, const Tizen::Net::Http::HttpHeader& header);
+
+       /**
+        * Load the resource specified by the URL with the given header and body of HTTP request.
+        * The header must include content-type entity-header field that is needed to check mime-type of the message body.
+        *
+        * @since 2.0
+        *
+        * @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_ARG           The header is invalid.
+        * @exception           E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
+        */
+       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
+        *
+        * @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_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.
+        */
+       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
+        *
+        * @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.
+        * @remarks     The specific error code can be accessed using the GetLastResult() method.
+        */
+       void StopLoading(void);
+
+       /**
+        * Reloads the current page.
+        *
+        * @since               2.0
+        *
+        * @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.
+        * @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 a 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
+        *
+        * @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.
+        * @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
+        *
+        * @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.
+        * @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 containing the history items of the %Web control
+        * @exception           E_SUCCESS               The method is successful.
+        * @exception           E_DATA_NOT_FOUND        There is no history data.
+        * @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
+        *
+        * @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_FAILURE               The method has failed.
+        * @exception           E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
+        */
+       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_OBJ_NOT_FOUND         The specified element is not found.
+        * @exception           E_INVALID_OPERATION     The current state of the instance prohibits the execution of the specified operation.
+        * @remarks     The specific error code can be accessed using the GetLastResult() method.
+        */
+       Tizen::Web::Controls::HitElementResult* GetElementByPointN(const Tizen::Graphics::Point& point) const;
+
+       /**
+        * Evaluates the JavaScript string and returns the result.
+        *
+        * @since               2.0
+        *
+        * @privilege           %http://tizen.org/privilege/web.service
+        *
+        * @return              The result of the evaluated JavaScript, @n
+        *                              else an empty string if an error occurs
+        * @param[in]           scriptCode              The JavaScript code as string
+        * @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.
+        */
+       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 ranges between @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 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 ranges between @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
+        *
+        * @privilege           %http://tizen.org/privilege/web.service
+        *
+        * @param[in]           pLoadingListener        The listener receives the events that occurs 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.
+        * @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
+        *
+        * @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.
+        * @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 starting point specified.
+        */
+       result SetBlockSelectionPosition(const Tizen::Graphics::Point& 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 this method is called without the selection block, the startPoint and 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 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.
+        */
+       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);
+
+       /**
+        * 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
+        *
+        * @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_SYSTEM                The method has failed.
+        */
+       result SetPrivateBrowsingEnabled(bool enable);
+
+       /**
+        * Clears the application's cache.
+        *
+        * @since               2.0
+        *
+        * @privilege           %http://tizen.org/privilege/web.service
+        *
+        * @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 ClearCache(void);
+
+       /**
+        * Clears the application's cookie.
+        *
+        * @since               2.0
+        *
+        * @privilege           %http://tizen.org/privilege/web.service
+        *
+        * @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 ClearCookie(void);
+
+       /**
+        * Checks whether the %Web control allows cookie. @n
+        * Returns @c true if cookie is enabled.
+        *
+        * @since               2.0
+        *
+        * @return              @c true if cookie is allowed, @n
+        *                               else @c false
+        */
+       bool IsCookieEnabled(void) const;
+
+       /**
+        * Enables or disables a cookie.
+        *
+        * @since               2.0
+        *
+        * @privilege           %http://tizen.org/privilege/web.service
+        *
+        * @return              The result of enabling or disabling 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_SYSTEM                The method has failed.
+        * @exception           E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
+        */
+       result SetCookieEnabled(bool enable);
+
+       /**
+        * Saves the current web page as a pdf file. The size parameter is used to set size of the pdf file using millimeter.
+        *
+        * @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 millimeter. The width and height must be greater than 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.
+        */
+       result RemoveJavaScriptBridge(const IJavaScriptBridge& jsBridge);
+
+       /**
+        * Registers a keypad event listener. @n
+        * The registered listener is notified when the keypad associated with @c <input> tag or with @c <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 instances of the text on the current page and then highlights them. @n
+        * The current matched block will indicate 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 with 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 current page.
+        *       
+        * @since 2.0
+        *
+        * @return              The image
+        *
+        * @exception           E_SUCCESS               The method is successful.
+        * @remarks     The specific error code can be accessed using the GetLastResult() method.
+        *
+        */
+       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 screen operations. 
+        *
+        * @since               2.0
+        */
+       void    Resume(void);
+
+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_
diff --git a/inc/FWebCtrlWebSetting.h b/inc/FWebCtrlWebSetting.h
new file mode 100755 (executable)
index 0000000..c96b7e7
--- /dev/null
@@ -0,0 +1,354 @@
+//
+// 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 canceled */
+       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
+       *
+       * @param[in]            mode            A cache mode
+       */
+       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 must load 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 keypad
+        * @remarks             If an application sets the input style to 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.
+        *
+        * @since               2.0
+        *
+        * @return              A cache mode
+        */
+       CacheMode GetCacheControl(void) const;
+
+       /**
+        * Gets the font size of the content.
+        *
+        * @since               2.0
+        *
+        * @return              The size of the font
+        */
+       int GetFontSize(void) const;
+
+       /**
+        * Gets the text encoding of the content of a %Web control.
+        *
+        * @since               2.0
+        *
+        * @return              The text encoding
+        */
+       Tizen::Base::String GetDefaultTextEncoding(void) const;
+
+       /**
+        * Checks whether a %Web control uses JavaScript. @n
+        * Returns @c true if JavaScript is enabled.
+        *
+        * @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
+        * Returns @c true if auto image loading is enabled.
+        *
+        * @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.
+        *
+        * @since               2.0
+        *
+        * @return              The input style of keypad @n
+        *                              The default value of the input style is INPUT_STYLE_FULLSCREEN.
+        */
+       Tizen::Ui::Controls::InputStyle GetInputStyle(void) const;
+
+       /**
+       * Sets a certificate error handling mode for a %Web control.
+       *
+       * @since                2.0
+       *
+       * @param[in]    mode    A certificate error handling mode
+       */
+       void SetCertificateErrorHandlingMode(CertificateErrorHandlingMode mode);
+
+       /**
+       * Gets the value of the certificate error handling mode for a %Web control.
+       *
+       * @since                2.0
+       *
+       * @return               A certificate error handling mode
+       */
+       CertificateErrorHandlingMode GetCertificateErrorHandlingMode(void) const;
+
+       /**
+        * Sets a user agent for a %Web control.
+        *
+        * @since 2.0
+        *
+        * @param[in]   agent   The user agent
+        */
+       void SetUserAgent(const Tizen::Base::String& agent);
+
+       /**
+        * Gets a value of user agent for a %Web control.
+        *
+        * @since 2.0
+        *
+        * @return              The value of user agent
+        */
+       Tizen::Base::String GetUserAgent(void) const;
+
+       /**
+        * Decides if a %Web control loads the resized contents to fit width automatically.
+        *
+        * @since 2.0
+        *
+        * @param[in]   enable  Set to @c true if the %Web control should load contents to fit width, @n
+        *                                      else @c false
+        */
+       void SetAutoFittingEnabled(bool enable);
+
+       /**
+        * Checks whether a %Web control loads the resize contents to fit width. Returns true if auto fitting is enabled.
+        *
+        * @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 new window.
+        *
+        * @since 2.0
+        *
+        * @param[in]   enable  Set to @c true if the %Web control should allow JavaScript to open new window, @n
+        *                                      else @c false
+        */
+       void SetJavaScriptPopupEnabled(bool enable);
+
+       /**
+        * Checks whether a %Web control allows JavaScript to open new window. Returns true if opening new window by JavaScript is enabled.
+        *
+        * @since 2.0
+        *
+        * @return      @c true if opening new window by JavaScript is enabled, @n
+        *                      else @c false
+        */
+       bool IsJavaScriptPopupEnabled(void) const;
+
+       /**
+        * Decides if a %Web control supports html5 geolocation feature.
+        *
+        * @since 2.0
+        *
+        * @param[in]   enable  Set to @c true if the %Web control should support html5 geolocation feature, @n
+        *                                      else @c false
+        */
+       void SetGeolocationEnabled(bool enable);
+
+       /**
+        * Checks whether a %Web control supports html5 geolocation feature. Returns true if html5 geolocation feature is enabled.
+        *
+        * @since 2.0
+        *
+        * @return      @c true if html5 geolocation feature is enabled, @n
+        *                      else @c false
+        */
+       bool IsGeolocationEnabled(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::Object::Equals()
+        */
+       virtual bool Equals(const 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 from
+        */
+       WebSetting& operator =(const WebSetting& setting);
+
+private:
+       _WebSettingImpl* __pWebSettingImpl;
+
+       friend class _WebSettingImpl;
+}; // WebSetting
+
+}}} // Tizen::Web::Control
+#endif // _FWEB_CTRL_WEB_SETTING_H_
diff --git a/inc/FWebHistoryItem.h b/inc/FWebHistoryItem.h
new file mode 100755 (executable)
index 0000000..950d11c
--- /dev/null
@@ -0,0 +1,130 @@
+//
+// 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>
+#include <FGrpBitmap.h>
+
+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 the 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.
+        * @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_
diff --git a/inc/FWebWebHistory.h b/inc/FWebWebHistory.h
new file mode 100755 (executable)
index 0000000..d206d46
--- /dev/null
@@ -0,0 +1,133 @@
+//
+// 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. 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
+        * @privilege   %http://tizen.org/privilege/web.privacy
+        *
+        * @return      An error code
+        * @exception   E_SUCCESS                       The method is successful.
+        * @exception   E_SYSTEM                        A system error has occurred.
+        * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
+        */
+       result Construct(void);
+
+       /**
+        * Gets the history item pointed to by the specified @c index.
+        *
+        * @since               2.0
+        * @privilege   %http://tizen.org/privilege/web.privacy
+        *
+        * @return              The history item at the specified @c index
+        * @param[in]   index                   The index of an 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 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
+        * @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_
diff --git a/osp-web.manifest b/osp-web.manifest
new file mode 100644 (file)
index 0000000..ae3e6f7
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+       <request>
+               <domain name="_"/>
+       </request>
+</manifest>
\ No newline at end of file
diff --git a/osp-web.pc.in b/osp-web.pc.in
new file mode 100755 (executable)
index 0000000..eb6c3b7
--- /dev/null
@@ -0,0 +1,14 @@
+# 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}
+
diff --git a/packaging/osp-web.spec b/packaging/osp-web.spec
new file mode 100755 (executable)
index 0000000..205210e
--- /dev/null
@@ -0,0 +1,106 @@
+%define debug_package %{nil}
+%define __strip /bin/true
+
+Name:          osp-web
+Summary:       osp web library
+Version:       1.2.0.0
+Release:       2
+Group:         System/Libraries
+License:       TO_BE/FILLED_IN
+Source0:       %{name}-%{version}.tar.gz
+BuildRequires:  cmake
+BuildRequires:  pkgconfig(capi-appfw-application)
+BuildRequires:  pkgconfig(capi-network-connection)
+BuildRequires:  pkgconfig(capi-web-favorites)
+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)
+
+# 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 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 
+MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+%ifarch %{ix86}
+CXXFLAGS="$CXXFLAGS -D_OSP_DEBUG_ -D_OSP_X86_ -D_OSP_EMUL_" 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
+
+# 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 debug
+%{_libdir}/osp/debug/*.so.*
+%{_libdir}/osp/browser-plugin/debug/*.so
\ No newline at end of file
diff --git a/src/FWebHistoryItem.cpp b/src/FWebHistoryItem.cpp
new file mode 100755 (executable)
index 0000000..f333cf8
--- /dev/null
@@ -0,0 +1,84 @@
+//
+// 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 <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, pFavicon, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+       return pFavicon;
+}
+
+
+}} // Tizen::Web
diff --git a/src/FWebWebHistory.cpp b/src/FWebWebHistory.cpp
new file mode 100755 (executable)
index 0000000..5e1cfdf
--- /dev/null
@@ -0,0 +1,110 @@
+//
+// 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;
+
+       r = _AccessController::CheckUserPrivilege(_PRV_WEB_PRIVACY);
+       SysTryReturnResult(NID_WEB, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+
+       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 r;
+}
+
+
+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
diff --git a/src/FWeb_HistoryItemImpl.cpp b/src/FWeb_HistoryItemImpl.cpp
new file mode 100755 (executable)
index 0000000..d944530
--- /dev/null
@@ -0,0 +1,166 @@
+//
+// 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 <FAppUiApp.h>
+#include <FAppIAppFrame.h>
+#include <FBaseSysLog.h>
+#include <FBase_StringConverter.h>
+#include <FUiAnim_EflNode.h>
+#include <FUiAnim_VisualElementImpl.h>
+#include <FUiCtrlFrame.h>
+#include <FUi_ControlImpl.h>
+#include <FWebHistoryItem.h>
+#include "FWeb_HistoryItemImpl.h"
+#include "FWebCtrl_Utility.h"
+
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Animations;
+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;
+
+       BufferInfo bufferInfo;
+       ByteBuffer byteBuffer;
+       Evas_Object* pIcon = null;
+
+       IAppFrame* pAppFrame = Application::GetInstance()->GetAppFrame();
+       SysTryReturn(NID_WEB_CTRL, pAppFrame, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+       Frame* pFrame = pAppFrame->GetFrame();
+       SysTryReturn(NID_WEB_CTRL, pFrame, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+       _ControlImpl* pControlimpl = _ControlImpl::GetInstance(*pFrame);
+       SysTryReturn(NID_WEB_CTRL, pControlimpl, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+       VisualElement* pVisual = pControlimpl->GetCore().GetVisualElement();
+       SysTryReturn(NID_WEB_CTRL, pVisual, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+       _VisualElementImpl* pWebVisualElementImpl = _VisualElementImpl::GetInstance(*pVisual);
+       SysTryReturn(NID_WEB_CTRL,pWebVisualElementImpl, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+       _EflNode* pEflNode = dynamic_cast< _EflNode* >(pWebVisualElementImpl->GetNativeNode());
+       SysTryReturn(NID_WEB_CTRL, pEflNode, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+       Evas* pEvas = pEflNode->GetEvas();
+       SysTryReturn(NID_WEB_CTRL, pEvas, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+       if( __id == -1)
+       {
+               Ewk_Context* pDefaultContext = ewk_context_default_get();
+
+               const std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(__url));
+               pIcon = ewk_context_icon_database_icon_object_add(pDefaultContext, pUrl.get(), pEvas);
+               SysTryReturn(NID_WEB_CTRL, pIcon, null, E_OBJ_NOT_FOUND, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+       }
+       else
+       {
+               favorites_history_get_favicon(__id, pEvas, &pIcon);
+       }
+
+       r = _Utility::GetPixelBufferFromEvasObject(pIcon,  bufferInfo);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       const Dimension dimension(bufferInfo.width, bufferInfo.height);
+
+       r = byteBuffer.Construct(reinterpret_cast < 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> pBitmapImage(new (std::nothrow) Bitmap());
+       SysTryReturn(NID_WEB_CTRL, pBitmapImage.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       r = pBitmapImage->Construct(byteBuffer, dimension, BITMAP_PIXEL_FORMAT_ARGB8888);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       return pBitmapImage.release();
+}
+
+
+_HistoryItemImpl*
+_HistoryItemImpl::GetInstance(HistoryItem* pHistoryItem)
+{
+       return pHistoryItem->__pHistoryItemImpl;
+}
+
+
+const _HistoryItemImpl*
+_HistoryItemImpl::GetInstance(const HistoryItem* pHistoryItem)
+{
+       return pHistoryItem->__pHistoryItemImpl;
+}
+
+
+}} // Tizen::Web
diff --git a/src/FWeb_HistoryItemImpl.h b/src/FWeb_HistoryItemImpl.h
new file mode 100755 (executable)
index 0000000..9a29a85
--- /dev/null
@@ -0,0 +1,68 @@
+//
+// 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_
diff --git a/src/FWeb_WebHistoryImpl.cpp b/src/FWeb_WebHistoryImpl.cpp
new file mode 100755 (executable)
index 0000000..1904983
--- /dev/null
@@ -0,0 +1,143 @@
+//
+// 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
diff --git a/src/FWeb_WebHistoryImpl.h b/src/FWeb_WebHistoryImpl.h
new file mode 100755 (executable)
index 0000000..22630e7
--- /dev/null
@@ -0,0 +1,61 @@
+//
+// 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_
diff --git a/src/controls/FWebCtrlAuthenticationChallenge.cpp b/src/controls/FWebCtrlAuthenticationChallenge.cpp
new file mode 100755 (executable)
index 0000000..69fc7df
--- /dev/null
@@ -0,0 +1,85 @@
+//
+// 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_PRIVACY);
+       SysTryReturnVoidResult(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));
+
+       __pAuthenticationChallengeImpl->Process(userId, password);
+
+       SysLog(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_PRIVACY);
+       SysTryReturnVoidResult(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));
+
+       __pAuthenticationChallengeImpl->Cancel();
+}
+
+
+}}} // Tizen::Web::Controls
diff --git a/src/controls/FWebCtrlGeolocationPermissionManager.cpp b/src/controls/FWebCtrlGeolocationPermissionManager.cpp
new file mode 100755 (executable)
index 0000000..b2d5a8d
--- /dev/null
@@ -0,0 +1,195 @@
+//
+// 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 <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)
+{
+}
+
+
+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;
+
+       r = _AccessController::CheckUserPrivilege(_PRV_WEB_PRIVACY);
+       SysTryReturnVoidResult(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));
+
+       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_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 = __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_WEB_PRIVACY);
+       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_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 = __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_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 =  __pGeolocationPermissionManagerImpl->RemoveAll();
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       return E_SUCCESS;
+}
+
+
+}}} // Tizen::Web::Controls
diff --git a/src/controls/FWebCtrlHitElementResult.cpp b/src/controls/FWebCtrlHitElementResult.cpp
new file mode 100755 (executable)
index 0000000..2f9d509
--- /dev/null
@@ -0,0 +1,120 @@
+//
+// 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
diff --git a/src/controls/FWebCtrlPageNavigationList.cpp b/src/controls/FWebCtrlPageNavigationList.cpp
new file mode 100755 (executable)
index 0000000..7615c15
--- /dev/null
@@ -0,0 +1,97 @@
+//
+// 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
diff --git a/src/controls/FWebCtrlWeb.cpp b/src/controls/FWebCtrlWeb.cpp
new file mode 100755 (executable)
index 0000000..cb3027c
--- /dev/null
@@ -0,0 +1,757 @@
+//
+// 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 <FWebCtrlHitElementResult.h>
+#include <FWebCtrlPageNavigationList.h>
+#include <FWebCtrlWeb.h>
+#include <FWebCtrlWebSetting.h>
+#include <FSec_AccessController.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);
+       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));
+
+       _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;
+}
+
+
+void
+Web::LoadUrl(const String& url)
+{
+       _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+       SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
+
+       ClearLastResult();
+       result r = E_SUCCESS;
+
+       r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+       SysTryReturnVoidResult(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 = pWebImpl->LoadUrl(url);
+       SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       SysLog(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 != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
+
+       result r = E_SUCCESS;
+
+       r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+       SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+
+       r = pWebImpl->LoadUrl(url, header);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       SysLog(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 != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
+
+       result r = E_SUCCESS;
+
+       r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+       SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+
+       SysLog(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 != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
+
+       ClearLastResult();
+       result r = E_SUCCESS;
+
+       r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+       SysTryReturnVoidResult(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 = pWebImpl->LoadData(baseUrl, content, mime, encoding);
+       SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       SysLog(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 != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
+
+       ClearLastResult();
+       result r = E_SUCCESS;
+
+       r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+       SysTryReturnVoidResult(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));
+
+       pWebImpl->StopLoading();
+}
+
+
+void
+Web::Reload(void)
+{
+       _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+       SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
+
+       ClearLastResult();
+       result r = E_SUCCESS;
+
+       r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+       SysTryReturnVoidResult(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));
+
+       pWebImpl->Reload();
+}
+
+
+bool
+Web::IsLoading(void) const
+{
+       const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+       SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
+
+       return pWebImpl->IsLoading();
+}
+
+
+bool
+Web::CanGoBack(void) const
+{
+       const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+       SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
+
+       return pWebImpl->CanGoBack();
+}
+
+
+bool
+Web::CanGoForward(void) const
+{
+       const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+       SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
+
+       return pWebImpl->CanGoForward();
+}
+
+
+void
+Web::GoBack(void)
+{
+       _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+       SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
+
+       ClearLastResult();
+       result r = E_SUCCESS;
+
+       r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+       SysTryReturnVoidResult(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));
+
+       pWebImpl->GoBack();
+}
+
+
+void
+Web::GoForward(void)
+{
+       _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+       SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
+
+       ClearLastResult();
+       result r = E_SUCCESS;
+
+       r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+       SysTryReturnVoidResult(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));
+
+       pWebImpl->GoForward();
+}
+
+
+PageNavigationList*
+Web::GetBackForwardListN(void) const
+{
+       const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+       SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
+
+       ClearLastResult();
+
+       const PageNavigationList* pList = pWebImpl->GetBackForwardListN();
+       SysTryReturn(NID_WEB_CTRL, pList, 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 != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
+
+       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 != null, "Not yet constructedl. Construct() should be called before use.");
+
+       result r = E_SUCCESS;
+
+       r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+       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 = 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 != null, "Not yet constructedl. Construct() should be called before use.");
+
+       return pWebImpl->GetSetting();
+}
+
+
+HitElementResult*
+Web::GetElementByPointN(const Point& point) const
+{
+       const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+       SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
+
+       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 != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
+
+       ClearLastResult();
+       result r = E_SUCCESS;
+
+       r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+       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));
+
+       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 != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
+
+       result 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 != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
+
+       return pWebImpl->GetZoomLevel();
+}
+
+
+String
+Web::GetTitle(void) const
+{
+       const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+       SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
+
+       return pWebImpl->GetTitle();
+}
+
+
+String
+Web::GetUrl(void) const
+{
+       const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+       SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
+
+       return pWebImpl->GetUrl();
+}
+
+
+bool
+Web::IsMimeSupported(const String& mime) const
+{
+       const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+       SysAssertf(pWebImpl != null, "Not yet constructedl. 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 != null, "Not yet constructedl. Construct() should be called before use.");
+
+       ClearLastResult();
+       result r = E_SUCCESS;
+
+       r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+       SysTryReturnVoidResult(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));
+
+       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 != null, "Not yet constructedl. Construct() should be called before use.");
+
+       ClearLastResult();
+       result r = E_SUCCESS;
+
+       r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+       SysTryReturnVoidResult(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));
+
+       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 != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
+
+       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 != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
+
+       result r = E_SUCCESS;
+
+       r = pWebImpl->ReleaseBlock();
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       return E_SUCCESS;
+}
+
+
+result
+Web::GetBlockRange(Point& startPoint, Point& endPoint) const
+{
+       const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+       SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
+
+       result r = E_SUCCESS;
+
+       r = pWebImpl->GetBlockRange(startPoint, endPoint);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       return E_SUCCESS;
+}
+
+
+String
+Web::GetTextFromBlock(void) const
+{
+       const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+       SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
+
+       return pWebImpl->GetTextFromBlock();
+}
+
+
+result
+Web::SetScrollEnabled(bool enable)
+{
+       _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+       SysAssertf(pWebImpl != null, "Not yet constructed or Not attached to parent control.");
+
+       result r = pWebImpl->SetScrollEnabled(enable);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       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 != null, "Not yet constructed or Not attached to parent control.");
+
+       return pWebImpl->IsScrollEnabled();
+}
+
+
+void
+Web::SetWebUiEventListener(IWebUiEventListener* pUiEventListener)
+{
+       _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+       SysAssertf(pWebImpl != null, "Not yet constructedl. Construct() should be called before use.");
+
+       pWebImpl->SetWebUiEventListener(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 != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
+
+       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 != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
+
+       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 != null, "Not yet constructedl. 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 != null, "Not yet constructedl. Construct() should be called before use.");
+
+       return pWebImpl->IsPrivateBrowsingEnabled();
+}
+
+
+result
+Web::SetPrivateBrowsingEnabled(bool enable)
+{
+       _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+       SysAssertf(pWebImpl != null, "Not yet constructedl. Construct() should be called before use.");
+
+       result r = E_SUCCESS;
+
+       r = pWebImpl->SetPrivateBrowsingEnabled(enable);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       SysLog(NID_WEB_CTRL, "The current value of enable is %d", enable);
+
+       return E_SUCCESS;
+}
+
+
+result
+Web::ClearCache(void)
+{
+       _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+       SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
+
+       result r = E_SUCCESS;
+
+       r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+       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));
+
+       pWebImpl->ClearCache();
+
+       return E_SUCCESS;
+}
+
+
+result
+Web::ClearCookie(void)
+{
+       _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+       SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
+
+       result r = E_SUCCESS;
+
+       r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+       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));
+
+       pWebImpl->ClearCookie();
+
+       return E_SUCCESS;
+}
+
+
+bool
+Web::IsCookieEnabled(void) const
+{
+       const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+       SysAssertf(pWebImpl != null, "Not yet constructedl. Construct() should be called before use.");
+
+       return pWebImpl->IsCookieEnabled();
+}
+
+
+result
+Web::SetCookieEnabled(bool enable)
+{
+       _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+       SysAssertf(pWebImpl != null, "Not yet constructedl. Construct() should be called before use.");
+
+       result r = E_SUCCESS;
+
+       r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
+       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));
+
+       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 != null && pWebImpl->HasValidNativeNode(), "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 != null, "Not yet constructedl. 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 != null, "Not yet constructed or Not attached to parent control.");
+
+       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 != null, "Not yet constructedl. 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 != null && pWebImpl->HasValidNativeNode(), "Not yet constructed. Construct() should be called before use.");
+
+       ClearLastResult();
+
+       Bitmap* pFavicon = pWebImpl->GetFaviconN();
+       SysTryReturn(NID_WEB_CTRL, pFavicon, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+       return pFavicon;
+}
+
+
+void
+Web::Pause(void)
+{
+       _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+       SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructedl. Construct() should be called before use.");
+
+       pWebImpl->Pause();
+}
+
+
+void
+Web::Resume(void)
+{
+       _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
+       SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructedl. Construct() should be called before use.");
+
+       pWebImpl->Resume();
+}
+
+
+}}} // Tizen::Web::Controls
diff --git a/src/controls/FWebCtrlWebSetting.cpp b/src/controls/FWebCtrlWebSetting.cpp
new file mode 100755 (executable)
index 0000000..4603e5b
--- /dev/null
@@ -0,0 +1,323 @@
+//
+// 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 "FWebCtrl_WebSettingImpl.h"
+
+
+using namespace Tizen::Base;
+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.");
+
+       __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.");
+
+       __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.");
+
+       __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();
+}
+
+
+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
diff --git a/src/controls/FWebCtrl_AppControlListener.cpp b/src/controls/FWebCtrl_AppControlListener.cpp
new file mode 100755 (executable)
index 0000000..e533eab
--- /dev/null
@@ -0,0 +1,163 @@
+//
+// 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 <EWebKit2.h>
+#include <FAppAppControl.h>
+#include <FBaseSysLog.h>
+#include <FBaseUtilStringTokenizer.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_Data* 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"))));
+
+               Ewk_Geolocation_Permission_Request permistionRequest = ewk_geolocation_permission_request_get(__pGeoLocationObject);
+               if (pCategoryStr && pCategoryStr->Equals(String(L"Location")) && pGPSStr && pGPSStr->Equals(String(L"GPSEnabled")))
+               {
+                       ewk_geolocation_permission_request_allow_set(permistionRequest, true);
+               }
+               else
+               {
+                       ewk_geolocation_permission_request_allow_set(permistionRequest, false);
+               }
+       }
+       delete this;
+}
+
+
+_MediaSelectionListener::_MediaSelectionListener(void)
+       : __isSelectionCompleted(false)
+       , __pSelectedFiles(null)
+{
+
+}
+
+
+_MediaSelectionListener::~_MediaSelectionListener(void)
+{
+
+}
+
+
+const ArrayList*
+_MediaSelectionListener::GetSelectedFiles(void) const
+{
+       return __pSelectedFiles.get();
+}
+
+
+bool
+_MediaSelectionListener::IsSelectionCompleted(void) const
+{
+       return __isSelectionCompleted;
+}
+
+
+void
+_MediaSelectionListener::OnAppControlCompleteResponseReceived(const Tizen::App::AppId& providerId, const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pAppData)
+{
+       __isSelectionCompleted = true;
+       SysTryReturnVoidResult(NID_WEB_CTRL, pAppData &&  providerId == L"tizen.filemanager" && operationId == L"http://tizen.org/appcontrol/operation/pick", E_INVALID_ARG, "[E_INVALID_ARG] Invalid arguments to _MediaSelectionListener::OnAppControlCompleted");
+
+       std::unique_ptr<ArrayList, AllElementsDeleter> pSelectedFiles(new (std::nothrow) ArrayList());
+       SysTryReturnVoidResult(NID_WEB_CTRL, pSelectedFiles.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       result r = pSelectedFiles->Construct();
+       SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       String *pFiles = static_cast< String* >(const_cast< Object* >(pAppData->GetValue(String("path"))));
+       SysTryReturnVoidResult(NID_WEB_CTRL, pFiles, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       StringTokenizer strTok(*pFiles, L";");
+       String token;
+
+       while (strTok.HasMoreTokens())
+       {
+               strTok.GetNextToken(token);
+               std::unique_ptr<String> pFile(new (std::nothrow) String(token));
+               SysTryReturnVoidResult(NID_WEB_CTRL, pFile, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+               r = pSelectedFiles->Add(*pFile);
+               SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+               pFile.release();
+       }
+
+       __pSelectedFiles = std::move(pSelectedFiles);
+}
+
+
+}}} // Tizen::Web::Controls
diff --git a/src/controls/FWebCtrl_AppControlListener.h b/src/controls/FWebCtrl_AppControlListener.h
new file mode 100644 (file)
index 0000000..8a18488
--- /dev/null
@@ -0,0 +1,106 @@
+//
+// 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_Data* 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_Data* __pGeoLocationObject;
+}; //_LocationSettingListener
+
+
+class _MediaSelectionListener
+       : public Tizen::App::IAppControlResponseListener
+       , public Tizen::Base::Object
+       , virtual public Tizen::Base::Runtime::IEventListener
+{
+public:
+       _MediaSelectionListener(void);
+
+       virtual ~_MediaSelectionListener(void);
+
+       const Tizen::Base::Collection::ArrayList* GetSelectedFiles(void) const;
+
+       bool IsSelectionCompleted(void) const;
+
+       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:
+       bool __isSelectionCompleted;
+
+       std::unique_ptr<Tizen::Base::Collection::ArrayList, Tizen::Base::Collection::AllElementsDeleter> __pSelectedFiles;
+}; //_MediaSelectionListener
+
+}}} //Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_APPCONTROL_LISTENERS_H_
diff --git a/src/controls/FWebCtrl_AuthConfirmPopup.cpp b/src/controls/FWebCtrl_AuthConfirmPopup.cpp
new file mode 100755 (executable)
index 0000000..d2ed471
--- /dev/null
@@ -0,0 +1,292 @@
+//
+// 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 <FGrpDimension.h>
+#include <FGrpRectangle.h>
+#include <FUiCtrlButton.h>
+#include <FUiCtrlEditField.h>
+#include <FUiCtrlLabel.h>
+#include <FUiCtrlPanel.h>
+#include <FUiIActionEventListener.h>
+#include <FUiLayout.h>
+#include <FUiVerticalBoxLayout.h>
+#include <FWebCtrlAuthenticationChallenge.h>
+#include <FBaseSysLog.h>
+#include <FUiCtrl_PopupImpl.h>
+#include <FUi_ControlManager.h>
+#include <FUi_ResourceManager.h>
+#include <FSys_SystemResource.h>
+#include "FWebCtrl_WebImpl.h"
+#include "FWebCtrl_AuthConfirmPopup.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::Web::Controls;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui;
+
+static const int AUTH_POPUP_TMP_LABLE_HEIGHT = 10;
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+_AuthConfirmPopup::_AuthConfirmPopup(void)
+       : __pPopup(null)
+       , __pIdEditField(null)
+       , __pPwdEditField(null)
+       , __pPanel(null)
+       , __pAuthHandler(null)
+       , __modal(0)
+{
+}
+
+_AuthConfirmPopup::~_AuthConfirmPopup(void)
+{
+}
+
+
+// Authentication popup
+result
+_AuthConfirmPopup::Construct(const Tizen::Base::String& host, const Tizen::Base::String& realm, AuthenticationChallenge* pAuth)
+{
+       SysTryReturnResult(NID_WEB_CTRL, pAuth != null, E_INVALID_ARG, "[%s] invalid argument(s) is used. The AuthenticationChallenge is null.", GetErrorMessage(E_INVALID_ARG));
+
+       __pAuthHandler = pAuth;
+
+       VerticalBoxLayout layout;
+       result r = layout.Construct(VERTICAL_DIRECTION_DOWNWARD);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       Dimension dim;
+       Dimension editDim;
+       Rectangle rect(0, 0, 0, 0);
+
+       int spacePad = 0;
+       int buttonHeight = 0;
+       int sideMargin = 0;
+       int buttonWidth = 0;
+
+       _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
+
+       GET_SHAPE_CONFIG(MESSAGEBOX::DEFAULT_WIDTH, orientation, rect.width);
+       GET_SHAPE_CONFIG(MESSAGEBOX::MIN_HEIGHT, orientation, rect.height);
+       GET_SHAPE_CONFIG(POPUP::SIDE_BORDER, orientation, sideMargin);
+       GET_SHAPE_CONFIG(MESSAGEBOX::BUTTON_SIDE_MARGIN_02, orientation, spacePad);
+       GET_DIMENSION_CONFIG(EDIT::MIN_SIZE, orientation, editDim);
+       GET_SHAPE_CONFIG(MESSAGEBOX::BUTTON_HEIGHT, orientation, buttonHeight);
+
+       std::unique_ptr<Popup> pPopup(new (std::nothrow) Popup());
+       SysTryReturnResult(NID_WEB_CTRL, pPopup.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       rect.height = ((5*spacePad) + (editDim.height*2) + buttonHeight);
+       r = pPopup->Construct(layout,layout, true, Tizen::Graphics::Dimension(rect.width, rect.height));
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pPopup->SetTitleText("Authentication Dialog");
+
+       // Id Edit Field
+       rect.x = 0;
+       rect.y = 0;
+       rect.height = editDim.height;
+
+       std::unique_ptr<EditField> pIdEditField(new (std::nothrow) EditField());
+       SysTryReturnResult(NID_WEB_CTRL, pIdEditField.get(), r = E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.",GetErrorMessage(E_OUT_OF_MEMORY));
+
+       r = pIdEditField->Construct(rect, EDIT_FIELD_STYLE_NORMAL);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pIdEditField->SetGuideText(L"id");
+       pIdEditField->SetGuideTextColor(Color(95, 95, 95));
+
+       r = pPopup->AddControl(*pIdEditField);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       __pIdEditField = pIdEditField.release();
+
+       // Pwd Edit Field
+       rect.y = spacePad + editDim.height;
+
+       std::unique_ptr<EditField> pPwdEditField(new (std::nothrow) EditField());
+       SysTryReturnResult(NID_WEB_CTRL, pPwdEditField.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.",GetErrorMessage(E_OUT_OF_MEMORY));
+
+       r = pPwdEditField->Construct(rect, EDIT_FIELD_STYLE_PASSWORD);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pPwdEditField->SetGuideText(L"Password");
+       pPwdEditField->SetGuideTextColor(Color(95, 95, 95));
+
+       r = pPopup->AddControl(*pPwdEditField);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       __pPwdEditField = pPwdEditField.release();
+       __pIdEditField->SetFocus();
+       __pPopup = std::move(pPopup);
+
+       r = AddButtons(spacePad, sideMargin, buttonHeight, rect);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       std::unique_ptr<VerticalBoxLayout> pLayout(dynamic_cast< VerticalBoxLayout* >(__pPopup->GetLayoutN()));
+       SysTryReturn(NID_WEB_CTRL, pLayout.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+       pLayout->SetHorizontalFitPolicy(*__pIdEditField, FIT_POLICY_PARENT);
+       pLayout->SetHorizontalFitPolicy(*__pPwdEditField, FIT_POLICY_PARENT);
+       pLayout->SetHorizontalFitPolicy(*__pPanel, FIT_POLICY_PARENT);
+
+       pLayout->SetHorizontalAlignment(*__pIdEditField, LAYOUT_HORIZONTAL_ALIGN_CENTER);
+       pLayout->SetHorizontalAlignment(*__pPwdEditField, LAYOUT_HORIZONTAL_ALIGN_CENTER);
+       pLayout->SetHorizontalAlignment(*__pPanel, LAYOUT_HORIZONTAL_ALIGN_CENTER);
+
+       pLayout->SetHorizontalAlignment(*__pIdEditField, LAYOUT_HORIZONTAL_ALIGN_CENTER);
+       pLayout->SetHorizontalAlignment(*__pPwdEditField, LAYOUT_HORIZONTAL_ALIGN_CENTER);
+       pLayout->SetHorizontalAlignment(*__pPanel, LAYOUT_HORIZONTAL_ALIGN_CENTER);
+
+       pLayout->SetSpacing(*__pPwdEditField, spacePad);
+       pLayout->SetSpacing(*__pPanel, spacePad);
+
+       return E_SUCCESS;
+}
+
+
+result
+_AuthConfirmPopup::AddButtons(int spacePad, int sideMargin, int buttonHeight, Rectangle& rect)
+{
+       result r = E_SUCCESS;
+       int buttonWidth = 0;
+       String buttonStr;
+       Dimension editDim;
+
+       _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();//_CONTROL_ORIENTATION_PORTRAIT;
+       GET_DIMENSION_CONFIG(EDIT::MIN_SIZE, orientation, editDim);
+
+       //Button Left
+       buttonWidth = (rect.width / 2) - (spacePad) - (sideMargin * 2);
+
+       Tizen::System::_SystemResource* pSysResource = Tizen::System::_SystemResource::GetInstance();
+       SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
+
+       buttonStr = pSysResource->GetString("sys_string", "IDS_COM_SK_OK");
+
+       std::unique_ptr<Panel> pPanel(new (std::nothrow) Panel());
+       SysTryReturnResult(NID_WEB_CTRL, pPanel.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       r = pPanel->Construct(Rectangle(0, 2 * (spacePad + editDim.height), rect.width, buttonHeight + spacePad));
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = __pPopup->AddControl(*pPanel);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       __pPanel = pPanel.release();
+
+       std::unique_ptr<Button> pBtnSelection(new (std::nothrow) Button());
+       SysTryReturnResult(NID_WEB_CTRL, pBtnSelection.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.",GetErrorMessage(E_OUT_OF_MEMORY));
+
+       r = pBtnSelection->Construct(Rectangle(sideMargin, 0, buttonWidth, buttonHeight), buttonStr);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pBtnSelection->SetActionId(ID_BUTTON_AUTH_PROCESS);
+
+       r = __pPanel->AddControl(*pBtnSelection);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pBtnSelection->AddActionEventListener(*this);
+       pBtnSelection.release();
+
+       // Button Right
+       buttonStr = pSysResource->GetString("sys_string", "IDS_COM_POP_CANCEL");
+
+       std::unique_ptr<Button> pBtnCancel(new (std::nothrow) Button());
+       SysTryReturnResult(NID_WEB_CTRL, pBtnCancel.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.",GetErrorMessage(E_OUT_OF_MEMORY));
+
+       r = pBtnCancel->Construct(Rectangle(buttonWidth + spacePad + sideMargin, 0, buttonWidth, buttonHeight), buttonStr);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pBtnCancel->SetActionId(ID_BUTTON_AUTH_CANCEL);
+
+       r = __pPanel->AddControl(*pBtnCancel);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pBtnCancel->AddActionEventListener(*this);      
+       pBtnCancel.release();
+
+       return E_SUCCESS;
+}
+
+
+void
+_AuthConfirmPopup::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
+{
+       result r = E_SUCCESS;
+
+       switch (actionId)
+       {
+       case ID_BUTTON_AUTH_PROCESS:
+               __pAuthHandler->Process(__pIdEditField->GetText(), __pPwdEditField->GetText());
+               break;
+
+       case ID_BUTTON_AUTH_CANCEL:
+               __pAuthHandler->Cancel();
+               break;
+
+       default:
+               break;
+       }
+
+       r = HidePopup();
+       SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+}
+
+
+result
+_AuthConfirmPopup::ShowPopup(void)
+{
+       result r = E_SUCCESS;
+
+       r = __pPopup->SetShowState(true);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = __pPopup->Show();
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = __pPopup->DoModal(__modal);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       return E_SUCCESS;
+}
+
+
+result
+_AuthConfirmPopup::HidePopup(void)
+{
+       result r = E_SUCCESS;
+
+       r = __pPopup->SetShowState(false);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = __pPopup->EndModal(__modal);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       return E_SUCCESS;
+}
+
+
+}}} // Tizen::Web::Controls
diff --git a/src/controls/FWebCtrl_AuthConfirmPopup.h b/src/controls/FWebCtrl_AuthConfirmPopup.h
new file mode 100755 (executable)
index 0000000..1ef62cd
--- /dev/null
@@ -0,0 +1,95 @@
+//
+// 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 <FBase.h>
+#include <FBaseString.h>
+#include <FUi.h>
+#include <FUiIActionEventListener.h>
+
+namespace Tizen { namespace Ui
+{
+class IActionEventListener;
+}} // Tizen::Ui
+
+namespace Tizen { namespace Ui { namespace Controls
+{
+class Popup;
+}}} // Tizen::Ui::Controls
+
+namespace Tizen { namespace Web { namespace Controls
+{
+class AuthenticationChallenge;
+
+
+enum _AuthPopupButtonId
+{
+       ID_BUTTON_AUTH_PROCESS,
+       ID_BUTTON_AUTH_CANCEL
+};
+
+
+class _AuthConfirmPopup
+       : public Tizen::Base::Object
+       , virtual public Tizen::Ui::IActionEventListener
+{
+
+public:
+       /**
+        * Constructor
+        */
+       _AuthConfirmPopup(void);
+
+       /**
+        * Destructor
+        */
+       virtual ~_AuthConfirmPopup(void);
+
+       result Construct(const Tizen::Base::String& host, const Tizen::Base::String& realm, AuthenticationChallenge* pAuth);
+
+       result ShowPopup(void);
+
+       result HidePopup(void);
+
+       virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+
+private:
+       _AuthConfirmPopup(const _AuthConfirmPopup&);
+
+       _AuthConfirmPopup& operator =(const _AuthConfirmPopup&);
+
+       result AddButtons(int spacePad, int sideMargin, int buttonHeight,Tizen::Graphics::Rectangle& rect);
+
+private:
+       std::unique_ptr<Tizen::Ui::Controls::Popup> __pPopup;
+       Tizen::Ui::Controls::EditField* __pIdEditField;
+       Tizen::Ui::Controls::EditField* __pPwdEditField;
+       Tizen::Ui::Controls::Panel* __pPanel;
+       AuthenticationChallenge* __pAuthHandler;
+       int __modal;
+}; // _AuthConfirmPopup
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_AUTH_COMMON_POPUP_H_
diff --git a/src/controls/FWebCtrl_AuthenticationChallengeImpl.cpp b/src/controls/FWebCtrl_AuthenticationChallengeImpl.cpp
new file mode 100755 (executable)
index 0000000..a6c4dc1
--- /dev/null
@@ -0,0 +1,105 @@
+//
+// 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
diff --git a/src/controls/FWebCtrl_AuthenticationChallengeImpl.h b/src/controls/FWebCtrl_AuthenticationChallengeImpl.h
new file mode 100644 (file)
index 0000000..0f4f057
--- /dev/null
@@ -0,0 +1,65 @@
+//
+// 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_
diff --git a/src/controls/FWebCtrl_EflWebkit.cpp b/src/controls/FWebCtrl_EflWebkit.cpp
new file mode 100755 (executable)
index 0000000..1485ca9
--- /dev/null
@@ -0,0 +1,230 @@
+//
+// 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 <EWebKit2.h>
+#include <net_connection.h>
+#include <vconf.h>
+#include <FAppApp.h>
+#include <FGrpPoint.h>
+#include <FGrpRectangle.h>
+#include <FIoDbEnumerator.h>
+#include <FUiAnimVisualElement.h>
+#include <FApp_AppInfo.h>
+#include <FBaseSysLog.h>
+#include <FBase_StringConverter.h>
+#include <FGrp_CoordinateSystem.h>
+#include <FIo_DirectoryImpl.h>
+#include <FIo_DatabaseImpl.h>
+#include <FIo_FileImpl.h>
+#include <FSecCert_CertService.h>
+#include "FUiAnim_EflNode.h"
+#include "FUiAnim_VisualElementImpl.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
+{
+
+
+_EflWebkit::_EflWebkit(void)
+       : __pWebFrame(null)
+{
+}
+
+
+_EflWebkit::~_EflWebkit(void)
+{
+//     evas_object_smart_member_del(__pWebFrame);
+       evas_object_del(__pWebFrame);
+       __pWebFrame = null;
+}
+
+
+result
+_EflWebkit::Construct(const Rectangle& rect, VisualElement& containerVisualElement)
+{
+       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.");
+
+       pEflNode->AddNativeSmartObject(containerVisualElement, __pWebFrame);
+
+       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));
+
+       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_view_text_selection_enable_set(__pWebFrame, 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());
+
+       r = CreateResourceDirectory();
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = InitializeGeolocationDb();
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = SetProxyAddress();
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       return E_SUCCESS;
+}
+
+
+result
+_EflWebkit::CreateResourceDirectory(void) const
+{
+       String geolocationPath(Tizen::App::App::GetInstance()->GetAppRootPath() + GEOLOCATION_DIRECTORY_PATH);
+       String parentPath(L"");
+
+       if (!_FileImpl::IsFileExist(geolocationPath))
+       {
+               result r = E_SUCCESS;
+
+               r = _DirectoryImpl::Create(geolocationPath, true);
+               SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_SYSTEM, "A system error has been occurred. create geolocation directory.");
+       }
+
+       return E_SUCCESS;
+}
+
+
+result
+_EflWebkit::InitializeGeolocationDb(void) const
+{
+       result r = E_SUCCESS;
+
+       _DatabaseImpl db;
+       String geolocationPath(Tizen::App::App::GetInstance()->GetAppRootPath() + GEOLOCATION_DIRECTORY_PATH + GEOLOCATION_DB_NAME);
+       String table(GEOLOCATION_TABLE_NAME);
+
+       r = db.Construct(geolocationPath, "a+", null);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       std::unique_ptr<DbEnumerator>   pEnum(db.QueryN(L"Select name from sqlite_master Where type='table' And name = '" + table + L"'"));
+       if (!pEnum.get())
+       {
+               r = db.ExecuteSql(
+                       L"CREATE TABLE IF NOT EXISTS " + table + L"(id INTEGER PRIMARY KEY AUTOINCREMENT, origin TEXT, permission INTEGER)",
+                       true);
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+       }
+
+       return E_SUCCESS;
+}
+
+
+result
+_EflWebkit::SetProxyAddress(void) const
+{
+       int ret = -1;
+       connection_h handle = null;
+
+       ret = connection_create(&handle);
+       SysTryReturnResult(NID_WEB_CTRL, ret >= 0, E_SYSTEM, "A system error has been occurred. Failed to create connection.");
+
+       char* pProxy = null;
+       connection_address_family_e family = CONNECTION_ADDRESS_FAMILY_IPV4;
+
+       ret = connection_get_proxy(handle, family, &pProxy);
+       SysTryReturnResult(NID_WEB_CTRL, ret >= 0, E_SYSTEM, "A system error has been occurred. Failed to get proxy address.");
+
+       ret = connection_destroy(handle);
+       SysTryReturnResult(NID_WEB_CTRL, ret >= 0, E_SYSTEM, "A system error has been occurred. Failed to destroy connection.");
+
+       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);
+
+       if (pProxy)
+       {
+               free(pProxy);
+       }
+
+       return E_SUCCESS;
+}
+
+
+Evas_Object*
+_EflWebkit::GetWebEvasObject(void) const
+{
+       return __pWebFrame;
+}
+
+
+}}} // Tizen::Web::Controls
diff --git a/src/controls/FWebCtrl_EflWebkit.h b/src/controls/FWebCtrl_EflWebkit.h
new file mode 100755 (executable)
index 0000000..6ccb3af
--- /dev/null
@@ -0,0 +1,76 @@
+//
+// 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 { namespace Animations
+{
+class VisualElement;
+}}} // 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);
+
+       Evas_Object* GetWebEvasObject(void) const;
+
+//     result GetPixelBufferFromEvasObject(const Evas_Object* source, Tizen::Graphics::BufferInfo& bufferInfo);
+
+private:
+       _EflWebkit(const _EflWebkit&);
+
+       result SetWebConfiguration(void) const;
+
+       result SetProxyAddress(void) const;
+
+       result CreateResourceDirectory(void) const;
+
+       result InitializeGeolocationDb() const;
+
+       _EflWebkit& operator =(const _EflWebkit&);
+
+private:
+       Evas_Object* __pWebFrame;
+}; // _EflWebkit
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_EFL_WEBKIT_H_
diff --git a/src/controls/FWebCtrl_GeolocationConfirmPopup.cpp b/src/controls/FWebCtrl_GeolocationConfirmPopup.cpp
new file mode 100755 (executable)
index 0000000..a4a0ceb
--- /dev/null
@@ -0,0 +1,327 @@
+//
+// 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_GeoLocationConfirmPopup.cpp
+ * @brief              The file contains the definition of _GeolocationConfirmPopup class.
+ */
+#include <FAppApp.h>
+#include <FGrpDimension.h>
+#include <FGrpRectangle.h>
+#include <FIoDbEnumerator.h>
+#include <FIoDbStatement.h>
+#include <FUiCtrlButton.h>
+#include <FUiCtrlLabel.h>
+#include <FUiCtrlPanel.h>
+#include <FUiIActionEventListener.h>
+#include <FUiLayout.h>
+#include <FUiVerticalBoxLayout.h>
+#include <FWebCtrlAuthenticationChallenge.h>
+#include <FBaseSysLog.h>
+#include <FIo_DatabaseImpl.h>
+#include <FUiCtrl_PopupImpl.h>
+#include <FUi_ControlManager.h>
+#include <FUi_ResourceManager.h>
+#include "FWebCtrl_GeolocationConfirmPopup.h"
+#include "FWebCtrl_GeolocationPermissionManagerImpl.h"
+#include "FWebCtrl_Utility.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::Io;
+using namespace Tizen::Web::Controls;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui;
+
+
+static const int GEOLOCATION_POPUP_TMP_LABLE_HEIGHT = 10;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+_GeolocationConfirmPopup::_GeolocationConfirmPopup(void)
+       : __pPopup(null)
+       , __pCheckButton(null)
+       , __pGeolocationHandler(null)
+       , __modal(0)
+{
+}
+
+
+_GeolocationConfirmPopup::~_GeolocationConfirmPopup(void)
+{
+}
+
+
+result
+_GeolocationConfirmPopup::Construct(Ewk_Geolocation_Permission_Data* pPermission)
+{
+       SysTryReturnResult(NID_WEB_CTRL, pPermission != null, E_INVALID_ARG, "[%s] Invalid argument(s) is used. pPermission is null." , GetErrorMessage(E_INVALID_ARG));
+
+       Dimension dim;
+       Dimension labelDim;
+       Dimension checkDim;
+
+       int spacePad = 0;
+       int buttonHeight = 0;
+       int sideMargin = 0;
+       int buttonWidth = 0;
+       int labelFontSize = 0;
+       int popupMaxHeight = 0;
+       int popupWidth = 0;
+
+       __pGeolocationHandler = pPermission;
+       String host = ewk_geolocation_permission_request_host_get(__pGeolocationHandler);
+       host.Append(" Requests your Location");
+
+       VerticalBoxLayout layout;
+       result r = layout.Construct(VERTICAL_DIRECTION_DOWNWARD);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
+
+       GET_SHAPE_CONFIG(MESSAGEBOX::DEFAULT_WIDTH, orientation, popupWidth);
+       GET_SHAPE_CONFIG(MESSAGEBOX::MAX_HEIGHT, orientation, popupMaxHeight);
+       GET_SHAPE_CONFIG(POPUP::SIDE_BORDER, orientation, sideMargin);
+       GET_SHAPE_CONFIG(MESSAGEBOX::BUTTON_SIDE_MARGIN_02, orientation, spacePad);
+       GET_SHAPE_CONFIG(LABEL::TEXT_FONT_SIZE, orientation, labelFontSize);
+       GET_DIMENSION_CONFIG(LABEL::MIN_SIZE, orientation, labelDim);
+       GET_SHAPE_CONFIG(CHECKBUTTON::MARK_BITMAP_HEIGHT, orientation, checkDim.height);
+       GET_SHAPE_CONFIG(CHECKBUTTON::MARK_BITMAP_WIDTH, orientation, checkDim.width);
+
+       popupWidth -= 2*sideMargin;
+       labelDim.width = popupWidth - 2*sideMargin;
+       labelDim.height = 3*labelFontSize;
+
+       std::unique_ptr<Popup> pPopup(new (std::nothrow) Popup());
+       SysTryReturnResult(NID_WEB_CTRL, pPopup.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       popupMaxHeight =  labelDim.height*2 + checkDim.height + buttonHeight + 6*sideMargin;
+
+       r = pPopup->Construct(layout, layout, false, Tizen::Graphics::Dimension(popupWidth, popupMaxHeight));
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       Rectangle rect(0, 0, 0, 0);
+
+       //label
+       rect.height = labelDim.height;
+       rect.width = labelDim.width;
+
+       std::unique_ptr<Label> pLabel(new (std::nothrow) Label());
+       SysTryReturnResult(NID_WEB_CTRL, pLabel.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       r = pLabel->Construct(rect, host);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pLabel->SetTextConfig(labelFontSize, LABEL_TEXT_STYLE_NORMAL);
+
+       r = pPopup->AddControl(*pLabel);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       Label* pTmpLabel = pLabel.release();
+
+       //checkbutton
+       rect.y = 0;
+       rect.height = checkDim.height;
+
+       std::unique_ptr<CheckButton> pCheckButton (new (std::nothrow) CheckButton());
+       SysTryReturnResult(NID_WEB_CTRL, pCheckButton.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       r = pCheckButton->Construct(Rectangle(0, 0, rect.width, rect.height), CHECK_BUTTON_STYLE_MARK, BACKGROUND_STYLE_DEFAULT, false, L"Remember Preference");
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = pPopup->AddControl(*pCheckButton);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       __pCheckButton = pCheckButton.release();
+
+       //button
+       GET_SHAPE_CONFIG(MESSAGEBOX::BUTTON_HEIGHT, orientation, buttonHeight);
+       buttonWidth = (popupWidth / 2) - (spacePad) - (sideMargin * 2);
+
+       std::unique_ptr<Panel> pPanel(new (std::nothrow) Panel());
+       SysTryReturnResult(NID_WEB_CTRL, pPanel.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       r = pPanel->Construct(Rectangle(0, 0, rect.width, buttonHeight));
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = pPopup->AddControl(*pPanel);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       Panel* pTmpPanel = pPanel.release();
+
+       std::unique_ptr<Button> pBtnSelection(new (std::nothrow) Button());
+       SysTryReturnResult(NID_WEB_CTRL, pBtnSelection.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       r = pBtnSelection->Construct(Rectangle(sideMargin, 0, buttonWidth, buttonHeight), "Allow");
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pBtnSelection->SetActionId(ID_BUTTON_GEOLOCATION_PROCESS);
+
+       r = pTmpPanel->AddControl(*pBtnSelection);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pBtnSelection->AddActionEventListener(*this);
+       pBtnSelection.release();
+
+       // Button Right
+       std::unique_ptr<Button> pBtnCancel(new (std::nothrow) Button());
+       SysTryReturnResult(NID_WEB_CTRL, pBtnCancel.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       r = pBtnCancel->Construct(Rectangle(buttonWidth + spacePad + sideMargin, 0, buttonWidth, buttonHeight), "Refuse");
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pBtnCancel->SetActionId(ID_BUTTON_GEOLOCATION_CANCEL);
+
+       r = pTmpPanel->AddControl(*pBtnCancel);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pBtnCancel->AddActionEventListener(*this);
+       pBtnCancel.release();
+
+       std::unique_ptr<VerticalBoxLayout> pLayout(dynamic_cast< VerticalBoxLayout* >(pPopup->GetLayoutN()));
+       SysTryReturn(NID_WEB_CTRL, pLayout.get(), r = GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+       pLayout->SetHorizontalFitPolicy(*pTmpLabel, FIT_POLICY_PARENT);
+       pLayout->SetHorizontalFitPolicy(*__pCheckButton, FIT_POLICY_PARENT);
+       pLayout->SetHorizontalFitPolicy(*pTmpPanel, FIT_POLICY_PARENT);
+
+       pLayout->SetHorizontalAlignment(*pTmpLabel, LAYOUT_HORIZONTAL_ALIGN_CENTER);
+       pLayout->SetHorizontalAlignment(*__pCheckButton, LAYOUT_HORIZONTAL_ALIGN_CENTER);
+       pLayout->SetHorizontalAlignment(*pTmpPanel, LAYOUT_HORIZONTAL_ALIGN_CENTER);
+
+       pLayout->SetSpacing(*__pCheckButton, 2*sideMargin);
+       pLayout->SetSpacing(*pTmpPanel, 2*sideMargin);
+
+       __pPopup = std::move(pPopup);
+
+       return E_SUCCESS;
+}
+
+
+void
+_GeolocationConfirmPopup::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
+{
+       result r = E_SUCCESS;
+
+       bool permission = false;
+
+       switch (actionId)
+       {
+       case ID_BUTTON_GEOLOCATION_PROCESS:
+               permission = true;
+               break;
+
+       case ID_BUTTON_GEOLOCATION_CANCEL:
+               permission = false;
+               break;
+
+       default:
+               break;
+       }
+
+       r = SetGeolocationPermission(permission);
+       SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = HidePopup();
+       SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       delete this;
+}
+
+
+result
+_GeolocationConfirmPopup::SetGeolocationPermission(bool enable)
+{
+       result r = E_SUCCESS;
+
+       Ewk_Geolocation_Permission_Request permistionRequest = ewk_geolocation_permission_request_get(__pGeolocationHandler);
+
+       ewk_geolocation_permission_request_allow_set(permistionRequest, static_cast < Eina_Bool >(enable));
+
+       if (__pCheckButton->IsSelected())
+       {
+               r = AddGeolocationDb(enable);
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+       }
+
+       return E_SUCCESS;
+}
+
+
+result
+_GeolocationConfirmPopup::AddGeolocationDb(bool enable)
+{
+       _DatabaseImpl db;
+       String geolocationPath(Tizen::App::App::GetInstance()->GetAppRootPath() + GEOLOCATION_DIRECTORY_PATH + GEOLOCATION_DB_NAME);
+       String table(GEOLOCATION_TABLE_NAME);
+
+       const Ewk_Security_Origin* pOrigin = ewk_geolocation_permission_request_origin_get(__pGeolocationHandler);
+       String origin = _GeolocationPermissionManagerImpl::CreateOrigin(pOrigin);
+
+       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;
+}
+
+
+result
+_GeolocationConfirmPopup::ShowPopup(void)
+{
+       result r = E_SUCCESS;
+
+       r = __pPopup->SetShowState(true);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = __pPopup->Show();
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       return E_SUCCESS;
+}
+
+
+result
+_GeolocationConfirmPopup::HidePopup(void)
+{
+       result r = E_SUCCESS;
+
+       r = __pPopup->SetShowState(false);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       return E_SUCCESS;
+}
+
+
+}}} // Tizen::Web::Controls
diff --git a/src/controls/FWebCtrl_GeolocationConfirmPopup.h b/src/controls/FWebCtrl_GeolocationConfirmPopup.h
new file mode 100755 (executable)
index 0000000..843dbe4
--- /dev/null
@@ -0,0 +1,96 @@
+//
+// 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_GeoLocationConfirmPopup.h
+ * @brief      The file contains the definition of _GeolocationConfirmPopup class.
+ */
+
+#ifndef _FWEB_CTRL_INTERNAL_GEOLOCATION_CONFIRM_POPUP_H_
+#define _FWEB_CTRL_INTERNAL_GEOLOCATION_CONFIRM_POPUP_H_
+
+#include <unique_ptr.h>
+#include <EWebKit2.h>
+#include <FBase.h>
+#include <FBaseString.h>
+#include <FUi.h>
+#include <FUiIActionEventListener.h>
+
+namespace Tizen { namespace Ui
+{
+class IActionEventListener;
+}} // Tizen::Ui
+
+namespace Tizen { namespace Ui { namespace Controls
+{
+class Popup;
+}}} // Tizen::Ui::Controls
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+enum _GeolocationPopupButtonId
+{
+       ID_BUTTON_GEOLOCATION_PROCESS,
+       ID_BUTTON_GEOLOCATION_CANCEL
+};
+
+class _GeolocationConfirmPopup
+       : public Tizen::Base::Object
+       , virtual public Tizen::Ui::IActionEventListener
+{
+
+public:
+       /**
+        * Constructor
+        */
+       _GeolocationConfirmPopup(void);
+
+       /**
+        * Destructor
+        */
+       virtual ~_GeolocationConfirmPopup(void);
+
+       result Construct(Ewk_Geolocation_Permission_Data* pPermission);
+
+       result ShowPopup(void);
+
+       result HidePopup(void);
+
+       virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+
+private:
+       _GeolocationConfirmPopup(const _GeolocationConfirmPopup&);
+
+       result SetGeolocationPermission(bool enable);
+
+       result AddGeolocationDb(bool enable);
+
+       _GeolocationConfirmPopup& operator =(const _GeolocationConfirmPopup&);
+
+private:
+       std::unique_ptr<Tizen::Ui::Controls::Popup> __pPopup;
+
+       Tizen::Ui::Controls::CheckButton* __pCheckButton;
+
+       Ewk_Geolocation_Permission_Data* __pGeolocationHandler;
+
+       int __modal;
+}; // _GeolocationConfirmPopup
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_GEOLOCATION_COMMON_POPUP_H_
diff --git a/src/controls/FWebCtrl_GeolocationPermissionManagerImpl.cpp b/src/controls/FWebCtrl_GeolocationPermissionManagerImpl.cpp
new file mode 100755 (executable)
index 0000000..ff791b9
--- /dev/null
@@ -0,0 +1,214 @@
+//
+// 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_GeolocationPermissionManagerImpl.h"
+#include "FWebCtrl_Utility.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() + GEOLOCATION_DIRECTORY_PATH + GEOLOCATION_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));
+
+       if (pEnum.get())
+       {
+               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();
+       }
+
+       return null;
+}
+
+
+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 + "'"));
+       if (pEnum.get())
+       {
+               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);
+       }
+
+       return false;
+}
+
+
+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;
+}
+
+
+String
+_GeolocationPermissionManagerImpl::CreateOrigin(const void* ewkSecurityOrigin)
+{
+       const Ewk_Security_Origin* pOrigin = reinterpret_cast< const Ewk_Security_Origin* >(ewkSecurityOrigin);
+
+       String protocol(ewk_security_origin_protocol_get(pOrigin));
+       String host(ewk_security_origin_host_get(pOrigin));
+       int port = ewk_security_origin_port_get(pOrigin);
+
+       String origin = protocol + L"://" + host;
+
+       if (port)
+       {
+               origin.Append(L":");
+               origin.Append(port);
+       }
+
+       SysLog(NID_WEB_CTRL, "The current value of origin is %ls", origin.GetPointer());
+
+       return origin;
+}
+
+
+_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
diff --git a/src/controls/FWebCtrl_GeolocationPermissionManagerImpl.h b/src/controls/FWebCtrl_GeolocationPermissionManagerImpl.h
new file mode 100755 (executable)
index 0000000..b7d5c8d
--- /dev/null
@@ -0,0 +1,78 @@
+//
+// 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 Tizen::Base::String CreateOrigin(const void* ewkSecurityOrigin);
+
+       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
diff --git a/src/controls/FWebCtrl_GestureState.cpp b/src/controls/FWebCtrl_GestureState.cpp
new file mode 100755 (executable)
index 0000000..cab69a1
--- /dev/null
@@ -0,0 +1,639 @@
+//
+// 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 <FBaseSysLog.h>
+#include <FGrpPoint.h>
+#include <FUi_Control.h>
+#include <FUi_TouchManager.h>
+#include <FUi_UiTouchEvent.h>
+#include "FWebCtrl_GestureState.h"
+#include "FWebCtrl_Web.h"
+#include "FWebCtrl_WebSettingImpl.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui;
+
+
+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)
+{
+       memset(&gestureEvent, 0, sizeof(gestureEvent));
+
+       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,  _PinchGestureState* pPinchListener)
+       : __pWebCore(pWeb)
+       , __pPinchListener(pPinchListener)
+       , __longPressed(false)
+{
+}
+
+
+_TapGestureState::~_TapGestureState(void)
+{
+}
+
+
+void
+_TapGestureState::OnLongPressGestureDetected(const _TouchLongPressGestureDetector& gesture)
+{
+       __longPressed = true;
+
+       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.");
+
+       Ewk_Event_Gesture gestureEvent;
+
+       SetGestureEvent(gestureEvent, EWK_GESTURE_LONG_PRESS, Point(0, 0), Point(0, 0), 0, 0);
+       pSmartData->api->gesture_move(const_cast<Ewk_View_Smart_Data*>(pSmartData), &gestureEvent);
+}
+
+
+bool
+_TapGestureState::OnTouchPressed(const _Control& source, const _TouchInfo& touchInfo)
+{
+       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.");
+
+       _TouchManager* pTouchManager = _TouchManager::GetInstance();
+       SysAssertf(pTouchManager, "Failed to get webkit smart data.");
+
+       if (pTouchManager->GetPointCount() == 2)
+       {
+               result r = E_SUCCESS;
+
+               std::unique_ptr<Tizen::Base::Collection::IListT<_FingerInfo*> > pTouchList(pTouchManager->GetMultiFingerInfoListN());
+               SysTryReturn(NID_WEB_CTRL, pTouchList.get(), false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+               std::unique_ptr<Tizen::Base::Collection::IBidirectionalEnumeratorT<_FingerInfo*> > pEnum(pTouchList->GetBidirectionalEnumeratorN());
+               SysTryReturn(NID_WEB_CTRL, pEnum.get(), false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+               _FingerInfo* pFingerInfo = null;
+
+               r = pEnum->MoveNext();
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
+
+               r = pEnum->GetCurrent(pFingerInfo);
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
+
+               Point firstFinger(pFingerInfo->GetPoint());
+
+               r = pEnum->MoveNext();
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
+
+               r = pEnum->GetCurrent(pFingerInfo);
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
+
+               Point secondFinger(pFingerInfo->GetPoint());
+
+               __pPinchListener->InitializeFactor();
+
+               double zoomFactor = __pPinchListener->GetZoomFactor(firstFinger, secondFinger);
+               Point center(__pPinchListener->GetCenterPoint(firstFinger, secondFinger));
+
+               Point absPoint = __pWebCore->GetAbsoluteCoordinate(center);
+
+               Ewk_Event_Gesture gestureEvent;
+
+               SetGestureEvent(gestureEvent, EWK_GESTURE_PINCH, absPoint, Point(0, 0), zoomFactor, 0);
+               pSmartData->api->gesture_start(const_cast<Ewk_View_Smart_Data*>(pSmartData), &gestureEvent);
+
+               __pWebCore->ChangeGesture(WEB_GESTURE_TYPE_PINCH);      
+       }
+       else
+       {
+               __longPressed = false;
+
+               Point absPoint = __pWebCore->GetAbsoluteCoordinate(touchInfo.GetCurrentPosition());
+
+               Ewk_Event_Gesture gestureEvent;
+
+               SetGestureEvent(gestureEvent, EWK_GESTURE_TAP, absPoint, Point(0, 0), 0, 1);
+               pSmartData->api->gesture_start(const_cast<Ewk_View_Smart_Data*>(pSmartData), &gestureEvent);
+       }
+
+       return true;
+}
+
+
+bool
+_TapGestureState::OnTouchMoved(const _Control& source, const _TouchInfo& touchInfo)
+{
+       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.");
+
+       Ewk_Event_Gesture gestureEvent;
+
+       Point absPoint = __pWebCore->GetAbsoluteCoordinate(touchInfo.GetCurrentPosition());
+
+       SetGestureEvent(gestureEvent, EWK_GESTURE_PAN, absPoint, Point(0, 0), 0, 0);
+       pSmartData->api->gesture_start(const_cast<Ewk_View_Smart_Data*>(pSmartData), &gestureEvent);
+
+       __pWebCore->ChangeGesture(WEB_GESTURE_TYPE_PANNING);
+
+       return true;
+}
+
+
+bool
+_TapGestureState::OnTouchReleased(const _Control& source, const _TouchInfo& touchInfo)
+{
+       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.");
+
+       if (!__longPressed)
+       {
+               Ewk_Event_Gesture gestureEvent;
+
+               Point absPoint = __pWebCore->GetAbsoluteCoordinate(touchInfo.GetCurrentPosition());
+
+               SetGestureEvent(gestureEvent, EWK_GESTURE_TAP, absPoint, Point(0, 0), 0, 1);
+               pSmartData->api->gesture_end(const_cast<Ewk_View_Smart_Data*>(pSmartData), &gestureEvent);
+       }
+
+       return true;
+}
+
+
+bool
+_TapGestureState::OnTouchCanceled(const _Control& source, const _TouchInfo& touchInfo)
+{
+       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.");
+
+       Ewk_Event_Gesture gestureEvent;
+
+       SetGestureEvent(gestureEvent, EWK_GESTURE_LONG_PRESS, Point(0, 0), Point(0, 0), 0, 0);
+       pSmartData->api->gesture_move(const_cast<Ewk_View_Smart_Data*>(pSmartData), &gestureEvent);
+
+       return true;
+}
+
+
+_DoubleTapGestureState::_DoubleTapGestureState(_Web* pWeb)
+       : __pWebCore(pWeb)
+{
+}
+
+
+_DoubleTapGestureState::~_DoubleTapGestureState(void)
+{
+}
+
+
+bool
+_DoubleTapGestureState::OnTouchPressed(const _Control& source, const _TouchInfo& touchInfo)
+{
+       return true;
+}
+
+
+bool
+_DoubleTapGestureState::OnTouchMoved(const _Control& source, const _TouchInfo& touchInfo)
+{
+       return true;
+}
+
+
+bool
+_DoubleTapGestureState::OnTouchReleased(const _Control& source, const _TouchInfo& touchInfo)
+{
+       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.");
+
+       Ewk_Event_Gesture gestureEvent;
+
+       Point absPoint = __pWebCore->GetAbsoluteCoordinate(touchInfo.GetCurrentPosition());
+
+       SetGestureEvent(gestureEvent, EWK_GESTURE_TAP, absPoint, Point(0, 0), 0, 2);
+       pSmartData->api->gesture_start(const_cast<Ewk_View_Smart_Data*>(pSmartData), &gestureEvent);
+       pSmartData->api->gesture_end(const_cast<Ewk_View_Smart_Data*>(pSmartData), &gestureEvent);
+
+       __pWebCore->ChangeGesture(WEB_GESTURE_TYPE_TAP);
+
+       return true;
+}
+
+
+bool
+_DoubleTapGestureState::OnTouchCanceled(const _Control& source, const _TouchInfo& touchInfo)
+{
+       __pWebCore->ChangeGesture(WEB_GESTURE_TYPE_TAP);
+
+       return true;
+}
+
+
+_PanningGestureState::_PanningGestureState(_Web* pWeb, _PinchGestureState* pPinchListener)
+       : __pWebCore(pWeb)
+       , __pPinchListener(pPinchListener)
+{
+}
+
+
+_PanningGestureState::~_PanningGestureState(void)
+{
+}
+
+
+bool
+_PanningGestureState::OnTouchPressed(const _Control& source, const _TouchInfo& touchInfo)
+{
+       result r = E_SUCCESS;
+
+       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.");
+
+       _TouchManager* pTouchManager = _TouchManager::GetInstance();
+       SysAssertf(pTouchManager, "Failed to get webkit smart data.");
+
+       std::unique_ptr<Tizen::Base::Collection::IListT<_FingerInfo*> > pTouchList(pTouchManager->GetMultiFingerInfoListN());
+       SysTryReturn(NID_WEB_CTRL, pTouchList.get(), false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       std::unique_ptr<Tizen::Base::Collection::IBidirectionalEnumeratorT<_FingerInfo*> > pEnum(pTouchList->GetBidirectionalEnumeratorN());
+       SysTryReturn(NID_WEB_CTRL, pEnum.get(), false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       _FingerInfo* pFingerInfo = null;
+
+       r = pEnum->MoveNext();
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = pEnum->GetCurrent(pFingerInfo);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       Point firstFinger(pFingerInfo->GetPoint());
+
+       r = pEnum->MoveNext();
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = pEnum->GetCurrent(pFingerInfo);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       Point secondFinger(pFingerInfo->GetPoint());
+
+       __pPinchListener->InitializeFactor();
+
+       double zoomFactor = __pPinchListener->GetZoomFactor(firstFinger, secondFinger);
+       Point center(__pPinchListener->GetCenterPoint(firstFinger, secondFinger));
+
+       Point absPoint = __pWebCore->GetAbsoluteCoordinate(center);
+
+       Ewk_Event_Gesture gestureEvent;
+
+       SetGestureEvent(gestureEvent, EWK_GESTURE_PINCH, absPoint, Point(0, 0), zoomFactor, 0);
+       pSmartData->api->gesture_start(const_cast<Ewk_View_Smart_Data*>(pSmartData), &gestureEvent);
+
+       __pWebCore->ChangeGesture(WEB_GESTURE_TYPE_PINCH);
+
+       return true;
+}
+
+
+bool
+_PanningGestureState::OnTouchMoved(const _Control& source, const _TouchInfo& touchInfo)
+{
+       if (__pWebCore->GetWebSettingImpl()->IsScrollEnabled())
+       {
+               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.");
+
+               Ewk_Event_Gesture gestureEvent;
+
+               Point absPoint = __pWebCore->GetAbsoluteCoordinate(touchInfo.GetCurrentPosition());
+
+               SetGestureEvent(gestureEvent, EWK_GESTURE_PAN, absPoint, Point(0, 0), 0, 0);
+               pSmartData->api->gesture_move(const_cast<Ewk_View_Smart_Data*>(pSmartData), &gestureEvent);
+       }
+
+       return true;
+}
+
+
+bool
+_PanningGestureState::OnTouchReleased(const _Control& source, const _TouchInfo& touchInfo)
+{
+       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.");
+
+       Ewk_Event_Gesture gestureEvent;
+
+       Point absPoint = __pWebCore->GetAbsoluteCoordinate(touchInfo.GetCurrentPosition());
+
+       SetGestureEvent(gestureEvent, EWK_GESTURE_PAN, absPoint, Point(0, 0), 0, 0);
+       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)
+{
+}
+
+
+void
+_FlickGestureState::OnFlickGestureDetected(const _TouchFlickGestureDetector& gesture)
+{
+       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;
+}
+
+
+bool
+_FlickGestureState::OnTouchPressed(const _Control& source, const _TouchInfo& touchInfo)
+{
+       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.");
+
+       Ewk_Event_Gesture gestureEvent;
+
+       Point absPoint = __pWebCore->GetAbsoluteCoordinate(touchInfo.GetCurrentPosition());
+
+       SetGestureEvent(gestureEvent, EWK_GESTURE_PAN, absPoint, Point(0, 0), 0, 0);
+       pSmartData->api->gesture_end(const_cast<Ewk_View_Smart_Data*>(pSmartData), &gestureEvent);
+
+       SetGestureEvent(gestureEvent, EWK_GESTURE_FLICK, absPoint, Point(0, 0), 0, 0);
+       pSmartData->api->gesture_end(const_cast<Ewk_View_Smart_Data*>(pSmartData), &gestureEvent);
+
+       __pWebCore->ChangeGesture(WEB_GESTURE_TYPE_TAP);
+
+       return true;
+}
+
+
+bool
+_FlickGestureState::OnTouchMoved(const _Control& source, const _TouchInfo& touchInfo)
+{
+       return true;
+}
+
+
+bool
+_FlickGestureState::OnTouchReleased(const _Control& source, const _TouchInfo& touchInfo)
+{
+       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.");
+
+       Ewk_Event_Gesture gestureEvent;
+
+       Point absPoint = __pWebCore->GetAbsoluteCoordinate(touchInfo.GetCurrentPosition());
+
+       SetGestureEvent(gestureEvent, EWK_GESTURE_FLICK, absPoint, __velocity, 0, 0);
+       pSmartData->api->gesture_start(const_cast<Ewk_View_Smart_Data*>(pSmartData), &gestureEvent);
+
+       return true;
+}
+
+
+bool
+_FlickGestureState::OnTouchCanceled(const _Control& source, const _TouchInfo& touchInfo)
+{
+       return OnTouchPressed(source, touchInfo);
+}
+
+
+_PinchGestureState::_PinchGestureState(_Web* pWeb)
+       : __pWebCore(pWeb)
+{
+}
+
+
+_PinchGestureState::~_PinchGestureState(void)
+{
+}
+
+void
+_PinchGestureState::InitializeFactor(void)
+{
+       __baseDistance = 0;
+       __distanceTolerance = PINCH_ZOOM_DISTANCE_TOLERANCE;
+}
+
+double
+_PinchGestureState::GetZoomFactor(const Point& firstFinger, const Point& secondFinger)
+{
+       int diffX = secondFinger.x - firstFinger.x;
+       int diffY = secondFinger.y - firstFinger.y;
+       int distance = static_cast < int >(sqrt((diffX * diffX) + (diffY * diffY)));
+       double relativeFactor = 1.0;
+
+       if (!__baseDistance)
+       {
+               __baseDistance = distance;
+               return relativeFactor;
+       }
+
+       if (__distanceTolerance)
+       {
+               if (distance < (__baseDistance - __distanceTolerance))
+               {
+                       __baseDistance -= __distanceTolerance;
+                       __distanceTolerance = 0;
+               }
+               else if (distance > (__baseDistance + __distanceTolerance))
+               {
+                       __baseDistance += __distanceTolerance;
+                       __distanceTolerance= 0;
+               }
+
+               return relativeFactor;
+       }
+       relativeFactor = 1.0 + (((distance - __baseDistance) / static_cast < double >(__baseDistance)) * PINCH_ZOOM_FINGER_FACTOR);
+
+       return relativeFactor;
+}
+
+
+Point
+_PinchGestureState::GetCenterPoint(const Point& firstFinger, const Point& secondFinger)
+{
+       int diffX = fabs(secondFinger.x - firstFinger.x);
+       int diffY = fabs(secondFinger.y - firstFinger.y);
+       double distance = sqrt((diffX * diffX) + (diffY * diffY));
+
+       Point center;
+
+       if (diffX && diffY)
+       {
+               double ratio = atan((diffY / static_cast < double >(diffX)));
+               int additionalX = static_cast < int >((distance / 2) * cos(ratio));
+               int additionalY = static_cast < int >((distance / 2) * sin(ratio));
+
+               center.x = (secondFinger.x > firstFinger.x) ? (firstFinger.x + additionalX) : (secondFinger.x + additionalX);
+               center.y = (secondFinger.y > firstFinger.y) ? (firstFinger.y + additionalY) : (secondFinger.y + additionalY);
+       }
+       else
+       {
+               center.x = (firstFinger.x + secondFinger.x) / 2;
+               center.y = (firstFinger.y + secondFinger.y) / 2;
+       }
+
+       return center;
+}
+
+
+bool
+_PinchGestureState::OnTouchPressed(const _Control& source, const _TouchInfo& touchInfo)
+{
+       return true;
+}
+
+
+bool
+_PinchGestureState::OnTouchMoved(const _Control& source, const _TouchInfo& touchInfo)
+{
+       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.");
+
+       _TouchManager* pTouchManager = _TouchManager::GetInstance();
+       SysAssertf(pTouchManager, "Failed to get webkit smart data.");
+
+       if (pTouchManager->GetPointCount() == 2)
+       {
+               result r = E_SUCCESS;
+
+               Ewk_Event_Gesture gestureEvent;
+
+               std::unique_ptr<Tizen::Base::Collection::IListT<_FingerInfo*> > pTouchList(pTouchManager->GetMultiFingerInfoListN());
+               SysTryReturn(NID_WEB_CTRL, pTouchList.get(), false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+               std::unique_ptr<Tizen::Base::Collection::IBidirectionalEnumeratorT<_FingerInfo*> > pEnum(pTouchList->GetBidirectionalEnumeratorN());
+               SysTryReturn(NID_WEB_CTRL, pEnum.get(), false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+               _FingerInfo* pFingerInfo = null;
+
+               r = pEnum->MoveNext();
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
+
+               r = pEnum->GetCurrent(pFingerInfo);
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
+
+               Point firstFinger(pFingerInfo->GetPoint());
+
+               r = pEnum->MoveNext();
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
+
+               r = pEnum->GetCurrent(pFingerInfo);
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
+
+               Point secondFinger(pFingerInfo->GetPoint());
+
+               double zoomFactor = GetZoomFactor(firstFinger, secondFinger);
+               Point center(GetCenterPoint(firstFinger, secondFinger));
+
+               Point absPoint = __pWebCore->GetAbsoluteCoordinate(center);
+
+               SetGestureEvent(gestureEvent, EWK_GESTURE_PINCH, absPoint, Point(0, 0), zoomFactor, 0); 
+               pSmartData->api->gesture_move(const_cast<Ewk_View_Smart_Data*>(pSmartData), &gestureEvent);
+       }
+
+       return true;
+}
+
+
+bool
+_PinchGestureState::OnTouchReleased(const _Control& source, const _TouchInfo& touchInfo)
+{
+       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.");
+
+       _TouchManager* pTouchManager = _TouchManager::GetInstance();
+       SysAssertf(pTouchManager, "Failed to get webkit smart data.");
+
+       if (pTouchManager->GetPointCount() == 1)
+       {
+               Ewk_Event_Gesture gestureEvent;
+
+               Point absPoint = __pWebCore->GetAbsoluteCoordinate(touchInfo.GetCurrentPosition());
+
+               SetGestureEvent(gestureEvent, EWK_GESTURE_PINCH, absPoint, Point(0, 0), 0, 0);
+               pSmartData->api->gesture_end(const_cast<Ewk_View_Smart_Data*>(pSmartData), &gestureEvent);
+
+               __pWebCore->ChangeGesture(WEB_GESTURE_TYPE_TAP);
+       }
+
+       return true;
+}
+
+
+bool
+_PinchGestureState::OnTouchCanceled(const _Control& source, const _TouchInfo& touchInfo)
+{
+       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.");
+
+       Ewk_Event_Gesture gestureEvent;
+
+       Point absPoint = __pWebCore->GetAbsoluteCoordinate(touchInfo.GetCurrentPosition());
+
+       SetGestureEvent(gestureEvent, EWK_GESTURE_PINCH, absPoint, Point(0, 0), 0, 0);
+       pSmartData->api->gesture_end(const_cast<Ewk_View_Smart_Data*>(pSmartData), &gestureEvent);
+
+       __pWebCore->ChangeGesture(WEB_GESTURE_TYPE_TAP);
+
+       return true;
+}
+
+
+}}}
diff --git a/src/controls/FWebCtrl_GestureState.h b/src/controls/FWebCtrl_GestureState.h
new file mode 100755 (executable)
index 0000000..ba1bc50
--- /dev/null
@@ -0,0 +1,168 @@
+//
+// 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 <FUi_ITouchEventListener.h>
+
+namespace Tizen { namespace Graphics
+{
+class Point;
+}} // Tizen::Graphics
+
+namespace Tizen { namespace Ui
+{
+class _Control;
+class _TouchInfo;
+}} // Tizen::Ui
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+class _Web;
+
+class _PinchGestureState
+       : public Tizen::Ui::_ITouchEventListener
+{
+public:
+       _PinchGestureState(_Web* pWeb);
+       
+       virtual ~_PinchGestureState(void);
+
+       void InitializeFactor(void);
+
+       Tizen::Graphics::Point GetCenterPoint(const Tizen::Graphics::Point& firstFinger, const Tizen::Graphics::Point& secondFinger);
+
+       double GetZoomFactor(const Tizen::Graphics::Point& firstFinger, const Tizen::Graphics::Point& secondFinger);
+
+       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;
+
+       int __baseDistance;
+
+       int __distanceTolerance;
+};
+
+class _TapGestureState
+       : public Tizen::Ui::_ITouchEventListener
+{
+public:
+       _TapGestureState(_Web* pWeb, _PinchGestureState* pPinchListener);
+       
+       virtual ~_TapGestureState(void);
+
+       void OnLongPressGestureDetected(const Tizen::Ui::_TouchLongPressGestureDetector& 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;
+
+       _PinchGestureState* __pPinchListener;
+
+       bool __longPressed;
+};
+
+class _DoubleTapGestureState
+       : public Tizen::Ui::_ITouchEventListener
+{
+public:
+       _DoubleTapGestureState(_Web* pWeb);
+       
+       virtual ~_DoubleTapGestureState(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 _PanningGestureState
+       : public Tizen::Ui::_ITouchEventListener
+{
+public:
+       _PanningGestureState(_Web* pWeb, _PinchGestureState* pPinchListener);
+       
+       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;
+
+       _PinchGestureState* __pPinchListener;
+};
+
+class _FlickGestureState
+       : public Tizen::Ui::_ITouchEventListener
+{
+public:
+       _FlickGestureState(_Web* pWeb);
+       
+       virtual ~_FlickGestureState(void);
+
+       void OnFlickGestureDetected(const 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;
+};
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_GESTURE_STATE_H_
diff --git a/src/controls/FWebCtrl_HitElementResultImpl.cpp b/src/controls/FWebCtrl_HitElementResultImpl.cpp
new file mode 100755 (executable)
index 0000000..62852b7
--- /dev/null
@@ -0,0 +1,154 @@
+//
+// 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
diff --git a/src/controls/FWebCtrl_HitElementResultImpl.h b/src/controls/FWebCtrl_HitElementResultImpl.h
new file mode 100755 (executable)
index 0000000..51adb1d
--- /dev/null
@@ -0,0 +1,88 @@
+//
+// 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_
diff --git a/src/controls/FWebCtrl_IWebEventListener.h b/src/controls/FWebCtrl_IWebEventListener.h
new file mode 100644 (file)
index 0000000..23e723b
--- /dev/null
@@ -0,0 +1,54 @@
+//
+// 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 LaunchAppControl(const Tizen::Base::Runtime::IEventArg& arg) = 0;
+       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 OnHandleTextSearchEvent(const Tizen::Base::Runtime::IEventArg& arg) = 0;
+
+}; // _IWebEventListener
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_IWEB_EVENT_LISTENER_H_
diff --git a/src/controls/FWebCtrl_InputPickerPopup.cpp b/src/controls/FWebCtrl_InputPickerPopup.cpp
new file mode 100755 (executable)
index 0000000..15eeaf7
--- /dev/null
@@ -0,0 +1,676 @@
+//
+// 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 <FUiIActionEventListener.h>
+#include <FUiLayout.h>
+#include <FUiVerticalBoxLayout.h>
+#include <FWebCtrlAuthenticationChallenge.h>
+#include <FUiCtrl_PopupImpl.h>
+#include <FUi_ResourceManager.h>
+#include <FSys_SystemResource.h>
+#include "FWebCtrl_WebImpl.h"
+#include "FWebCtrl_InputPickerPopup.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::Web::Controls;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui;
+using namespace Tizen::Locales;
+using namespace Tizen::System;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+static const int DATE_POPUP_BUTTON_WIDTH = 250;
+
+
+_InputPickerPopup::_InputPickerPopup(void)
+       : __pPopup(null)
+       , __pEditDate(null)
+       , __pEditTime(null)
+       , __pSelectionBtn(null)
+       , __modal(0)
+       , __popupHeight(0)
+       , __popupWidth(0)
+       , __btnHeight(0)
+       , __inputType(EWK_INPUT_TYPE_TIME)
+{
+}
+
+
+_InputPickerPopup::~_InputPickerPopup(void)
+{
+}
+
+
+result
+_InputPickerPopup::Construct(const String& strDate, Ewk_Input_Type inputType)
+{
+       result r = E_SUCCESS;
+
+       Dimension dim;
+       int dateHeight = 0;
+       int dateWidth = 0;
+       int sideMargin = 0;
+       DateTime inputDateTime;
+
+       __inputPickerMode = INPUT_MODE_DATE;
+       __inputType = inputType;
+
+       SystemTime::GetCurrentTime(UTC_TIME, inputDateTime);
+
+       if (!strDate.IsEmpty())
+       {
+               r = Parse(strDate, inputDateTime);
+       }
+
+       _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
+
+       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_HEIGHT, orientation, __btnHeight);
+
+       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.");
+
+       switch (__inputType)
+       {
+       case EWK_INPUT_TYPE_TIME :
+
+               __popupHeight = __popupHeight + dateHeight + __btnHeight;
+               r = CreatePopup();
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+               __pPopup->SetTitleText("Select 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 = __pPopup->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 = __popupHeight + 2*dateHeight + __btnHeight;
+               r = CreatePopup();
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+               __pPopup->SetTitleText("Select datetime");
+
+               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 = __pPopup->AddControl(*pEditTime);
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+               pEditTime->SetTime(inputDateTime);
+               __pEditTime = pEditTime.release();
+
+               r = __pPopup->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 = __popupHeight + dateHeight + __btnHeight;
+               r = CreatePopup();
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+               __pPopup->SetTitleText("Select 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 = __pPopup->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;
+       }
+
+       r = AddButton(ID_BUTTON_INPUT_DATE_SELECTION);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       std::unique_ptr<VerticalBoxLayout> pLayout(dynamic_cast< VerticalBoxLayout* >(__pPopup->GetLayoutN()));
+       SysTryReturnResult(NID_WEB_CTRL, pLayout.get(), E_OUT_OF_MEMORY, "Memory Allocation Failed.");
+
+       if (__pEditDate)
+       {
+               pLayout->SetHorizontalAlignment(*__pEditDate, LAYOUT_HORIZONTAL_ALIGN_LEFT);
+               pLayout->SetSpacing(*__pEditDate, sideMargin);
+       }
+
+       if (__pEditTime)
+       {
+               pLayout->SetHorizontalAlignment(*__pEditTime, LAYOUT_HORIZONTAL_ALIGN_LEFT);
+               pLayout->SetSpacing(*__pEditTime, sideMargin);
+       }
+
+       pLayout->SetHorizontalAlignment(*__pSelectionBtn, LAYOUT_HORIZONTAL_ALIGN_CENTER);
+       pLayout->SetSpacing(*__pSelectionBtn, sideMargin);
+
+       return E_SUCCESS;
+}
+
+
+result
+_InputPickerPopup::Construct(const Color& color)
+{
+       result r = E_SUCCESS;
+
+       __inputPickerMode = INPUT_MODE_COLOR;
+
+       _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
+
+       CalculateColorPickerPopupSize(orientation);
+
+       r = CreatePopup();
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       __pPopup->SetTitleText("Select color");
+
+       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);
+
+       r = __pPopup->AddControl(*pColorPicker);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       __pColorPicker = pColorPicker.release();
+       r = AddButton(ID_BUTTON_INPUT_COLOR_SELECTION);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       std::unique_ptr<VerticalBoxLayout> pLayout(dynamic_cast< VerticalBoxLayout* >(__pPopup->GetLayoutN()));
+       SysTryReturnResult(NID_WEB_CTRL, pLayout.get(), E_OUT_OF_MEMORY, "Memory Allocation Failed.");
+
+       pLayout->SetHorizontalAlignment(*__pColorPicker, LAYOUT_HORIZONTAL_ALIGN_LEFT);
+       pLayout->SetHorizontalAlignment(*__pSelectionBtn, LAYOUT_HORIZONTAL_ALIGN_CENTER);
+
+       int sideMargin = 0;
+       GET_SHAPE_CONFIG(POPUP::SIDE_BORDER, orientation, sideMargin);
+
+       pLayout->SetSpacing(*__pColorPicker, sideMargin);
+       pLayout->SetSpacing(*__pSelectionBtn, sideMargin);
+
+       return E_SUCCESS;
+
+}
+
+
+void
+_InputPickerPopup::CalculateColorPickerPopupSize(_ControlOrientation orientation)
+{
+       int sideMargin = 0;
+       Dimension dim;
+
+       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_HEIGHT, orientation, __btnHeight);
+
+       GET_DIMENSION_CONFIG(COLORPICKER::DEFAULT_SIZE, orientation, dim);
+
+       dim.width += sideMargin;
+       __popupWidth = dim.width;
+       __popupHeight = __popupHeight + dim.height + __btnHeight;
+}
+
+
+result
+_InputPickerPopup::CreatePopup(void)
+{
+       result r = E_SUCCESS;
+
+       VerticalBoxLayout layout;
+       r = layout.Construct(VERTICAL_DIRECTION_DOWNWARD);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       std::unique_ptr<Popup> pPopup(new (std::nothrow) Popup());
+       SysTryReturnResult(NID_WEB_CTRL, pPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation Failed.");
+
+       r = pPopup->Construct(layout, layout, true, Tizen::Graphics::Dimension(__popupWidth, __popupHeight));
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       __pPopup = std::move(pPopup);
+
+       return E_SUCCESS;
+}
+
+
+result
+_InputPickerPopup::AddButton(_InputPickerButtonId buttonId)
+{
+       result r = E_SUCCESS;
+
+       String buttonStr;
+       
+       Tizen::System::_SystemResource* pSysResource = Tizen::System::_SystemResource::GetInstance();
+       SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
+
+       buttonStr = pSysResource->GetString("sys_string", "IDS_COM_SK_OK");
+
+       std::unique_ptr<Button> pSelectionBtn(new (std::nothrow) Button());
+       SysTryReturnResult(NID_WEB_CTRL, pSelectionBtn.get(), E_OUT_OF_MEMORY, "Memory Allocation Failed.");
+
+       r = pSelectionBtn->Construct(Rectangle(0, 0, DATE_POPUP_BUTTON_WIDTH, __btnHeight), buttonStr);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pSelectionBtn->SetActionId(buttonId);
+       __pPopup->AddControl(*pSelectionBtn);
+       pSelectionBtn->AddActionEventListener(*this);
+
+       __pSelectionBtn =  pSelectionBtn.release();
+
+       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;
+       Dimension screenRect = _ControlManager::GetInstance()->GetScreenSize();
+
+       CalculateColorPickerPopupSize(orientation);
+
+       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 = __pPopup->SetBounds(Rectangle(x, y, __popupWidth, __popupHeight));
+       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();
+}
+
+
+result
+_InputPickerPopup::ShowPopup(void)
+{
+       result r = E_SUCCESS;
+
+       r = __pPopup->SetShowState(true);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = __pPopup->DoModal(__modal);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       return E_SUCCESS;
+}
+
+
+result
+_InputPickerPopup::HidePopup(void)
+{
+       result r = E_SUCCESS;
+
+       r = __pPopup->SetShowState(false);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = __pPopup->EndModal(__modal);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       return E_SUCCESS;
+}
+
+
+String
+_InputPickerPopup::GetDate(void) const
+{
+       return __dateStr;
+}
+
+
+Color
+_InputPickerPopup::GetColor(void) const
+{
+       return __Color;
+}
+
+
+result
+_InputPickerPopup::Parse(const String& strDateTime, DateTime & dateTime)
+{
+       result r = E_SUCCESS;
+
+       wchar_t* pMchar = (wchar_t*) strDateTime.GetPointer();
+       wchar_t* pTmp = (wchar_t*) malloc(sizeof(wchar_t) * 10);
+       SysTryReturnResult(NID_WEB_CTRL, pTmp, E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+       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;
+       String formattedString = L"e";
+       String dayno;
+
+       switch (__inputType)
+       {
+       case EWK_INPUT_TYPE_TIME :                       //"HH:mm";
+
+               // hour
+               wcsncpy(pTmp, pMchar, 2);
+               pTmp[2] = L'\0';
+               hour = (int) wcstol(pTmp, null, 10);
+
+               // minute
+               wcsncpy(pTmp, pMchar + 3, 2);
+               pTmp[2] = L'\0';
+               minute = (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 = (int) wcstol(pTmp, null, 10);
+
+               // month
+               wcsncpy(pTmp, pMchar + 5, 2);
+               pTmp[2] = L'\0';
+
+               month = (int) wcstol(pTmp, null, 10);
+
+               // day
+               wcsncpy(pTmp, pMchar + 8, 2);
+               pTmp[2] = L'\0';
+
+               day = (int) wcstol(pTmp, null, 10);
+
+               // hour
+               wcsncpy(pTmp, pMchar + 11, 2);
+               pTmp[2] = L'\0';
+
+               hour = (int) wcstol(pTmp, null, 10);
+
+               // minute
+               wcsncpy(pTmp, pMchar + 14, 2);
+               pTmp[2] = L'\0';
+               minute = (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 = (int) wcstol(pTmp, null, 10);
+
+               // week
+               wcsncpy(pTmp, pMchar + 6, 2);
+               pTmp[2] = L'\0';
+               week = (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 = (int) wcstol(pTmp, null, 10);
+
+               // month
+               wcsncpy(pTmp, pMchar + 5, 2);
+               pTmp[2] = L'\0';
+               month = (int) wcstol(pTmp, null, 10);
+
+               // day
+               wcsncpy(pTmp, pMchar + 8, 2);
+               pTmp[2] = L'\0';
+               day = (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 = (int) wcstol(pTmp, null, 10);
+
+               // month
+               wcsncpy(pTmp, pMchar + 5, 2);
+               pTmp[2] = L'\0';
+               month = (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);
+               return r;
+       }
+
+       if (pTmp)
+       {
+               free(pTmp);
+       }
+
+       return E_SUCCESS;
+}
+
+
+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
diff --git a/src/controls/FWebCtrl_InputPickerPopup.h b/src/controls/FWebCtrl_InputPickerPopup.h
new file mode 100755 (executable)
index 0000000..1b7a736
--- /dev/null
@@ -0,0 +1,133 @@
+//
+// 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 <FUi_ControlManager.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 Tizen::Base::Object
+       , virtual public Tizen::Ui::IActionEventListener
+{
+
+public:
+       /**
+        * Constructor
+        */
+       _InputPickerPopup(void);
+
+       /**
+        * Destructor
+        */
+       virtual ~_InputPickerPopup(void);
+
+       result Construct(const Tizen::Base::String& strDate, Ewk_Input_Type inputType);
+
+       result Construct(const Tizen::Graphics::Color& color);
+
+       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;
+
+       result ShowPopup(void);
+       result HidePopup(void);
+
+private:
+       _InputPickerPopup(const _InputPickerPopup& rhs);
+
+       _InputPickerPopup& operator =(const _InputPickerPopup& rhs);
+
+       result CreatePopup(void);
+
+       result AddButton(_InputPickerButtonId buttonId);
+
+       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:
+
+       std::unique_ptr<Tizen::Ui::Controls::Popup> __pPopup;
+       Tizen::Ui::Controls::EditDate* __pEditDate;
+       Tizen::Ui::Controls::EditTime* __pEditTime;
+       Tizen::Ui::Controls::Button* __pSelectionBtn;
+       Tizen::Ui::Controls::ColorPicker* __pColorPicker;
+
+       int __modal;
+       int __popupHeight;
+       int __popupWidth;
+       int __btnHeight;
+
+       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_
diff --git a/src/controls/FWebCtrl_PageNavigationListImpl.cpp b/src/controls/FWebCtrl_PageNavigationListImpl.cpp
new file mode 100755 (executable)
index 0000000..dfc4dd9
--- /dev/null
@@ -0,0 +1,105 @@
+//
+// 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
diff --git a/src/controls/FWebCtrl_PageNavigationListImpl.h b/src/controls/FWebCtrl_PageNavigationListImpl.h
new file mode 100755 (executable)
index 0000000..a8b4893
--- /dev/null
@@ -0,0 +1,76 @@
+//
+// 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_
diff --git a/src/controls/FWebCtrl_PromptPopup.cpp b/src/controls/FWebCtrl_PromptPopup.cpp
new file mode 100755 (executable)
index 0000000..7920137
--- /dev/null
@@ -0,0 +1,275 @@
+//
+// 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 <FGrpDimension.h>
+#include <FGrpRectangle.h>
+#include <FUiCtrlButton.h>
+#include <FUiCtrlEditField.h>
+#include <FUiCtrlLabel.h>
+#include <FUiCtrlPanel.h>
+#include <FUiLayout.h>
+#include <FUiVerticalBoxLayout.h>
+#include <FWebCtrlAuthenticationChallenge.h>
+#include <FBaseSysLog.h>
+#include <FUiCtrl_PopupImpl.h>
+#include <FUi_ControlManager.h>
+#include <FUi_ResourceManager.h>
+#include <FGrpColor.h>
+#include <FUiCtrlTextBox.h>
+#include <FUiCtrl_TextBoxImpl.h>
+#include <FSys_SystemResource.h>
+#include "FWebCtrl_WebImpl.h"
+#include "FWebCtrl_PromptPopup.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::Web::Controls;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui;
+
+static const int LABEL_HEIGHT = 10;
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+_PromptPopup::_PromptPopup(void)
+       : __pPopup(null)
+       , __pEditField(null)
+{
+}
+
+_PromptPopup::~_PromptPopup(void)
+{
+}
+
+
+// Prompt popup
+result
+_PromptPopup::Construct(const Tizen::Base::String& message, const Tizen::Base::String& defaultVale)
+{
+       result r = E_SUCCESS;
+       String buttonStr;
+       Dimension dim;
+       Dimension editDim;
+       Rectangle rect(0, 0, 0, 0);
+
+       int spacePad = 0;
+       int buttonHeight = 0;
+       int sideMargin = 0;
+       int buttonWidth = 0;
+       int popupWidth = 0;
+       int popupHeight = 0;
+       int gapForControls = 0;
+
+       _ControlOrientation orientation = _CONTROL_ORIENTATION_PORTRAIT;
+
+       GET_SHAPE_CONFIG(MESSAGEBOX::DEFAULT_WIDTH, orientation, popupWidth);
+       GET_SHAPE_CONFIG(MESSAGEBOX::MAX_HEIGHT, orientation, popupHeight);
+       GET_SHAPE_CONFIG(MESSAGEBOX::BUTTON_HEIGHT, orientation, buttonHeight);
+       GET_SHAPE_CONFIG(POPUP::SIDE_BORDER, orientation, sideMargin);
+       GET_SHAPE_CONFIG(MESSAGEBOX::BUTTON_SIDE_MARGIN_02, orientation, spacePad);
+       r = GET_DIMENSION_CONFIG(EDIT::MIN_SIZE, orientation, editDim);
+       GET_SHAPE_CONFIG(MESSAGEBOX::BUTTON_TOP_MARGIN, orientation, gapForControls);
+
+       VerticalBoxLayout layout;
+       r = layout.Construct(VERTICAL_DIRECTION_DOWNWARD);
+
+       Tizen::System::_SystemResource* pSysResource = Tizen::System::_SystemResource::GetInstance();
+       SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
+
+       std::unique_ptr<Popup> pPopup(new (std::nothrow) Popup());
+       SysTryReturnResult(NID_WEB_CTRL, pPopup.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       popupHeight = LABEL_HEIGHT + (2 * editDim.height + gapForControls)  + buttonHeight + (4 * spacePad) ;
+
+       r = pPopup->Construct(layout, layout, true, Tizen::Graphics::Dimension(popupWidth, popupHeight));
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pPopup->SetTitleText("Prompt Dialog");
+
+       //Temp Label for Y position adjustment using Vertical layout.
+       rect.x = 0;
+       rect.y = 0;
+       rect.height = LABEL_HEIGHT;
+       rect.width = popupWidth - 2*sideMargin;;
+
+       std::unique_ptr<Label> pLabel(new (std::nothrow) Label());
+       SysTryReturnResult(NID_WEB_CTRL, pLabel.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       r = pLabel->Construct(rect, L"");
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = pPopup->AddControl(*pLabel);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       Label* pTmpLabel = pLabel.release();
+
+       //Text box
+       rect = pPopup->GetClientAreaBounds();
+       rect.width = popupWidth - 2*sideMargin;
+       rect.y = 0;
+       rect.height = editDim.height;
+       
+       std::unique_ptr<TextBox> pTextBox(new (std::nothrow) TextBox());
+       SysTryReturnResult(NID_WEB_CTRL, pTextBox.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       r = pTextBox->Construct(rect, TEXT_BOX_BORDER_ROUNDED);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pTextBox->SetText(message);
+       pTextBox->SetColor(TEXT_BOX_STATUS_NORMAL, pPopup->GetColor());
+       pTextBox->SetColor(TEXT_BOX_STATUS_HIGHLIGHTED, pPopup->GetColor());
+
+       r = pPopup->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 = editDim.height;
+
+       std::unique_ptr<EditField> pEditField(new (std::nothrow) EditField());
+       SysTryReturnResult(NID_WEB_CTRL, pEditField.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       r = pEditField->Construct(rect, EDIT_FIELD_STYLE_NORMAL);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pEditField->SetText(defaultVale);
+
+       r = pPopup->AddControl(*pEditField);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       __pEditField = pEditField.release();
+
+       //Panel
+       buttonWidth = (popupWidth / 2) - (spacePad) - (sideMargin * 2);
+
+       std::unique_ptr<Panel> pPanel(new Panel());
+       SysTryReturnResult(NID_WEB_CTRL, pPanel.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       r = pPanel->Construct(Rectangle(0, 0, rect.width, buttonHeight + gapForControls));
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = pPopup->AddControl(*pPanel);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       Panel* pTempPanel = pPanel.release();
+
+       //Button OK
+       buttonStr = pSysResource->GetString("sys_string", "IDS_COM_SK_OK");
+       std::unique_ptr<Button> pBtnOk(new (std::nothrow) Button());
+       SysTryReturnResult(NID_WEB_CTRL, pBtnOk.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       r = pBtnOk->Construct(Rectangle(sideMargin, gapForControls, buttonWidth, buttonHeight), buttonStr);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pBtnOk->SetActionId(ID_BUTTON_PROMPT_OK);
+
+       r = pTempPanel->AddControl(*pBtnOk);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pBtnOk->AddActionEventListener(*this);
+       pBtnOk.release();
+
+       // Button Cancel
+       buttonStr = pSysResource->GetString("sys_string", "IDS_COM_POP_CANCEL");
+       std::unique_ptr<Button> pBtnCancel(new (std::nothrow) Button());
+       SysTryReturnResult(NID_WEB_CTRL, pBtnCancel.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       r = pBtnCancel->Construct(Rectangle(buttonWidth + spacePad + sideMargin, gapForControls, buttonWidth, buttonHeight), buttonStr);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pBtnCancel->SetActionId(ID_BUTTON_PROMPT_CANCEL);
+
+       r = pTempPanel->AddControl(*pBtnCancel);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pBtnCancel->AddActionEventListener(*this);
+       pBtnCancel.release();
+
+       __pEditField->SetFocus();
+
+       std::unique_ptr<VerticalBoxLayout> pLayout(dynamic_cast< VerticalBoxLayout* >(pPopup->GetLayoutN()));
+       SysTryReturn(NID_WEB_CTRL, pLayout.get(), r = GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+       pLayout->SetHorizontalFitPolicy(*pTmpLabel, FIT_POLICY_PARENT);
+       pLayout->SetHorizontalFitPolicy(*pTempPanel, FIT_POLICY_PARENT);
+       pLayout->SetHorizontalFitPolicy(*__pEditField, FIT_POLICY_PARENT);
+
+       pLayout->SetHorizontalAlignment(*pTmpTextBox, LAYOUT_HORIZONTAL_ALIGN_LEFT);
+       pLayout->SetHorizontalAlignment(*__pEditField, LAYOUT_HORIZONTAL_ALIGN_LEFT);
+       pLayout->SetHorizontalAlignment(*pTempPanel, LAYOUT_HORIZONTAL_ALIGN_CENTER);
+
+       pLayout->SetSpacing(*pTmpTextBox, gapForControls);
+       pLayout->SetSpacing(*__pEditField, gapForControls);
+       pLayout->SetSpacing(*pTempPanel, gapForControls);
+
+       __pPopup = std::move(pPopup);
+
+       return r;
+}
+
+const String
+_PromptPopup::GetPromptText()
+{
+       return __pEditField->GetText();
+}
+
+
+void
+_PromptPopup::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
+{
+       switch (actionId)
+       {
+       case ID_BUTTON_PROMPT_OK:
+       {
+               __pPopup->SetShowState(false);
+               EndModal(ID_BUTTON_PROMPT_OK);
+       }
+       break;
+
+       case ID_BUTTON_PROMPT_CANCEL:
+               __pPopup->SetShowState(false);
+               EndModal(ID_BUTTON_PROMPT_CANCEL);
+               break;
+
+       default:
+               break;
+       }
+}
+
+result
+_PromptPopup::ShowAndWait(int& modalResult)
+{
+       return __pPopup->DoModal(modalResult);
+}
+
+
+result
+_PromptPopup::EndModal(int modalResult)
+{
+       return __pPopup->EndModal(modalResult);
+}
+
+}}} // Tizen::Web::Controls
diff --git a/src/controls/FWebCtrl_PromptPopup.h b/src/controls/FWebCtrl_PromptPopup.h
new file mode 100644 (file)
index 0000000..afa2bb2
--- /dev/null
@@ -0,0 +1,84 @@
+//
+// 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 <FBase.h>
+#include <FBaseString.h>
+#include <FUiIActionEventListener.h>
+
+namespace Tizen { namespace Ui { namespace Controls
+{
+class Popup;
+}}} // Tizen::Ui::Controls
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+enum _PromptPopupButtonId
+{
+       ID_BUTTON_PROMPT_CANCEL,
+       ID_BUTTON_PROMPT_OK
+};
+
+
+class _PromptPopup
+       : public Tizen::Base::Object
+       , virtual public Tizen::Ui::IActionEventListener
+{
+
+public:
+       /**
+        * Constructor
+        */
+       _PromptPopup(void);
+
+       /**
+        * Destructor
+        */
+       virtual ~_PromptPopup(void);
+
+       result Construct(const Tizen::Base::String& message, const Tizen::Base::String& defaultValue);
+
+       const Tizen::Base::String GetPromptText(void);
+
+       result ShowAndWait(int& modalResult);
+
+       virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+
+private:
+       result EndModal(int modalResult);
+
+       _PromptPopup(const _PromptPopup&);
+
+       _PromptPopup& operator =(const _PromptPopup&);
+
+private:
+       std::unique_ptr<Tizen::Ui::Controls::Popup> __pPopup;
+
+       Tizen::Ui::Controls::EditField* __pEditField;
+}; // _PromptPopup
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_PROMPT_POPUP_H_
diff --git a/src/controls/FWebCtrl_SelectBox.cpp b/src/controls/FWebCtrl_SelectBox.cpp
new file mode 100755 (executable)
index 0000000..c9cad23
--- /dev/null
@@ -0,0 +1,581 @@
+//
+// 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 <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 <FUiVerticalBoxLayout.h>
+#include <FUi_ResourceManager.h>
+#include "FSys_SystemResource.h"
+#include "FWebCtrl_SelectBox.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Web;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+static const int SELECTBOX_BUTTON_WIDTH = 100;
+template< class Type > Type
+Max(Type a, Type b)
+{
+       return a > b ? a : b;
+}
+
+
+//Internal class for maintaining states of list elements
+class _ListElement
+       : public Tizen::Base::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)
+       , __modal(0)
+       , __SelectedIndex(-1)
+       , __prevIndex(-1)
+       , __orientation(_CONTROL_ORIENTATION_PORTRAIT)
+       , __pWebView(null)
+{
+}
+
+
+_SelectBox::~_SelectBox(void)
+{
+       __listElementArray.RemoveAll(true);
+}
+
+
+result
+_SelectBox::Construct(bool isMultiSelect, const String& title, int listItemCnt, Evas_Object* pWebView)
+{
+       Rectangle popupRect(0, 0, 0, 0);
+       result r = E_SUCCESS;
+       Rectangle rect;
+       Dimension dim(0, 0);
+       Dimension btnDim(0,0);
+       int listCount = 4;
+
+       int totalListHeight = 0;
+       int listMaxHeihgt = 0;
+       int popupWinTopMargin = 0;
+       int popupWinBottomMargin = 0;
+       int popupBetweenListNBtnGap = 0;
+
+       int listViewheight = 0;
+       int sideBorder = 0;
+
+       __pWebView = pWebView;
+
+       GET_SHAPE_CONFIG(MESSAGEBOX::DEFAULT_WIDTH, __orientation, dim.width);
+       GET_SHAPE_CONFIG(MESSAGEBOX::MIN_HEIGHT, __orientation, dim.height);
+       GET_SHAPE_CONFIG(CONTEXTMENU::LIST_ITEM_HEIGHT, __orientation, totalListHeight);
+       GET_SHAPE_CONFIG(POPUP::TOP_BORDER, __orientation, popupWinTopMargin);
+       GET_SHAPE_CONFIG(POPUP::BOTTOM_BORDER, __orientation, popupWinBottomMargin);
+       GET_SHAPE_CONFIG(MESSAGEBOX::BUTTON_TOP_MARGIN, __orientation, popupBetweenListNBtnGap);
+       GET_SHAPE_CONFIG(POPUP::SIDE_BORDER, __orientation, sideBorder);
+       GET_SHAPE_CONFIG(MESSAGEBOX::BUTTON_HEIGHT, __orientation, btnDim.height);
+
+       __multiSelection = isMultiSelect;
+
+       totalListHeight = listCount * totalListHeight;
+
+       listMaxHeihgt = totalListHeight + btnDim.height + 2 * (popupBetweenListNBtnGap + popupWinTopMargin + popupWinBottomMargin);
+
+       dim.height = Max< int >(listMaxHeihgt, dim.height);
+       rect.height = dim.height;
+       rect.width = dim.width;
+       rect.x = 0;
+       rect.y = 0;
+
+       VerticalBoxLayout layout;
+       r = layout.Construct(VERTICAL_DIRECTION_DOWNWARD);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       if (title.IsEmpty())
+       {
+               SysLog(NID_WEB_CTRL, "title empty Popup::Construct rect.width=%d rect.height=%d\n", rect.width, rect.height);
+               r = Popup::Construct(layout, layout, false, Dimension(rect.width, rect.height));
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+       }
+       else
+       {
+               SysLog(NID_WEB_CTRL, "with title Popup::Construct rect.width=%d rect.height=%d\n", rect.width, rect.height);
+               r = Popup::Construct(layout, layout, true, Dimension(rect.width, rect.height));
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+               Popup::SetTitleText(title);
+       }
+
+       listViewheight = GetClientAreaBounds().height - popupWinTopMargin - popupWinBottomMargin - btnDim.height;
+       std::unique_ptr<ListView> pListView(new (std::nothrow) ListView());
+       SysTryReturnResult(NID_WEB_CTRL, pListView.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       r = pListView->Construct(Rectangle(0, popupWinTopMargin, GetClientAreaBounds().width, listViewheight), false);
+       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();
+
+       r = CreateButtons(btnDim.height, popupBetweenListNBtnGap);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       return r;
+}
+
+
+result
+_SelectBox::CreateButtons(int buttonHeight, int buttonGap)
+{
+       result r = E_SUCCESS;
+
+       int buttonLeftRightMargin = 0;
+       int popupWinBottomMargin = 0;
+
+       Rectangle rect = this->GetClientAreaBounds();
+       Rectangle buttonRect;
+
+       Tizen::System::_SystemResource* pSysResource = Tizen::System::_SystemResource::GetInstance();
+       SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
+
+       String buttonStr = pSysResource->GetString("sys_string", "IDS_COM_BODY_DONE");
+
+       GET_SHAPE_CONFIG(MESSAGEBOX::BUTTON_SIDE_MARGIN_02, __orientation, buttonLeftRightMargin);
+       GET_SHAPE_CONFIG(MESSAGEBOX::BUTTON_BOTTOM_MARGIN, __orientation, popupWinBottomMargin);
+
+       std::unique_ptr<Panel> pPanel(new (std::nothrow) Panel());
+       SysTryReturnResult(NID_WEB_CTRL, pPanel.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       r = pPanel->Construct(Rectangle(0, 0, GetClientAreaBounds().width, buttonHeight));
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = AddControl(*pPanel);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       Panel* pAttachedPanel = pPanel.release();
+
+       buttonRect.x = 0;
+       buttonRect.y = 0;
+       buttonRect.width = GetClientAreaBounds().width;
+       buttonRect.height = buttonHeight;
+
+       // Create Softkey Buttons
+       if (__multiSelection)
+       {
+               buttonRect.x = buttonLeftRightMargin;
+               buttonRect.width = GetClientAreaBounds().width/2 - buttonLeftRightMargin;
+               std::unique_ptr<Button> pBtnSelection(new (std::nothrow) Button());
+               SysTryReturnResult(NID_WEB_CTRL, pBtnSelection.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.",GetErrorMessage(E_OUT_OF_MEMORY));
+
+               r = pBtnSelection->Construct(buttonRect, buttonStr);
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+               pBtnSelection->SetActionId(ID_BUTTON_SELECTION);
+               pBtnSelection->AddActionEventListener(*this);
+
+               r = pAttachedPanel->AddControl(*pBtnSelection);
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+               pBtnSelection.release();
+
+               buttonRect.x = buttonRect.width + buttonLeftRightMargin;
+       }
+
+       std::unique_ptr<Button> pBtnCancel(new (std::nothrow) Button());
+       SysTryReturnResult(NID_WEB_CTRL, pBtnCancel.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.",GetErrorMessage(E_OUT_OF_MEMORY));
+
+       buttonStr = pSysResource->GetString("sys_string", "IDS_COM_POP_CANCEL");
+
+       r = pBtnCancel->Construct(buttonRect, buttonStr);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pBtnCancel->SetActionId(ID_BUTTON_CANCEL);
+       pBtnCancel->AddActionEventListener(*this);
+
+       r = pAttachedPanel->AddControl(*pBtnCancel);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pBtnCancel.release();
+
+       std::unique_ptr<VerticalBoxLayout> pLayout(dynamic_cast< VerticalBoxLayout* >(GetLayoutN()));
+       SysTryReturn(NID_WEB_CTRL, pLayout.get(), r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pLayout->SetSpacing(*__pListView, buttonGap);
+       pLayout->SetSpacing(*pAttachedPanel, buttonGap);
+
+       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, "[%s] Memory Allocation failed.",GetErrorMessage(E_OUT_OF_MEMORY));
+
+       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;
+}
+
+
+Tizen::Base::Collection::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
+Tizen::Ui::Controls::ListItemBase*
+_SelectBox::CreateItem(int index, int itemWidth)
+{
+       result r = E_SUCCESS;
+       int listItemXPos = 0;
+       int listItemYPos = 0;
+       int checkBoxWidth = 0;
+       int listItemTxtHeight = 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(LIST::LIST_ITEM_LEFT_MARGIN, __orientation, listItemXPos);
+       GET_SHAPE_CONFIG(LIST::LIST_CHECK_ITEM_WIDTH, __orientation, checkBoxWidth);
+       GET_SHAPE_CONFIG(MESSAGEBOX::BUTTON_TOP_MARGIN, __orientation, popupBetweenListNBtnGap);
+       GET_SHAPE_CONFIG(LIST::GROUPITEM_DEFAULT_FONT_SIZE, __orientation, listItemTxtHeight);
+
+       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, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth)
+{
+       delete pItem;
+       pItem = null;
+
+       return true;
+}
+
+
+int
+_SelectBox::GetItemCount(void)
+{
+       return __listElementArray.GetCount();
+}
+
+
+void
+_SelectBox::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId,
+                                                                                         Tizen::Ui::Controls::ListContextItemStatus state)
+{
+}
+
+
+void
+_SelectBox::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId,
+                                                                          Tizen::Ui::Controls::ListItemStatus status)
+{
+       if (__multiSelection)
+       {
+               return;
+       }
+
+       //In case of single selection ... update the index.
+       __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);
+       }
+
+       EndModal();
+       SetShowState(false);
+       return;
+}
+
+
+void
+_SelectBox::OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction)
+{
+
+}
+
+
+void
+_SelectBox::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
+{
+       switch (actionId)
+       {
+       case ID_BUTTON_SELECTION:
+       //fall through
+       case ID_BUTTON_CANCEL:
+       {
+               if (__pWebView)
+               {
+                       ewk_view_popup_menu_select(__pWebView, __prevIndex);
+               }
+               EndModal();
+               SetShowState(false);
+               break;
+       }
+       }
+}
+
+
+result
+_SelectBox::UpdateList(Eina_List* pItems, int prevIndex, bool clearPrevList, bool isGroupdList)
+{
+       SysTryReturnResult(NID_WEB_CTRL, __pListView, E_INVALID_STATE, "[%s] List View is in an invalid state", GetErrorMessage(E_INVALID_STATE));
+
+       if (clearPrevList)
+       {
+               __listElementArray.RemoveAll(true);
+       }
+
+       //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));
+
+       __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));
+
+               bool isSelected = (itemIndex == prevIndex) ? true : false;
+               if (ewk_popup_menu_item_type_get(pItem) == EWK_POPUP_MENU_ITEM)
+               {
+                       String text(ewk_popup_menu_item_text_get(pItem));
+
+                       if (isGroupdList)
+                       {
+                               AddListItem(text, _SelectBox::LIST_ITEM_TYPE_GROUP, isSelected);
+                       }
+                       else
+                       {
+                               AddListItem(text, _SelectBox::LIST_ITEM_TYPE_NORMAL, isSelected);
+                       }
+               }
+       }
+
+       __pListView->UpdateList();
+
+       return E_SUCCESS;
+}
+
+
+result
+_SelectBox::ShowAndWait(int &selectedIndex)
+{
+       result res = E_SUCCESS;
+
+       __modal++;
+
+       res = Popup::DoModal(__modal);
+       __modal = 0;
+       selectedIndex = __SelectedIndex;
+
+       return res;
+}
+
+
+result
+_SelectBox::EndModal(void)
+{
+       result res = E_SUCCESS;
+
+       if (__modal)
+       {
+               res = Popup::EndModal(__modal);
+       }
+
+       return res;
+}
+
+}}} // Tizen::Web::Controls
diff --git a/src/controls/FWebCtrl_SelectBox.h b/src/controls/FWebCtrl_SelectBox.h
new file mode 100644 (file)
index 0000000..807e979
--- /dev/null
@@ -0,0 +1,133 @@
+//
+// 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 <FUiCtrlPopup.h>
+#include <FUiCtrlIListViewItemEventListener.h>
+#include <FUiCtrlIListViewItemProvider.h>
+#include <FUi_ControlManager.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 Tizen::Ui::Controls::Popup
+       , public Tizen::Ui::Controls::IListViewItemEventListener
+       , public Tizen::Ui::Controls::IListViewItemProvider
+       , public Tizen::Ui::IActionEventListener
+{
+public:
+       /**
+        * Constructor
+        */
+       _SelectBox(void);
+
+       /**
+        * Destructor
+        */
+       virtual ~_SelectBox(void);
+
+       result Construct(bool isMultiSelect, const Tizen::Base::String& title, int listItemCnt, Evas_Object* pWebView = null);
+       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);
+
+       result AddListItem(const Tizen::Base::String& itemText, int itemType,bool slected);
+       result ShowAndWait(int &selectedIndex);
+       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);
+       result EndModal(void);
+
+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;
+
+private:
+       Tizen::Base::Collection::ArrayList __listElementArray;
+       Tizen::Ui::Controls::ListView* __pListView;
+       bool __multiSelection;
+       int __modal;
+       int __SelectedIndex;
+       int __prevIndex;
+       Tizen::Ui::_ControlOrientation __orientation;
+       Evas_Object* __pWebView;
+}; // _SelectBox
+
+}}} //Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_SELECT_BOX_H_
diff --git a/src/controls/FWebCtrl_Utility.cpp b/src/controls/FWebCtrl_Utility.cpp
new file mode 100755 (executable)
index 0000000..7d86339
--- /dev/null
@@ -0,0 +1,120 @@
+//\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 <FBaseSysLog.h>\r
+#include "FWebCtrl_Utility.h"\r
+\r
+using namespace Tizen::Base;\r
+using namespace Tizen::Graphics;\r
+\r
+namespace Tizen { namespace Web { namespace Controls\r
+{\r
+\r
+\r
+const char CERTIFICATE_FILE_PATH[]  =  "/opt/osp/system/internal/security/certmgr/certificates.crt";\r
+const char PLUGIN_DIRECTORY_PATH[] =  "/usr/lib/osp/browser-plugin/";\r
+\r
+\r
+const wchar_t GEOLOCATION_DIRECTORY_PATH[] = L"data/.webkit/locationDatabase/";\r
+const wchar_t GEOLOCATION_DB_NAME[] = L".location.db";\r
+const wchar_t GEOLOCATION_TABLE_NAME[] = L"geolocationPermission";\r
+\r
+\r
+_Utility::_Utility(void)\r
+{\r
+}\r
+\r
+_Utility::~_Utility(void)\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
+//     evas_object_image_data_set(const_cast<Evas_Object*>(source), null);\r
+\r
+       return E_SUCCESS;\r
+\r
+}\r
+}}}\r
diff --git a/src/controls/FWebCtrl_Utility.h b/src/controls/FWebCtrl_Utility.h
new file mode 100755 (executable)
index 0000000..f1f82ad
--- /dev/null
@@ -0,0 +1,53 @@
+//\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 <Evas.h>\r
+#include <FGrpBufferInfo.h>\r
+\r
+namespace Tizen { namespace Web { namespace Controls\r
+{\r
+\r
+extern const char CERTIFICATE_FILE_PATH[];\r
+extern const char PLUGIN_DIRECTORY_PATH[];\r
+\r
+extern const wchar_t GEOLOCATION_DIRECTORY_PATH[];\r
+extern const wchar_t GEOLOCATION_DB_NAME[];\r
+extern const wchar_t GEOLOCATION_TABLE_NAME[];\r
+\r
+class _Utility\r
+{\r
+public:\r
+       static result GetPixelBufferFromEvasObject(const Evas_Object* source, Tizen::Graphics::BufferInfo& bufferInfo);\r
+\r
+private:\r
+       _Utility(void);\r
+       \r
+       virtual ~_Utility(void);\r
+}; \r
+\r
+}}} // Tizen::Web::Controls\r
+#endif \r
+\r
diff --git a/src/controls/FWebCtrl_Web.cpp b/src/controls/FWebCtrl_Web.cpp
new file mode 100755 (executable)
index 0000000..505bacc
--- /dev/null
@@ -0,0 +1,643 @@
+//
+// 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 <memory>
+#include <FBaseByteBuffer.h>
+#include <FBaseColLinkedListT.h>
+#include <FBaseSysLog.h>
+#include <FBaseColIListT.h>
+#include <FGrpPoint.h>
+#include <FGrpBitmap.h>
+#include <FGrpCanvas.h>
+#include <FWebCtrlWebSetting.h>
+#include <FGrp_CoordinateSystem.h>
+#include <FUiAnim_EflNode.h>
+#include <FUiAnim_VisualElement.h>
+#include <FUi_TouchManager.h>
+#include "FWebCtrl_EflWebkit.h"
+#include "FWebCtrl_GestureState.h"
+#include "FWebCtrl_Web.h"
+#include "FWebCtrl_WebImpl.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
+{
+
+
+static const char WEB_CTRL[] = "webcontrol";
+
+
+_Web::_Web(void)
+       : __pGestureHandler(null)
+       , __pEflWebkit(null)
+       , __pGestureFlick(null)
+       , __pGestureLongPress(null)
+       , __pGestureDoubleTap(null)
+       , __pTouchEventInfoList(null)
+       , __pTapGestureHandler(null)
+       , __pDoubleTapGestureHandler(null)
+       , __pPanningGestureHandler(null)
+       , __pFlickGestureHandler(null)
+       , __pPinchGestureHandler(null)
+{
+       SetBackgroundColor(Color(0, 0, 0, 0));
+}
+
+
+_Web::~_Web(void)
+{
+       RemoveGestureListener();
+}
+
+
+_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->AcquireHandle();
+       pWeb->SetMultiTouchEnabled(true);
+       pWeb->SetTouchMoveAllowance(TOUCH_MOVE_ALLOWANCE_NORMAL);
+
+       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));
+
+       r = pEflWebkit->Construct(GetAbsoluteBounds(), *GetVisualElement());
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       __pEflWebkit = std::move(pEflWebkit);
+
+       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, __pPinchGestureHandler.get()));
+       SysTryReturnResult(NID_WEB_CTRL, __pTapGestureHandler.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       __pDoubleTapGestureHandler = std::unique_ptr<_DoubleTapGestureState>(new (std::nothrow) _DoubleTapGestureState(this));
+       SysTryReturnResult(NID_WEB_CTRL, __pDoubleTapGestureHandler.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       __pPanningGestureHandler = std::unique_ptr<_PanningGestureState>(new (std::nothrow) _PanningGestureState(this, __pPinchGestureHandler.get()));
+       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;
+
+       _ITouchFlickGestureEventListener* pFlickListener = dynamic_cast< _ITouchFlickGestureEventListener* >(this);
+       SysAssertf(pFlickListener != null, "Failed to get flick gesture listener");
+
+       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(*pFlickListener);
+       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);
+
+       _ITouchLongPressGestureEventListener* pLongPressListener = dynamic_cast< _ITouchLongPressGestureEventListener* >(this);
+       SysAssertf(pLongPressListener != null, "Failed to get longpress gesture listener");
+
+       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(*pLongPressListener);
+       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);
+
+       _ITouchTapGestureEventListener* pDoubleTapListener = dynamic_cast< _ITouchTapGestureEventListener* >(this);
+       SysAssertf(pDoubleTapListener != null, "Failed to get tap gesture listener");
+
+       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(*pDoubleTapListener);
+       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);
+
+       return E_SUCCESS;
+}
+
+
+void
+_Web::RemoveGestureListener(void)
+{
+       if (__pGestureFlick.get())
+       {
+               _ITouchFlickGestureEventListener* pListener = dynamic_cast< _ITouchFlickGestureEventListener* >(this);
+               __pGestureFlick->RemoveGestureListener(*pListener);
+               RemoveGestureDetector(*__pGestureFlick);
+       }
+
+       if (__pGestureLongPress.get())
+       {
+               _ITouchLongPressGestureEventListener* pListener = dynamic_cast< _ITouchLongPressGestureEventListener* >(this);
+               __pGestureLongPress->RemoveGestureListener(*pListener);
+               RemoveGestureDetector(*__pGestureLongPress);
+       }
+
+       if (__pGestureDoubleTap.get())
+       {
+               _ITouchTapGestureEventListener* pListener = dynamic_cast< _ITouchTapGestureEventListener* >(this);
+               __pGestureDoubleTap->RemoveGestureListener(*pListener);
+               RemoveGestureDetector(*__pGestureDoubleTap);
+       }
+}
+
+
+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);
+
+       return E_SUCCESS;
+}
+
+
+Point
+_Web::GetAbsoluteCoordinate(Point relativePoint)
+{
+       _ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetTransformer();
+       SysAssertf(pXformer, "Failed to get coordinate transformer.");
+
+       int absX = pXformer->TransformHorizontal(relativePoint.x + GetAbsoluteBounds().x);
+       int absY = pXformer->TransformVertical(relativePoint.y + GetAbsoluteBounds().y);
+
+       return Point(absX, absY);
+}
+
+
+Point
+_Web::GetRelativeCoordinate(Point absolutePoint)
+{
+       _ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetInverseTransformer();
+       SysAssertf(pXformer, "Failed to get coordinate transformer.");
+
+       Point bound(GetAbsoluteCoordinate(Point(0, 0)));
+
+       int absX = pXformer->TransformHorizontal(absolutePoint.x - bound.x);
+       int absY = pXformer->TransformVertical(absolutePoint.y - bound.y);
+
+       return Point(absX, absY);
+}
+
+
+Evas_Object*
+_Web::GetWebNativeNode(void)
+{
+       SysTryReturn(NID_WEB_CTRL, __pEflWebkit, null, E_INVALID_STATE, "[%s] Native node is in an invalid state.", GetErrorMessage(E_INVALID_STATE));
+
+       return __pEflWebkit->GetWebEvasObject();
+}
+
+
+void 
+_Web::SetWebSettingImpl(_WebSettingImpl* pWebSettingImpl)
+{
+       __pWebSettingImpl = pWebSettingImpl;
+}
+
+
+_WebSettingImpl* 
+_Web::GetWebSettingImpl(void) const
+{
+       return __pWebSettingImpl;
+}
+
+
+result
+_Web::OnAttaching(const _Control* pParent)
+{
+       if (__pEflWebkit)
+       {
+               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)
+       {
+               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::ChangeGesture(_WebGestureType type)
+{
+       switch (type)
+       {
+       case WEB_GESTURE_TYPE_TAP:
+               __pGestureHandler = __pTapGestureHandler.get();
+               break;
+
+       case WEB_GESTURE_TYPE_DOUBLE_TAP:
+               __pGestureHandler = __pDoubleTapGestureHandler.get();
+               break;          
+
+       case WEB_GESTURE_TYPE_PANNING:
+               __pGestureHandler = __pPanningGestureHandler.get();
+               break;
+
+       case WEB_GESTURE_TYPE_FLICK:
+               __pGestureHandler = __pFlickGestureHandler.get();
+               break;
+
+       case WEB_GESTURE_TYPE_PINCH:
+               __pGestureHandler = __pPinchGestureHandler.get();
+               break;
+
+       default:
+               SysAssert(false);
+       }
+}
+
+
+bool
+_Web::OnTouchPressed(const _Control& source, const _TouchInfo& touchInfo)
+{
+       SendTouchEventForJavaScript(touchInfo);
+
+       __pGestureHandler->OnTouchPressed(source, touchInfo);
+
+       return true;
+}
+
+
+bool
+_Web::OnTouchMoved(const _Control& source, const _TouchInfo& touchInfo)
+{
+       SendTouchEventForJavaScript(touchInfo);
+
+       __pGestureHandler->OnTouchMoved(source, touchInfo);
+
+       return true;
+}
+
+
+bool
+_Web::OnTouchReleased(const _Control& source, const _TouchInfo& touchInfo)
+{
+       SendTouchEventForJavaScript(touchInfo);
+
+       __pGestureHandler->OnTouchReleased(source, touchInfo);
+
+       _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(GetWebNativeNode(), WEB_CTRL));
+       SysAssertf(pWebImpl, "Failed to get Impl");
+
+       if (pWebImpl->GetLoadingListener() && pWebImpl->GetTextFromBlock().GetLength() > 0)
+       {
+               pWebImpl->FireWebPageBlockSelectedEvent();
+       }
+
+       SetFocused();
+
+       return true;
+}
+
+bool
+_Web::OnTouchCanceled(const _Control& source, const _TouchInfo& touchInfo)
+{
+       SendTouchEventForJavaScript(touchInfo);
+
+       __pGestureHandler->OnTouchCanceled(source, touchInfo);
+
+       return true;
+}
+
+
+bool
+_Web::OnFlickGestureDetected(_TouchFlickGestureDetector& gesture)
+{
+       if (__pWebSettingImpl->IsScrollEnabled())
+       {
+               ChangeGesture(WEB_GESTURE_TYPE_FLICK);
+               static_cast< _FlickGestureState* >(__pGestureHandler)->OnFlickGestureDetected(gesture);
+       }
+
+       return true;
+}
+
+
+bool
+_Web::OnFlickGestureCanceled(_TouchFlickGestureDetector& gesture)
+{
+       return true;
+}
+
+
+bool
+_Web::OnLongPressGestureDetected(_TouchLongPressGestureDetector& gesture)
+{
+       _TapGestureState* pTapGestureHandler = dynamic_cast< _TapGestureState* >(__pGestureHandler);
+       if (pTapGestureHandler)
+       {
+               pTapGestureHandler->OnLongPressGestureDetected(gesture);
+       }
+
+       return true;
+}
+
+
+bool
+_Web::OnLongPressGestureCanceled(_TouchLongPressGestureDetector& gesture)
+{
+       return true;
+}
+
+
+bool
+_Web::OnTapGestureDetected(_TouchTapGestureDetector& gesture)
+{
+       ChangeGesture(WEB_GESTURE_TYPE_DOUBLE_TAP);
+
+       return true;
+}
+
+
+bool
+_Web::OnTapGestureCanceled(_TouchTapGestureDetector& gesture)
+{
+       return true;
+}
+
+
+Canvas*
+_Web::OnCanvasRequestedN(const Dimension& size)
+{
+       result r = E_SUCCESS;
+
+       Evas_Object* pWebFrame = GetWebNativeNode();
+       Eina_Rectangle rect;
+       BufferInfo bufferInfo;
+
+       Point absSize = GetAbsoluteCoordinate(Point(size.width, size.height));
+
+       EINA_RECTANGLE_SET(&rect, 0, 0, absSize.x, absSize.y);
+
+       Evas_Object* pScreenShot = ewk_view_screenshot_contents_get(pWebFrame, rect, 1.0f, evas_object_evas_get(pWebFrame));
+       SysTryReturn(NID_WEB_CTRL, pScreenShot, null, E_SYSTEM, "[%s] A system error has been occurred. Failed to get snapshot of Web control", GetErrorMessage(E_SYSTEM));
+
+       r = _Utility::GetPixelBufferFromEvasObject(pScreenShot, bufferInfo);
+       evas_object_del(pScreenShot);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] propagating", GetErrorMessage(r));
+
+       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));
+
+       r = pCanvas->Construct(bufferInfo);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] propagating", GetErrorMessage(r));
+
+       return pCanvas.release();
+}
+
+
+Bitmap*
+_Web::OnCapturedBitmapRequestedN(void)
+{
+       result r = E_SUCCESS;
+
+       Evas_Object* pWebFrame = GetWebNativeNode();
+       Eina_Rectangle rect;
+       ByteBuffer buffer;
+       BufferInfo bufferInfo;
+
+       Dimension size = GetSize();
+       Point absSize = GetAbsoluteCoordinate(Point(size.width, size.height));
+
+       EINA_RECTANGLE_SET(&rect, 0, 0, absSize.x, absSize.y);
+
+       Evas_Object* pScreenShot = ewk_view_screenshot_contents_get(pWebFrame, rect, 1.0f, evas_object_evas_get(pWebFrame));
+       SysTryReturn(NID_WEB_CTRL, pScreenShot, null, E_SYSTEM, "[%s] A system error has been occurred. Failed to get snapshot of Web control", GetErrorMessage(E_SYSTEM));
+
+       r = _Utility::GetPixelBufferFromEvasObject(pScreenShot, bufferInfo);
+       evas_object_del(pScreenShot);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] propagating", GetErrorMessage(r));
+
+       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();
+}
+
+
+void
+_Web::DumpPointList(void* pData)
+{
+       Eina_List* pList = reinterpret_cast< Eina_List* >(pData);
+       
+       for(; pList; pList = eina_list_next(pList))
+       {
+               Ewk_Touch_Point* pPointDump = static_cast<Ewk_Touch_Point*>(eina_list_data_get(pList));
+               SysLog(NID_WEB_CTRL, "The current value of id is %lu, x is %d, y is %d, state is %d", pPointDump->id, pPointDump->x, pPointDump->y, pPointDump->state);
+       }
+}
+
+
+void
+_Web::SendTouchEventForJavaScript(const _TouchInfo& touchInfo)
+{
+       result r = E_SUCCESS;
+
+       Eina_List* pPointList = null;
+       Ewk_Touch_Point* pPoint = null;
+       
+       _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.");
+
+       Point currentPoint;
+       _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)
+               {
+                       currentPoint = GetAbsoluteCoordinate(pFingerInfo->GetPoint());
+
+                       pPoint = static_cast<Ewk_Touch_Point*>(calloc(1, sizeof(Ewk_Touch_Point)));
+               
+                       pPoint->id = pFingerInfo->GetPointId();                 
+                       pPoint->x = currentPoint.x;
+                       pPoint->y = currentPoint.y;
+                       pPoint->state = GetEvasTouchState((TouchStatus)pFingerInfo->GetStatus());
+
+                       pPointList = eina_list_append(pPointList, pPoint);      
+               }
+       }
+       DumpPointList(pPointList);
+
+       Eina_Bool ret = ewk_view_feed_touch_event(__pEflWebkit->GetWebEvasObject(), GetEwkTouchEvent(touchInfo.GetTouchStatus()), pPointList, null);
+       SysTryReturnVoidResult(NID_WEB_CTRL, ret == EINA_TRUE, E_SYSTEM, "[%s] A system error has been occurred. Failed to deliver touch event to javascript.", GetErrorMessage(E_SYSTEM));
+
+       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;
+}
+
+
+}}} // Tizen::Web::Controls
diff --git a/src/controls/FWebCtrl_Web.h b/src/controls/FWebCtrl_Web.h
new file mode 100755 (executable)
index 0000000..7a40e57
--- /dev/null
@@ -0,0 +1,176 @@
+//
+// 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_ITouchTapGestureEventListener.h>
+
+namespace Tizen { namespace Ui
+{
+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;
+}} // Tizen::Graphics
+
+namespace Tizen { namespace Web { namespace Controls
+{
+class _EflWebkit;
+class _WebSettingImpl;
+class _TapGestureState;
+class _DoubleTapGestureState;
+class _PanningGestureState;
+class _FlickGestureState;
+class _PinchGestureState;
+
+enum _WebGestureType
+{
+       WEB_GESTURE_TYPE_TAP,
+       WEB_GESTURE_TYPE_DOUBLE_TAP,
+       WEB_GESTURE_TYPE_PANNING,
+       WEB_GESTURE_TYPE_FLICK,
+       WEB_GESTURE_TYPE_PINCH
+};
+
+class _Web
+       : public Tizen::Ui::_Control
+       , Tizen::Ui::_ITouchFlickGestureEventListener
+       , Tizen::Ui::_ITouchLongPressGestureEventListener
+       , Tizen::Ui::_ITouchTapGestureEventListener
+       , 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::Point GetRelativeCoordinate(Tizen::Graphics::Point absolutePoint);
+
+       void SetWebSettingImpl(Tizen::Web::Controls::_WebSettingImpl* pWebSettingImpl);
+
+       _WebSettingImpl* GetWebSettingImpl(void) const;
+
+       virtual result OnAttaching(const _Control* pParent);
+
+       virtual result OnBoundsChanging(const Tizen::Graphics::Rectangle& bounds);
+
+       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 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::Dimension& size);
+
+       virtual Tizen::Graphics::Bitmap* OnCapturedBitmapRequestedN(void);
+
+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);
+
+       void DumpPointList(void* pData);
+
+private:
+       Tizen::Ui::_ITouchEventListener* __pGestureHandler;
+
+       Tizen::Web::Controls::_WebSettingImpl* __pWebSettingImpl;
+
+       std::unique_ptr<_EflWebkit> __pEflWebkit;
+
+       std::unique_ptr<Tizen::Ui::_TouchFlickGestureDetector> __pGestureFlick;
+
+       std::unique_ptr<Tizen::Ui::_TouchLongPressGestureDetector> __pGestureLongPress;
+
+       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<_DoubleTapGestureState> __pDoubleTapGestureHandler;
+
+       std::unique_ptr<_PanningGestureState> __pPanningGestureHandler;
+
+       std::unique_ptr<_FlickGestureState> __pFlickGestureHandler;
+
+       std::unique_ptr<_PinchGestureState> __pPinchGestureHandler;
+}; // _Web
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_WEB_H_
diff --git a/src/controls/FWebCtrl_WebDataHandler.cpp b/src/controls/FWebCtrl_WebDataHandler.cpp
new file mode 100755 (executable)
index 0000000..94d6300
--- /dev/null
@@ -0,0 +1,257 @@
+//
+// 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)
+{
+       SysLog(NID_WEB_CTRL, "Start Download %S", 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);
+       ClearLastResult();
+
+       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, baseUri.GetHost(), 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
diff --git a/src/controls/FWebCtrl_WebDataHandler.h b/src/controls/FWebCtrl_WebDataHandler.h
new file mode 100644 (file)
index 0000000..14fa0e2
--- /dev/null
@@ -0,0 +1,72 @@
+//
+// 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_
diff --git a/src/controls/FWebCtrl_WebEvent.cpp b/src/controls/FWebCtrl_WebEvent.cpp
new file mode 100755 (executable)
index 0000000..7a45d9f
--- /dev/null
@@ -0,0 +1,122 @@
+//
+// 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_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
diff --git a/src/controls/FWebCtrl_WebEvent.h b/src/controls/FWebCtrl_WebEvent.h
new file mode 100755 (executable)
index 0000000..325af58
--- /dev/null
@@ -0,0 +1,76 @@
+//
+// 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_
diff --git a/src/controls/FWebCtrl_WebEventArg.cpp b/src/controls/FWebCtrl_WebEventArg.cpp
new file mode 100755 (executable)
index 0000000..4ab91fb
--- /dev/null
@@ -0,0 +1,317 @@
+//
+// 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
diff --git a/src/controls/FWebCtrl_WebEventArg.h b/src/controls/FWebCtrl_WebEventArg.h
new file mode 100755 (executable)
index 0000000..6c636fe
--- /dev/null
@@ -0,0 +1,234 @@
+//
+// 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_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_TEXTSEARCHLISTENER = 0x500,
+       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
+       };
+
+       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_
diff --git a/src/controls/FWebCtrl_WebImpl.cpp b/src/controls/FWebCtrl_WebImpl.cpp
new file mode 100755 (executable)
index 0000000..87b0941
--- /dev/null
@@ -0,0 +1,3823 @@
+//
+// 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_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 <FCntDownloadRequest.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 <FUiControl.h>
+#include <FUiCtrlKeypad.h>
+#include <FWebCtrlHitElementResult.h>
+#include <FWebCtrlITextSearchListener.h>
+#include <FWebCtrlIWebDownloadListener.h>
+#include <FWebCtrlIWebUiEventListener.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 <FCnt_DownloadManagerImpl.h>
+#include <FGrp_CoordinateSystem.h>
+#include <FIo_DatabaseImpl.h>
+#include <FIo_NormalFile.h>
+#include <FUi_Control.h>
+#include <FUi_EcoreEvasMgr.h>
+#include <FUi_EcoreEvas.h>
+#include <FUi_ResourceSizeInfo.h>
+#include <FUi_Window.h>
+#include <FUiAnim_EflNode.h>
+#include <FUiAnim_VisualElement.h>
+#include <FUiCtrl_FooterImpl.h>
+#include <FUiCtrl_Form.h>
+#include "FWeb_HistoryItemImpl.h"
+#include "FWebCtrl_AppControlListener.h"
+#include "FWebCtrl_AuthConfirmPopup.h"
+#include "FWebCtrl_AuthenticationChallengeImpl.h"
+#include "FWebCtrl_GeolocationConfirmPopup.h"
+#include "FWebCtrl_GeolocationPermissionManagerImpl.h"
+#include "FWebCtrl_HitElementResultImpl.h"
+#include "FWebCtrl_InputPickerPopup.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_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::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;
+
+
+Eina_Bool
+AddHttpHeaderData(const Eina_Hash* pHash, const void* pKey, void* pValue, void* pUserData)
+{
+       result r = E_SUCCESS;
+
+       String key(reinterpret_cast< const char* >(pKey));
+       String value(reinterpret_cast< char* >(pValue));
+
+       SysLog(NID_WEB_CTRL, "The current value of key is %ls, value is %ls", key.GetPointer(), value.GetPointer());
+
+       r = reinterpret_cast< HttpHeader* >(pUserData)->AddField(key, value);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       return EINA_TRUE;
+}
+
+
+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));
+
+       SysLog(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, r, r, "[%s] Propagating.", GetErrorMessage(r));
+       pAttrKey.release();
+       pAttrValue.release();
+
+       return EINA_TRUE;
+}
+
+
+void FreeCharArray(void* pData)
+{
+       delete[] reinterpret_cast<char*>(pData);
+}
+
+
+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));
+       SysTryReturn(NID_WEB_CTRL, pErrorCode.get() && pErrorDescription.get() && pEventArg.get(), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       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);
+
+       result r = E_SUCCESS;
+
+       String msg(pMessage);
+
+       MessageBox messageBox;
+       r = messageBox.Construct(L"", msg, MSGBOX_STYLE_OK);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       int modalResult = 0;
+       r = messageBox.ShowAndWait(modalResult);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       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;
+
+       String msg(pMessage);
+
+       MessageBox messageBox;
+       r = messageBox.Construct(L"", msg, MSGBOX_STYLE_OKCANCEL);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       int modalResult = 0;
+       r = messageBox.ShowAndWait(modalResult);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       if (modalResult == MSGBOX_RESULT_OK)
+       {
+               ewk_view_javascript_confirm_reply(pView, EINA_TRUE);
+       }
+       else
+       {
+               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;
+
+       String msg(pMessage);
+       String defVal(pDefaultValue);
+
+       int modalResult = -1;
+       _PromptPopup pPromptPopup;
+
+       r = pPromptPopup.Construct(msg, defVal);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pPromptPopup.ShowAndWait(modalResult);
+
+       if (modalResult)
+       {
+               std::unique_ptr<char[]> pResult(_StringConverter::CopyToCharArrayN(pPromptPopup.GetPromptText()));
+               SysTryReturn(NID_WEB_CTRL, pResult.get(), EINA_FALSE, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+               ewk_view_javascript_prompt_reply(pView, pResult.get());
+       }
+       else
+       {
+               ewk_view_javascript_prompt_reply(pView, null);
+       }
+
+       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");
+
+       SysLog(NID_WEB_CTRL, "url : %s, pem : %s, error : %d", ewk_certificate_policy_decision_url_get(pPolicy), ewk_certificate_policy_decision_certificate_pem_get(pPolicy), ewk_certificate_policy_decision_error_get(pPolicy));
+
+       ewk_certificate_policy_decision_allowed_set(pPolicy, EINA_TRUE);
+
+       if (pImpl->GetLoadingListener())
+       {
+//             ToDo : If certificate check works properly, remove annotation.
+//             r = FireLoadingErrorOccurredEvent(pImpl, 999, "Invalid certificate.");
+//             SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+       }
+}
+
+
+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();
+       }
+}
+
+
+void
+OnGeolocationPermissionRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+       _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
+       Ewk_Geolocation_Permission_Data* pPermissionData = reinterpret_cast< Ewk_Geolocation_Permission_Data* >(pEventInfo);
+       SysAssertf(pImpl && pPermissionData, "Failed to request");
+
+       Ewk_Geolocation_Permission_Request permissionRequest = ewk_geolocation_permission_request_get(pPermissionData);
+
+       if (pImpl->GetSetting().IsGeolocationEnabled())
+       {
+               result r = E_SUCCESS;
+
+               std::unique_ptr<DbEnumerator> pEnum;
+
+               String geolocationPath(Tizen::App::App::GetInstance()->GetAppRootPath() + GEOLOCATION_DIRECTORY_PATH + GEOLOCATION_DB_NAME);
+               String table(GEOLOCATION_TABLE_NAME);
+               _DatabaseImpl db;
+
+               const Ewk_Security_Origin* pOrigin = ewk_geolocation_permission_request_origin_get(pPermissionData);
+               String origin = _GeolocationPermissionManagerImpl::CreateOrigin(pOrigin);
+
+               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_allow_set(permissionRequest, static_cast < Eina_Bool >(permission));
+               }
+               else
+               {
+                       r = pImpl->ShowGeolocationPopup(pPermissionData);
+                       SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+               }
+
+               return;
+       }
+
+CATCH:
+       ewk_geolocation_permission_request_allow_set(permissionRequest, EINA_FALSE);
+}
+
+
+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));
+       SysLog(NID_WEB_CTRL, "The current value of url is %ls", url.GetPointer());
+
+       if (url == L"about:blank")
+       {
+               ewk_policy_decision_use(pPolicy);
+               return;
+       }
+
+       if (pImpl->GetLoadingListener() && ewk_frame_is_main_frame(ewk_policy_decision_frame_get(pPolicy))
+               && !pImpl->IsRedirectRequested())
+       {
+               if (pImpl->GetTextSearchListener())
+               {
+                       pImpl->DisableAsyncSearch();
+               }
+       
+               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 (pImpl->GetLoadingListener()->OnLoadingRequested(url, navigationType))
+               {
+                       ewk_policy_decision_ignore(pPolicy);
+
+                       return;
+               }
+       }
+
+       String uriScheme(ewk_policy_decision_scheme_get(pPolicy));
+       SysLog(NID_WEB_CTRL, "The current value of scheme is %ls", uriScheme.GetPointer());
+
+       if ((uriScheme != L"http") && (uriScheme != L"https") && (uriScheme != L"file"))
+       {
+               ewk_policy_decision_ignore(pPolicy);
+
+               result r = E_SUCCESS;
+
+               _WebEventType eventType = WEB_EVENT_REQUEST_UNKNOWN;
+
+               if (uriScheme == L"rtsp")
+               {
+                       eventType = WEB_EVENT_REQUEST_RTSP;
+               }
+               else if (uriScheme == L"mailto")
+               {
+                       eventType = WEB_EVENT_REQUEST_EMAIL;
+               }
+               else if (uriScheme == L"tel")
+               {
+                       eventType = WEB_EVENT_REQUEST_TEL;
+               }
+               else if (uriScheme == L"sms" || uriScheme == L"smsto" )
+               {
+                       eventType = WEB_EVENT_REQUEST_SMS;
+               }
+               else if (uriScheme == L"mms" || uriScheme == L"mmsto" )
+               {
+                       eventType = WEB_EVENT_REQUEST_MMS;
+               }
+
+               std::unique_ptr<_WebEventArg> pEventArg(new _WebEventArg(eventType, url));
+               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();
+
+               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;
+
+       const char* pUrl = ewk_policy_decision_url_get(pPolicy);
+       int code = ewk_policy_decision_response_status_code_get(pPolicy);
+       String mime(ewk_policy_decision_response_mime_get(pPolicy));
+       SysLog(NID_WEB_CTRL, "url : %s, mime : %ls, code : %d", pUrl, mime.GetPointer(), code);
+
+       ILoadingListener* pLoadingListener = pImpl->GetLoadingListener();
+       if (pLoadingListener && ewk_frame_is_main_frame(ewk_policy_decision_frame_get(pPolicy)))
+       {
+               const Eina_Hash* pHeader = ewk_policy_decision_response_headers_get(pPolicy);
+
+               DecisionPolicy policy;
+               HttpHeader httpHeader;
+
+               if (code >= REDIRECTION_HEADER_GROUP && code < REDIRECTION_HEADER_GROUP + 100)
+               {
+                       pImpl->SetRedirectRequested(true);
+                       mime = L"";
+               }
+
+               eina_hash_foreach(pHeader, AddHttpHeaderData, &httpHeader);
+               SysTryCatch(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+               policy = pLoadingListener->OnWebDataReceived(mime, httpHeader);
+               pImpl->SetPolicyDecision(policy);
+       }
+
+       switch (pImpl->GetPolicyDecision())
+       {
+       case WEB_DECISION_CONTINUE:
+       {
+               if (pImpl->IsMimeSupported(mime) || mime == L"")
+               {
+                       break;
+               }
+               
+               else
+               {
+                       SysLog(NID_WEB_CTRL, "Lauch native app to handle the mime");
+
+                       ewk_policy_decision_ignore(pPolicy);
+
+                       AppControl* pAppControl = null;
+                       _SelectBox selectBox;
+                       int appCount = 0;
+                       int selectedIndex = 0;
+
+                       std::unique_ptr<IList, AllElementsDeleter> pList(_AppManagerImpl::FindAppControlsN(NULL, NULL, &mime, NULL));
+
+                       if (pList.get())
+                       {
+                               appCount = pList->GetCount();
+                       }
+
+                       r = selectBox.Construct(false, L"", appCount+1); //+1 for Downloader
+                       SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+                       selectBox.AddListItem(L"Download", _SelectBox::LIST_ITEM_TYPE_NORMAL, false);
+                       for (int i = 0; i < appCount; i++)
+                       {
+                               pAppControl = dynamic_cast< AppControl* >(pList->GetAt(i));
+                               SysTryReturnVoidResult(NID_WEB_CTRL, pAppControl, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+                               String text = pAppControl->GetAppName();
+                               SysLog(NID_WEB_CTRL, "AppName : %S", text.GetPointer());
+
+                               selectBox.AddListItem(text, _SelectBox::LIST_ITEM_TYPE_NORMAL, false);
+                       }
+                       selectBox.ShowAndWait(selectedIndex);
+
+                       if (selectedIndex == 0) //download
+                       {
+                               RequestId reqId = 0;
+                               DownloadRequest request(pUrl);
+
+                               _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));
+                       }
+                       else if (selectedIndex != -1) // -1 for cancel
+                       {
+                               String path("path");
+                               String pathVal(pUrl);
+
+                               HashMap dataList;
+                               r = dataList.Construct();
+                               SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+                               r = dataList.Add(path, pathVal);
+                               SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+                               pAppControl = dynamic_cast< AppControl* >(pList->GetAt(selectedIndex));
+                               SysTryReturnVoidResult(NID_WEB_CTRL, pAppControl, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+                               _AppControlImpl* pAcImpl = _AppControlImpl::GetInstance(*pAppControl);
+                               SysTryReturnVoidResult(NID_WEB_CTRL, pAcImpl, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+                               r = pAcImpl->Start(null, null, &dataList, 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(pUrl);
+
+               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);
+
+       pImpl->SetLoadingErrorOccurred(true);
+       switch (code)
+       {
+       case EWK_ERROR_CODE_FRAMELOADINTERRUPTEDBYPOLICYCHANGE:
+               //fall through
+       case EWK_ERROR_CODE_PLUGINWILLHANDLELOAD:
+               break;
+
+       case EWK_ERROR_NETWORK_STATUS_CANCELLED:
+               evas_object_smart_callback_call(pView, "load,stop", NULL);
+               break;
+
+       default:
+               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
+OnDidStartDownloadCallback(const char* pUrl, void* pUserData)
+{
+       _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+       SysAssertf(pUrl && pImpl != null, "Failed to request");
+
+       SysLog(NID_WEB_CTRL, "The current value of url is %s", pUrl);
+}
+
+
+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;
+
+               std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED));
+               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
+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();
+       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);
+               }
+       }
+}
+
+
+void
+OnWebWindowClosedRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+       _WebImpl* pChildImpl = reinterpret_cast< _WebImpl* >(pUserData);
+       _WebImpl* pParentImpl = reinterpret_cast< _WebImpl* >(evas_object_data_get(pView, PARENT_WEB_CTRL));
+       SysAssertf(pChildImpl && pParentImpl, "Failed to request");
+
+       if (pParentImpl->GetUiEventListener())
+       {
+               result r = E_SUCCESS;
+
+               std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED));
+               SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+               r = pChildImpl->GetWebEvent()->FireAsync(*pEventArg.get());
+               SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+               pEventArg.release();
+       }
+}
+
+
+Eina_Bool
+OnSelectUploadFile(Evas_Object* pView, Eina_Bool multipleFile, Eina_List* pAcceptTypes, const char* pCapture, void* pUserData)
+{
+       Eina_Bool ret = EINA_FALSE;
+       Eina_List* pSelectedFileNames = null;
+       String isMultipleSelection(L"single");
+
+       if (multipleFile)
+       {
+               isMultipleSelection.Append(L"multiple");
+       }
+
+       std::unique_ptr<_MediaSelectionListener> pMediaListener(new (std::nothrow) _MediaSelectionListener());
+       SysTryCatch(NID_WEB_CTRL, pMediaListener.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       {
+               int itemCount = eina_list_count(pAcceptTypes);
+               String fileType = L"all";
+
+               if (itemCount == 1)
+               {
+                       String item((char*)eina_list_nth(pAcceptTypes, 0));
+                       if (item.StartsWith("image/",0))
+                       {
+                               fileType = L"image";
+                       }
+                       else if (item.StartsWith("audio/",0))
+                       {
+                               fileType = L"audio";
+                       }
+                       else if (item.StartsWith("video/",0))
+                       {
+                               fileType = L"video";
+                       }
+               }
+
+               HashMap dataList;
+               result r = dataList.Construct();
+               SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+               String mode(L"selectionType");
+               r = dataList.Add(mode, isMultipleSelection);
+               SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+               String type(L"type");
+               r = dataList.Add(type, fileType);
+               SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+               std::unique_ptr<AppControl> pMediaAppControl(_AppManagerImpl::FindAppControlN(L"tizen.filemanager", L"http://tizen.org/appcontrol/operation/pick"));
+               SysTryCatch(NID_WEB_CTRL, pMediaAppControl.get(), r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+               _AppControlImpl* pMediaAppControlImpl = _AppControlImpl::GetInstance(*pMediaAppControl);
+               r = pMediaAppControlImpl->Start(null, null, &dataList, pMediaListener.get());
+               SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+               while (true)
+               {
+                       if (pMediaListener->IsSelectionCompleted())
+                       {
+                               const ArrayList* pSelectedFiles = pMediaListener->GetSelectedFiles();
+                               SysTryCatch(NID_WEB_CTRL, pSelectedFiles, r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+                               int fileCount = pSelectedFiles->GetCount();
+
+                               for (int i = 0; i < fileCount; i++)
+                               {
+                                       String* pFile = (String*)pSelectedFiles->GetAt(i);
+                                       SysTryCatch(NID_WEB_CTRL, pFile, r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+                                       std::unique_ptr<ByteBuffer> pByteBuf(StringUtil::StringToUtf8N(*pFile));
+                                       SysTryCatch(NID_WEB_CTRL, pByteBuf.get(), r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+                                       pSelectedFileNames = eina_list_append(pSelectedFileNames, strdup((const char*)pByteBuf->GetPointer()));
+                               }
+
+                               ret = EINA_TRUE;
+                               break;
+                       }
+
+                       ecore_main_loop_iterate();
+               }
+
+               ewk_view_open_panel_reply(pView, pSelectedFileNames, ret);
+               return ret;
+       }
+
+CATCH:
+       ewk_view_open_panel_reply(pView, null, ret);
+       eina_list_free(pSelectedFileNames);
+       return ret;
+}
+
+
+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;
+               }
+
+               _Form* pFormCore = pImpl->GetParentFormCore(dynamic_cast< _Control* >(&pImpl->GetCore()));
+               SysAssertf(pFormCore != null, "Failed to get FormCore");
+
+               if (pFormCore->HasFooter() && pFormCore->IsFooterVisible())
+               {
+                       pImpl->SetFooterVisibleState(true);
+                       pFormCore->SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, false);
+               }
+
+               if (pImpl->GetWebKeypadEventListener())
+               {
+                       if (pImpl->IsKeypadVisible() == true)
+                       {
+                               if ((pImpl->GetPreviousOrientation() == pFormCore->GetOrientation()) && (pImpl->GetKeypadHeight() != rect.height))
+                               {
+                                       pFormCore->DeflateClientRectHeight(pXformer->TransformVertical(rect.height));
+                                       pImpl->GetWebKeypadEventListener()->OnWebKeypadBoundsChanged(*dynamic_cast< Web* >(&pImpl->GetPublic()));
+                               }
+                       }
+                       else
+                       {
+                               pFormCore->DeflateClientRectHeight(pXformer->TransformVertical(rect.height));
+                               pImpl->GetWebKeypadEventListener()->OnWebKeypadWillOpen(*dynamic_cast< Web* >(&pImpl->GetPublic()));
+                       }
+               }
+               pImpl->SetKeypadVisibleState(true);
+               pImpl->SetPreviousOrientation(pFormCore->GetOrientation());
+               pImpl->SetKeypadHeight(rect.height);
+       }
+       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");
+
+       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");
+
+       _Form* pFormCore = pImpl->GetParentFormCore(dynamic_cast< _Control* >(&pImpl->GetCore()));
+       SysAssertf(pFormCore != null, "Failed to get FormCore");
+
+       if (pFormCore->HasFooter() && pImpl->IsFooterVisible())
+       {
+               pImpl->SetFooterVisibleState(false);
+               pFormCore->SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true);
+       }
+
+       pFormCore->DeflateClientRectHeight(0);
+
+       if (pImpl->GetWebKeypadEventListener())
+       {
+               pImpl->GetWebKeypadEventListener()->OnWebKeypadClosed(*dynamic_cast< Web* >(&pImpl->GetPublic()));
+       }
+
+       pImpl->SetKeypadVisibleState(false);
+}
+
+
+void
+OnWindowObjectFocusGained(void *pUserData, Evas_Object *pWin, void *pEvent_info)
+{
+       _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+       SysAssertf(pImpl, "Failed to request");
+
+       if (pImpl->IsKeypadOpened() == true)
+       {
+               _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
+               SysAssertf(pWebCore, "Failed to get Web core object");
+
+               evas_object_focus_set(pWebCore->GetWebNativeNode(), EINA_TRUE);
+
+               pImpl->SetKeypadOpened(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);
+       }
+} 
+
+
+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 = E_SUCCESS;
+
+       std::unique_ptr<_SelectBox> pSelectBox(new (std::nothrow) _SelectBox());
+       SysTryReturn(NID_WEB_CTRL, pSelectBox.get(), EINA_FALSE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       //Create list required for selectBox
+       int itemCount = eina_list_count(pItems);
+       SysTryReturn(NID_WEB_CTRL, itemCount > 0, EINA_FALSE , E_SYSTEM, "[%s] ItemCount is invalid.", GetErrorMessage(E_SYSTEM));
+
+       r = pSelectBox->Construct(false, L"", itemCount, pSmartData->self);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = pSelectBox->UpdateList(pItems, selectedIndex, false, false);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pWebImpl->SetSelectBox(pSelectBox.release());
+
+       pWebImpl->GetSelectBox()->Show();
+
+       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");
+
+       Eina_Bool ret = EINA_TRUE;
+
+       _SelectBox* pSelectBox = pWebImpl->GetSelectBox();
+
+       if (pSelectBox)
+       {
+               pWebImpl->DeleteSelectBox();
+       }
+       else
+       {
+               ret = EINA_FALSE;
+       }
+
+       return ret;
+}
+
+
+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");
+
+       _SelectBox* pSelectBox = pWebImpl->GetSelectBox();
+
+       Eina_Bool ret = EINA_FALSE;
+
+       if (pSelectBox)
+       {
+               result r = pSelectBox->UpdateList(pItems, selectedIndex, true, false);
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+               ret = EINA_TRUE;
+       }
+
+       return ret;
+}
+
+
+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());
+
+       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)
+       , __isLoadingErrorOccurred(false)
+       , __isRedirectRequested(false)
+       , __keypadHeight(0)
+       , __pWebCore(null)
+       , __pUserLoadingListener(null)
+       , __pUserUiListener(null)
+       , __pUserKeypadEventListener(null)
+       , __pTextSearchListener(null)
+       , __pKeypad(null)
+       , __pWebSetting(null)
+       , __pJsBridgeList(null)
+       , __pJsProvider(null)
+       , __pJsComparer(null)
+       , __pWebDownloadHandler(null)
+       , __pWebEvent(null)
+       , __pAuthChallenge(null)
+       , __pAuthPopup(null)
+       , __pGeolocationPopup(null)
+       , __orientation(_CONTROL_ORIENTATION_PORTRAIT)
+       , __pSelectBox(null)
+       , __pDatePicker(null)
+       , __pColorPicker(null)
+       , __policy(WEB_DECISION_CONTINUE)
+{
+       __textSearch.__searchAll = false;
+       __textSearch.__searchForward = true;
+       __textSearch.__caseSensitive = false;
+       __textSearch.__pending = 0;
+       __textSearch.__currentIndex = 1;
+       __textSearch.__totalCount -1;
+       __textSearch.__text = L"";
+}
+
+
+_WebImpl::~_WebImpl()
+{
+       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;
+}
+
+
+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));
+
+       __pWebSetting = std::unique_ptr<WebSetting>(new (std::nothrow) WebSetting());
+       SysTryReturn(NID_WEB_CTRL, __pWebSetting.get(), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       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");
+
+       __pWebCore->SetWebSettingImpl(_WebSettingImpl::GetInstance(__pWebSetting.get()));
+
+       return E_SUCCESS;
+}
+
+
+result
+_WebImpl::InitializeSetting(void)
+{
+       result r = E_SUCCESS;
+
+       r = SetSetting(*__pWebSetting.get());
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       SetCookieEnabled(_WebSettingImpl::GetInstance(__pWebSetting.get())->IsCookieEnabled());
+       SetPrivateBrowsingEnabled(_WebSettingImpl::GetInstance(__pWebSetting.get())->IsPrivateBrowsingEnabled());
+       SetZoomLevel(_WebSettingImpl::GetInstance(__pWebSetting.get())->GetZoomLevel());
+
+       SetEventListenerCallback();
+
+       _Form* pFormCore = GetParentFormCore(dynamic_cast< _Control* >(&this->GetCore()));
+       SysAssertf(pFormCore != null, "Failed to get FormCore");
+
+       SetPreviousOrientation(pFormCore->GetOrientation());
+
+       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
+{
+       std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
+       SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+       ewk_view_url_set(__pWebCore->GetWebNativeNode(), pUrl.get());
+
+       return E_SUCCESS;
+}
+
+
+result 
+_WebImpl::LoadUrl(const String& url, const HttpHeader& header)
+{
+       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(__pWebCore->GetWebNativeNode(), 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
+{
+
+       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(__pWebCore->GetWebNativeNode(), 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
+{
+       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(__pWebCore->GetWebNativeNode(), reinterpret_cast< const char* >(content.GetPointer()), content.GetLimit(), pMime.get(), pEncoding.get(), pUrl.get());
+
+       return E_SUCCESS;
+}
+
+
+void
+_WebImpl::Pause(void)
+{
+       ewk_view_suspend(__pWebCore->GetWebNativeNode());
+}
+
+
+void
+_WebImpl::Resume(void)
+{
+       ewk_view_resume(__pWebCore->GetWebNativeNode());
+}
+
+
+void
+_WebImpl::SetSelectBox(_SelectBox* pSelectBox)
+{
+       __pSelectBox = std::unique_ptr<_SelectBox>(pSelectBox);
+}
+
+
+_SelectBox*
+_WebImpl::GetSelectBox(void)
+{
+       return __pSelectBox.get();
+}
+
+
+void
+_WebImpl::DeleteSelectBox(void)
+{
+       _SelectBox* pSelectBox = __pSelectBox.release();
+       delete pSelectBox;
+}
+
+
+_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
+{
+       return static_cast< bool >(ewk_view_back_possible(__pWebCore->GetWebNativeNode()));
+}
+
+
+bool
+_WebImpl::CanGoForward(void) const
+{
+       return static_cast< bool >(ewk_view_forward_possible(__pWebCore->GetWebNativeNode()));
+}
+
+
+void
+_WebImpl::GoBack(void) const
+{
+       ewk_view_back(__pWebCore->GetWebNativeNode());
+}
+
+
+void
+_WebImpl::GoForward(void) const
+{
+       ewk_view_forward(__pWebCore->GetWebNativeNode());
+}
+
+
+Tizen::Base::String
+_WebImpl::GetUrl(void) const
+{
+       return ewk_view_url_get(__pWebCore->GetWebNativeNode());
+}
+
+
+Tizen::Base::String
+_WebImpl::GetTitle(void) const
+{
+       return ewk_view_title_get(__pWebCore->GetWebNativeNode());
+}
+
+
+void
+_WebImpl::StopLoading(void) const
+{
+       ewk_view_stop(__pWebCore->GetWebNativeNode());
+}
+
+
+void
+_WebImpl::Reload(void) const
+{
+       ewk_view_reload_bypass_cache(__pWebCore->GetWebNativeNode());
+}
+
+
+String*
+_WebImpl::EvaluateJavascriptN(const String& scriptCode) const
+{
+       if (scriptCode.GetLength())
+       {
+               std::unique_ptr<char[]> pScript(_StringConverter::CopyToCharArrayN(scriptCode));
+               SysTryReturn(NID_WEB_CTRL, pScript.get(), null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+               _WebPresenter presenter;
+               presenter.InitAsyncProcess();
+
+               ewk_view_script_execute(__pWebCore->GetWebNativeNode(), pScript.get(), OnScriptExecuted, &presenter);
+
+               Tizen::Base::String* pResult = new (std::nothrow) Tizen::Base::String(L"");
+               SysTryReturn(NID_WEB_CTRL, pResult, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+               presenter.WaitAsyncProcess(*pResult);
+
+               return pResult;
+       }
+
+       return null;
+}
+
+
+result
+_WebImpl::SetZoomLevel(float level)
+{
+       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(__pWebCore->GetWebNativeNode(), static_cast< double >(level), 0, 0);
+
+       return E_SUCCESS;
+}
+
+
+float
+_WebImpl::GetZoomLevel(void) const
+{
+       return static_cast< float >(ewk_view_scale_get(__pWebCore->GetWebNativeNode()));
+}
+
+
+const PageNavigationList*
+_WebImpl::GetBackForwardListN(void) const
+{
+       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(__pWebCore->GetWebNativeNode());
+       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);
+               SysLog(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;
+}
+
+
+result 
+_WebImpl::AddCustomHeader(const HttpHeader& header)
+{
+       std::unique_ptr<IList> pFieldNameList(header.GetFieldNamesN());
+       if (pFieldNameList.get())
+       {
+               int count = pFieldNameList->GetCount();
+               for (int i = 0; i < count; i++)
+               {
+                       String* pFieldName = dynamic_cast< String* >(pFieldNameList->GetAt(i));
+                       SysTryReturn(NID_WEB_CTRL, pFieldName, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+                       std::unique_ptr<char[]> pKey(_StringConverter::CopyToCharArrayN(*pFieldName));
+                       SysTryReturn(NID_WEB_CTRL, pKey.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+                       std::unique_ptr<IEnumerator> pFieldValueEnum(header.GetFieldValuesN(*pFieldName));
+                       SysTryReturn(NID_WEB_CTRL, pFieldValueEnum.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+                       
+                       while (pFieldValueEnum->MoveNext() == E_SUCCESS)
+                       {
+                               String* pFieldValue = dynamic_cast< String* >(pFieldValueEnum->GetCurrent());
+                               SysTryReturn(NID_WEB_CTRL, pFieldValue, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+                               std::unique_ptr<char[]> pValue(_StringConverter::CopyToCharArrayN(*pFieldValue));
+                               SysTryReturn(NID_WEB_CTRL, pValue.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+                               ewk_view_custom_header_add(__pWebCore->GetWebNativeNode(), pKey.get(), pValue.get());
+                       }
+               }
+       }
+       return E_SUCCESS;
+}
+
+
+void
+_WebImpl::RemoveAllCustomHeaders(void)
+{
+}
+
+
+bool
+_WebImpl::SearchText(const String& text, bool searchForward)
+{
+       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);
+       }
+
+       _WebPresenter presenter;
+       presenter.InitAsyncProcess();
+
+       r = SynchronizeSearch(SEARCH_SYNC, __pWebCore->GetWebNativeNode(), condition, text, searchForward, false, &presenter);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       int result = 0;
+       presenter.WaitAsyncProcess(result);
+
+       return static_cast < bool >(result);
+}
+
+
+result
+_WebImpl::SearchTextAllAsync(const Tizen::Base::String& text, bool caseSensitive)
+{
+       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, __pWebCore->GetWebNativeNode(), 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)
+{
+       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, __pWebCore->GetWebNativeNode(), 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()));
+
+               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_show_ime_on_autofocus_set(pSettings, EINA_FALSE);
+       }
+
+       __pWebSetting->SetDefaultTextEncoding(setting.GetDefaultTextEncoding());
+       __pWebSetting->SetCacheControl(setting.GetCacheControl());
+       __pWebSetting->SetFontSize(setting.GetFontSize());
+       __pWebSetting->SetJavascriptEnabled(setting.IsJavascriptEnabled());
+       __pWebSetting->SetAutoImageLoadEnabled(setting.IsAutoImageLoadEnabled());
+       __pWebSetting->SetInputStyle(setting.GetInputStyle());
+       __pWebSetting->SetUserAgent(setting.GetUserAgent());
+       __pWebSetting->SetAutoFittingEnabled(setting.IsAutoFittingEnabled());
+       __pWebSetting->SetJavaScriptPopupEnabled(setting.IsJavaScriptPopupEnabled());
+       __pWebSetting->SetGeolocationEnabled(setting.IsGeolocationEnabled());
+
+       return E_SUCCESS;
+}
+
+
+WebSetting
+_WebImpl::GetSetting(void) const
+{
+       return *__pWebSetting;
+}
+
+
+const HitElementResult*
+_WebImpl::GetElementByPointN(const Point& point) const
+{
+       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(__pWebCore->GetAbsoluteCoordinate(point));
+
+       Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(__pWebCore->GetWebNativeNode(), 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));
+
+       SysLog(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
+{
+       double percent = ewk_view_load_progress_get(__pWebCore->GetWebNativeNode());
+
+       if (Double::Compare(percent, 0.0) > 0 && Double::Compare(percent, 1.0) < 0)
+       {
+               return true;
+       }
+       else
+       {
+               return false;
+       }
+}
+
+
+String
+_WebImpl::GetTextFromBlock(void) const
+{
+       return ewk_view_text_selection_text_get(__pWebCore->GetWebNativeNode());
+}
+
+
+bool
+_WebImpl::IsPrivateBrowsingEnabled(void) const
+{
+       if (__pWebCore->GetWebNativeNode() == null)
+       {
+               return _WebSettingImpl::GetInstance(__pWebSetting.get())->IsPrivateBrowsingEnabled();
+       }
+
+       Ewk_Settings* pSettings = ewk_view_settings_get(__pWebCore->GetWebNativeNode());
+       SysAssertf(pSettings, "Failed to get webkit instance.");
+
+       return static_cast< bool >(ewk_settings_private_browsing_enabled_get(pSettings));
+}
+
+
+result
+_WebImpl::SetPrivateBrowsingEnabled(bool enable)
+{
+       if (__pWebCore->GetWebNativeNode() == null)
+       {
+               _WebSettingImpl::GetInstance(__pWebSetting.get())->SetPrivateBrowsingEnabled(enable);
+               return E_SUCCESS;
+       }
+
+       Ewk_Settings* pSettings = ewk_view_settings_get(__pWebCore->GetWebNativeNode());
+       SysAssertf(pSettings, "Failed to get webkit instance.");
+
+       ewk_settings_private_browsing_enabled_set(pSettings, static_cast< Eina_Bool >(enable));
+
+       return E_SUCCESS;
+}
+
+
+void
+_WebImpl::ClearCache(void)
+{
+       Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
+       SysAssertf(pContext, "Failed to get webkit instance.");
+
+       ewk_context_cache_clear(pContext);
+}
+
+
+void
+_WebImpl::ClearCookie(void)
+{
+       Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
+       Ewk_Cookie_Manager* pCookieManager =  ewk_context_cookie_manager_get(pContext);
+       SysAssertf(pCookieManager, "Failed to get webkit instance.");
+
+       ewk_cookie_manager_cookies_clear(pCookieManager);
+}
+
+
+bool
+_WebImpl::IsCookieEnabled(void) const
+{
+       if (__pWebCore->GetWebNativeNode() == null)
+       {
+               return _WebSettingImpl::GetInstance(__pWebSetting.get())->IsCookieEnabled();
+       }
+
+       Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
+       Ewk_Cookie_Manager* pCookieManager =  ewk_context_cookie_manager_get(pContext);
+       SysAssertf(pCookieManager, "Failed to get webkit instance.");
+
+       _WebPresenter presenter;
+       presenter.InitAsyncProcess();
+
+       ewk_cookie_manager_async_accept_policy_get(pCookieManager, OnCookiesPolicyGot, &presenter);
+
+       bool result = false;
+       presenter.WaitAsyncProcess(result);
+
+       return result;
+}
+
+
+void
+_WebImpl::SetCookieEnabled(bool enable)
+{
+       if (__pWebCore->GetWebNativeNode() == null)
+       {
+               _WebSettingImpl::GetInstance(__pWebSetting.get())->SetCookiEnabled(enable);
+
+               return;
+       }
+
+       Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
+       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_NO_THIRD_PARTY);
+       }
+       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
+{
+       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(__pWebCore->GetWebNativeNode(), pSize->width, pSize->height, pFilePath.get());
+       }
+       else
+       {
+               Evas_Coord contentsWidth;
+               Evas_Coord contentsHeight;
+
+               ewk_view_contents_size_get(__pWebCore->GetWebNativeNode(), &contentsWidth, &contentsHeight);
+               ewk_view_contents_pdf_get(__pWebCore->GetWebNativeNode(), contentsWidth, contentsHeight, pFilePath.get());
+       }
+
+       return E_SUCCESS;
+}
+
+
+bool
+_WebImpl::IsMimeSupported(const String& mime) const
+{
+       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(__pWebCore->GetWebNativeNode()), pMime.get()));
+}
+
+
+void
+_WebImpl::SetLoadingListener(ILoadingListener* pLoadingListener)
+{
+       __pUserLoadingListener = const_cast< ILoadingListener* >(pLoadingListener);
+}
+
+
+void
+_WebImpl::SetWebUiEventListener(IWebUiEventListener* pUiEventListener)
+{
+       __pUserUiListener = 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;
+}
+
+
+result
+_WebImpl::SetScrollEnabled(bool enable)
+{
+       _WebSettingImpl::GetInstance(__pWebSetting.get())->SetScrollEnabled(enable);
+
+       return E_SUCCESS;
+}
+
+
+bool
+_WebImpl::IsScrollEnabled(void) const
+{
+       return _WebSettingImpl::GetInstance(__pWebSetting.get())->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 r;
+}
+
+
+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 r;
+}
+
+
+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 r;
+}
+
+
+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;
+}
+
+
+IWebKeypadEventListener*
+_WebImpl::GetWebKeypadEventListener(void) const
+{
+       return __pUserKeypadEventListener;
+}
+
+
+ITextSearchListener*
+_WebImpl::GetTextSearchListener(void) const
+{
+       return __pTextSearchListener;
+}
+
+
+void
+_WebImpl::SetEventListenerCallback(void) const
+{
+       Evas_Object* pWebNativeNode = __pWebCore->GetWebNativeNode();
+       SysAssertf(pWebNativeNode, "Failed to get Web evas object");
+
+       _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->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;
+
+       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(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, "request,geolocation,permission", 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));
+
+       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, "text,found", OnTextFound, 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_view_open_panel_callback_set(pWebNativeNode, OnSelectUploadFile, const_cast< _WebImpl* >(this));
+
+       evas_object_event_callback_add(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained, this);
+}
+
+
+void
+_WebImpl::RemoveEventListenerCallback(void) const
+{
+       Evas_Object* pWebNativeNode = __pWebCore->GetWebNativeNode();
+       SysTryReturnVoidResult(NID_WEB_CTRL, pWebNativeNode, E_SYSTEM, "[%s] Failed to get Web evas object.", GetErrorMessage(E_SYSTEM));
+
+       _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, "requestToNative,json", OnHandleJavaScriptRequest);
+
+       evas_object_smart_callback_del(pWinObject, "focus,in", OnWindowObjectFocusGained);
+
+       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, "request,geolocation,permission", OnGeolocationPermissionRequested);
+
+       ewk_view_javascript_alert_callback_set(null, null, null);
+       ewk_view_javascript_prompt_callback_set(null, null, null);
+       ewk_view_javascript_confirm_callback_set(null, 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, "text,found", OnTextFound);
+
+       ewk_view_open_panel_callback_set(null, null, null);
+
+       evas_object_event_callback_del(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained);
+}
+
+
+result
+_WebImpl::SetBlockSelectionPosition(const Point& startPoint)
+{
+       Evas_Object* pWebNativeNode = __pWebCore->GetWebNativeNode();
+
+       Ewk_View_Smart_Data* pSmartData = (Ewk_View_Smart_Data*) evas_object_smart_data_get(pWebNativeNode);
+       SysAssertf(pSmartData, "Failed to request");
+
+       Point absPoint(__pWebCore->GetAbsoluteCoordinate(startPoint));
+
+       pSmartData->api->text_selection_down(pSmartData, absPoint.x, absPoint.y);
+       pSmartData->api->text_selection_up(pSmartData, absPoint.x, absPoint.y);
+
+       ewk_view_command_execute(pWebNativeNode, "SelectWord", 0);
+
+       SysTryReturnResult(NID_WEB_CTRL, GetTextFromBlock().GetLength() > 0, E_INVALID_ARG, "Failed to set text selection up.");
+
+       if (__pUserUiListener)
+       {
+               FireWebPageBlockSelectedEvent();
+       }
+
+       return E_SUCCESS;
+}
+
+
+result
+_WebImpl::ReleaseBlock(void)
+{
+       ewk_view_command_execute(__pWebCore->GetWebNativeNode(), "Unselect", 0);
+
+       return E_SUCCESS;
+}
+
+
+result
+_WebImpl::GetBlockRange(Point& startPoint, Point& endPoint) const
+{
+       Eina_Rectangle leftHandle;
+       Eina_Rectangle rightHandle;
+
+       ewk_view_text_selection_range_get(__pWebCore->GetWebNativeNode(), &leftHandle, &rightHandle);
+
+       startPoint.x = leftHandle.x;
+       startPoint.y = leftHandle.y;
+       endPoint.x = rightHandle.x + rightHandle.w;
+       endPoint.y = rightHandle.y + rightHandle.h;
+
+       if ((endPoint.x != 0) && (endPoint.y != 0))
+       {
+               startPoint = __pWebCore->GetRelativeCoordinate(startPoint);
+               endPoint = __pWebCore->GetRelativeCoordinate(endPoint);
+       }
+
+       return E_SUCCESS;
+}
+
+
+void
+_WebImpl::FireWebPageBlockSelectedEvent(void) const
+{
+       result r = E_SUCCESS;
+
+       std::unique_ptr<Point> startPoint(new (std::nothrow) Point());
+       std::unique_ptr<Point> endPoint(new (std::nothrow) Point());
+       SysTryReturnVoidResult(NID_WEB_CTRL, startPoint.get() && endPoint.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       r = GetBlockRange(*startPoint.get(), *endPoint.get());
+       SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED));
+       SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_START, *startPoint.get());
+       SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+       startPoint.release();
+
+       r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_END, *endPoint.get());
+       SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+       endPoint.release();
+
+       r = __pWebEvent->FireAsync(*pEventArg.get());
+       SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+       pEventArg.release();
+}
+
+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;
+}
+
+
+LoadingErrorType
+_ConvertToOspErrorCode(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_SSL_FAILED:
+       //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 999:
+               errorCode = WEB_INVALID_CERTIFICATE;
+               break;
+
+       default:
+               errorCode = WEB_ERROR_UNKNOWN;
+               break;
+       }
+
+       return errorCode;
+}
+
+
+result
+_WebImpl::LaunchAppControl(const IEventArg& arg)
+{
+       result r = E_SUCCESS;
+
+       IEventArg* pArg = const_cast< IEventArg* >(&arg);
+       _WebEventArg* pWebEventArg = dynamic_cast< _WebEventArg* >(pArg);
+       SysTryReturnResult(NID_WEB_CTRL, pWebEventArg, E_INVALID_ARG, "Type casting failed. argument must be IEventArg type.");
+
+       String operationId(L"");
+       String uriPattern(pWebEventArg->GetEventMessage());
+       SysLog(NID_WEB_CTRL, "The current value of web event type is %d", pWebEventArg->GetEventType());
+
+       switch (pWebEventArg->GetEventType())
+       {
+       case WEB_EVENT_REQUEST_RTSP:
+       {
+               String ext;
+               String mimeType;
+               int uriLength = uriPattern.GetLength();
+               int index;
+
+               operationId = L"http://tizen.org/appcontrol/operation/view";
+
+               r = uriPattern.LastIndexOf(L".", uriLength - 1, index);
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+               r = uriPattern.SubString(index + 1, ext);
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+               r = _AppControlManager::GetMimeFromExt(ext, mimeType);
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+               r = _AppControlImpl::FindAndStart(operationId, &uriPattern, &mimeType, null, null, null);
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+               return r;
+       }
+       case WEB_EVENT_REQUEST_TEL:
+       {
+               operationId = L"http://tizen.org/appcontrol/operation/dial";
+               break;
+       }
+       case WEB_EVENT_REQUEST_EMAIL:
+       //fall through
+       case WEB_EVENT_REQUEST_SMS:
+       //fall through
+       case WEB_EVENT_REQUEST_MMS:
+       {
+               operationId = L"http://tizen.org/appcontrol/operation/compose";
+               break;
+       }
+       case WEB_EVENT_REQUEST_UNKNOWN:
+       {
+               break;
+       }
+       default:
+               SysAssert(false);
+               break;
+       }
+
+       r = _AppControlImpl::FindAndStart(operationId, &uriPattern, null, null, null, null);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       return r;
+}
+
+
+result
+_WebImpl::SetFullScreenKeypad(void)
+{
+       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));
+
+       String text(ewk_view_focused_input_element_value_get(__pWebCore->GetWebNativeNode()));
+       pKeypad->SetText(text);
+
+       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;
+}
+
+
+int 
+_WebImpl::GetKeypadHeight(void) const
+{
+       return __keypadHeight;
+}
+
+
+void 
+_WebImpl::SetKeypadHeight(int keypadHeight)
+{
+       __keypadHeight = keypadHeight;
+}
+
+
+_ControlOrientation
+_WebImpl::GetPreviousOrientation(void) const
+{
+       return __orientation;
+}
+
+
+void
+_WebImpl::SetPreviousOrientation(_ControlOrientation orientation)
+{
+       __orientation = orientation;
+}
+
+
+void
+_WebImpl::OnTextValueChangeCanceled(const Control& source)
+{
+       RemoveFullScreenKeypad();
+}
+
+
+void
+_WebImpl::OnTextValueChanged(const Control& source)
+{
+       std::unique_ptr<char[]> pText(_StringConverter::CopyToCharArrayN(__pKeypad->GetText()));
+
+       ewk_view_focused_input_element_value_set(__pWebCore->GetWebNativeNode(), 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 = _ConvertToOspErrorCode(pErrorType->ToInt());
+
+               pLoadingListner->OnLoadingErrorOccurred(errorType, *pErrorMessage);
+               break;
+       }
+
+       case WEB_EVENT_LOADINGLISTENER_COMPLETED:
+       {
+               pLoadingListner->OnLoadingCompleted();
+               break;
+       }
+
+       case WEB_EVENT_LOADINGLISTENER_AUTHENTICATION_CANCELED:
+       {
+               pLoadingListner->OnHttpAuthenticationCanceled();
+               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)
+{
+       result r = E_SUCCESS;
+
+       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());
+
+       IWebUiEventListener* pWebUiEventListner = GetUiEventListener();
+       SysTryReturnResult(NID_WEB_CTRL, pWebUiEventListner, 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()));
+
+               pWebUiEventListner->OnWebPageBlockSelected(*pWeb, *pStartPoint, *pEndPoint);
+               break;
+       }
+
+       case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED:
+       {
+               Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
+
+               pWebUiEventListner->OnWebPageShowRequested(*pWeb);
+               break;
+       }
+
+       case WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED:
+       {
+               Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
+
+               pWebUiEventListner->OnWebWindowCloseRequested(*pWeb);
+               break;
+       }
+
+       default:
+       {
+               SysAssert(false);
+       }
+       }
+
+       return r;
+}
+
+
+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::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));
+
+       __pAuthChallenge.reset();
+
+       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);
+
+       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, pAuthChallenge);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       __pAuthPopup = std::move(pAuthPopup);
+
+       r = __pAuthPopup->ShowPopup();
+       SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+CATCH:
+       __pAuthPopup.reset();
+
+       return r;
+}
+
+
+result
+_WebImpl::ShowGeolocationPopup(Ewk_Geolocation_Permission_Data* pPermissionData)
+{
+       result r = E_SUCCESS;
+
+       std::unique_ptr<_GeolocationConfirmPopup> pGeolocationPopup(new (std::nothrow) _GeolocationConfirmPopup());
+       SysTryReturnResult(NID_WEB_CTRL, pGeolocationPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+       r = pGeolocationPopup->Construct(pPermissionData);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       __pGeolocationPopup = std::move(pGeolocationPopup);
+
+       r = __pGeolocationPopup->ShowPopup();
+       SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+       __pGeolocationPopup.release();
+
+       return E_SUCCESS;
+
+CATCH:
+       __pGeolocationPopup.reset();
+
+       return r;
+}
+
+
+_Form*
+_WebImpl::GetParentFormCore(_Control* pControlCore)
+{
+       String parentName;
+       _Form* pFormCore = null;
+
+       _Control* pParentControlCore = dynamic_cast< _Control* >(pControlCore->GetParent());
+
+       if (pParentControlCore == null)
+       {
+               _Window* pWindowCore = dynamic_cast< _Window* >(pControlCore);
+               SysAssertf(pWindowCore, "Failed to get parent control and window core.");
+               pFormCore = dynamic_cast< _Form* >(pWindowCore->GetOwner());
+               if (pFormCore == null)
+               {
+                       pParentControlCore = dynamic_cast< _Control* >(pWindowCore->GetOwner());
+                       SysTryReturn(NID_WEB_CTRL, pParentControlCore, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+               }
+       }
+       else
+       {
+               pFormCore = dynamic_cast< _Form* >(pParentControlCore);
+       }
+
+       if (pFormCore != null)
+       {
+               return pFormCore;
+       }
+
+       return GetParentFormCore(pParentControlCore);
+}
+
+
+bool 
+_WebImpl::OnFocusGained(const _ControlImpl& source)
+{
+       return true;
+}
+
+
+bool 
+_WebImpl::OnFocusLost(const _ControlImpl& source)
+{
+       if(IsKeypadVisible() == true)
+       {
+               SetKeypadOpened(true);
+       }
+
+       evas_object_focus_set(__pWebCore->GetWebNativeNode(), EINA_FALSE);
+
+       return true;
+}
+
+
+bool
+_WebImpl::HasValidNativeNode(void) const
+{
+       if (__pWebCore && __pWebCore->GetWebNativeNode())
+       {
+               return true;
+       }
+
+       return false;
+}
+
+
+result
+_WebImpl::OnAttachedToMainTree(void)
+{
+       result r = E_SUCCESS;
+
+       r = __pWebCore->InitializeWebNativeNode();
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = InitializeSetting();
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = _ContainerImpl::OnAttachedToMainTree();
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       return E_SUCCESS;
+}
+
+
+void
+_WebImpl::OnChangeLayout(_ControlOrientation orientation)
+{
+       if (IsKeypadVisible() == true)
+       {
+               _ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetInverseTransformer();
+               SysAssertf(pXformer, "Failed to get CoordinateTransformer");
+
+               _Form* pFormCore = GetParentFormCore(dynamic_cast< _Control* >(&this->GetCore()));
+               SysAssertf(pFormCore != null, "Failed to get FormCore");
+
+               if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
+               {
+                       pFormCore->DeflateClientRectHeight(pXformer->TransformVertical(PORTRAIT_KEYPAD_HEIGHT));
+               }
+               else if (orientation == _CONTROL_ORIENTATION_LANDSCAPE)
+               {
+                       pFormCore->DeflateClientRectHeight(pXformer->TransformVertical(LANDSCAPE_KEYPAD_HEIGHT));
+               }
+       }
+
+       if (__pColorPicker.get())
+       {
+               __pColorPicker->ChangeLayout(orientation);
+       }
+
+}
+
+
+_WebDataHandler*
+_WebImpl::GetDownloadHandler(void) const
+{
+       return __pWebDownloadHandler.get();
+}
+
+
+Bitmap*
+_WebImpl::GetFaviconN(void) const
+{
+       result r = E_SUCCESS;
+
+       Evas_Object* pView = __pWebCore->GetWebNativeNode();
+
+       Evas* pEvas = evas_object_evas_get(pView);
+       Ewk_Context* pContext = ewk_view_context_get(pView);
+       SysAssertf(pEvas && pContext, "Failed to request");
+
+       const char* pUrl = ewk_view_url_get(pView);
+
+       Tizen::Graphics::BufferInfo bufferInfo;
+       Tizen::Base::ByteBuffer byteBuffer;
+
+       std::unique_ptr<Bitmap> pBitmapImage(new (std::nothrow) Bitmap());
+       SysTryReturn(NID_WEB_CTRL, pBitmapImage.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       Evas_Object* pfavicon = ewk_context_icon_database_icon_object_add(pContext, pUrl, pEvas);
+       SysTryReturn(NID_WEB_CTRL, pfavicon, null, E_OBJ_NOT_FOUND, "[%s] Propagating.", GetErrorMessage(E_OBJ_NOT_FOUND));
+
+       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);
+
+       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));
+
+       r = pBitmapImage->Construct(byteBuffer, dimension, BITMAP_PIXEL_FORMAT_ARGB8888);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       return pBitmapImage.release();
+
+}
+
+
+_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));
+}
+
+
+Eina_Bool
+_WebImpl::HideColorPicker()
+{
+       __pColorPicker.reset();
+
+       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);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       __pColorPicker = std::move(pColorHadler);
+
+       r = __pColorPicker->ShowPopup();
+       SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+       color = __pColorPicker->GetColor();
+
+       return E_SUCCESS;
+
+CATCH:
+       __pColorPicker.reset();
+
+       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);
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       __pDatePicker = std::move(pInputPicker);
+
+       r = __pDatePicker->ShowPopup();
+       SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+       dateStr = __pDatePicker->GetDate();
+
+CATCH:
+       __pDatePicker.reset();
+
+       return r;
+}
+
+
+}}} // Tizen::Web::Controls
diff --git a/src/controls/FWebCtrl_WebImpl.h b/src/controls/FWebCtrl_WebImpl.h
new file mode 100755 (executable)
index 0000000..86f7b9c
--- /dev/null
@@ -0,0 +1,408 @@
+//
+// 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 <FBaseString.h>
+#include <FUiIActionEventListener.h>
+#include <FUiIOrientationEventListener.h>
+#include <FUiITextEventListener.h>
+#include <FWebCtrlILoadingListener.h>
+#include <FUi_ContainerImpl.h>
+#include "FWebCtrl_IWebEventListener.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 Ui
+{
+class Contorl;
+class _Contorl;
+class _ContorlImpl;
+}} // Tizen::Ui
+
+namespace Tizen { namespace Ui {  namespace Controls
+{
+class Keypad;
+class _Form;
+}}} // 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 AuthenticationChallenge;
+class HitElementResult;
+class PageNavigationList;
+class Web;
+class WebSetting;
+class _Web;
+class _JsBridgeArg;
+class _WebEvent;
+class _WebPresenter;
+class _JsBridgeComparer;
+class _JsBridgeHashCodeProvider;
+class _AuthConfirmPopup;
+class _GeolocationConfirmPopup;
+class _PromptPopup;
+class _WebDataHandler;
+class _SelectBox;
+class _InputPickerPopup;
+
+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
+};
+
+class _WebImpl
+       : public Tizen::Ui::_ContainerImpl
+       , public Tizen::Ui::ITextEventListener
+       , public Tizen::Web::Controls::_IWebEventListener
+       , virtual public Tizen::Base::Runtime::IEventListener
+{
+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;
+
+       result AddCustomHeader(const Tizen::Net::Http::HttpHeader& header);
+
+       void RemoveAllCustomHeaders(void);
+
+       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 ReleaseBlock(void);
+
+       result GetBlockRange(Tizen::Graphics::Point& startPoint, Tizen::Graphics::Point& endPoint) const;
+
+       void FireWebPageBlockSelectedEvent(void) const;
+
+       Tizen::Base::String GetTextFromBlock(void) const;
+
+       Tizen::Base::String* EvaluateJavascriptN(const Tizen::Base::String& scriptCode) const;
+
+       bool IsPrivateBrowsingEnabled(void) const;
+
+       result SetPrivateBrowsingEnabled(bool enable);
+
+       void ClearCache(void);
+
+       void ClearCookie(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 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::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;
+
+       result AddJavaScriptBridge(const IJavaScriptBridge& jsBridge);
+
+       result RemoveJavaScriptBridge(const IJavaScriptBridge& jsBridge);
+
+       result SetScrollEnabled(bool enable);
+
+       bool IsScrollEnabled(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;
+
+       bool IsFooterVisible(void) const;
+
+       void SetFooterVisibleState(bool isFooterVisible);
+
+       bool IsKeypadVisible(void) const;
+
+       void SetKeypadVisibleState(bool isKeypadVisible);
+
+       bool IsKeypadOpened(void) const;
+
+       void SetKeypadOpened(bool isKeypadOpened);
+
+       int GetKeypadHeight(void) const;
+
+       void SetKeypadHeight(int keypadHeight);
+
+       Tizen::Ui::_ControlOrientation GetPreviousOrientation(void) const;
+
+       void SetPreviousOrientation(Tizen::Ui::_ControlOrientation orientation);
+
+       result HttpAuthenticationRequested(Ewk_Auth_Challenge* pChallenge);
+
+       result ShowGeolocationPopup(Ewk_Geolocation_Permission_Data* pPermissionData);
+
+       Tizen::Ui::Controls::_Form* GetParentFormCore(Tizen::Ui::_Control* pControlCore);
+
+       Tizen::Graphics::Bitmap* GetFaviconN(void) const;
+
+       void Pause(void);
+
+       void Resume(void);
+
+       void SetSelectBox(_SelectBox* pSelectBox);
+
+       _SelectBox* GetSelectBox(void);
+
+       void DeleteSelectBox(void);
+
+       result ShowColorPicker(int r, int g, int b, int a,Tizen::Graphics::Color& color);
+       Eina_Bool HideColorPicker();
+       _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 OnAttachedToMainTree(void);
+
+       virtual void OnChangeLayout(Tizen::Ui::_ControlOrientation orientation);
+
+       static _WebImpl* CreateWebImplN(Web* pControl, const Tizen::Graphics::Rectangle& bounds);
+
+       static _WebImpl* GetInstance(Web* pWeb);
+
+       static const _WebImpl* GetInstance(const Web* pWeb);
+
+private:
+       result InitializeSetting(void);
+       result InitJsBridgeList(void);
+       result InitWebEvent(void);
+
+       IJavaScriptBridge* FindJsInterface(const Tizen::Web::Json::IJsonValue* pValue) const;
+       result LaunchAppControl(const Tizen::Base::Runtime::IEventArg& arg);
+
+       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 OnHandleTextSearchEvent(const Tizen::Base::Runtime::IEventArg& arg);
+
+private:
+       bool __isFooterVisible;
+       bool __isKeypadVisible;
+       bool __isKeypadOpened;
+       bool __isLoadingErrorOccurred;
+       bool __isRedirectRequested;
+       int __keypadHeight;
+
+       _Web* __pWebCore;
+
+       ILoadingListener* __pUserLoadingListener;
+       IWebUiEventListener* __pUserUiListener;
+       IWebKeypadEventListener* __pUserKeypadEventListener;
+       ITextSearchListener* __pTextSearchListener;
+
+       std::unique_ptr<Tizen::Ui::Controls::Keypad> __pKeypad;
+
+       std::unique_ptr<WebSetting> __pWebSetting;
+
+       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<_GeolocationConfirmPopup> __pGeolocationPopup;
+
+       std::unique_ptr<_SelectBox> __pSelectBox;
+       std::unique_ptr<_InputPickerPopup> __pDatePicker;
+       std::unique_ptr<_InputPickerPopup> __pColorPicker;
+
+       Tizen::Ui::_ControlOrientation __orientation;
+
+       Tizen::Base::Runtime::Mutex __mutex;
+
+       _TextSearch __textSearch;
+
+       DecisionPolicy __policy;
+}; // _WebImpl
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_WEB_IMPL_H_
diff --git a/src/controls/FWebCtrl_WebMaker.cpp b/src/controls/FWebCtrl_WebMaker.cpp
new file mode 100755 (executable)
index 0000000..ebe3522
--- /dev/null
@@ -0,0 +1,243 @@
+//
+// 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>
+
+
+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;
+               Tizen::Base::String elementString;
+               //bool ret = false;
+               //ApiVersion apiVersion = getApiVersion();
+
+               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();
+
+               // Construct
+               /*if( apiVersion >= V2_0)
+               {
+                   ret = PrivilegeManager_checkPrivileges(&e, 1, PRV_WEB_SERVICE);
+
+
+                   if( ret == false)
+                   {
+                       SetLastResult(E_PRIVILEGE_DENIED);
+                       return null;
+                   }
+               }*/
+
+               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))
+               {
+                       int fontSize;
+                       Base::Integer::Parse(elementString, fontSize);
+                       setting.SetFontSize(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);
+                       }
+               }
+
+
+               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
diff --git a/src/controls/FWebCtrl_WebPresenter.cpp b/src/controls/FWebCtrl_WebPresenter.cpp
new file mode 100755 (executable)
index 0000000..1d189f4
--- /dev/null
@@ -0,0 +1,123 @@
+//
+// 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.h>
+#include <FBaseSysLog.h>
+#include <FApp_AppImpl.h>
+#include "FWebCtrl_WebPresenter.h"
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+_WebPresenter::_WebPresenter(void)
+       : __stopState(false)
+       , __boolean(false)
+       , __string(L"")
+       , __integer(0)
+{
+       //empty statement
+}
+
+_WebPresenter::~_WebPresenter(void)
+{
+}
+
+
+void
+_WebPresenter::InitAsyncProcess(void)
+{
+       __stopState = false;
+       __boolean = false;
+       __string = L"";
+       __integer = 0;
+}
+
+
+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;
+}
+
+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;
+}
+}}} // Tizen::Web::Controls
diff --git a/src/controls/FWebCtrl_WebPresenter.h b/src/controls/FWebCtrl_WebPresenter.h
new file mode 100755 (executable)
index 0000000..e747554
--- /dev/null
@@ -0,0 +1,70 @@
+//
+// 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 <FBaseString.h>
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+class _WebPresenter
+       : public Tizen::Base::Object
+{
+// Lifecycle
+public:
+       _WebPresenter(void);
+
+       virtual ~_WebPresenter(void);
+
+// Operations
+public:
+       void InitAsyncProcess(void);
+
+       void WaitAsyncProcess(bool& result);
+       void WaitAsyncProcess(Tizen::Base::String& result);
+       void WaitAsyncProcess(int& result);
+
+       void EndAsyncProcess(bool result);
+       void EndAsyncProcess(const Tizen::Base::String& result);
+       void EndAsyncProcess(int 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;
+};
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_WEB_PRESENTER_H_
diff --git a/src/controls/FWebCtrl_WebSettingImpl.cpp b/src/controls/FWebCtrl_WebSettingImpl.cpp
new file mode 100755 (executable)
index 0000000..13c3b2f
--- /dev/null
@@ -0,0 +1,336 @@
+//
+// 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 = 17;
+static const float DEFAULT_ZOOM_LEVEL = 2.0f;
+static const wchar_t* DEFAULT_USER_AGENT = L"Mozilla/5.0 (Linux; U; Tizen 2.0; en-us) AppleWebKit/537.1 (KHTML, like Gecko) Version/2.0 Mobile";
+
+
+_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)
+{
+       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;
+}
+
+
+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;
+}
+
+
+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();
+}
+
+
+_WebSettingImpl*
+_WebSettingImpl::GetInstance(WebSetting* pWebSetting)
+{
+       return pWebSetting->__pWebSettingImpl;
+}
+
+
+const _WebSettingImpl*
+_WebSettingImpl::GetInstance(const WebSetting* pWebSetting)
+{
+       return pWebSetting->__pWebSettingImpl;
+}
+
+
+}}} // Tizen::Web::Controls
diff --git a/src/controls/FWebCtrl_WebSettingImpl.h b/src/controls/FWebCtrl_WebSettingImpl.h
new file mode 100644 (file)
index 0000000..de150e3
--- /dev/null
@@ -0,0 +1,146 @@
+//
+// 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;
+
+       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;
+}; // _WebSettingImpl
+
+}}} // Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_WEB_SETTING_IMPL_H_
diff --git a/src/controls/js-bridge-plugin-deprecated/CMakeLists.txt b/src/controls/js-bridge-plugin-deprecated/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..bc45b66
--- /dev/null
@@ -0,0 +1,41 @@
+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}"
+               )
+
diff --git a/src/controls/js-bridge-plugin-deprecated/FWebCtrl_JsBridgePlugin.cpp b/src/controls/js-bridge-plugin-deprecated/FWebCtrl_JsBridgePlugin.cpp
new file mode 100755 (executable)
index 0000000..c564715
--- /dev/null
@@ -0,0 +1,327 @@
+//
+// 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;
+}
diff --git a/src/controls/js-bridge-plugin-deprecated/FWebCtrl_JsBridgePlugin.h b/src/controls/js-bridge-plugin-deprecated/FWebCtrl_JsBridgePlugin.h
new file mode 100644 (file)
index 0000000..3f037c0
--- /dev/null
@@ -0,0 +1,68 @@
+//
+// 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_
diff --git a/src/controls/js-bridge-plugin-tizen/CMakeLists.txt b/src/controls/js-bridge-plugin-tizen/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..ea2f8e5
--- /dev/null
@@ -0,0 +1,41 @@
+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}"
+               )
+
diff --git a/src/controls/js-bridge-plugin-tizen/FWebCtrl_JsBridgePlugin.cpp b/src/controls/js-bridge-plugin-tizen/FWebCtrl_JsBridgePlugin.cpp
new file mode 100755 (executable)
index 0000000..878a730
--- /dev/null
@@ -0,0 +1,327 @@
+//
+// 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;
+}
diff --git a/src/controls/js-bridge-plugin-tizen/FWebCtrl_JsBridgePlugin.h b/src/controls/js-bridge-plugin-tizen/FWebCtrl_JsBridgePlugin.h
new file mode 100644 (file)
index 0000000..3f037c0
--- /dev/null
@@ -0,0 +1,68 @@
+//
+// 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_