From: jyothi kumar sambolu Date: Wed, 27 Mar 2013 08:54:26 +0000 (+0530) Subject: Separated sync and async popup implementations X-Git-Tag: 2.1b_release~54^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2f11260122751276565bfde1a1e7090ea4e22023;p=framework%2Fosp%2Fweb.git Separated sync and async popup implementations Change-Id: I230e23e1969842e2646573053f4049e135698356 Signed-off-by: jyothi kumar sambolu --- diff --git a/CMakeLists.txt b/CMakeLists.txt index cf51265..3809b7a 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,7 +73,6 @@ SET (${this_target}_SOURCE_FILES 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 @@ -81,7 +80,7 @@ SET (${this_target}_SOURCE_FILES src/controls/FWebCtrl_InputPickerPopup.cpp src/controls/FWebCtrl_UserConfirmPopup.cpp src/controls/FWebCtrl_WebPopup.cpp - src/controls/FWebCtrl_CertificatePopup.cpp + src/controls/FWebCtrl_CertificateConfirmPopup.cpp src/controls/FWebCtrlWebStorageManager.cpp src/controls/FWebCtrl_WebStorageManagerImpl.cpp ) diff --git a/src/controls/FWebCtrl_CertificateConfirmPopup.cpp b/src/controls/FWebCtrl_CertificateConfirmPopup.cpp new file mode 100644 index 0000000..60b6d3d --- /dev/null +++ b/src/controls/FWebCtrl_CertificateConfirmPopup.cpp @@ -0,0 +1,362 @@ +// +// Open Service Platform +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file FWebCtrl_CertificateConfirmPopup.cpp + * @brief The file contains the definition of _CertificateConfirmPopup class. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "FWebCtrl_CertificateConfirmPopup.h" +#include "FWebCtrl_Utility.h" + + +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Utility; +using namespace Tizen::Graphics; +using namespace Tizen::Io; +using namespace Tizen::Security::Cert; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; + + +namespace Tizen { namespace Web { namespace Controls +{ + + +_CertificateConfirmPopup::_CertificateConfirmPopup(void) +{ +} + + +_CertificateConfirmPopup::~_CertificateConfirmPopup(void) +{ +} + + +result +_CertificateConfirmPopup::Construct(_CertificatePopupMode certPopupMode, Ewk_Certificate_Policy_Decision* pPolicy) +{ + SysTryReturnResult(NID_WEB_CTRL, pPolicy, E_INVALID_ARG, "Certificate Policy pointer is null."); + result r = E_SUCCESS; + + _WebPopupData* pPopupData = _WebPopup::GetPopupData(); + SysTryReturn(NID_WEB_CTRL, pPopupData, r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r)); + + __pCertificatePolicyData = pPolicy; + __certPopupMode = certPopupMode; + String titleText = L""; + int popupMaxHeight = 0; + Rectangle rect(0, 0, 0, 0); + + ArrayList idList; + r = idList.Construct(); + SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + + ArrayList titleList; + r = titleList.Construct(); + SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + + if( __certPopupMode == CERTIFICATE_POPUP_MODE_VIEW ) + { + titleText = L"Certificate"; + popupMaxHeight = pPopupData->popupDim.height; + + rect.height = pPopupData->popupDim.height - 4*pPopupData->sideMargin - 2*pPopupData->btnDim.height; + rect.width = pPopupData->labelDim.width; + + idList.Add(*(new Integer(ID_BUTTON_CERTIFICATE_CLOSE))); + titleList.Add(*(new String(L"Close"))); + } + else // CERTIFICATE_POPUP_MODE_CONFIRM + { + titleText = L"Security Warning"; + popupMaxHeight = 2*pPopupData->labelDim.height + 2*pPopupData->btnDim.height + 6*pPopupData->sideMargin; + + rect.height = 2*pPopupData->labelDim.height; + rect.width = pPopupData->labelDim.width; + + idList.Add(*(new Integer(ID_BUTTON_CERTIFICATE_ALLOW))); + idList.Add(*(new Integer(ID_BUTTON_CERTIFICATE_VIEW))); + idList.Add(*(new Integer(ID_BUTTON_CERTIFICATE_CANCEL))); + + titleList.Add(*(new String(L"Allow"))); + titleList.Add(*(new String(L"View"))); + titleList.Add(*(new String(L"Cancel"))); + } + + r = _WebPopup::Construct(true, Dimension(pPopupData->popupDim.width, popupMaxHeight)); + SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + + SetTitleText(titleText); + + std::unique_ptr pLayout(dynamic_cast< VerticalBoxLayout* >(GetLayoutN())); + SysTryReturn(NID_WEB_CTRL, pLayout.get(), r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r)); + + if( certPopupMode == CERTIFICATE_POPUP_MODE_VIEW ) + { + String certString; + result r = GenerateCertifiate(certString); + SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + + std::unique_ptr pTextBox(new (std::nothrow) TextBox()); + SysTryReturnResult(NID_WEB_CTRL, pTextBox.get(), E_OUT_OF_MEMORY, "Memory Allocation failed."); + + r = pTextBox->Construct(rect, TEXT_BOX_BORDER_ROUNDED); + SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + + r = pTextBox->SetTextSize(30); + SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + + r = pTextBox->SetAutoLinkMask(LINK_TYPE_NONE); + SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + + r = pTextBox->SetText(certString); + SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + + r = AddControl(*pTextBox); + SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + + TextBox* pCertBox = pTextBox.release(); + pLayout->SetHorizontalFitPolicy(*pCertBox, FIT_POLICY_PARENT); + } + else // CERTIFICATE_POPUP_MODE_CONFIRM + { + std::unique_ptr