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_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
)
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FWebCtrl_CertificateConfirmPopup.cpp
+ * @brief The file contains the definition of _CertificateConfirmPopup class.
+ */
+#include <FBaseColArrayList.h>
+#include <FBaseSysLog.h>
+#include <FBaseUtilUri.h>
+#include <FGrpDimension.h>
+#include <FGrpRectangle.h>
+#include <FSecCertX509Certificate.h>
+#include <FUiCtrlButton.h>
+#include <FUiCtrlLabel.h>
+#include <FUiCtrlPanel.h>
+#include <FUiLayout.h>
+#include <FUiVerticalBoxLayout.h>
+#include <FUi_ControlManager.h>
+#include <FUi_ResourceManager.h>
+#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<VerticalBoxLayout> pLayout(dynamic_cast< VerticalBoxLayout* >(GetLayoutN()));
+ SysTryReturn(NID_WEB_CTRL, pLayout.get(), r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ if( certPopupMode == CERTIFICATE_POPUP_MODE_VIEW )
+ {
+ String certString;
+ result r = GenerateCertifiate(certString);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ std::unique_ptr<TextBox> pTextBox(new (std::nothrow) TextBox());
+ SysTryReturnResult(NID_WEB_CTRL, pTextBox.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ r = pTextBox->Construct(rect, TEXT_BOX_BORDER_ROUNDED);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pTextBox->SetTextSize(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<Label> pLabel(new (std::nothrow) Label());
+ SysTryReturnResult(NID_WEB_CTRL, pLabel.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ String message = L"";
+ message = L"There are problems with the security certificate of this site.\n";
+ message.Append(ewk_certificate_policy_decision_url_get(__pCertificatePolicyData));
+
+ r = pLabel->Construct(rect, message);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pLabel->SetTextConfig(pPopupData->labelFontSize, LABEL_TEXT_STYLE_NORMAL);
+
+ r = AddControl(*pLabel);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ Label* pInfoLabel = pLabel.release();
+ pLayout->SetHorizontalFitPolicy(*pInfoLabel, FIT_POLICY_PARENT);
+ }
+ Panel* pButtonPanel = CreateAndAddPanel();
+ SysTryReturn(NID_WEB_CTRL, pButtonPanel, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ r = CreateAndAddButtons(idList, titleList, pButtonPanel);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pLayout->SetHorizontalFitPolicy(*pButtonPanel, FIT_POLICY_PARENT);
+ pLayout->SetHorizontalAlignment(*pButtonPanel, LAYOUT_HORIZONTAL_ALIGN_CENTER);
+
+ pLayout->SetSpacing(*pButtonPanel, 2*pPopupData->sideMargin);
+
+ return E_SUCCESS;
+}
+
+
+void
+_CertificateConfirmPopup::OnActionPerformed(const Control& source, int actionId)
+{
+ result r = E_SUCCESS;
+
+ switch (actionId)
+ {
+ case ID_BUTTON_CERTIFICATE_ALLOW:
+ ewk_certificate_policy_decision_allowed_set(__pCertificatePolicyData, EINA_TRUE);
+ __confirm = static_cast< bool >(EINA_TRUE);
+ break;
+
+ case ID_BUTTON_CERTIFICATE_VIEW:
+ {
+ std::unique_ptr<_CertificateConfirmPopup> pCertificatePopup(new (std::nothrow) _CertificateConfirmPopup());
+ SysTryReturnVoidResult(NID_WEB_CTRL, pCertificatePopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ r = pCertificatePopup->Construct(CERTIFICATE_POPUP_MODE_VIEW, __pCertificatePolicyData);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pCertificatePopup->ShowPopup();
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pCertificatePopup.release();
+ return;
+ }
+
+ case ID_BUTTON_CERTIFICATE_CANCEL:
+ ewk_certificate_policy_decision_allowed_set(__pCertificatePolicyData, EINA_FALSE);
+ __confirm = static_cast< bool >(EINA_FALSE);
+ break;
+
+ case ID_BUTTON_CERTIFICATE_CLOSE:
+ break;
+
+ default:
+ SysAssert(false);
+ break;
+ }
+
+ r = HidePopup();
+ if (IsFailed(r))
+ {
+ SysLogException(NID_WEB_CTRL, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ if (__certPopupMode == CERTIFICATE_POPUP_MODE_VIEW )
+ {
+ delete this;
+ }
+}
+
+
+bool
+_CertificateConfirmPopup::GetConfirmResult() const
+{
+ return __confirm;
+}
+
+
+result
+_CertificateConfirmPopup::GenerateCertifiate(String& certString)
+{
+ SysTryReturnResult(NID_WEB_CTRL, __pCertificatePolicyData, E_INVALID_ARG, "Certificate Policy pointer is null.");
+
+ String pemString(ewk_certificate_policy_decision_certificate_pem_get(__pCertificatePolicyData));
+ std::unique_ptr<ByteBuffer> pByteBuf(StringUtil::StringToUtf8N(pemString));
+ SysTryReturnResult(NID_WEB_CTRL, pByteBuf.get(), E_INVALID_DATA, "Certificate pem information is Empty.");
+
+ X509Certificate certificate;
+ result r = certificate.Construct(*pByteBuf);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ //Issued to
+ certString.Append(L"ISSUED TO:\n\n");
+ String subject = certificate.GetSubject();
+
+ certString.Append(L"Common Name:\n");
+ certString.Append(GetStringOfToken(subject, L"/CN=") + L"\n");
+
+ certString.Append(L"Organization:\n");
+ certString.Append(GetStringOfToken(subject, L"/O=") + L"\n");
+
+ certString.Append(L"Organizational Unit:\n");
+ certString.Append(GetStringOfToken(subject, L"/OU=") + L"\n");
+
+ certString.Append(L"Serial Number:\n");
+ certString.Append(certificate.GetSerialNumber() + L"\n\n\n");
+
+ //Issued by
+ certString.Append(L"ISSUER:\n\n");
+ String issuer = certificate.GetIssuer();
+
+ certString.Append(L"Common Name:\n");
+ certString.Append(GetStringOfToken(issuer, L"/CN=") + L"\n");
+
+ certString.Append(L"Organization:\n");
+ certString.Append(GetStringOfToken(issuer, L"/O=") + L"\n");
+
+ certString.Append(L"Organizational Unit:\n");
+ certString.Append(GetStringOfToken(issuer, L"/OU=") + L"\n\n");
+
+ //Validity
+ certString.Append(L"VALIDITY:\n\n");
+ certString.Append(L"Valid From:\n");
+ certString.Append(certificate.GetNotBefore() + L"\n\n");
+
+ certString.Append(L"Valid Till:\n");
+ certString.Append(certificate.GetNotAfter() + L"\n\n\n");
+
+ //FingerPrints
+ certString.Append(L"FINGERPRINTS:\n\n");
+ certString.Append(L"Signature Algorithm:\n");
+ certString.Append(certificate.GetSignatureAlgorithm() + L"\n\n");
+
+ std::unique_ptr<ByteBuffer> pFingerPrint(certificate.GetFingerprintN());
+ if (pFingerPrint.get() && pFingerPrint->GetPointer())
+ {
+ String fingerPrint;
+ StringUtil::Utf8ToString((const char*)pFingerPrint->GetPointer(), fingerPrint);
+ certString.Append(fingerPrint + L"\n\n");
+ }
+
+ return E_SUCCESS;
+}
+
+
+String
+_CertificateConfirmPopup::GetStringOfToken(const String& parseString, const String& parseToken)
+{
+ String inString(parseString);
+ int index = 0;
+
+ String outString;
+ outString.Append(L"\n");
+
+ result r = inString.IndexOf(parseToken, 0, index);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, outString, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ int prsTokLen = parseToken.GetLength();
+ r = inString.Remove(0, index + prsTokLen);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, outString, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ while (true)
+ {
+ r = inString.IndexOf(parseToken, 0, index);
+
+ switch (r)
+ {
+ case E_SUCCESS:
+ r = inString.Remove(index, prsTokLen);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, outString, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ inString.Insert(L"\n", index);
+ continue;
+
+ case E_OBJ_NOT_FOUND:
+ r = inString.IndexOf('=', 0, index);
+ if (r == E_SUCCESS)
+ {
+ int slashIndex = 0;
+ r = inString.LastIndexOf('/', index - 3, slashIndex);
+
+ if (!IsFailed(r) && (slashIndex == index - 2 || slashIndex == index - 3))
+ {
+ inString.Remove(slashIndex, inString.GetLength() - slashIndex);
+ }
+ }
+ inString.Append(L"\n");
+ outString = inString;
+ return outString;
+
+ default:
+ return outString;
+ }
+ }
+}
+
+
+}}} // Tizen::Web::Controls
//
/**
- * @file FWebCtrl_CertificatePopup.h
- * @brief The file contains the definition of _CertificatePopup class.
+ * @file FWebCtrl_CertificateConfirmPopup.h
+ * @brief The file contains the definition of _CertificateConfirmPopup class.
*/
-#ifndef _FWEB_CTRL_INTERNAL_CERTIFICATE_POPUP_H_
-#define _FWEB_CTRL_INTERNAL_CERTIFICATE_POPUP_H_
+#ifndef _FWEB_CTRL_INTERNAL_CERTIFICATE_CONFIRM_POPUP_H_
+#define _FWEB_CTRL_INTERNAL_CERTIFICATE_CONFIRM_POPUP_H_
#include <unique_ptr.h>
#include <EWebKit2.h>
namespace Tizen { namespace Web { namespace Controls
{
-enum _CertificatePopupButtonId
+enum _IdButtonCertificatePopup
{
+ ID_BUTTON_CERTIFICATE_ALLOW,
+ ID_BUTTON_CERTIFICATE_CANCEL,
+ ID_BUTTON_CERTIFICATE_VIEW,
ID_BUTTON_CERTIFICATE_CLOSE
};
+enum _CertificatePopupMode
+{
+ CERTIFICATE_POPUP_MODE_USER_CONFIRM,
+ CERTIFICATE_POPUP_MODE_VIEW
+};
-class _CertificatePopup
+class _CertificateConfirmPopup
: public _WebPopup
{
/**
* Constructor
*/
- _CertificatePopup(void);
+ _CertificateConfirmPopup(void);
/**
* Destructor
*/
- virtual ~_CertificatePopup(void);
+ virtual ~_CertificateConfirmPopup(void);
- result Construct(Ewk_Certificate_Policy_Decision* pPolicy);
+ result Construct(_CertificatePopupMode certPopupMode, Ewk_Certificate_Policy_Decision* pPolicy);
virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+ bool GetConfirmResult() const;
+
private:
- _CertificatePopup(const _CertificatePopup&);
+ _CertificateConfirmPopup(const _CertificateConfirmPopup&);
- _CertificatePopup& operator =(const _CertificatePopup&);
+ _CertificateConfirmPopup& operator =(const _CertificateConfirmPopup&);
result GetMessageFromPolicy(Tizen::Base::String& message);
- result GenerateCertifiate(Ewk_Certificate_Policy_Decision* pPolicy, Tizen::Base::String& certString);
+ result GenerateCertifiate(Tizen::Base::String& certString);
Tizen::Base::String GetStringOfToken(const Tizen::Base::String& parseString, const Tizen::Base::String& parseToken);
-}; // _CertificatePopup
+private:
+ _CertificatePopupMode __certPopupMode;
+ bool __confirm;
+
+ Ewk_Certificate_Policy_Decision* __pCertificatePolicyData;
+}; // _CertificateConfirmPopup
}}} // Tizen::Web::Controls
-#endif // _FWEB_CTRL_INTERNAL_CERTIFICATE_POPUP_H_
+#endif // _FWEB_CTRL_INTERNAL_CERTIFICATE_CONFIRM_POPUP_H_
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-/**
- * @file FWebCtrl_CertificatePopup.cpp
- * @brief The file contains the definition of _CertificatePopup class.
- */
-#include <FBaseColArrayList.h>
-#include <FBaseSysLog.h>
-#include <FBaseUtilUri.h>
-#include <FGrpDimension.h>
-#include <FGrpRectangle.h>
-#include <FSecCertX509Certificate.h>
-#include <FUiCtrlButton.h>
-#include <FUiCtrlLabel.h>
-#include <FUiCtrlPanel.h>
-#include <FUiLayout.h>
-#include <FUiVerticalBoxLayout.h>
-#include <FUi_ControlManager.h>
-#include <FUi_ResourceManager.h>
-#include "FWebCtrl_CertificatePopup.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
-{
-
-
-_CertificatePopup::_CertificatePopup(void)
-{
-}
-
-
-_CertificatePopup::~_CertificatePopup(void)
-{
-}
-
-
-result
-_CertificatePopup::Construct(Ewk_Certificate_Policy_Decision* pPolicy)
-{
- SysTryReturnResult(NID_WEB_CTRL, pPolicy, E_INVALID_ARG, "Certificate Policy pointer is null.");
-
- String certString;
- result r = GenerateCertifiate(pPolicy, certString);
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
- _WebPopupData* pPopupData = _WebPopup::GetPopupData();
- SysTryReturn(NID_WEB_CTRL, pPopupData, r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
-
- r = _WebPopup::Construct(true, Dimension(pPopupData->popupDim.width, pPopupData->popupDim.height));
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
- SetTitleText(L"Certificate");
-
- //Add TextBox
- Rectangle rect(0, 0, 0, 0);
-
- //label
- rect.height = pPopupData->popupDim.height - 4*pPopupData->sideMargin - 2*pPopupData->btnDim.height;
- rect.width = pPopupData->labelDim.width;
-
- std::unique_ptr<TextBox> pTextBox(new (std::nothrow) TextBox());
- SysTryReturnResult(NID_WEB_CTRL, pTextBox.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
-
- r = pTextBox->Construct(rect, TEXT_BOX_BORDER_ROUNDED);
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
- r = pTextBox->SetTextSize(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();
-
- //Add Panel
- Panel* pButtonPanel = CreateAndAddPanel();
- SysTryReturn(NID_WEB_CTRL, pButtonPanel, r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
-
- //Add Buttons
- ArrayList idList;
- r = idList.Construct();
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
- idList.Add(*(new Integer(ID_BUTTON_CERTIFICATE_CLOSE)));
-
- ArrayList titleList;
- r = titleList.Construct();
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
- titleList.Add(*(new String(L"Close")));
-
- r = CreateAndAddButtons(idList, titleList, pButtonPanel);
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
- std::unique_ptr<VerticalBoxLayout> pLayout(dynamic_cast< VerticalBoxLayout* >(GetLayoutN()));
- SysTryReturn(NID_WEB_CTRL, pLayout.get(), r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
-
- pLayout->SetHorizontalFitPolicy(*pCertBox, FIT_POLICY_PARENT);
- pLayout->SetHorizontalFitPolicy(*pButtonPanel, FIT_POLICY_PARENT);
-
- pLayout->SetHorizontalAlignment(*pCertBox, LAYOUT_HORIZONTAL_ALIGN_CENTER);
- pLayout->SetHorizontalAlignment(*pButtonPanel, LAYOUT_HORIZONTAL_ALIGN_CENTER);
-
- pLayout->SetSpacing(*pButtonPanel, 2*pPopupData->sideMargin);
-
- return E_SUCCESS;
-}
-
-
-void
-_CertificatePopup::OnActionPerformed(const Control& source, int actionId)
-{
- result r = E_SUCCESS;
-
- switch (actionId)
- {
- case ID_BUTTON_CERTIFICATE_CLOSE:
- r = HidePopup();
- if (IsFailed(r))
- {
- SysLogException(NID_WEB_CTRL, r, "[%s] Propagating.", GetErrorMessage(r));
- }
- break;
-
- default:
- break;
- }
-
- delete this;
-}
-
-
-result
-_CertificatePopup::GenerateCertifiate(Ewk_Certificate_Policy_Decision* pPolicy, String& certString)
-{
- SysTryReturnResult(NID_WEB_CTRL, pPolicy, E_INVALID_ARG, "Certificate Policy pointer is null.");
-
- String pemString(ewk_certificate_policy_decision_certificate_pem_get(pPolicy));
- std::unique_ptr<ByteBuffer> pByteBuf(StringUtil::StringToUtf8N(pemString));
- SysTryReturnResult(NID_WEB_CTRL, pByteBuf.get(), E_INVALID_DATA, "Certificate pem information is Empty.");
-
- X509Certificate certificate;
- result r = certificate.Construct(*pByteBuf);
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
- //Issued to
- certString.Append(L"ISSUED TO:\n\n");
- String subject = certificate.GetSubject();
-
- certString.Append(L"Common Name:\n");
- certString.Append(GetStringOfToken(subject, L"/CN=")+L"\n");
-
- certString.Append(L"Organization:\n");
- certString.Append(GetStringOfToken(subject, L"/O=")+L"\n");
-
- certString.Append(L"Organizational Unit:\n");
- certString.Append(GetStringOfToken(subject, L"/OU=")+L"\n");
-
- certString.Append(L"Serial Number:\n");
- certString.Append(certificate.GetSerialNumber()+L"\n\n\n");
-
- //Issued by
- certString.Append(L"ISSUER:\n\n");
- String issuer = certificate.GetIssuer();
-
- certString.Append(L"Common Name:\n");
- certString.Append(GetStringOfToken(issuer, L"/CN=")+L"\n");
-
- certString.Append(L"Organization:\n");
- certString.Append(GetStringOfToken(issuer, L"/O=")+L"\n");
-
- certString.Append(L"Organizational Unit:\n");
- certString.Append(GetStringOfToken(issuer, L"/OU=")+L"\n\n");
-
- //Validity
- certString.Append(L"VALIDITY:\n\n");
- certString.Append(L"Valid From:\n");
- certString.Append(certificate.GetNotBefore()+L"\n\n");
-
- certString.Append(L"Valid Till:\n");
- certString.Append(certificate.GetNotAfter()+L"\n\n\n");
-
- //FingerPrints
- certString.Append(L"FINGERPRINTS:\n\n");
- certString.Append(L"Signature Algorithm:\n");
- certString.Append(certificate.GetSignatureAlgorithm()+L"\n\n");
-
- std::unique_ptr<ByteBuffer> pFingerPrint(certificate.GetFingerprintN());
- if (pFingerPrint.get() && pFingerPrint->GetPointer())
- {
- String fingerPrint;
- StringUtil::Utf8ToString((const char*)pFingerPrint->GetPointer(), fingerPrint);
- certString.Append(fingerPrint+L"\n\n");
- }
-
- return E_SUCCESS;
-}
-
-
-String
-_CertificatePopup::GetStringOfToken(const String& parseString, const String& parseToken)
-{
- String inString(parseString);
- int index = 0;
-
- String outString;
- outString.Append(L"\n");
-
- result r = inString.IndexOf(parseToken, 0, index);
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, outString, r, "[%s] Propagating.", GetErrorMessage(r));
-
- int prsTokLen = parseToken.GetLength();
- r = inString.Remove(0, index + prsTokLen);
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, outString, r, "[%s] Propagating.", GetErrorMessage(r));
-
- while (true)
- {
- r = inString.IndexOf(parseToken, 0, index);
-
- switch (r)
- {
- case E_SUCCESS:
- r = inString.Remove(index, prsTokLen);
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, outString, r, "[%s] Propagating.", GetErrorMessage(r));
-
- inString.Insert(L"\n", index);
- continue;
-
- case E_OBJ_NOT_FOUND:
- r = inString.IndexOf('=', 0, index);
- if (r == E_SUCCESS)
- {
- int slashIndex = 0;
- r = inString.LastIndexOf('/', index - 3, slashIndex);
-
- if (!IsFailed(r) && (slashIndex == index - 2 || slashIndex == index - 3))
- {
- inString.Remove(slashIndex, inString.GetLength() - slashIndex);
- }
- }
- inString.Append(L"\n");
- outString = inString;
- return outString;
-
- default:
- return outString;
- }
- }
-}
-
-
-}}} // Tizen::Web::Controls
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-/**
- * @file FWebCtrl_GeoLocationConfirmPopup.cpp
- * @brief The file contains the definition of _GeolocationConfirmPopup class.
- */
-#include <FAppApp.h>
-#include <FBaseColArrayList.h>
-#include <FBaseSysLog.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 <FIo_DatabaseImpl.h>
-#include <FUi_ControlManager.h>
-#include <FUi_ResourceManager.h>
-#include "FWebCtrl_EflWebkit.h"
-#include "FWebCtrl_GeolocationConfirmPopup.h"
-#include "FWebCtrl_WebPopup.h"
-#include "FWebCtrl_Utility.h"
-
-
-using namespace Tizen::App;
-using namespace Tizen::Base;
-using namespace Tizen::Base::Collection;
-using namespace Tizen::Graphics;
-using namespace Tizen::Io;
-using namespace Tizen::Ui;
-using namespace Tizen::Ui::Controls;
-
-
-namespace Tizen { namespace Web { namespace Controls
-{
-
-
-_GeolocationConfirmPopup::_GeolocationConfirmPopup(void)
- : __pCheckButton(null)
- , __pGeolocationHandler(null)
-{
-}
-
-
-_GeolocationConfirmPopup::~_GeolocationConfirmPopup(void)
-{
-}
-
-
-result
-_GeolocationConfirmPopup::Construct(Ewk_Geolocation_Permission_Request* pPermission)
-{
- SysTryReturnResult(NID_WEB_CTRL, pPermission != null, E_INVALID_ARG, "Invalid argument(s) is used. pPermission is null.");
-
- result r = E_SUCCESS;
- int popupMaxHeight = 0;
-
- __pGeolocationHandler = pPermission;
- const Ewk_Security_Origin* pSecurityOrigin = ewk_geolocation_permission_request_origin_get(__pGeolocationHandler);
- String origin = _Utility::CreateOrigin(pSecurityOrigin);
- origin.Append(" Requests your Location");
-
- _WebPopupData* pPopupData = _WebPopup::GetPopupData();
- SysTryReturn(NID_WEB_CTRL, pPopupData, r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
-
- popupMaxHeight = pPopupData->labelDim.height + pPopupData->checkDim.height + pPopupData->btnDim.height + 6*pPopupData->sideMargin;
-
- r = _WebPopup::Construct(false, Dimension(pPopupData->popupDim.width, popupMaxHeight));
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
- Rectangle rect(0, 0, 0, 0);
-
- //label
- rect.height = pPopupData->labelDim.height;
- rect.width = pPopupData->labelDim.width;
-
- std::unique_ptr<Label> pLabel(new (std::nothrow) Label());
- SysTryReturnResult(NID_WEB_CTRL, pLabel.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
-
- r = pLabel->Construct(rect, origin);
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
- pLabel->SetTextConfig(pPopupData->labelFontSize, LABEL_TEXT_STYLE_NORMAL);
-
- r = AddControl(*pLabel);
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
- Label* pHostLabel = pLabel.release();
-
- //checkbutton
- rect.y = 0;
- rect.height = pPopupData->checkDim.height;
-
- std::unique_ptr<CheckButton> pCheckButton (new (std::nothrow) CheckButton());
- SysTryReturnResult(NID_WEB_CTRL, pCheckButton.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
-
- r = pCheckButton->Construct(Rectangle(0, 0, rect.width, rect.height), CHECK_BUTTON_STYLE_MARK, BACKGROUND_STYLE_DEFAULT, false, L"Remember Preference");
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
- r = AddControl(*pCheckButton);
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
- __pCheckButton = pCheckButton.release();
-
- Panel* pButtonPanel = CreateAndAddPanel();
- SysTryReturn(NID_WEB_CTRL, pButtonPanel, r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
-
- ArrayList idList;
- r = idList.Construct();
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
- idList.Add(*(new Integer(ID_BUTTON_GEOLOCATION_PROCESS)));
- idList.Add(*(new Integer(ID_BUTTON_GEOLOCATION_CANCEL)));
-
- ArrayList titleList;
- r = titleList.Construct();
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
- titleList.Add(*(new String(L"Allow")));
- titleList.Add(*(new String(L"Refuse")));
-
- r = CreateAndAddButtons(idList, titleList, pButtonPanel);
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
- std::unique_ptr<VerticalBoxLayout> pLayout(dynamic_cast< VerticalBoxLayout* >(GetLayoutN()));
- SysTryReturn(NID_WEB_CTRL, pLayout.get(), r = GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
-
- pLayout->SetHorizontalFitPolicy(*pHostLabel, FIT_POLICY_PARENT);
- pLayout->SetHorizontalFitPolicy(*__pCheckButton, FIT_POLICY_PARENT);
- pLayout->SetHorizontalFitPolicy(*pButtonPanel, FIT_POLICY_PARENT);
-
- pLayout->SetHorizontalAlignment(*pHostLabel, LAYOUT_HORIZONTAL_ALIGN_CENTER);
- pLayout->SetHorizontalAlignment(*__pCheckButton, LAYOUT_HORIZONTAL_ALIGN_CENTER);
- pLayout->SetHorizontalAlignment(*pButtonPanel, LAYOUT_HORIZONTAL_ALIGN_CENTER);
-
- pLayout->SetSpacing(*__pCheckButton, 2*pPopupData->sideMargin);
- pLayout->SetSpacing(*pButtonPanel, 2*pPopupData->sideMargin);
-
- return E_SUCCESS;
-}
-
-
-void
-_GeolocationConfirmPopup::OnActionPerformed(const 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_set(__pGeolocationHandler, 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() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
- String table(GEOLOCATION_TABLE_NAME);
-
- const Ewk_Security_Origin* pSecurityOrigin = ewk_geolocation_permission_request_origin_get(__pGeolocationHandler);
- String origin = _Utility::CreateOrigin(pSecurityOrigin);
-
- result r = db.Construct(geolocationPath, "r+", null);
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
- std::unique_ptr<DbStatement> pStmt(db.CreateStatementN(L"Insert Into " + table + L" (origin, permission) Values (?, ?)"));
- SysTryReturn(NID_WEB_CTRL, pStmt.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
-
- SysLog(NID_WEB_CTRL, "The current value of stmt is %u, host is %ls", pStmt.get(), origin.GetPointer());
-
- pStmt->BindString(0, origin);
- pStmt->BindInt(1, static_cast < int >(enable));
-
- db.BeginTransaction();
-
- std::unique_ptr<DbEnumerator> pEnum(db.ExecuteStatementN(*pStmt));
-
- db.CommitTransaction();
-
- return E_SUCCESS;
-}
-
-
-}}} // Tizen::Web::Controls
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-/**
- * @file FWebCtrl_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 <FBaseString.h>
-#include <FUiIActionEventListener.h>
-#include "FWebCtrl_WebPopup.h"
-
-namespace Tizen { namespace Web { namespace Controls
-{
-
-class _WebPopup;
-
-enum _GeolocationPopupButtonId
-{
- ID_BUTTON_GEOLOCATION_PROCESS,
- ID_BUTTON_GEOLOCATION_CANCEL
-};
-
-class _GeolocationConfirmPopup
- : public Tizen::Web::Controls::_WebPopup
-{
-
-public:
- /**
- * Constructor
- */
- _GeolocationConfirmPopup(void);
-
- /**
- * Destructor
- */
- virtual ~_GeolocationConfirmPopup(void);
-
- result Construct(Ewk_Geolocation_Permission_Request* pPermission);
-
- 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:
- Tizen::Ui::Controls::CheckButton* __pCheckButton;
-
- Ewk_Geolocation_Permission_Request* __pGeolocationHandler;
-
-}; // _GeolocationConfirmPopup
-
-}}} // Tizen::Web::Controls
-#endif // _FWEB_CTRL_GEOLOCATION_COMMON_POPUP_H_
* @file FWebCtrl_UserConfirmPopup.cpp
* @brief The file contains the definition of _UserConfirmPopup class.
*/
+#include <FAppApp.h>
#include <FBaseColArrayList.h>
#include <FBaseSysLog.h>
#include <FBaseUtilUri.h>
#include <FGrpDimension.h>
#include <FGrpRectangle.h>
+#include <FIoDbEnumerator.h>
+#include <FIoDbStatement.h>
#include <FSecCertX509Certificate.h>
#include <FUiCtrlButton.h>
#include <FUiCtrlLabel.h>
#include <FUiCtrlPanel.h>
#include <FUiLayout.h>
#include <FUiVerticalBoxLayout.h>
+#include <FIo_DatabaseImpl.h>
#include <FUi_ControlManager.h>
#include <FUi_ResourceManager.h>
-#include "FWebCtrl_CertificatePopup.h"
+#include "FWebCtrl_EflWebkit.h"
#include "FWebCtrl_UserConfirmPopup.h"
#include "FWebCtrl_Utility.h"
_UserConfirmPopup::_UserConfirmPopup(void)
: __pUserPolicyData(null)
- , __userConfirmMode(USER_CONFIRM_CERTIFICATE)
- , __confirm(false)
- , __sync(true)
+ , __userConfirmMode(USER_CONFIRM_USERMEDIA)
+ , __pCheckButton(null)
{
}
result
-_UserConfirmPopup::Construct(_UserConfirmMode userConfirmMode, void* pEventInfo, bool sync)
+_UserConfirmPopup::Construct(_UserConfirmMode userConfirmMode, void* pEventInfo)
{
result r = E_SUCCESS;
SysTryReturnResult(NID_WEB_CTRL, pEventInfo, E_INVALID_ARG, "Invalid argument(s) is used. pPolicy is null.");
- SysTryReturnResult(NID_WEB_CTRL, userConfirmMode >= USER_CONFIRM_CERTIFICATE && userConfirmMode <= USER_CONFIRM_USERMEDIA, E_INVALID_ARG,
- "Invalid userConfirmMode is used. [%d]", userConfirmMode);
+ SysTryReturnResult(NID_WEB_CTRL, userConfirmMode >= USER_CONFIRM_USERMEDIA && userConfirmMode <= USER_CONFIRM_GEOLOCATION, E_INVALID_ARG,
+ "Invalid userConfirmMode is used. [%d]", userConfirmMode);
_WebPopupData* pPopupData = _WebPopup::GetPopupData();
SysTryReturn(NID_WEB_CTRL, pPopupData, r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
__pUserPolicyData = pEventInfo;
__userConfirmMode = userConfirmMode;
- __sync = sync;
- int popupMaxHeight = 0;
- popupMaxHeight = 2*pPopupData->labelDim.height + 2*pPopupData->btnDim.height + 6*pPopupData->sideMargin;
+ int popupMaxHeight = 2*pPopupData->labelDim.height + 2*pPopupData->btnDim.height + 6*pPopupData->sideMargin;
+ if (__userConfirmMode == USER_CONFIRM_GEOLOCATION)
+ {
+ popupMaxHeight += pPopupData->checkDim.height;
+ }
r = _WebPopup::Construct(true, Dimension(pPopupData->popupDim.width, popupMaxHeight));
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
Label* pInfoLabel = pLabel.release();
+ //checkbutton
+ if (__userConfirmMode == USER_CONFIRM_GEOLOCATION)
+ {
+ rect.y = 0;
+ rect.height = pPopupData->checkDim.height;
+
+ std::unique_ptr<CheckButton> pCheckButton (new (std::nothrow) CheckButton());
+ SysTryReturnResult(NID_WEB_CTRL, pCheckButton.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ r = pCheckButton->Construct(Rectangle(0, 0, rect.width, rect.height), CHECK_BUTTON_STYLE_MARK, BACKGROUND_STYLE_DEFAULT, false, L"Remember Preference");
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = AddControl(*pCheckButton);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pCheckButton = pCheckButton.release();
+ }
Panel* pButtonPanel = CreateAndAddPanel();
SysTryReturn(NID_WEB_CTRL, pButtonPanel, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
r = idList.Construct();
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
idList.Add(*(new Integer(ID_BUTTON_USER_ALLOW)));
- if (__userConfirmMode == USER_CONFIRM_CERTIFICATE)
- {
- idList.Add(*(new Integer(ID_BUTTON_USER_CERT_VIEW)));
- }
idList.Add(*(new Integer(ID_BUTTON_USER_CANCEL)));
ArrayList titleList;
r = titleList.Construct();
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
titleList.Add(*(new String(L"Allow")));
- if (__userConfirmMode == USER_CONFIRM_CERTIFICATE)
- {
- titleList.Add(*(new String(L"View")));
- }
titleList.Add(*(new String(L"Cancel")));
r = CreateAndAddButtons(idList, titleList, pButtonPanel);
SysTryReturn(NID_WEB_CTRL, pLayout.get(), r = GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
pLayout->SetHorizontalFitPolicy(*pInfoLabel, FIT_POLICY_PARENT);
+ if (__userConfirmMode == USER_CONFIRM_GEOLOCATION)
+ {
+ pLayout->SetHorizontalFitPolicy(*__pCheckButton, FIT_POLICY_PARENT);
+ }
pLayout->SetHorizontalFitPolicy(*pButtonPanel, FIT_POLICY_PARENT);
pLayout->SetHorizontalAlignment(*pInfoLabel, LAYOUT_HORIZONTAL_ALIGN_CENTER);
+ if (__userConfirmMode == USER_CONFIRM_GEOLOCATION)
+ {
+ pLayout->SetHorizontalAlignment(*__pCheckButton, LAYOUT_HORIZONTAL_ALIGN_CENTER);
+ }
pLayout->SetHorizontalAlignment(*pButtonPanel, LAYOUT_HORIZONTAL_ALIGN_CENTER);
pLayout->SetSpacing(*pButtonPanel, 2*pPopupData->sideMargin);
HandleUserAction(EINA_TRUE);
break;
- case ID_BUTTON_USER_CERT_VIEW:
- r = ShowCertificatePopup();
- SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
- return;
-
case ID_BUTTON_USER_CANCEL:
HandleUserAction(EINA_FALSE);
break;
SysLogException(NID_WEB_CTRL, r, "[%s] Propagating.", GetErrorMessage(r));
}
- if (!sync)
- {
- delete this;
- }
-}
-
-
-bool
-_UserConfirmPopup::GetConfirmResult() const
-{
- return __confirm;
+ delete this;
}
switch(__userConfirmMode)
{
- case USER_CONFIRM_CERTIFICATE:
- {
- Ewk_Certificate_Policy_Decision* pPolicy = reinterpret_cast< Ewk_Certificate_Policy_Decision* >(__pUserPolicyData);
- message = L"There are problems with the security certificate of this site.\n";
- message.Append(ewk_certificate_policy_decision_url_get(pPolicy));
- break;
- }
case USER_CONFIRM_USERMEDIA:
{
message = L"Do you want to allow acccess to media?\n";
break;
}
+ case USER_CONFIRM_GEOLOCATION:
+ {
+ Ewk_Geolocation_Permission_Request* pGeoLocPermReq = reinterpret_cast< Ewk_Geolocation_Permission_Request* >(__pUserPolicyData);
+ const Ewk_Security_Origin* pSecurityOrigin = ewk_geolocation_permission_request_origin_get(pGeoLocPermReq);
+
+ message = _Utility::CreateOrigin(pSecurityOrigin);
+ message.Append("Requests your Location");
+ }
default:
SysAssert(false);
}
{
switch (__userConfirmMode)
{
- case USER_CONFIRM_CERTIFICATE:
- {
- Ewk_Certificate_Policy_Decision* pPolicy = reinterpret_cast< Ewk_Certificate_Policy_Decision* >(__pUserPolicyData);
- ewk_certificate_policy_decision_allowed_set(pPolicy, allow);
- break;
- }
case USER_CONFIRM_USERMEDIA:
{
Ewk_User_Media_Permission_Request* pPolicy = reinterpret_cast< Ewk_User_Media_Permission_Request* >(__pUserPolicyData);
ewk_user_media_permission_request_set(pPolicy, allow);
break;
}
+ case USER_CONFIRM_GEOLOCATION:
+ {
+ Ewk_Geolocation_Permission_Request* pPolicy = reinterpret_cast< Ewk_Geolocation_Permission_Request* >(__pUserPolicyData);
+ ewk_geolocation_permission_request_set(pPolicy, allow);
+ if (__pCheckButton->IsSelected())
+ {
+ result r = AddGeolocationDb(pPolicy, static_cast < bool >(allow));
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ }
default:
SysAssert(false);
}
-
- __confirm = static_cast< bool >(allow);
}
result
-_UserConfirmPopup::ShowCertificatePopup(void)
+_UserConfirmPopup::AddGeolocationDb(Ewk_Geolocation_Permission_Request* pPolicy, bool enable)
{
- //get Certificate information
- Ewk_Certificate_Policy_Decision* pPolicy = reinterpret_cast< Ewk_Certificate_Policy_Decision* >(__pUserPolicyData);
- SysTryReturnResult(NID_WEB_CTRL, pPolicy, E_SYSTEM, "Certificate policy is not set.");
+ _DatabaseImpl db;
+ String geolocationPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
+ String table(GEOLOCATION_TABLE_NAME);
- std::unique_ptr<_CertificatePopup> pCertificatePopup(new (std::nothrow) _CertificatePopup());
- SysTryReturnResult(NID_WEB_CTRL, pCertificatePopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+ const Ewk_Security_Origin* pSecurityOrigin = ewk_geolocation_permission_request_origin_get(pPolicy);
+ String origin = _Utility::CreateOrigin(pSecurityOrigin);
- result r = pCertificatePopup->Construct(pPolicy);
+ result r = db.Construct(geolocationPath, "r+", null);
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
- r = pCertificatePopup->ShowPopup();
- 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();
- pCertificatePopup.release();
return E_SUCCESS;
}
-
}}} // Tizen::Web::Controls
#include <FBaseString.h>
#include "FWebCtrl_WebPopup.h"
+namespace Tizen { namespace Ui { namespace Controls
+{
+class CheckButton;
+}}}
namespace Tizen { namespace Web { namespace Controls
{
enum _UserConfirmMode
{
- USER_CONFIRM_CERTIFICATE,
- USER_CONFIRM_USERMEDIA
+ USER_CONFIRM_USERMEDIA,
+ USER_CONFIRM_GEOLOCATION
};
class _UserConfirmPopup
*/
virtual ~_UserConfirmPopup(void);
- result Construct(_UserConfirmMode userConfirmMode, void* pEventInfo, bool sync);
+ result Construct(_UserConfirmMode userConfirmMode, void* pEventInfo);
virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
- bool GetConfirmResult() const;
-
private:
_UserConfirmPopup(const _UserConfirmPopup&);
void HandleUserAction(Eina_Bool allow);
- result ShowCertificatePopup(void);
+ result AddGeolocationDb(Ewk_Geolocation_Permission_Request* pPolicy, bool enable);
private:
void* __pUserPolicyData;
-
_UserConfirmMode __userConfirmMode;
+ Tizen::Ui::Controls::CheckButton* __pCheckButton;
- bool __confirm;
-
- bool __sync;
}; // _UserConfirmPopup
}}} // Tizen::Web::Controls
result r = E_SUCCESS;
- r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_CERTIFICATE, pEventInfo);
+ r = pImpl->ShowCertificateConfirmPopup(CERTIFICATE_POPUP_MODE_USER_CONFIRM, pPolicy);
SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
pImpl->SetCertificateRequested(true);
{
ewk_geolocation_permission_request_suspend(pPermissionRequest);
- r = pImpl->ShowGeolocationPopup(pPermissionRequest);
+ r = pImpl->ShowUserConfirmPopupAsync(USER_CONFIRM_GEOLOCATION, pPermissionRequest);
SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
}
, __pAuthChallenge(null)
, __pAuthPopup(null)
, __pUserConfirmPopup(null)
- , __pGeolocationPopup(null)
+ , __pCertConfirmPopup(null)
, __pSelectBox(null)
, __pDatePicker(null)
, __pColorPicker(null)
result
-_WebImpl::ShowGeolocationPopup(Ewk_Geolocation_Permission_Request* pPermissionRequest)
+_WebImpl::ShowCertificateConfirmPopup(_CertificatePopupMode userConfirmMode, Ewk_Certificate_Policy_Decision* pPolicy)
{
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.");
+ std::unique_ptr<_CertificateConfirmPopup> pCertConfirmPopup(new (std::nothrow) _CertificateConfirmPopup());
+ SysTryReturnResult(NID_WEB_CTRL, pCertConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
- r = pGeolocationPopup->Construct(pPermissionRequest);
+ r = pCertConfirmPopup->Construct(userConfirmMode, pPolicy);
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;
-}
-
-
-result
-_WebImpl::ShowUserConfirmPopup(_UserConfirmMode userConfirmMode, void* pPolicy)
-{
- result r = E_SUCCESS;
-
- std::unique_ptr<_UserConfirmPopup> pUserConfirmPopup(new (std::nothrow) _UserConfirmPopup());
- SysTryReturnResult(NID_WEB_CTRL, pUserConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
-
- r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, true);
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
- __pUserConfirmPopup = std::move(pUserConfirmPopup);
+ __pCertConfirmPopup = std::move(pCertConfirmPopup);
int modalResult = 0;
- r = __pUserConfirmPopup->ShowAndWait(modalResult);
+ r = __pCertConfirmPopup->ShowAndWait(modalResult);
SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- if (userConfirmMode == USER_CONFIRM_CERTIFICATE)
+ if (userConfirmMode == CERTIFICATE_POPUP_MODE_USER_CONFIRM)
{
- __isCertificateConfirmed = __pUserConfirmPopup->GetConfirmResult();
+ __isCertificateConfirmed = __pCertConfirmPopup->GetConfirmResult();
}
CATCH:
- __pUserConfirmPopup.reset();
+ __pCertConfirmPopup.reset();
return r;
}
std::unique_ptr<_UserConfirmPopup> pUserConfirmPopup(new (std::nothrow) _UserConfirmPopup());
SysTryReturnResult(NID_WEB_CTRL, pUserConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
- r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, false);
+ r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy);
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
__pUserConfirmPopup = std::move(pUserConfirmPopup);
#include <FUi_ContainerImpl.h>
#include "FWebCtrl_IWebEventListener.h"
#include "FWebCtrl_UserConfirmPopup.h"
+#include "FWebCtrl_CertificateConfirmPopup.h"
namespace Tizen { namespace Base { namespace Collection
{
result HttpAuthenticationRequested(Ewk_Auth_Challenge* pChallenge);
- result ShowGeolocationPopup(Ewk_Geolocation_Permission_Request* pPermissionRequest);
+ result ShowCertificateConfirmPopup(_CertificatePopupMode userConfirmMode, Ewk_Certificate_Policy_Decision *pPolicy);
- result ShowUserConfirmPopup(_UserConfirmMode userConfirmMode, void* pPolicy);
result ShowUserConfirmPopupAsync(_UserConfirmMode userConfirmMode, void* pPolicy);
Tizen::Ui::Controls::_Form* GetParentFormCore(Tizen::Ui::_Control* pControlCore);
std::unique_ptr<_UserConfirmPopup> __pUserConfirmPopup;
- std::unique_ptr<_GeolocationConfirmPopup> __pGeolocationPopup;
+ std::unique_ptr<_CertificateConfirmPopup> __pCertConfirmPopup;
std::unique_ptr<_SelectBox> __pSelectBox;
std::unique_ptr<_InputPickerPopup> __pDatePicker;