tizen beta release
[framework/web/webkit-efl.git] / Source / WebKit / efl / WebCoreSupport / ChromeClientEfl.cpp
index 268b7b9..e80d65d 100755 (executable)
@@ -153,6 +153,17 @@ int ChromeClientEfl::getDPI()
 {
     return ecore_x_dpi_get();
 }
+
+double ChromeClientEfl::getDPCM()
+{
+    // dpi : dots per inch, dpcm : dots per centimeter
+    // 1 inch = 2.54 cm
+    // So, dpcm = dpi / 2.54
+    int dpi = ecore_x_dpi_get();
+    double dpcm = dpi / 2.54;
+
+    return dpcm;
+}
 #endif
 
 void ChromeClientEfl::focus()
@@ -172,7 +183,15 @@ Page* ChromeClientEfl::createWindow(Frame*, const FrameLoadRequest& frameLoadReq
 #endif
 {
 #if ENABLE(TIZEN_FORM_SUBMIT_SUPPORT)
-    Evas_Object* newView = ewk_view_window_create(m_view, frame, EINA_TRUE, EINA_FALSE, &features, action, frameLoadRequest.frameName());
+    // When new window is created by website's javascript, some target pages doesn't have any signs related to mobile.
+    // So, our browser doesn't show the patch as mobile page. In order to fix this problem, additional parameter is added to window creation
+    // function. - Gyuyoung Kim.
+    Eina_Bool isMobile = EINA_FALSE;
+    String url = frameLoadRequest.resourceRequest().url().string();
+    if (url.startsWith("http://www.facebook.com/connect"))
+        isMobile = EINA_TRUE;
+
+    Evas_Object* newView = ewk_view_window_create(m_view, frame, EINA_TRUE, isMobile, &features, action, frameLoadRequest.frameName());
 #else
     Evas_Object* newView = ewk_view_window_create(m_view, frame, EINA_TRUE, &features);
 #endif
@@ -205,7 +224,7 @@ void ChromeClientEfl::setToolbarsVisible(bool visible)
 
 bool ChromeClientEfl::toolbarsVisible()
 {
-    Eina_Bool visible;
+    bool visible;
 
     ewk_view_toolbars_visible_get(m_view, &visible);
     return visible;
@@ -218,7 +237,7 @@ void ChromeClientEfl::setStatusbarVisible(bool visible)
 
 bool ChromeClientEfl::statusbarVisible()
 {
-    Eina_Bool visible;
+    bool visible;
 
     ewk_view_statusbar_visible_get(m_view, &visible);
     return visible;
@@ -231,7 +250,7 @@ void ChromeClientEfl::setScrollbarsVisible(bool visible)
 
 bool ChromeClientEfl::scrollbarsVisible()
 {
-    Eina_Bool visible;
+    bool visible;
 
     ewk_view_scrollbars_visible_get(m_view, &visible);
     return visible;
@@ -244,7 +263,7 @@ void ChromeClientEfl::setMenubarVisible(bool visible)
 
 bool ChromeClientEfl::menubarVisible()
 {
-    Eina_Bool visible;
+    bool visible;
 
     ewk_view_menubar_visible_get(m_view, &visible);
     return visible;
@@ -352,6 +371,32 @@ IntRect ChromeClientEfl::windowResizerRect() const
     return IntRect();
 }
 
+#if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
+void ChromeClientEfl::setMobileWebAppCapableState(const String& content)
+{
+    if (equalIgnoringCase(content, "yes"))
+        ewk_view_mobile_web_app_capable_state_set(m_view, content.utf8().data());
+}
+
+void ChromeClientEfl::setMobileWebAppStatusBarStyle(const String& content)
+{
+    if (equalIgnoringCase(content, "default")
+        || equalIgnoringCase(content, "black")
+        || equalIgnoringCase(content, "black-translucent"))
+        ewk_view_mobile_web_app_status_bar_style_set(m_view, content.utf8().data());
+}
+#endif
+
+#if ENABLE(TIZEN_SUPPORT_VIEWPORT)
+bool ChromeClientEfl::canContentsSizeChange(Frame* frame, const IntSize& size) const
+{
+    if (ewk_view_frame_main_get(m_view) == kit(frame))
+        return ewk_view_contents_size_change_possible(m_view, size.width(), size.height());
+
+    return true;
+}
+#endif
+
 void ChromeClientEfl::contentsSizeChanged(Frame* frame, const IntSize& size) const
 {
     ewk_frame_contents_size_changed(kit(frame), size.width(), size.height());
@@ -359,7 +404,7 @@ void ChromeClientEfl::contentsSizeChanged(Frame* frame, const IntSize& size) con
         ewk_view_contents_size_changed(m_view, size.width(), size.height());
 }
 
-IntRect ChromeClientEfl::windowToScreen(const IntRect& rect) const
+IntRect ChromeClientEfl::rootViewToScreen(const IntRect& rect) const
 {
 #if ENABLE(TIZEN_SUPPORT_PLUGINS) && ENABLE(TIZEN_CAIRO_SCALE_PATCH)
     // mariusz.g@samsung.com
@@ -376,7 +421,7 @@ IntRect ChromeClientEfl::windowToScreen(const IntRect& rect) const
 #endif
 }
 
-IntPoint ChromeClientEfl::screenToWindow(const IntPoint& point) const
+IntPoint ChromeClientEfl::screenToRootView(const IntPoint& point) const
 {
     notImplemented();
     return point;
@@ -483,6 +528,9 @@ void ChromeClientEfl::exceededDatabaseQuota(Frame* frame, const String& database
 #if ENABLE(NOTIFICATIONS)
 NotificationPresenter* ChromeClientEfl::notificationPresenter() const
 {
+#if ENABLE(TIZEN_NOTIFICATION)
+    return ewk_view_notification_presenter_get(m_view);
+#endif
     notImplemented();
     return 0;
 }
@@ -571,12 +619,12 @@ void ChromeClientEfl::invalidateContents(const IntRect& updateRect, bool immedia
     notImplemented();
 }
 
-void ChromeClientEfl::invalidateWindow(const IntRect& updateRect, bool immediate)
+void ChromeClientEfl::invalidateRootView(const IntRect& updateRect, bool immediate)
 {
     notImplemented();
 }
 
-void ChromeClientEfl::invalidateContentsAndWindow(const IntRect& updateRect, bool immediate)
+void ChromeClientEfl::invalidateContentsAndRootView(const IntRect& updateRect, bool immediate)
 {
     if (updateRect.isEmpty())
         return;
@@ -596,7 +644,7 @@ void ChromeClientEfl::invalidateContentsForSlowScroll(const IntRect& updateRect,
 #if ENABLE(TIZEN_OFFSET_UPDATE)
     ewk_view_tiled_offset_update(m_view);
 #endif
-    invalidateContentsAndWindow(updateRect, immediate);
+    invalidateContentsAndRootView(updateRect, immediate);
 }
 
 void ChromeClientEfl::scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect)
@@ -619,7 +667,7 @@ void ChromeClientEfl::loadIconForFiles(const Vector<String>&, FileIconLoader*)
     notImplemented();
 }
 
-void ChromeClientEfl::dispatchViewportDataDidChange(const ViewportArguments& arguments) const
+void ChromeClientEfl::dispatchViewportPropertiesDidChange(const ViewportArguments& arguments) const
 {
     ewk_view_viewport_attributes_set(m_view, arguments);
 }
@@ -701,6 +749,18 @@ ChromeClient::CompositingTriggerFlags ChromeClientEfl::allowedCompositingTrigger
 #endif
 }
 
+#if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
+void ChromeClientEfl::addOrUpdateScrollingLayer(Node*, PlatformLayer* scrollingLayer, PlatformLayer* contentsLayer, const IntSize& scrollSize)
+{
+    ewk_view_add_or_update_scrolling_layer(m_view, scrollingLayer, contentsLayer, scrollSize);
+}
+
+void ChromeClientEfl::removeScrollingLayer(Node*, PlatformLayer* scrollingLayer, PlatformLayer* contentsLayer)
+{
+    ewk_view_remove_scrolling_layer(m_view, scrollingLayer, contentsLayer);
+}
+#endif
+
 #if ENABLE(CANVAS_CAIRO_GLES_RENDERING)
 void* ChromeClientEfl::sharedCairoDevice()
 {
@@ -719,6 +779,11 @@ bool ChromeClientEfl::shouldAllowOpenUrl(const char* url)
 #if ENABLE(FULLSCREEN_API)
 bool ChromeClientEfl::supportsFullScreenForElement(const WebCore::Element* element, bool withKeyboard)
 {
+#if ENABLE(TIZEN_FULLSCREEN_API)
+    Settings* settings = ewk_view_core_page_get(m_view)->settings();
+    return settings->fullScreenEnabled();
+#endif
+
     if (withKeyboard)
         return false;