2 // Open Service Platform
\r
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
\r
5 // Licensed under the Apache License, Version 2.0 (the License);
\r
6 // you may not use this file except in compliance with the License.
\r
7 // You may obtain a copy of the License at
\r
9 // http://www.apache.org/licenses/LICENSE-2.0
\r
11 // Unless required by applicable law or agreed to in writing, software
\r
12 // distributed under the License is distributed on an "AS IS" BASIS,
\r
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
14 // See the License for the specific language governing permissions and
\r
15 // limitations under the License.
\r
19 * @file FWebCtrl_Utility.cpp
\r
20 * @brief The file contains the definition of _Utility class.
\r
22 * The file contains the definition of _Utility class.
\r
26 #include <FAppUiApp.h>
27 #include <FAppIAppFrame.h>
28 #include <FBaseSysLog.h>
\r
29 #include <FUiAnim_EflNode.h>
\r
30 #include <FUiAnim_VisualElementImpl.h>
31 #include <FUiCtrlFrame.h>
32 #include <FUi_ControlImpl.h>
\r
33 #include "FWebCtrl_Utility.h"
\r
35 using namespace Tizen::App;
\r
36 using namespace Tizen::Base;
\r
37 using namespace Tizen::Graphics;
\r
38 using namespace Tizen::Ui;
39 using namespace Tizen::Ui::Controls;
\r
40 using namespace Tizen::Ui::Animations;
\r
42 namespace Tizen { namespace Web { namespace Controls
\r
46 _Utility::_Utility(void)
\r
50 _Utility::~_Utility(void)
\r
56 _Utility::GetEvasFromUiApp()
\r
58 IAppFrame* pAppFrame = Application::GetInstance()->GetAppFrame();
59 SysTryReturn(NID_WEB_CTRL, pAppFrame, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
61 Frame* pFrame = pAppFrame->GetFrame();
62 SysTryReturn(NID_WEB_CTRL, pFrame, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
64 _ControlImpl* pControlimpl = _ControlImpl::GetInstance(*pFrame);
65 SysTryReturn(NID_WEB_CTRL, pControlimpl, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
67 VisualElement* pVisual = pControlimpl->GetCore().GetVisualElement();
68 SysTryReturn(NID_WEB_CTRL, pVisual, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
70 _VisualElementImpl* pWebVisualElementImpl = _VisualElementImpl::GetInstance(*pVisual);
71 SysTryReturn(NID_WEB_CTRL,pWebVisualElementImpl, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
73 _EflNode* pEflNode = dynamic_cast< _EflNode* >(pWebVisualElementImpl->GetNativeNode());
74 SysTryReturn(NID_WEB_CTRL, pEflNode, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
76 Evas* pEvas = pEflNode->GetEvas();
77 SysTryReturn(NID_WEB_CTRL, pEvas, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
\r
84 _Utility::GetPixelBufferFromEvasObject(const Evas_Object* source, Tizen::Graphics::BufferInfo& bufferInfo)
\r
86 bufferInfo.pPixels = evas_object_image_data_get(source, EINA_FALSE);
\r
87 SysTryReturnResult(NID_WEB_CTRL, bufferInfo.pPixels, E_INVALID_DATA, "Failed to get pixel data from evas object.");
\r
89 evas_object_image_size_get(source, &bufferInfo.width, &bufferInfo.height);
\r
91 Evas_Colorspace colorSpace = evas_object_image_colorspace_get(source);
\r
95 case EVAS_COLORSPACE_ARGB8888:
\r
96 bufferInfo.bitsPerPixel = 32;
\r
97 bufferInfo.pixelFormat = PIXEL_FORMAT_ARGB8888;
\r
100 case EVAS_COLORSPACE_YCBCR422P601_PL:
\r
101 bufferInfo.bitsPerPixel = 0;
\r
102 bufferInfo.pixelFormat = PIXEL_FORMAT_MIN;
\r
105 case EVAS_COLORSPACE_YCBCR422P709_PL:
\r
106 bufferInfo.bitsPerPixel = 0;
\r
107 bufferInfo.pixelFormat = PIXEL_FORMAT_MIN;
\r
110 case EVAS_COLORSPACE_RGB565_A5P:
\r
111 bufferInfo.bitsPerPixel = 0;
\r
112 bufferInfo.pixelFormat = PIXEL_FORMAT_MIN;
\r
115 case EVAS_COLORSPACE_GRY8:
\r
116 bufferInfo.bitsPerPixel = 0;
\r
117 bufferInfo.pixelFormat = PIXEL_FORMAT_MIN;
\r
120 case EVAS_COLORSPACE_YCBCR422601_PL:
\r
121 bufferInfo.bitsPerPixel = 0;
\r
122 bufferInfo.pixelFormat = PIXEL_FORMAT_MIN;
\r
125 case EVAS_COLORSPACE_YCBCR420NV12601_PL:
\r
126 bufferInfo.bitsPerPixel = 0;
\r
127 bufferInfo.pixelFormat = PIXEL_FORMAT_MIN;
\r
130 case EVAS_COLORSPACE_YCBCR420TM12601_PL:
\r
131 bufferInfo.bitsPerPixel = 0;
\r
132 bufferInfo.pixelFormat = PIXEL_FORMAT_MIN;
\r
136 bufferInfo.bitsPerPixel = 0;
\r
137 bufferInfo.pixelFormat = PIXEL_FORMAT_MIN;
\r
141 bufferInfo.pitch = bufferInfo.width * bufferInfo.bitsPerPixel / 8;
\r
143 SysLog(NID_WEB_CTRL, "color space : %d, pitch (%d), w-h (%d, %d)", colorSpace, bufferInfo.pitch, bufferInfo.width, bufferInfo.height);
\r
150 _Utility::CreateOrigin(const Ewk_Security_Origin* pSecurityOrigin)
\r
152 String protocol(ewk_security_origin_protocol_get(pSecurityOrigin));
\r
153 String host(ewk_security_origin_host_get(pSecurityOrigin));
\r
154 int port = ewk_security_origin_port_get(pSecurityOrigin);
\r
156 String origin = protocol + L"://" + host;
164 SysLog(NID_WEB_CTRL, "The current value of origin is %ls", origin.GetPointer());