2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FWebCtrl_AuthenticationChallengeImpl.cpp
20 * @brief The file contains the definition of _AuthenticationChallengeImpl class.
22 * The file contains the definition of _AuthenticationChallengeImpl class.
24 #include <unique_ptr.h>
26 #include <FBaseErrors.h>
27 #include <FWebCtrlAuthenticationChallenge.h>
28 #include <FBase_StringConverter.h>
29 #include <FBaseSysLog.h>
30 #include "FWebCtrl_AuthenticationChallengeImpl.h"
33 using namespace Tizen::Base;
36 namespace Tizen { namespace Web { namespace Controls
40 _AuthenticationChallengeImpl::_AuthenticationChallengeImpl(void)
41 : __pAuthChallengeHandler(null)
46 _AuthenticationChallengeImpl::~_AuthenticationChallengeImpl(void)
52 _AuthenticationChallengeImpl::Process(const UserId& userId, const Tizen::Base::String& password)
54 std::unique_ptr<char[]> pUserId(_StringConverter::CopyToCharArrayN(userId));
55 std::unique_ptr<char[]> pUserPwd(_StringConverter::CopyToCharArrayN(password));
56 SysTryReturnVoidResult(NID_WEB_CTRL, pUserId.get() && pUserPwd.get(), E_SYSTEM, "[%s] A system error has been occurred. Failed to convert strings.", GetErrorMessage(E_SYSTEM));
58 //ewk_auth_response_ok(__pAuthChallengeHandler, pUserId, pUserPwd);
59 ewk_auth_challenge_credential_use(__pAuthChallengeHandler, pUserId.get(), pUserPwd.get());
64 _AuthenticationChallengeImpl::Cancel(void)
66 //ewk_auth_response_cancel(__pAuthChallengeHandler);
67 ewk_auth_challenge_credential_cancel(__pAuthChallengeHandler);
68 evas_object_smart_callback_call(__pWebFrame, "authentication,canceled", NULL);
73 _AuthenticationChallengeImpl::SetAuthenticationChallengeHandler(Ewk_Auth_Challenge* pAuthHandler)
75 SysTryReturnVoidResult(NID_WEB_CTRL, pAuthHandler, E_INVALID_ARG, "[%s] Invalid argument(s) is used. pAuthHandler instance is null." , GetErrorMessage(E_INVALID_ARG));
76 __pAuthChallengeHandler = pAuthHandler;
81 _AuthenticationChallengeImpl::SetWebEvasObject(Evas_Object* pObj)
83 SysTryReturnVoidResult(NID_WEB_CTRL, pObj, E_INVALID_ARG, "[%s] Invalid argument(s) is used. pAuthHandler instance is null." , GetErrorMessage(E_INVALID_ARG));
88 _AuthenticationChallengeImpl*
89 _AuthenticationChallengeImpl::GetInstance(AuthenticationChallenge* pAuthChallenge)
92 SysTryReturn(NID_WEB_CTRL, pAuthChallenge, null, E_INVALID_ARG, "[%s] Invalid argument(s) is used. pAuthChallenge instance is null." , GetErrorMessage(E_INVALID_ARG));
93 return pAuthChallenge->__pAuthenticationChallengeImpl;
97 const _AuthenticationChallengeImpl*
98 _AuthenticationChallengeImpl::GetInstance(const AuthenticationChallenge* pAuthChallenge)
100 SysTryReturn(NID_WEB_CTRL, pAuthChallenge, null, E_INVALID_ARG, "[%s] Invalid argument(s) is used. pAuthChallenge instance is null." , GetErrorMessage(E_INVALID_ARG));
101 return pAuthChallenge->__pAuthenticationChallengeImpl;
105 }}} // Tizen::Web::Controls