src/controls/FWebCtrl_CertificateConfirmPopup.cpp
src/controls/FWebCtrlWebStorageManager.cpp
src/controls/FWebCtrl_WebStorageManagerImpl.cpp
+ src/controls/FWebCtrl_WebNotification.cpp
+ src/controls/FWebCtrl_WebNotificationHandler.cpp
)
## Add Definitions
ADD_DEFINITIONS(${OSP_DEFINITIONS} -D_MODEL_RES_WVGA)
BuildRequires: pkgconfig(libsoup-2.4)
BuildRequires: pkgconfig(vconf)
BuildRequires: pkgconfig(openssl)
+BuildRequires: pkgconfig(haptic)
# runtime requires
Requires: osp-appfw
#include <FGrpPoint.h>
#include <FGrpRectangle.h>
#include <FNetHttpHttpHeader.h>
+#include <FSysVibrator.h>
#include <FWebCtrlHitElementResult.h>
#include <FWebCtrlPageNavigationList.h>
#include <FWebCtrlWeb.h>
#include <FWebCtrlWebSetting.h>
#include <FSec_AccessController.h>
+#include <FSys_VibratorImpl.h>
#include "FWebCtrl_WebImpl.h"
#include <FBaseSysLog.h>
#include <FGrpDimension.h>
#include <FGrpRectangle.h>
+#include <FSysVibrator.h>
#include <FUiCtrlButton.h>
#include <FUiCtrlEditField.h>
#include <FUiCtrlLabel.h>
#include <FUiVerticalBoxLayout.h>
#include <FWebCtrlAuthenticationChallenge.h>
#include <FSys_SystemResource.h>
+#include <FSys_VibratorImpl.h>
#include <FUi_ControlManager.h>
#include <FUi_ResourceManager.h>
#include "FWebCtrl_WebImpl.h"
#include <FGrpPoint.h>
#include <FGrpRectangle.h>
#include <FIoDbEnumerator.h>
+#include <FSysVibrator.h>
#include <FUiAnimVisualElement.h>
#include <FApp_AppInfo.h>
#include <FBaseSysLog.h>
#include <FIo_DatabaseImpl.h>
#include <FIo_FileImpl.h>
#include <FSecCert_CertService.h>
+#include <FSys_VibratorImpl.h>
#include "FUiAnim_EflNode.h"
#include "FUiAnim_VisualElementImpl.h"
#include "FWebCtrl_EflWebkit.h"
#include <FUi_ControlManager.h>
#include <FUi_ResourceManager.h>
#include <FUiCtrl_TextBoxImpl.h>
-#include "FWebCtrl_WebImpl.h"
#include "FWebCtrl_PromptPopup.h"
#include <FGrpBitmap.h>
#include <FGrpCanvas.h>
#include <FGrpFloatRectangle.h>
+#include <FSysVibrator.h>
#include <FWebCtrlWebSetting.h>
#include <FGrp_CoordinateSystem.h>
+#include <FSys_VibratorImpl.h>
#include <FUiAnim_EflNode.h>
#include <FUiAnim_VisualElement.h>
#include <FUi_CoordinateSystemUtils.h>
#include <FMediaImage.h>
#include <FMediaImageTypes.h>
#include <FNetHttpHttpHeader.h>
+#include <FSysVibrator.h>
#include <FUiControl.h>
#include <FUiCtrlKeypad.h>
#include <FWebCtrlHitElementResult.h>
#include <FGrp_CoordinateSystem.h>
#include <FIo_DatabaseImpl.h>
#include <FIo_NormalFile.h>
+#include <FSys_VibratorImpl.h>
#include <FUi_Control.h>
#include <FUi_CoordinateSystemUtils.h>
#include <FUi_EcoreEvasMgr.h>
#include "FWebCtrl_GeolocationPermissionManagerImpl.h"
#include "FWebCtrl_HitElementResultImpl.h"
#include "FWebCtrl_InputPickerPopup.h"
+#include "FWebCtrl_WebNotification.h"
#include "FWebCtrl_PageNavigationListImpl.h"
#include "FWebCtrl_PromptPopup.h"
#include "FWebCtrl_SelectBox.h"
using namespace Tizen::Io;
using namespace Tizen::Media;
using namespace Tizen::Net::Http;
+using namespace Tizen::System;
using namespace Tizen::Ui;
using namespace Tizen::Ui::Animations;
using namespace Tizen::Ui::Controls;
void
OnNotificationPermissionRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
{
+ result r = E_SUCCESS;
_WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
Ewk_Notification_Permission_Request* pPermissionRequest = reinterpret_cast< Ewk_Notification_Permission_Request* >(pEventInfo);
SysAssertf(pImpl && pPermissionRequest, "Failed to request");
- SysLog(NID_WEB_CTRL, "The permission popup has not Implemented yet. allow is the default value now.");
-
- //ToDo : Show NotificationPermissionPopup
-
- Ewk_Context* pContext = ewk_view_context_get(pView);
- SysAssertf(pContext, "Failed to get webkit instance.");
+ MessageBox messageBox;
+ r = messageBox.Construct(L"Notification request", L"Do you want to allow notifications from this site ?", MSGBOX_STYLE_OKCANCEL);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
- //ewk_notification_permission_request_origin_get(pPermissionRequest);
+ int modalResult = 0;
+ r = messageBox.ShowAndWait(modalResult);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
- ewk_notification_permission_request_set(pPermissionRequest, EINA_TRUE);
+ if (modalResult == MSGBOX_RESULT_OK)
+ {
+ ewk_notification_permission_request_set(pPermissionRequest, EINA_TRUE);
+ }
+ else
+ {
+ ewk_notification_permission_request_set(pPermissionRequest, EINA_FALSE);
+ }
}
Ewk_Notification* pNotification = reinterpret_cast< Ewk_Notification* >(pEventInfo);
SysAssertf(pImpl && pNotification, "Failed to request");
+ result r = E_SUCCESS;
Ewk_Context* pContext = ewk_view_context_get(pView);
SysAssertf(pContext, "Failed to get webkit instance.");
+ uint64_t notificationId = ewk_notification_id_get(pNotification);
- //ToDo : Show Notification
- //Perform ewk_notification_clicked
//ewk_notification_security_origin_get(pNotification)
- SysLog(NID_WEB_CTRL, "The current value of title is %s", ewk_notification_title_get(pNotification));
- SysLog(NID_WEB_CTRL, "The current value of body is %s", ewk_notification_body_get(pNotification));
+
+ const char* text = ewk_notification_body_get(pNotification);
SysLog(NID_WEB_CTRL, "The current value of icon path is %s",ewk_notification_icon_url_get(pNotification));
- uint64_t notificationId = ewk_notification_id_get(pNotification);
+ std::unique_ptr<_WebNotification> pNotificationWindow( new (std::nothrow) _WebNotification());
+ SysTryReturnVoidResult(NID_WEB_CTRL, pNotificationWindow.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pNotificationWindow->Construct(pContext, notificationId);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Error propogated.", GetErrorMessage(r));
+
+ pNotificationWindow->SetText(String(text));
+ pNotificationWindow->LaunchNotification();
+ pNotificationWindow.release();
+
ewk_notification_showed(pContext, notificationId);
}
}
}
+
void
OnContentHandlerUnregistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
{
void
+OnVibrationRequested(uint64_t duration, void* pUserData)
+{
+ result r = E_SUCCESS;
+
+ _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
+ SysAssertf(pImpl, "Failed to request");
+
+ r = pImpl->VibrationRequested(duration);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+}
+
+
+void
+OnVibrationCanceled(void* pUserData)
+{
+ _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
+ SysAssertf(pImpl, "Failed to request");
+
+ pImpl->VibrationCanceled();
+}
+
+
+void
OnLoadingRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
{
_WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
_WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
SysAssertf(pImpl, "Failed to request");
- if (pImpl->IsKeypadVisible())
+ _Form* pFormCore = pImpl->GetParentFormCore(dynamic_cast< _Control* >(&pImpl->GetCore()));
+ if (pFormCore)
{
- _Form* pFormCore = pImpl->GetParentFormCore(dynamic_cast< _Control* >(&pImpl->GetCore()));
- if (pFormCore)
+ if (pFormCore->HasFooter() && pImpl->IsFooterVisible())
{
- if (pFormCore->HasFooter() && pImpl->IsFooterVisible())
- {
- pImpl->SetFooterVisibleState(false);
- pFormCore->SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true);
- }
-
- pFormCore->DeflateClientRectHeight(0);
+ pImpl->SetFooterVisibleState(false);
+ pFormCore->SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true);
}
- if (pImpl->GetWebKeypadEventListener())
- {
- pImpl->GetWebKeypadEventListener()->OnWebKeypadClosed(*dynamic_cast< Web* >(&pImpl->GetPublic()));
- }
+ pFormCore->DeflateClientRectHeight(0);
+ }
- pImpl->SetKeypadVisibleState(false);
+ if (pImpl->GetWebKeypadEventListener())
+ {
+ pImpl->GetWebKeypadEventListener()->OnWebKeypadClosed(*dynamic_cast< Web* >(&pImpl->GetPublic()));
}
+
+ pImpl->SetKeypadVisibleState(false);
}
, __pSelectBox(null)
, __pDatePicker(null)
, __pColorPicker(null)
+ , __pVibrator(null)
, __policy(WEB_DECISION_CONTINUE)
{
__textSearch.__searchAll = false;
evas_object_smart_callback_add(pWebNativeNode, "text,style,state", OnWebPageBlockSelected, this);
+ ewk_view_open_panel_callback_set(pWebNativeNode, OnSelectUploadFile, const_cast< _WebImpl* >(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));
+ ewk_context_vibration_client_callbacks_set(pContext, OnVibrationRequested, OnVibrationCanceled, const_cast< _WebImpl* >(this));
evas_object_event_callback_add(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained, this);
}
evas_object_smart_callback_del(pWebNativeNode, "text,style,state", OnWebPageBlockSelected);
ewk_view_open_panel_callback_set(null, null, null);
+ Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
+ SysAssertf(pContext, "Failed to get webkit instance.");
+ ewk_context_vibration_client_callbacks_set(pContext, null, null, null);
evas_object_event_callback_del(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained);
}
result
+_WebImpl::VibrationRequested(uint64_t duration)
+{
+ result r = E_SUCCESS;
+
+ __pVibrator.reset();
+
+ std::unique_ptr<_VibratorImpl> pVibrator(new (std::nothrow) _VibratorImpl);
+ SysTryReturnResult(NID_WEB_CTRL, pVibrator.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ r = pVibrator->Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pVibrator = std::move(pVibrator);
+
+ IntensityDurationVibrationPattern pattern;
+ pattern.duration = static_cast< int >(duration);
+ pattern.intensity = -1;
+
+ r = pVibrator->Start(&pattern, 1, 1);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return E_SUCCESS;
+}
+
+
+void
+_WebImpl::VibrationCanceled(void)
+{
+ __pVibrator.reset();
+}
+
+
+result
_WebImpl::HttpAuthenticationRequested(Ewk_Auth_Challenge* pChallenge)
{
result r = E_SUCCESS;
{
if(IsKeypadVisible() == true)
{
- OnWebKeypadClosed(this, null, null);
-
SetKeypadOpened(true);
+
+ SetKeypadVisibleState(false);
}
evas_object_focus_set(__pWebCore->GetWebNativeNode(), EINA_FALSE);
{
_ContainerImpl::OnChangeLayout(orientation);
- if (IsKeypadVisible() == true)
- {
- int x = 0;
- int y = 0;
- int w = 0;
- int h = 0;
- ecore_imf_context_input_panel_geometry_get(ecore_imf_context_add(ecore_imf_context_default_id_get()), &x, &y, &w, &h);
-
- _Form* pFormCore = GetParentFormCore(dynamic_cast< _Control* >(&this->GetCore()));
- if (pFormCore)
- {
- pFormCore->DeflateClientRectHeight(h);
- }
- }
-
if (__pColorPicker.get())
{
__pColorPicker->ChangeLayout(orientation);
class HttpHeader;
}}} // Tizen::Net::Http
+namespace Tizen { namespace Sytem
+{
+class _VibratorImpl;
+}} // Tizen::Sytem
+
namespace Tizen { namespace Ui
{
class Contorl;
bool IsCertificateRequested(void) const;
bool IsCertificateConfirmed(void) const;
+ result VibrationRequested(uint64_t duration);
+ void VibrationCanceled(void);
+
bool IsFooterVisible(void) const;
void SetFooterVisibleState(bool isFooterVisible);
std::unique_ptr<_InputPickerPopup> __pDatePicker;
std::unique_ptr<_InputPickerPopup> __pColorPicker;
+ std::unique_ptr<Tizen::System::_VibratorImpl> __pVibrator;
+
Tizen::Base::Runtime::Mutex __mutex;
_TextSearch __textSearch;
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FWebCtrl_WebNotification.cpp
+ * @brief The file contains the definition of _WebNotification class.
+ */
+
+#include <FBaseRtTimer.h>
+#include <FBaseSysLog.h>
+#include <FUiAnimControlAnimator.h>
+#include <FUiAnimPointAnimation.h>
+#include <FUiAnimFloatAnimation.h>
+#include <FUiAnimAnimationTransaction.h>
+#include <FUiCtrlButton.h>
+#include "FWebCtrl_WebNotificationHandler.h"
+#include "FWebCtrl_WebNotification.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Runtime;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Animations;
+using namespace Tizen::Ui::Controls;
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+_WebNotification::_WebNotification(void)
+ : __pNotificationHandler(null)
+ , __pContext(null)
+ , __notificationId(0)
+ , __pTimer(null)
+{
+}
+
+
+_WebNotification::~_WebNotification(void)
+{
+}
+
+result
+_WebNotification::Construct(Ewk_Context *pContext, uint64_t notificationId)
+{
+
+// _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
+// Dimension screenRect = _ControlManager::GetInstance()->GetScreenSize();
+
+ Rectangle rect(NOTIFCATION_RECT_AREA);
+ result r = E_SUCCESS;
+
+ __pContext = pContext;
+ __notificationId = notificationId;
+
+ r = Window::Construct(rect, true, true);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Error Propogating.", GetErrorMessage(r));
+ SetBounds(rect);
+
+ __pNotificationHandler = std::unique_ptr<_WebNotificationHandler>(new (std::nothrow) _WebNotificationHandler());
+ SysTryReturnResult(NID_WEB_CTRL, __pNotificationHandler.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ r = __pNotificationHandler->Construct(this);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Error Propogating.", GetErrorMessage(r));
+
+ SetPropagatedTouchEventListener(__pNotificationHandler.get());
+ __pTimer = std::unique_ptr<Timer>( new (std::nothrow) Timer());
+ SysTryReturnResult(NID_WEB_CTRL, __pTimer.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ r = __pTimer->Construct(*this);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Error Propogating.", GetErrorMessage(r));
+
+ return r;
+}
+
+
+void
+_WebNotification::SetText(const String& text)
+{
+ __pNotificationHandler->SetText(text);
+}
+
+String
+_WebNotification::GetText(void) const
+{
+ return __pNotificationHandler->GetText();
+}
+
+
+result
+_WebNotification::OnDraw(void)
+{
+ result r = E_SUCCESS;
+ SysTryReturnResult(NID_WEB_CTRL, __pNotificationHandler.get(), E_SYSTEM, "Failed to find Impl Instance.");
+
+ std::unique_ptr<Canvas> pCanvas(GetCanvasN());
+ SysTryReturnResult(NID_WEB_CTRL, pCanvas.get(), GetLastResult(), "[%s] Error Propagated.", GetErrorMessage(GetLastResult()));
+
+ r = __pNotificationHandler->DrawNotification(*pCanvas);
+
+ return r;
+}
+
+
+void
+_WebNotification::OnClicked()
+{
+ SysTryReturnVoidResult(NID_WEB_CTRL, __pContext != null, E_SYSTEM, "[E_SYSTEM] Context instance not found.");
+ ewk_notification_clicked(__pContext,__notificationId);
+}
+
+result
+_WebNotification::LaunchNotification()
+{
+ result r = E_SUCCESS;
+ std::unique_ptr<Button> pButton( new (std::nothrow) Button());
+ SysTryReturnResult(NID_WEB_CTRL, pButton.get(), E_OUT_OF_MEMORY, "Memory Allocation Failed.");
+
+ r = pButton->Construct(Rectangle(NOTIFCATION_BUTTON_AREA));
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Error Propogating.", GetErrorMessage(r));
+
+ pButton->SetText(L"x"); //Need to add bit map
+ pButton->AddActionEventListener(*this);
+
+ r = AddControl(pButton.get());
+ pButton.release();
+
+ SetShowState(true);
+ r = Window::Show();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Error Propogating.", GetErrorMessage(r));
+
+ Point start(0,-200),end;
+ PointAnimation pointAnimation(Point(0, 0), Point(0, 0), 0, ANIMATION_INTERPOLATOR_LINEAR);
+
+ end = Point(0,0);
+
+ pointAnimation.SetStartValue(start);
+ pointAnimation.SetEndValue(end);
+ pointAnimation.SetDuration(2000);
+ pointAnimation.SetAutoReverseEnabled(false);
+
+ ControlAnimator *pAnimator = this->GetControlAnimator();
+ r = pAnimator->StartUserAnimation(ANIMATION_TARGET_POSITION, pointAnimation);
+ SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Error Propagated.", GetErrorMessage(r));
+
+ __pTimer->Start(15000);
+ return E_SUCCESS;
+}
+
+
+void
+_WebNotification::OnTimerExpired(Timer& timer)
+{
+
+ int transactionId = 0;
+ int duration = 1000;
+ float start = 1.0f;
+ float end = 0.0f;
+
+ ParallelAnimationGroup showAnim;
+ FloatAnimation floatAnim(start, end, duration, ANIMATION_INTERPOLATOR_LINEAR);
+ showAnim.AddAnimation(ANIMATION_TARGET_ALPHA, floatAnim);
+
+ AnimationTransaction::Begin(transactionId);
+
+ ControlAnimator *pAnimator = this->GetControlAnimator();
+ pAnimator->SetAnimation(ANIMATION_TRIGGER_SHOW_STATE_CHANGE, &showAnim);
+ pAnimator->SetShowState(static_cast< int >(start));
+
+ AnimationTransaction::Commit();
+ delete this;
+}
+
+void
+_WebNotification::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
+{
+ SetShowState(false);
+
+ delete this;
+}
+
+}}}
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+* @file» » FWebCtrl_WebNotification.h
+* @brief» » The file contains the declaration of _WebNotification class.
+*
+* The file contains the declaration of _WebNotification class.
+*/
+#ifndef _FWEB_CTRL_INTERNAL_WEB_NOTIFCATION_H_
+#define _FWEB_CTRL_INTERNAL_WEB_NOTIFCATION_H_
+
+#include <EWebKit2.h>
+#include <FBaseRtITimerEventListener.h>
+#include <FBaseString.h>
+#include <FGrpDimension.h>
+#include <FGrpRectangle.h>
+#include <FUiControl.h>
+#include <FUiIActionEventListener.h>
+#include <FUiWindow.h>
+
+
+namespace Tizen { namespace Base { namespace Runtime {
+
+class Timer;
+}}} //Tizen::Base::Runtime
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+// forward declaration
+class _WebNotification;
+class _WebNotificationHandler;
+
+
+class _WebNotification
+ : public Tizen::Ui::Window
+ , public Tizen::Base::Runtime::ITimerEventListener
+ , public Tizen::Ui::IActionEventListener
+{
+// Life-cycle
+public:
+ _WebNotification(void);
+ virtual ~_WebNotification(void);
+
+ result Construct(Ewk_Context *pContext, uint64_t notificationId);
+ void SetText(const Tizen::Base::String& text);
+ Tizen::Base::String GetText(void) const;
+ virtual result OnDraw(void);
+
+ result LaunchNotification();
+ void OnClicked();
+
+private:
+ void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
+ void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+
+private:
+ std::unique_ptr<_WebNotificationHandler> __pNotificationHandler;
+ Ewk_Context *__pContext;
+ uint64_t __notificationId;
+ std::unique_ptr<Tizen::Base::Runtime::Timer> __pTimer;
+ Tizen::Graphics::Dimension __screenRect;
+}; // _WebNotification
+
+}}}
+#endif // _FWEB_CTRL_INTERNAL_WEB_NOTIFCATION_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FWebCtrl_WebNotificationHandler.cpp
+ * @brief The file contains the definition of _WebNotificationHandler class.
+ */
+
+#include "FWebCtrl_WebNotification.h"
+#include "FWebCtrl_WebNotificationHandler.h"
+#include <FBaseSysLog.h>
+
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+_WebNotificationHandler::_WebNotificationHandler(void)
+ : __pNotification(null)
+ , __state(NOTIFCATION_STATE_NORMAL)
+{
+}
+
+_WebNotificationHandler::~_WebNotificationHandler(void)
+{
+}
+
+
+result
+_WebNotificationHandler::Construct(_WebNotification* pNotification)
+{
+
+ SysTryReturnResult(NID_WEB_CTRL, pNotification != null, E_INVALID_ARG, "Notification instancce cannot be null.");
+
+ __pNotification = pNotification;
+ __pallete[NOTIFCATION_COLOR_BG_NORMAL] = NOTIFCATION_NORMAL_BLACKGROUND_COLOR;
+ __pallete[NOTIFCATION_COLOR_FG_NORMAL] = NOTIFCATION_NORMAL_FOREGROUND_COLOR;
+
+ __bounds = __pNotification->GetBounds();
+ return E_SUCCESS;
+}
+
+
+int
+_WebNotificationHandler::GetState(void) const
+{
+ return __state;
+}
+
+
+void
+_WebNotificationHandler::SetState(int newState)
+{
+ __state = newState;
+}
+
+
+bool
+_WebNotificationHandler::OnPreviewTouchMoved(Control &source, const TouchEventInfo &touchEventInfo)
+{
+ return false;
+}
+
+
+bool
+_WebNotificationHandler::OnPreviewTouchPressed(Control &source, const TouchEventInfo &touchEventInfo)
+{
+ return false;
+}
+
+
+bool
+_WebNotificationHandler::OnPreviewTouchReleased(Control &source, const TouchEventInfo &touchEventInfo)
+{
+ return false;
+}
+
+
+bool
+_WebNotificationHandler::OnTouchCanceled(Control &source, const TouchEventInfo &touchEventInfo)
+{
+ if (GetState() == NOTIFCATION_STATE_PRESSED)
+ {
+ SetState(NOTIFCATION_STATE_NORMAL);
+ __pNotification->Invalidate(false);
+ }
+ return true;
+}
+
+
+bool
+_WebNotificationHandler::OnTouchMoved(Control &source, const TouchEventInfo &touchEventInfo)
+{
+ return false;
+}
+
+
+bool
+_WebNotificationHandler::OnTouchPressed(Control &source, const TouchEventInfo &touchEventInfo)
+{
+ if (GetState() == NOTIFCATION_STATE_NORMAL)
+ {
+ SetState(NOTIFCATION_STATE_PRESSED);
+ __pNotification->Invalidate(false);
+ }
+ return true;
+}
+
+
+bool
+_WebNotificationHandler::OnTouchReleased(Control &source, const TouchEventInfo &touchEventInfo)
+{
+ if (GetState() == NOTIFCATION_STATE_PRESSED)
+ {
+ SetState(NOTIFCATION_STATE_NORMAL);
+ __pNotification->Invalidate(false);
+
+ __pNotification->OnClicked();
+ }
+ return true;
+}
+
+
+result
+_WebNotificationHandler::DrawNotification(Canvas& canvas)
+{
+
+ canvas.SetBackgroundColor(Color(0, 0, 0, 0));
+ canvas.Clear();
+ canvas.FillRoundRectangle(__pallete[NOTIFCATION_COLOR_BG_NORMAL], Rectangle(0, 0 , __bounds.width, __bounds.height), Dimension(5, 5));
+
+ EnrichedText enriched;
+ enriched.Construct(Dimension(__bounds.width, __bounds.height));
+ enriched.SetVerticalAlignment(TEXT_ALIGNMENT_MIDDLE);
+ enriched.SetHorizontalAlignment(TEXT_ALIGNMENT_CENTER);
+
+ TextElement element;
+ element.Construct(__text);
+ element.SetTextColor(__pallete[NOTIFCATION_COLOR_FG_NORMAL]);
+
+ enriched.Add(element);
+ canvas.DrawText(Point(0, 0), enriched);
+ enriched.RemoveAll(false);
+
+ return E_SUCCESS;
+}
+
+
+String
+_WebNotificationHandler::GetText(void) const
+{
+ return __text;
+}
+
+
+void
+_WebNotificationHandler::SetText(const String& text)
+{
+
+ __text = text;
+}
+
+}}}
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FWebCtrl_WebNotificationImpl.h
+ * @brief The file contains the declaration of _WebNotificationHandler class.
+ *
+ * The file contains the declaration of _WebNotificationHandler class.
+ */
+#ifndef _FWEB_CTRL_INTERNAL_WEB_NOTIFCATION_Handler_H_
+#define _FWEB_CTRL_INTERNAL_WEB_NOTIFCATION_Handler_H_
+
+
+#include <FBaseString.h>
+#include <FGrpDimension.h>
+#include <FGrpRectangle.h>
+#include <FUiControl.h>
+#include <FUiIPropagatedTouchEventListener.h>
+#include <FUiTouchEventInfo.h>
+
+const Tizen::Graphics::Color NOTIFCATION_NORMAL_BLACKGROUND_COLOR = Tizen::Graphics::Color(255, 255, 255, 255);
+const Tizen::Graphics::Color NOTIFCATION_NORMAL_FOREGROUND_COLOR = Tizen::Graphics::Color(0, 0, 0, 255);
+const Tizen::Graphics::Rectangle NOTIFCATION_RECT_AREA = Tizen::Graphics::Rectangle(0,0,600,150);
+const Tizen::Graphics::Rectangle NOTIFCATION_BUTTON_AREA = Tizen::Graphics::Rectangle(550,0,50,50);
+
+const int NOTIFCATION_STATE_NORMAL = 0;
+const int NOTIFCATION_STATE_PRESSED = 1;
+const int NOTIFCATION_STATE_MAX = 2;
+
+const int NOTIFCATION_COLOR_BG_NORMAL = 0;
+const int NOTIFCATION_COLOR_FG_NORMAL = 1;
+const int NOTIFCATION_COLOR_MAX = 2;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+// forward declaration
+class _WebNotification;
+class _WebNotificationHandler;
+
+class _WebNotificationHandler
+ : public Tizen::Ui::IPropagatedTouchEventListener
+{
+// Life-cycle
+public:
+ _WebNotificationHandler(void);
+ virtual ~_WebNotificationHandler(void);
+
+ result Construct(_WebNotification* pnotification);
+
+ int GetState(void) const;
+ void SetState(int newState);
+
+ bool OnPreviewTouchMoved(Tizen::Ui::Control &source, const Tizen::Ui::TouchEventInfo &touchEventInfo);
+ bool OnPreviewTouchPressed(Tizen::Ui::Control &source, const Tizen::Ui::TouchEventInfo &touchEventInfo);
+ bool OnPreviewTouchReleased(Tizen::Ui::Control &source, const Tizen::Ui::TouchEventInfo &touchEventInfo);
+ bool OnTouchCanceled(Tizen::Ui::Control &source, const Tizen::Ui::TouchEventInfo &touchEventInfo);
+ bool OnTouchMoved(Tizen::Ui::Control &source, const Tizen::Ui::TouchEventInfo &touchEventInfo);
+ bool OnTouchPressed(Tizen::Ui::Control &source, const Tizen::Ui::TouchEventInfo &touchEventInfo);
+ bool OnTouchReleased(Tizen::Ui::Control &source, const Tizen::Ui::TouchEventInfo &touchEventInfo);
+
+ virtual result DrawNotification(Tizen::Graphics::Canvas& canvas);
+ void SetText(const Tizen::Base::String& text);
+ Tizen::Base::String GetText(void) const;
+
+
+protected:
+ _WebNotification* __pNotification;
+ int __state;
+ Tizen::Base::String __text;
+ Tizen::Graphics::Rectangle __bounds;
+ Tizen::Graphics::Color __pallete[NOTIFCATION_COLOR_MAX];
+}; // _WebNotificationHandler
+
+}}}
+#endif // _FWEB_CTRL_INTERNAL_WEB_NOTIFCATION_Handler_H_