src/controls/FWebCtrl_WebStorageManagerImpl.cpp
src/controls/FWebCtrl_WebNotification.cpp
src/controls/FWebCtrl_WebNotificationHandler.cpp
+ src/controls/FWebCtrl_FormDataWindow.cpp
)
## Add Definitions
ADD_DEFINITIONS(${OSP_DEFINITIONS} -D_MODEL_RES_WVGA)
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FWebCtrl_FormDataWindow.cpp
+ * @brief The file contains the definition of _FormDataWindow class.
+ */
+
+#include <ewk_view.h>
+#include <unique_ptr.h>
+#include <FBaseSysLog.h>
+#include <FSysVibrator.h>
+#include <FUiCtrlCustomItem.h>
+#include <FUiCtrlListView.h>
+#include <FUiVerticalBoxLayout.h>
+#include <FBase_StringConverter.h>
+#include <FUi_ResourceManager.h>
+#include "FWebCtrl_WebImpl.h"
+#include "FWebCtrl_FormDataWindow.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Base::Utility;
+using namespace Tizen::Graphics;
+using namespace Tizen::System;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+static const int MAX_LIST_ITEM_COUNT = 3;
+
+_FormDataWindow::_FormDataWindow(void)
+ : __pListView(null)
+ , __pWebView(null)
+ , __pWebImpl(null)
+ , __listItemHeight(0)
+{
+}
+
+
+_FormDataWindow::~_FormDataWindow(void)
+{
+ __listElementArray.RemoveAll(true);
+}
+
+
+result
+_FormDataWindow::Construct(const Rectangle& rect, _WebImpl* pImpl, Evas_Object* pWebView)
+{
+ VerticalBoxLayout layout;
+
+ result r = layout.Construct(VERTICAL_DIRECTION_DOWNWARD);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ GET_SHAPE_CONFIG(CONTEXTMENU::LIST_ITEM_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, __listItemHeight);
+ Rectangle windowRect(rect);
+ windowRect.height = MAX_LIST_ITEM_COUNT*__listItemHeight;
+
+ r = Window::Construct(layout, windowRect, true, true);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Error Propogating.", GetErrorMessage(r));
+ SetBounds(rect);
+
+ Window::SetOwner(&pImpl->GetPublic());
+
+ std::unique_ptr<ListView> pListView(new (std::nothrow) ListView());
+ SysTryReturnResult(NID_WEB_CTRL, pListView.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ r = pListView->Construct(Rectangle(0, 0, windowRect.width, windowRect.height), true, SCROLL_STYLE_FADE_OUT);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = __listElementArray.Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pListView->SetItemProvider(*this);
+ pListView->AddListViewItemEventListener(*this);
+ pListView->SetTextOfEmptyList(L"");
+
+ r = AddControl(*pListView);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pListView = pListView.release();
+
+ std::unique_ptr< VerticalBoxLayout > pLayout(dynamic_cast< VerticalBoxLayout* >(GetLayoutN()));
+ SysTryReturn(NID_WEB_CTRL, pLayout.get(), r = GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ pLayout->SetHorizontalAlignment(*__pListView, LAYOUT_HORIZONTAL_ALIGN_CENTER);
+ pLayout->SetHorizontalFitPolicy(*__pListView, FIT_POLICY_PARENT);
+
+ __pWebImpl = pImpl;
+ __pWebView = pWebView;
+
+ return E_SUCCESS;
+}
+
+
+//IListViewItemProvider
+ListItemBase*
+_FormDataWindow::CreateItem(int index, int itemWidth)
+{
+ String* pListElement = static_cast< String* >(__listElementArray.GetAt(index));
+ SysTryReturn(NID_WEB_CTRL, pListElement, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ std::unique_ptr<CustomItem> pItem(new (std::nothrow) CustomItem());
+ SysTryReturn(NID_WEB_CTRL, pItem.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.",GetErrorMessage(E_OUT_OF_MEMORY));
+
+ result r = pItem->Construct(Dimension(itemWidth, __listItemHeight), LIST_ANNEX_STYLE_NORMAL);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pItem->AddElement(Rectangle(0, 0, itemWidth, __listItemHeight), ID_FORMAT_STRING, *pListElement, true);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return pItem.release();
+}
+
+
+bool
+_FormDataWindow::DeleteItem(int index, ListItemBase* pItem, int itemWidth)
+{
+ delete pItem;
+
+ return true;
+}
+
+
+int
+_FormDataWindow::GetItemCount(void)
+{
+ return __listElementArray.GetCount();
+}
+
+
+// IListViewItemEventListener
+void
+_FormDataWindow::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId, ListContextItemStatus state)
+{
+}
+
+
+void
+_FormDataWindow::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status)
+{
+ std::unique_ptr< char[] > pInputValue;
+
+ String* pListElement = static_cast< String* >(__listElementArray.GetAt(index));
+ SysTryCatch(NID_WEB_CTRL, pListElement, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ pInputValue = std::unique_ptr< char[] >(_StringConverter::CopyToCharArrayN(*pListElement));
+ SysTryCatch(NID_WEB_CTRL, pInputValue.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ ewk_view_focused_input_element_value_set(__pWebView, pInputValue.get());
+
+CATCH:
+ SetShowState(false);
+ __pWebImpl->HideFormDataWindow(false);
+}
+
+
+void
+_FormDataWindow::OnListViewItemSwept(ListView& listView, int index, SweepDirection direction)
+{
+}
+
+
+result
+_FormDataWindow::UpdateList(Eina_List* pDataList, const Rectangle& rect)
+{
+ SysTryReturnResult(NID_WEB_CTRL, pDataList, E_INVALID_ARG, "Invalid argument(s) is used. data list pointer should not be null.");
+
+ __listElementArray.RemoveAll(true);
+
+ int itemCount = eina_list_count(pDataList);
+
+ for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
+ {
+ char* pItemText = static_cast<char*>(eina_list_nth(pDataList, itemIndex));
+
+ std::unique_ptr<String> pListElement(new (std::nothrow) String(pItemText));
+ SysTryReturnResult(NID_WEB_CTRL, pListElement.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
+
+ result r = __listElementArray.Add(*pListElement);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pListElement.release();
+ }
+
+ __pListView->UpdateList();
+
+ Rectangle rec(rect);
+ rec.height = (itemCount >= MAX_LIST_ITEM_COUNT) ? (MAX_LIST_ITEM_COUNT*__listItemHeight) : (itemCount*__listItemHeight);
+ SetBounds(rec);
+
+ return E_SUCCESS;
+}
+
+
+result
+_FormDataWindow::LaunchFormDataWindow(void)
+{
+ result r = SetFocusable(false);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = SetShowState(true);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = Show();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return E_SUCCESS;
+}
+
+
+}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FWebCtrl_FormDataWindow.h
+ * @brief The file contains the declaration of _FormDataWindow class.
+ *
+ * The file contains the declaration of _FormDataWindow class.
+ */
+#ifndef _FWEB_CTRL_INTERNAL_FORMDATA_WINDOW_H_
+#define _FWEB_CTRL_INTERNAL_FORMDATA_WINDOW_H_
+
+#include <FBaseColIList.h>
+#include <FBaseString.h>
+#include <FUiCtrlIListViewItemEventListener.h>
+#include <FUiCtrlIListViewItemProvider.h>
+#include <FUiWindow.h>
+
+
+namespace Tizen { namespace Graphics
+{
+class Rectangle;
+}} // Tizen::Graphics
+
+namespace Tizen { namespace Ui
+{
+class IActionEventListener;
+}} // Tizen::Ui
+
+namespace Tizen { namespace Ui { namespace Controls
+{
+class ListItemBase;
+class ListView;
+}}} // Tizen::Ui::Controls
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+class _WebImpl;
+
+class _FormDataWindow
+ : public Tizen::Ui::Window
+ , public Tizen::Ui::Controls::IListViewItemEventListener
+ , public Tizen::Ui::Controls::IListViewItemProvider
+{
+public:
+ /**
+ * Constructor
+ */
+ _FormDataWindow(void);
+
+ /**
+ * Destructor
+ */
+ virtual ~_FormDataWindow(void);
+
+ result Construct(const Tizen::Graphics::Rectangle& rect, _WebImpl* pImpl, Evas_Object* pWebView);
+
+ //IListViewItemProvider
+ virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth);
+ virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth);
+ virtual int GetItemCount(void);
+
+ // IListViewItemEventListener
+ virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state);
+ virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status);
+ virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction);
+
+ result UpdateList(Eina_List* pDataList, const Tizen::Graphics::Rectangle& rect);
+ result LaunchFormDataWindow(void);
+
+private:
+ /**
+ * This is the copy constructor for this class.
+ */
+ _FormDataWindow(const _FormDataWindow& source);
+
+ /**
+ * This is the assignment operator for this class.
+ */
+ _FormDataWindow& operator =(const _FormDataWindow& source);
+
+public:
+ static const int ID_FORMAT_STRING = 300;
+
+private:
+ Tizen::Base::Collection::ArrayList __listElementArray;
+ Tizen::Ui::Controls::ListView* __pListView;
+ Evas_Object* __pWebView;
+ _WebImpl* __pWebImpl;
+ int __listItemHeight;
+}; // _FormDataWindow
+
+}}} //Tizen::Web::Controls
+#endif // _FWEB_CTRL_INTERNAL_FORMDATA_WINDOW_H_
#include "FWebCtrl_AuthConfirmPopup.h"
#include "FWebCtrl_AuthenticationChallengeImpl.h"
#include "FWebCtrl_EflWebkit.h"
+#include "FWebCtrl_FormDataWindow.h"
#include "FWebCtrl_GeolocationPermissionManagerImpl.h"
#include "FWebCtrl_HitElementResultImpl.h"
#include "FWebCtrl_InputPickerPopup.h"
}
+Eina_Bool
+OnFormDataCandidateShow(Ewk_View_Smart_Data *pSmartData, int x, int y, int w, int h)
+{
+ SysAssertf(pSmartData, "Failed to request");
+
+ _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
+ SysAssertf(pWebImpl, "Failed to get Impl");
+
+ Rectangle windowRect(x, y, w, h);
+ result r = pWebImpl->ShowFormDataWindow(windowRect, pSmartData->self);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return EINA_TRUE;
+}
+
+
+Eina_Bool
+OnFormDataCandidateHide(Ewk_View_Smart_Data *pSmartData)
+{
+ SysAssertf(pSmartData, "Failed to request");
+
+ _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
+ SysAssertf(pWebImpl, "Failed to get Impl");
+
+ if (pWebImpl->IsFormDataWindowVisible())
+ {
+ pWebImpl->HideFormDataWindow();
+ }
+
+ return EINA_TRUE;
+}
+
+
+Eina_Bool
+OnFormDataCandidateUpdate(Ewk_View_Smart_Data *pSmartData, Eina_List *pDataList)
+{
+ SysAssertf(pSmartData, "Failed to request");
+
+ _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
+ SysAssertf(pWebImpl, "Failed to get Impl");
+
+ pWebImpl->SetFormDataList(pDataList);
+
+ return EINA_TRUE;
+}
+
+
+Eina_Bool
+OnFormDataCandidateIsShowing(Ewk_View_Smart_Data *pSmartData)
+{
+ SysAssertf(pSmartData, "Failed to request");
+
+ _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
+ SysAssertf(pWebImpl, "Failed to get Impl");
+
+ if (pWebImpl->IsFormDataWindowVisible())
+ {
+ return EINA_TRUE;
+ }
+ else
+ {
+ return EINA_FALSE;
+ }
+}
+
+
void
OnCookiesPolicyGot(Ewk_Cookie_Accept_Policy policy, Ewk_Web_Error *pError, void *pUserData)
{
, __isCertificateRequested(false)
, __isCertificateConfirmed(false)
, __isOrientationChanged(false)
+ , __isFormDataVisible(false)
, __keypadBounds(0, 0, 0, 0)
, __pWebCore(null)
, __pUserLoadingListener(null)
, __pSelectBox(null)
, __pDatePicker(null)
, __pColorPicker(null)
+ , __pFormDataWindow(null)
, __pVibrator(null)
, __policy(WEB_DECISION_CONTINUE)
, __defaultUserAgent(L"")
+ , __pFormDataList(null)
{
__textSearch.__searchAll = false;
__textSearch.__searchForward = true;
pSmart->input_picker_color_request = OnColorPickerProviderRequested;
pSmart->input_picker_color_dismiss = OnColorPickerProviderDismissed;
+ pSmart->formdata_candidate_show = OnFormDataCandidateShow;
+ pSmart->formdata_candidate_hide = OnFormDataCandidateHide;
+ pSmart->formdata_candidate_update_data = OnFormDataCandidateUpdate;
+ pSmart->formdata_candidate_is_showing = OnFormDataCandidateIsShowing;
+
evas_object_data_set(pWebNativeNode, WEB_CTRL, this);
// add loading event callbacks for ILoadingListener
__pColorPicker->ChangeLayout(orientation);
}
+ HideFormDataWindow();
+
__isOrientationChanged = true;
}
}
+void
+_WebImpl::SetFormDataList(Eina_List* pFormDataList)
+{
+ __pFormDataList = pFormDataList;
+}
+
+
+bool
+_WebImpl::IsFormDataWindowVisible(void) const
+{
+ return __isFormDataVisible;
+}
+
+
+result
+_WebImpl::ShowFormDataWindow(const Rectangle& windowRect, Evas_Object* pWebView)
+{
+ Point absPoint(windowRect.x, windowRect.y);
+
+ Point relPoint = __pWebCore->GetRelativeCoordinate(absPoint);
+
+ Rectangle rect(relPoint.x, relPoint.y, windowRect.width, windowRect.height);
+
+ if (__isFormDataVisible)
+ {
+ result r = __pFormDataWindow->UpdateList(__pFormDataList, rect);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ else
+ {
+ __pFormDataWindow.reset();
+
+ std::unique_ptr<_FormDataWindow> pFormDataWindow( new (std::nothrow) _FormDataWindow());
+ SysTryReturnResult(NID_WEB_CTRL, pFormDataWindow.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ result r = pFormDataWindow->Construct(rect, this, pWebView);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pFormDataWindow->UpdateList(__pFormDataList, rect);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pFormDataWindow->LaunchFormDataWindow();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pFormDataWindow = std::move(pFormDataWindow);
+ __isFormDataVisible = true;
+ }
+
+ return E_SUCCESS;
+}
+
+
+void
+_WebImpl::HideFormDataWindow(bool delWindow)
+{
+ if (delWindow)
+ {
+ __pFormDataWindow.reset();
+ }
+
+ __isFormDataVisible = false;
+}
+
+
}}} // Tizen::Web::Controls
class _WebDataHandler;
class _SelectBox;
class _InputPickerPopup;
+class _FormDataWindow;
struct _TextSearch
{
const Tizen::Base::String GetRedirectUri(const Tizen::Base::String& originuri, const Tizen::Base::String& currenturi, const Tizen::Base::String& mime);
+ void SetFormDataList(Eina_List* pFormDataList);
+
+ bool IsFormDataWindowVisible(void) const;
+
+ result ShowFormDataWindow(const Tizen::Graphics::Rectangle& windowRect, Evas_Object* pWebView);
+
+ void HideFormDataWindow(bool delWindow = true);
+
private:
result InitializeSetting(void);
result InitJsBridgeList(void);
bool __isCertificateRequested;
bool __isCertificateConfirmed;
bool __isOrientationChanged;
+ bool __isFormDataVisible;
Tizen::Graphics::Rectangle __keypadBounds;
_Web* __pWebCore;
std::unique_ptr<_SelectBox> __pSelectBox;
std::unique_ptr<_InputPickerPopup> __pDatePicker;
std::unique_ptr<_InputPickerPopup> __pColorPicker;
+ std::unique_ptr<_FormDataWindow> __pFormDataWindow;
std::unique_ptr<Tizen::System::_VibratorImpl> __pVibrator;
DecisionPolicy __policy;
Tizen::Base::String __defaultUserAgent;
+
+ Eina_List* __pFormDataList;
}; // _WebImpl
}}} // Tizen::Web::Controls