[EFL][WK2] Add Ewk_Window_Features API and related UI callbacks
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Nov 2012 03:21:11 +0000 (03:21 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Nov 2012 03:21:11 +0000 (03:21 +0000)
https://bugs.webkit.org/show_bug.cgi?id=99114

Patch by Jinwoo Song <jinwoo7.song@samsung.com> on 2012-11-20
Reviewed by Gyuyoung Kim.

Source/WebKit2:

Added Ewk_Window_Features API so that we can create new windows
with various window features such as location, size, toolbar, menubar,
statusbar, locationbar, scrollbar, resizable, and fullscreen.

UI client callbacks related to window features also implemented
so that it is possible to retrieve the window object property values.

* PlatformEfl.cmake:
* UIProcess/API/efl/EWebKit2.h:
* UIProcess/API/efl/EwkViewCallbacks.h:
(EwkViewCallbacks):
* UIProcess/API/efl/EwkViewImpl.cpp:
(EwkViewImpl::windowFeatures):
(EwkViewImpl::createNewPage):
(EwkViewImpl::closePage):
* UIProcess/API/efl/EwkViewImpl.h:
(EwkViewImpl):
* UIProcess/API/efl/ewk_view.h:
* UIProcess/efl/PageUIClientEfl.cpp:
(WebKit::PageUIClientEfl::createNewPage):
(WebKit::PageUIClientEfl::toolbarsAreVisible):
(WebKit):
(WebKit::PageUIClientEfl::setToolbarsAreVisible):
(WebKit::PageUIClientEfl::menuBarIsVisible):
(WebKit::PageUIClientEfl::setMenuBarIsVisible):
(WebKit::PageUIClientEfl::statusBarIsVisible):
(WebKit::PageUIClientEfl::setStatusBarIsVisible):
(WebKit::PageUIClientEfl::isResizable):
(WebKit::PageUIClientEfl::setIsResizable):
(WebKit::PageUIClientEfl::PageUIClientEfl):
* UIProcess/efl/PageUIClientEfl.h:
(PageUIClientEfl):

Tools:

Implemented window_create and window_close smartcallback functions.

* MiniBrowser/efl/main.c:
(on_window_create):
(on_window_close):
(window_create):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@135343 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/PlatformEfl.cmake
Source/WebKit2/UIProcess/API/efl/EWebKit2.h
Source/WebKit2/UIProcess/API/efl/EwkViewCallbacks.h
Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp
Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h
Source/WebKit2/UIProcess/API/efl/ewk_view.h
Source/WebKit2/UIProcess/API/efl/ewk_window_features.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/efl/ewk_window_features.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/efl/ewk_window_features_private.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_window_features.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/efl/PageUIClientEfl.cpp
Source/WebKit2/UIProcess/efl/PageUIClientEfl.h
Tools/ChangeLog
Tools/MiniBrowser/efl/main.c

index 20aa01272af7ab5abf15f254d2eddc31ace97447..9b83f41667de714b09aa7102636cd75711c3815a 100644 (file)
@@ -1,3 +1,43 @@
+2012-11-20  Jinwoo Song  <jinwoo7.song@samsung.com>
+
+        [EFL][WK2] Add Ewk_Window_Features API and related UI callbacks
+        https://bugs.webkit.org/show_bug.cgi?id=99114
+
+        Reviewed by Gyuyoung Kim.
+
+        Added Ewk_Window_Features API so that we can create new windows
+        with various window features such as location, size, toolbar, menubar,
+        statusbar, locationbar, scrollbar, resizable, and fullscreen.
+
+        UI client callbacks related to window features also implemented
+        so that it is possible to retrieve the window object property values.
+
+        * PlatformEfl.cmake:
+        * UIProcess/API/efl/EWebKit2.h:
+        * UIProcess/API/efl/EwkViewCallbacks.h:
+        (EwkViewCallbacks):
+        * UIProcess/API/efl/EwkViewImpl.cpp:
+        (EwkViewImpl::windowFeatures):
+        (EwkViewImpl::createNewPage):
+        (EwkViewImpl::closePage):
+        * UIProcess/API/efl/EwkViewImpl.h:
+        (EwkViewImpl):
+        * UIProcess/API/efl/ewk_view.h:
+        * UIProcess/efl/PageUIClientEfl.cpp:
+        (WebKit::PageUIClientEfl::createNewPage):
+        (WebKit::PageUIClientEfl::toolbarsAreVisible):
+        (WebKit):
+        (WebKit::PageUIClientEfl::setToolbarsAreVisible):
+        (WebKit::PageUIClientEfl::menuBarIsVisible):
+        (WebKit::PageUIClientEfl::setMenuBarIsVisible):
+        (WebKit::PageUIClientEfl::statusBarIsVisible):
+        (WebKit::PageUIClientEfl::setStatusBarIsVisible):
+        (WebKit::PageUIClientEfl::isResizable):
+        (WebKit::PageUIClientEfl::setIsResizable):
+        (WebKit::PageUIClientEfl::PageUIClientEfl):
+        * UIProcess/efl/PageUIClientEfl.h:
+        (PageUIClientEfl):
+
 2012-11-20  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r135295.
index bb8747b1cb1f5838c2dd7ccddf782911ea67c1e5..679a6a57b4c3aa2baedde3f2ee2f9a238de1ee87 100644 (file)
@@ -73,6 +73,7 @@ LIST(APPEND WebKit2_SOURCES
     UIProcess/API/efl/ewk_url_response.cpp
     UIProcess/API/efl/ewk_url_scheme_request.cpp
     UIProcess/API/efl/ewk_view.cpp
+    UIProcess/API/efl/ewk_window_features.cpp
 
     UIProcess/cairo/BackingStoreCairo.cpp
 
@@ -279,6 +280,7 @@ SET (EWebKit2_HEADERS
     "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_url_response.h"
     "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_url_scheme_request.h"
     "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_view.h"
+    "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_window_features.h"
 )
 
 INSTALL(FILES ${CMAKE_BINARY_DIR}/WebKit2/efl/ewebkit2.pc DESTINATION lib/pkgconfig)
@@ -376,6 +378,7 @@ SET(EWK2UnitTests_BINARIES
     test_ewk2_storage_manager
     test_ewk2_text_checker
     test_ewk2_view
+    test_ewk2_window_features
 )
 
 IF (ENABLE_API_TESTS)
index 07ca129350f4edb7e3db4bf92ad70b8c3a209ce4..adaae1ecde50679c995cc95beb7d19a11860e55a 100644 (file)
@@ -58,5 +58,6 @@
 #include "ewk_url_response.h"
 #include "ewk_url_scheme_request.h"
 #include "ewk_view.h"
+#include "ewk_window_features.h"
 
 #endif // EWebKit2_h
index b417b7ccc35f2bdcc465db282e2cb125480a8e00..4140c742bc85d907990f5c96552a4de38ddde5e5 100644 (file)
@@ -57,8 +57,6 @@ enum CallbackType {
     AuthenticationRequest,
     BackForwardListChange,
     CancelVibration,
-    CloseWindow,
-    CreateWindow,
     DownloadJobCancelled,
     DownloadJobFailed,
     DownloadJobFinished,
@@ -69,6 +67,7 @@ enum CallbackType {
     LoadError,
     LoadFinished,
     LoadProgress,
+    MenuBarVisible,
     ProvisionalLoadFailed,
     ProvisionalLoadRedirect,
     ProvisionalLoadStarted,
@@ -77,15 +76,18 @@ enum CallbackType {
     ResourceLoadFailed,
     ResourceLoadFinished,
     ResourceRequestSent,
+    StatusBarVisible,
     NavigationPolicyDecision,
     NewWindowPolicyDecision,
     TextFound,
     TitleChange,
+    ToolbarVisible,
     TooltipTextUnset,
     TooltipTextSet,
     URLChanged,
     Vibrate,
     WebProcessCrashed,
+    WindowResizable,
 #if ENABLE(WEB_INTENTS)
     IntentRequest,
 #endif
@@ -164,8 +166,6 @@ struct CallBackInfo<callbackType> {                           \
 DECLARE_EWK_VIEW_CALLBACK(AuthenticationRequest, "authentication,request", Ewk_Auth_Request);
 DECLARE_EWK_VIEW_CALLBACK(BackForwardListChange, "back,forward,list,changed", void);
 DECLARE_EWK_VIEW_CALLBACK(CancelVibration, "cancel,vibration", void);
-DECLARE_EWK_VIEW_CALLBACK(CloseWindow, "close,window", void);
-DECLARE_EWK_VIEW_CALLBACK(CreateWindow, "create,window", Evas_Object*);
 DECLARE_EWK_VIEW_CALLBACK(DownloadJobCancelled, "download,cancelled", Ewk_Download_Job);
 DECLARE_EWK_VIEW_CALLBACK(DownloadJobFailed, "download,failed", Ewk_Download_Job_Error);
 DECLARE_EWK_VIEW_CALLBACK(DownloadJobFinished, "download,finished", Ewk_Download_Job);
@@ -179,6 +179,7 @@ DECLARE_EWK_VIEW_CALLBACK(LoadProgress, "load,progress", double);
 DECLARE_EWK_VIEW_CALLBACK(ProvisionalLoadFailed, "load,provisional,failed", Ewk_Error);
 DECLARE_EWK_VIEW_CALLBACK(ProvisionalLoadRedirect, "load,provisional,redirect", void);
 DECLARE_EWK_VIEW_CALLBACK(ProvisionalLoadStarted, "load,provisional,started", void);
+DECLARE_EWK_VIEW_CALLBACK(MenuBarVisible, "menubar,visible", bool);
 DECLARE_EWK_VIEW_CALLBACK(NavigationPolicyDecision, "policy,decision,navigation", Ewk_Navigation_Policy_Decision);
 DECLARE_EWK_VIEW_CALLBACK(NewWindowPolicyDecision, "policy,decision,new,window", Ewk_Navigation_Policy_Decision);
 DECLARE_EWK_VIEW_CALLBACK(ResourceLoadStarted, "resource,request,new", Ewk_Resource_Request);
@@ -186,13 +187,16 @@ DECLARE_EWK_VIEW_CALLBACK(ResourceLoadResponse, "resource,request,response", Ewk
 DECLARE_EWK_VIEW_CALLBACK(ResourceLoadFailed, "resource,request,failed", Ewk_Resource_Load_Error);
 DECLARE_EWK_VIEW_CALLBACK(ResourceLoadFinished, "resource,request,finished", Ewk_Resource);
 DECLARE_EWK_VIEW_CALLBACK(ResourceRequestSent, "resource,request,sent", Ewk_Resource_Request);
+DECLARE_EWK_VIEW_CALLBACK(StatusBarVisible, "statusbar,visible", bool);
 DECLARE_EWK_VIEW_CALLBACK(TextFound, "text,found", unsigned);
 DECLARE_EWK_VIEW_CALLBACK(TitleChange, "title,changed", char);
+DECLARE_EWK_VIEW_CALLBACK(ToolbarVisible, "toolbar,visible", bool);
 DECLARE_EWK_VIEW_CALLBACK(TooltipTextUnset, "tooltip,text,unset", void);
 DECLARE_EWK_VIEW_CALLBACK(TooltipTextSet, "tooltip,text,set", char);
 DECLARE_EWK_VIEW_CALLBACK(URLChanged, "url,changed", char);
 DECLARE_EWK_VIEW_CALLBACK(Vibrate, "vibrate", uint64_t);
 DECLARE_EWK_VIEW_CALLBACK(WebProcessCrashed, "webprocess,crashed", bool);
+DECLARE_EWK_VIEW_CALLBACK(WindowResizable, "window,resizable", bool);
 #if ENABLE(WEB_INTENTS)
 DECLARE_EWK_VIEW_CALLBACK(IntentRequest, "intent,request,new", Ewk_Intent);
 #endif
index 07553c48cc6cbe4327d8a3b833d3a1ce34f6b1f1..0044341927e82b7ef7c41c7a20c6eb727f4d211c 100644 (file)
@@ -54,6 +54,7 @@
 #include "ewk_settings_private.h"
 #include "ewk_view.h"
 #include "ewk_view_private.h"
+#include "ewk_window_features_private.h"
 #include <Ecore_Evas.h>
 #include <Ecore_X.h>
 #include <Edje.h>
@@ -850,37 +851,45 @@ void EwkViewImpl::informURLChange()
     informIconChange();
 }
 
-WKPageRef EwkViewImpl::createNewPage(WKDictionaryRef windowFeatures)
+EwkWindowFeatures* EwkViewImpl::windowFeatures()
 {
-    Ewk_View_Smart_Data* sd = smartData();
-    ASSERT(sd->api);
+    if (!m_windowFeatures)
+        m_windowFeatures = EwkWindowFeatures::create(0, this);
 
-    Evas_Object* newEwkView = 0;
-
-    // Extract the width and height from the window attributes and pass them along to the embedder.
-    WKRetainPtr<WKStringRef> widthStr(AdoptWK, WKStringCreateWithUTF8CString("width"));
-    WKRetainPtr<WKStringRef> heightStr(AdoptWK, WKStringCreateWithUTF8CString("height"));
+    return m_windowFeatures.get();
+}
 
-    WKTypeRef ref = WKDictionaryGetItemForKey(windowFeatures, widthStr.get());
-    unsigned width = ref ? WKDoubleGetValue(static_cast<WKDoubleRef>(ref)) : 0;
-    ref = WKDictionaryGetItemForKey(windowFeatures, heightStr.get());
-    unsigned height = ref ? WKDoubleGetValue(static_cast<WKDoubleRef>(ref)) : 0;
+WKPageRef EwkViewImpl::createNewPage(ImmutableDictionary* windowFeatures)
+{
+    Ewk_View_Smart_Data* sd = smartData();
+    ASSERT(sd->api);
 
-    if (!sd->api->window_create_new)
+    if (!sd->api->window_create)
         return 0;
 
-    if (!(newEwkView = sd->api->window_create_new(sd, width, height)))
+    RefPtr<EwkWindowFeatures> ewkWindowFeatures = EwkWindowFeatures::create(windowFeatures, this);
+
+    Evas_Object* newEwkView = sd->api->window_create(sd, ewkWindowFeatures.get());
+    if (!newEwkView)
         return 0;
 
     EwkViewImpl* newViewImpl = EwkViewImpl::fromEvasObject(newEwkView);
     ASSERT(newViewImpl);
 
+    newViewImpl->m_windowFeatures = ewkWindowFeatures;
+
     return static_cast<WKPageRef>(WKRetain(newViewImpl->page()));
 }
 
 void EwkViewImpl::closePage()
 {
-    smartCallback<CloseWindow>().call();
+    Ewk_View_Smart_Data* sd = smartData();
+    ASSERT(sd->api);
+
+    if (!sd->api->window_close)
+        return;
+
+    sd->api->window_close(sd);
 }
 
 void EwkViewImpl::onMouseDown(void* data, Evas*, Evas_Object*, void* eventInfo)
index bd256bcad5815cf2eed24b70030303b70c00fe0b..c0b97a8999a8c823a12fa4c38b09ab18a9754abf 100644 (file)
@@ -22,6 +22,7 @@
 #define EwkViewImpl_h
 
 #include "EwkViewCallbacks.h"
+#include "ImmutableDictionary.h"
 #include "RefPtrEfl.h"
 #include "WKEinaSharedString.h"
 #include "WKGeometry.h"
@@ -80,6 +81,7 @@ class EwkBackForwardList;
 class EwkColorPicker;
 class EwkPopupMenu;
 class EwkSettings;
+class EwkWindowFeatures;
 
 #if USE(ACCELERATED_COMPOSITING)
 typedef struct _Evas_GL_Context Evas_GL_Context;
@@ -106,6 +108,7 @@ public:
     EwkContext* ewkContext() { return m_context.get(); }
     EwkSettings* settings() { return m_settings.get(); }
     EwkBackForwardList* backForwardList() { return m_backForwardList.get(); }
+    EwkWindowFeatures* windowFeatures();
 
     WebCore::IntSize size() const;
     bool isFocused() const;
@@ -160,7 +163,7 @@ public:
     void dismissColorPicker();
 #endif
 
-    WKPageRef createNewPage(WKDictionaryRef windowFeatures);
+    WKPageRef createNewPage(WebKit::ImmutableDictionary* windowFeatures);
     void closePage();
 
     void requestPopupMenu(WebKit::WebPopupMenuProxyEfl*, const WebCore::IntRect&, WebCore::TextDirection, double pageScaleFactor, const Vector<WebKit::WebPopupItem>& items, int32_t selectedIndex);
@@ -252,6 +255,7 @@ private:
     WebCore::IntPoint m_scrollPosition;
 #endif
     OwnPtr<EwkSettings> m_settings;
+    RefPtr<EwkWindowFeatures> m_windowFeatures;
     const void* m_cursorIdentifier; // This is an address, do not free it.
     WKEinaSharedString m_faviconURL;
     WKEinaSharedString m_url;
index 750161174b9a457ff2ede988518b0b346772b57f..39170ee6dc5692c1647394c4dd6f2d168657f6c3 100644 (file)
@@ -30,8 +30,6 @@
  *   ewk_auth_request_ref() on the request object to process the authentication asynchronously.
  * - "back,forward,list,changed", void: reports that the view's back / forward list had changed.
  * - "cancel,vibration", void: request to cancel the vibration.
- * - "close,window", void: window is closed.
- * - "create,window", Evas_Object**: a new window is created.
  * - "download,cancelled", Ewk_Download_Job*: reports that a download was effectively cancelled.
  * - "download,failed", Ewk_Download_Job_Error*: reports that a download failed with the given error.
  * - "download,finished", Ewk_Download_Job*: reports that a download completed successfully.
@@ -94,6 +92,7 @@
 #include "ewk_touch.h"
 #include "ewk_url_request.h"
 #include "ewk_url_response.h"
+#include "ewk_window_features.h"
 #include <Evas.h>
 
 #ifdef __cplusplus
@@ -148,16 +147,17 @@ struct Ewk_View_Smart_Class {
     //   - Web database.
     unsigned long long (*exceeded_database_quota)(Ewk_View_Smart_Data *sd, const char *databaseName, const char *displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage);
 
-    // new window:
-    //   - Create a new window with specified size
-    Evas_Object* (*window_create_new)(Ewk_View_Smart_Data *sd, Evas_Coord width, Evas_Coord height);
+    // window creation and closing:
+    //   - Create a new window with specified features and close window.
+    Evas_Object *(*window_create)(Ewk_View_Smart_Data *sd, const Ewk_Window_Features *window_features);
+    void (*window_close)(Ewk_View_Smart_Data *sd);
 };
 
 /**
  * The version you have to put into the version field
  * in the @a Ewk_View_Smart_Class structure.
  */
-#define EWK_VIEW_SMART_CLASS_VERSION 7UL
+#define EWK_VIEW_SMART_CLASS_VERSION 8UL
 
 /**
  * Initializer for whole Ewk_View_Smart_Class structure.
@@ -169,7 +169,7 @@ struct Ewk_View_Smart_Class {
  * @see EWK_VIEW_SMART_CLASS_INIT_VERSION
  * @see EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION
  */
-#define EWK_VIEW_SMART_CLASS_INIT(smart_class_init) {smart_class_init, EWK_VIEW_SMART_CLASS_VERSION, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+#define EWK_VIEW_SMART_CLASS_INIT(smart_class_init) {smart_class_init, EWK_VIEW_SMART_CLASS_VERSION, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
 
 /**
  * Initializer to zero a whole Ewk_View_Smart_Class structure.
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_window_features.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_window_features.cpp
new file mode 100644 (file)
index 0000000..66a6c91
--- /dev/null
@@ -0,0 +1,161 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ewk_window_features.h"
+
+#include "WebNumber.h"
+#include "ewk_window_features_private.h"
+#include <Eina.h>
+
+using namespace WebKit;
+
+EwkWindowFeatures::EwkWindowFeatures(ImmutableDictionary* windowFeatures, EwkViewImpl* viewImpl)
+    : m_viewImpl(viewImpl)
+    , m_geometry(0, 0, 100, 100)
+    , m_toolbarVisible(true)
+    , m_statusBarVisible(true)
+    , m_scrollbarsVisible(true)
+    , m_menuBarVisible(true)
+    , m_locationBarVisible(true)
+    , m_resizable(true)
+    , m_fullScreen(false)
+{
+    if (windowFeatures) {
+        m_geometry.setX(getWindowFeatureValue<double, WebDouble>(windowFeatures, ASCIILiteral("x")));
+        m_geometry.setY(getWindowFeatureValue<double, WebDouble>(windowFeatures, ASCIILiteral("y")));
+        m_geometry.setWidth(getWindowFeatureValue<double, WebDouble>(windowFeatures, ASCIILiteral("width")));
+        m_geometry.setHeight(getWindowFeatureValue<double, WebDouble>(windowFeatures, ASCIILiteral("height")));
+
+        m_toolbarVisible = getWindowFeatureValue<bool, WebBoolean>(windowFeatures, ASCIILiteral("toolBarVisible"));
+        m_statusBarVisible = getWindowFeatureValue<bool, WebBoolean>(windowFeatures, ASCIILiteral("statusBarVisible"));
+        m_scrollbarsVisible = getWindowFeatureValue<bool, WebBoolean>(windowFeatures, ASCIILiteral("scrollbarsVisible"));
+        m_menuBarVisible = getWindowFeatureValue<bool, WebBoolean>(windowFeatures, ASCIILiteral("menuBarVisible"));
+        m_locationBarVisible = getWindowFeatureValue<bool, WebBoolean>(windowFeatures, ASCIILiteral("locationBarVisible"));
+        m_resizable = getWindowFeatureValue<bool, WebBoolean>(windowFeatures, ASCIILiteral("resizable"));
+        m_fullScreen = getWindowFeatureValue<bool, WebBoolean>(windowFeatures, ASCIILiteral("fullscreen"));
+    }
+}
+
+template <typename T1, typename T2>
+T1 EwkWindowFeatures::getWindowFeatureValue(ImmutableDictionary* windowFeatures, const String& featureName)
+{
+    T2* featureValue = static_cast<T2*>(windowFeatures->get(featureName));
+
+    if (!featureValue)
+        return false;
+
+    return featureValue->value();
+}
+
+void EwkWindowFeatures::setToolbarVisible(bool toolbarVisible)
+{
+    m_toolbarVisible = toolbarVisible;
+    m_viewImpl->smartCallback<EwkViewCallbacks::ToolbarVisible>().call(&toolbarVisible);
+}
+
+void EwkWindowFeatures::setStatusBarVisible(bool statusBarVisible)
+{
+    m_statusBarVisible = statusBarVisible;
+    m_viewImpl->smartCallback<EwkViewCallbacks::StatusBarVisible>().call(&statusBarVisible);
+}
+
+void EwkWindowFeatures::setMenuBarVisible(bool menuBarVisible)
+{
+    m_menuBarVisible = menuBarVisible;
+    m_viewImpl->smartCallback<EwkViewCallbacks::MenuBarVisible>().call(&menuBarVisible);
+}
+
+void EwkWindowFeatures::setResizable(bool resizable)
+{
+    m_resizable = resizable;
+    m_viewImpl->smartCallback<EwkViewCallbacks::WindowResizable>().call(&resizable);
+}
+
+Eina_Bool ewk_window_features_toolbar_visible_get(const Ewk_Window_Features* window_features)
+{
+    EWK_OBJ_GET_IMPL_OR_RETURN(const EwkWindowFeatures, window_features, impl, false);
+
+    return impl->toolbarVisible();
+}
+
+Eina_Bool ewk_window_features_statusbar_visible_get(const Ewk_Window_Features* window_features)
+{
+    EWK_OBJ_GET_IMPL_OR_RETURN(const EwkWindowFeatures, window_features, impl, false);
+
+    return impl->statusBarVisible();
+}
+
+Eina_Bool ewk_window_features_scrollbars_visible_get(const Ewk_Window_Features* window_features)
+{
+    EWK_OBJ_GET_IMPL_OR_RETURN(const EwkWindowFeatures, window_features, impl, false);
+
+    return impl->scrollbarsVisible();
+}
+
+Eina_Bool ewk_window_features_menubar_visible_get(const Ewk_Window_Features* window_features)
+{
+    EWK_OBJ_GET_IMPL_OR_RETURN(const EwkWindowFeatures, window_features, impl, false);
+
+    return impl->menuBarVisible();
+}
+
+Eina_Bool ewk_window_features_locationbar_visible_get(const Ewk_Window_Features* window_features)
+{
+    EWK_OBJ_GET_IMPL_OR_RETURN(const EwkWindowFeatures, window_features, impl, false);
+
+    return impl->locationBarVisible();
+}
+
+Eina_Bool ewk_window_features_resizable_get(const Ewk_Window_Features* window_features)
+{
+    EWK_OBJ_GET_IMPL_OR_RETURN(const EwkWindowFeatures, window_features, impl, false);
+
+    return impl->resizable();
+}
+
+Eina_Bool ewk_window_features_fullscreen_get(const Ewk_Window_Features* window_features)
+{
+    EWK_OBJ_GET_IMPL_OR_RETURN(const EwkWindowFeatures, window_features, impl, false);
+
+    return impl->fullScreen();
+}
+
+void ewk_window_features_geometry_get(const Ewk_Window_Features* window_features, Evas_Coord* x, Evas_Coord* y, Evas_Coord* width, Evas_Coord* height)
+{
+    EWK_OBJ_GET_IMPL_OR_RETURN(const EwkWindowFeatures, window_features, impl);
+
+    if (x)
+        *x = static_cast<Evas_Coord>(impl->geometry().x());
+
+    if (y)
+        *y = static_cast<Evas_Coord>(impl->geometry().y());
+
+    if (width)
+        *width = static_cast<Evas_Coord>(impl->geometry().width());
+
+    if (height)
+        *height = static_cast<Evas_Coord>(impl->geometry().height());
+}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_window_features.h b/Source/WebKit2/UIProcess/API/efl/ewk_window_features.h
new file mode 100644 (file)
index 0000000..8e43675
--- /dev/null
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file    ewk_window_features.h
+ * @brief   Access to the features of window.
+ */
+
+#ifndef ewk_window_features_h
+#define ewk_window_features_h
+
+#include <Eina.h>
+#include <Evas.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Declare Ewk_Window_Features as Ewk_Object.
+ *
+ * @see Ewk_Object
+ */
+typedef struct EwkObject Ewk_Window_Features;
+
+/**
+ * Queries the toolbar visibility of the window feature.
+ *
+ * @param window_features the object to get properties
+ *
+ * @return @c EINA_TRUE is the toolbar should be visible, @c EINA_FALSE otherwise
+ */
+EAPI Eina_Bool ewk_window_features_toolbar_visible_get(const Ewk_Window_Features *window_features);
+
+/**
+ * Queries the statusbar visibility of the window feature.
+ *
+ * @param window_features the object to get properties
+ *
+ * @return @c EINA_TRUE is the statusbar should be visible, @c EINA_FALSE otherwise
+ */
+EAPI Eina_Bool ewk_window_features_statusbar_visible_get(const Ewk_Window_Features *window_features);
+
+/**
+ * Queries the scrollbar visibility of the window feature.
+ *
+ * @param window_features the object to get properties
+ *
+ * @return @c EINA_TRUE is the scrollbars should be visible, @c EINA_FALSE otherwise
+ */
+EAPI Eina_Bool ewk_window_features_scrollbars_visible_get(const Ewk_Window_Features *window_features);
+
+/**
+ * Queries the menubar visibility of the window feature.
+ *
+ * @param window_features the object to get properties
+ *
+ * @return @c EINA_TRUE is the menubar should be visible, @c EINA_FALSE otherwise
+ */
+EAPI Eina_Bool ewk_window_features_menubar_visible_get(const Ewk_Window_Features *window_features);
+
+/**
+ * Queries the locationbar visibility of the window feature.
+ *
+ * @param window_features the object to get properties
+ *
+ * @return @c EINA_TRUE is the locationbar should be visible, @c EINA_FALSE otherwise
+ */
+EAPI Eina_Bool ewk_window_features_locationbar_visible_get(const Ewk_Window_Features *window_features);
+
+/**
+ * Queries if the window is resizable.
+ *
+ * @param window_features the object to get properties
+ *
+ * @return @c EINA_TRUE is the window should be resizable, @c EINA_FALSE otherwise
+ */
+EAPI Eina_Bool ewk_window_features_resizable_get(const Ewk_Window_Features *window_features);
+
+/**
+ * Queries the the window is fullscreen
+ *
+ * @param window_features the object to get properties
+ *
+ * @return @c EINA_TRUE is the window should be fullscreen, @c EINA_FALSE otherwise
+ */
+EAPI Eina_Bool ewk_window_features_fullscreen_get(const Ewk_Window_Features *window_features);
+
+/**
+ * Gets geometry properties of an Ewk_Window_Features.
+ *
+ * Properties are returned in the respective pointers. Passing @c NULL to any of
+ * these pointers will cause that property to not be returned.
+ *
+ * @param window_features the window's features
+ * @param x the pointer to store x position
+ * @param y the pointer to store y position
+ * @param w the pointer to store width
+ * @param h the pointer to store height
+ */
+EAPI void ewk_window_features_geometry_get(const Ewk_Window_Features *window_features, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ewk_window_features_h
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_window_features_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_window_features_private.h
new file mode 100644 (file)
index 0000000..c6bf892
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ewk_window_features_private_h
+#define ewk_window_features_private_h
+
+#include "EwkViewImpl.h"
+#include "ImmutableDictionary.h"
+#include "WindowFeatures.h"
+#include "ewk_object_private.h"
+#include <WebCore/FloatRect.h>
+#include <wtf/RefCounted.h>
+
+class EwkViewImpl;
+
+class EwkWindowFeatures : public EwkObject {
+public:
+    EWK_OBJECT_DECLARE(EwkWindowFeatures)
+
+    static PassRefPtr<EwkWindowFeatures> create(WebKit::ImmutableDictionary* windowFeatures, EwkViewImpl* viewImpl)
+    {
+        return adoptRef(new EwkWindowFeatures(windowFeatures, viewImpl));
+    }
+
+    WebCore::FloatRect geometry() const { return m_geometry; }
+    void setGeometry(WebCore::FloatRect& geometry) { m_geometry = geometry; }
+
+    bool toolbarVisible() const { return m_toolbarVisible; }
+    void setToolbarVisible(bool toolbarVisible);
+
+    bool statusBarVisible() const { return m_statusBarVisible; }
+    void setStatusBarVisible(bool statusBarVisible);
+
+    bool scrollbarsVisible() const { return m_scrollbarsVisible; }
+    void setScrollbarsVisible(bool scrollbarsVisible) { m_scrollbarsVisible = scrollbarsVisible; }
+
+    bool menuBarVisible() const { return m_menuBarVisible; }
+    void setMenuBarVisible(bool menuBarVisible);
+
+    bool locationBarVisible() const { return m_locationBarVisible; }
+    void setLocationBarVisible(bool locationBarVisible) { m_locationBarVisible = locationBarVisible; }
+
+    bool resizable() const { return m_resizable; }
+    void setResizable(bool resizable);
+
+    bool fullScreen() const { return m_fullScreen; }
+    void setFullScreen(bool fullScreen) { m_fullScreen = fullScreen; }
+
+private:
+    EwkWindowFeatures(WebKit::ImmutableDictionary* windowFeatures, EwkViewImpl* viewImpl);
+    template <typename T1, typename T2>
+    static T1 getWindowFeatureValue(WebKit::ImmutableDictionary* windowFeatures, const String& featureName);
+
+    EwkViewImpl* m_viewImpl;
+
+    WebCore::FloatRect m_geometry;
+    bool m_toolbarVisible;
+    bool m_statusBarVisible;
+    bool m_scrollbarsVisible;
+    bool m_menuBarVisible;
+    bool m_locationBarVisible;
+    bool m_resizable;
+    bool m_fullScreen;
+};
+
+#endif // ewk_window_features_private_h
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_window_features.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_window_features.cpp
new file mode 100644 (file)
index 0000000..5fb0e52
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "UnitTestUtils/EWK2UnitTestBase.h"
+#include <EWebKit2.h>
+#include <Ecore.h>
+#include <WebCore/IntRect.h>
+
+using namespace EWK2UnitTest;
+using namespace WebCore;
+
+static Evas_Object* createDefaultWindow(Ewk_View_Smart_Data* smartData, const Ewk_Window_Features* windowFeatures)
+{
+    // default values of WebCore:WindowFeatures()
+    // - menuBarVisible(true)
+    // - statusBarVisible(true)
+    // - toolBarVisible(true)
+    // - locationBarVisible(true)
+    // - scrollbarsVisible(true)
+    // - resizable(true)
+    // - fullscreen(false)
+
+    EXPECT_TRUE(ewk_window_features_toolbar_visible_get(windowFeatures));
+    EXPECT_TRUE(ewk_window_features_statusbar_visible_get(windowFeatures));
+    EXPECT_TRUE(ewk_window_features_scrollbars_visible_get(windowFeatures));
+    EXPECT_TRUE(ewk_window_features_menubar_visible_get(windowFeatures));
+    EXPECT_TRUE(ewk_window_features_locationbar_visible_get(windowFeatures));
+    EXPECT_TRUE(ewk_window_features_resizable_get(windowFeatures));
+
+    EXPECT_FALSE(ewk_window_features_fullscreen_get(windowFeatures));
+
+    int x, y, width, height;
+    ewk_window_features_geometry_get(windowFeatures, &x, &y, &width, &height);
+
+    EXPECT_EQ(0, x);
+    EXPECT_EQ(0, y);
+    EXPECT_EQ(0, width);
+    EXPECT_EQ(0, height);
+
+    return 0;
+}
+
+TEST_F(EWK2UnitTestBase, ewk_window_features_default_property_get)
+{
+    Evas_Object* view = webView();
+
+    const char windowHTML[] = "<html><body onLoad=\"window.open('', '');\"></body></html>";
+
+    ewkViewClass()->window_create = createDefaultWindow;
+
+    ewk_view_html_string_load(view, windowHTML, 0, 0);
+    ASSERT_TRUE(waitUntilLoadFinished());
+}
+
+static Evas_Object* createWindow(Ewk_View_Smart_Data *smartData, const Ewk_Window_Features *windowFeatures)
+{
+    EXPECT_FALSE(ewk_window_features_toolbar_visible_get(windowFeatures));
+    EXPECT_TRUE(ewk_window_features_statusbar_visible_get(windowFeatures));
+    EXPECT_TRUE(ewk_window_features_scrollbars_visible_get(windowFeatures));
+    EXPECT_FALSE(ewk_window_features_menubar_visible_get(windowFeatures));
+    EXPECT_FALSE(ewk_window_features_locationbar_visible_get(windowFeatures));
+    EXPECT_TRUE(ewk_window_features_resizable_get(windowFeatures));
+    EXPECT_FALSE(ewk_window_features_fullscreen_get(windowFeatures));
+
+    int x, y, width, height;
+    ewk_window_features_geometry_get(windowFeatures, &x, &y, &width, &height);
+
+    EXPECT_EQ(100, x);
+    EXPECT_EQ(150, y);
+    EXPECT_EQ(400, width);
+    EXPECT_EQ(400, height);
+
+    return 0;
+}
+
+TEST_F(EWK2UnitTestBase, ewk_window_features_property_get)
+{
+    Evas_Object* view = webView();
+
+    const char windowHTML[] = "<html><body onLoad=\"window.open('', '', 'left=100,top=150,width=400,height=400,location=no,menubar=no,status=yes,toolbar=no,scrollbars=yes,resizable=yes,fullscreen=no');\"></body></html>";
+
+    ewkViewClass()->window_create = createWindow;
+
+    ewk_view_html_string_load(view, windowHTML, 0, 0);
+    ASSERT_TRUE(waitUntilLoadFinished());
+}
index 2b750710f9de4a7ce4f89ed0769f6e5745188559..f0a7b4bf1a0af4be643f7ad04b2aca8d77454186 100644 (file)
@@ -32,6 +32,7 @@
 #include "WKEvent.h"
 #include "WKString.h"
 #include "ewk_file_chooser_request_private.h"
+#include "ewk_window_features_private.h"
 #include <Ecore_Evas.h>
 #include <WebCore/Color.h>
 
@@ -49,9 +50,9 @@ void PageUIClientEfl::closePage(WKPageRef, const void* clientInfo)
     toPageUIClientEfl(clientInfo)->m_viewImpl->closePage();
 }
 
-WKPageRef PageUIClientEfl::createNewPage(WKPageRef, WKURLRequestRef, WKDictionaryRef windowFeatures, WKEventModifiers, WKEventMouseButton, const void* clientInfo)
+WKPageRef PageUIClientEfl::createNewPage(WKPageRef, WKURLRequestRef, WKDictionaryRef wkWindowFeatures, WKEventModifiers, WKEventMouseButton, const void* clientInfo)
 {
-    return toPageUIClientEfl(clientInfo)->m_viewImpl->createNewPage(windowFeatures);
+    return toPageUIClientEfl(clientInfo)->m_viewImpl->createNewPage(toImpl(wkWindowFeatures));
 }
 
 void PageUIClientEfl::runJavaScriptAlert(WKPageRef, WKStringRef alertText, WKFrameRef, const void* clientInfo)
@@ -70,6 +71,62 @@ WKStringRef PageUIClientEfl::runJavaScriptPrompt(WKPageRef, WKStringRef message,
     return value ? WKStringCreateWithUTF8CString(value) : 0;
 }
 
+bool PageUIClientEfl::toolbarsAreVisible(WKPageRef, const void* clientInfo)
+{
+    EwkWindowFeatures* features = toPageUIClientEfl(clientInfo)->m_viewImpl->windowFeatures();
+    ASSERT(features);
+    return features->toolbarVisible();
+}
+
+void PageUIClientEfl::setToolbarsAreVisible(WKPageRef, bool toolbarVisible, const void* clientInfo)
+{
+    EwkWindowFeatures* features = toPageUIClientEfl(clientInfo)->m_viewImpl->windowFeatures();
+    ASSERT(features);
+    features->setToolbarVisible(toolbarVisible);
+}
+
+bool PageUIClientEfl::menuBarIsVisible(WKPageRef, const void* clientInfo)
+{
+    EwkWindowFeatures* features = toPageUIClientEfl(clientInfo)->m_viewImpl->windowFeatures();
+    ASSERT(features);
+    return features->menuBarVisible();
+}
+
+void PageUIClientEfl::setMenuBarIsVisible(WKPageRef, bool menuBarVisible, const void* clientInfo)
+{
+    EwkWindowFeatures* features = toPageUIClientEfl(clientInfo)->m_viewImpl->windowFeatures();
+    ASSERT(features);
+    features->setMenuBarVisible(menuBarVisible);
+}
+
+bool PageUIClientEfl::statusBarIsVisible(WKPageRef, const void* clientInfo)
+{
+    EwkWindowFeatures* features = toPageUIClientEfl(clientInfo)->m_viewImpl->windowFeatures();
+    ASSERT(features);
+    return features->statusBarVisible();
+}
+
+void PageUIClientEfl::setStatusBarIsVisible(WKPageRef, bool statusBarVisible, const void* clientInfo)
+{
+    EwkWindowFeatures* features = toPageUIClientEfl(clientInfo)->m_viewImpl->windowFeatures();
+    ASSERT(features);
+    features->setStatusBarVisible(statusBarVisible);
+}
+
+bool PageUIClientEfl::isResizable(WKPageRef, const void* clientInfo)
+{
+    EwkWindowFeatures* features = toPageUIClientEfl(clientInfo)->m_viewImpl->windowFeatures();
+    ASSERT(features);
+    return features->resizable();
+}
+
+void PageUIClientEfl::setIsResizable(WKPageRef, bool resizable, const void* clientInfo)
+{
+    EwkWindowFeatures* features = toPageUIClientEfl(clientInfo)->m_viewImpl->windowFeatures();
+    ASSERT(features);
+    features->setResizable(resizable);
+}
+
 #if ENABLE(INPUT_TYPE_COLOR)
 void PageUIClientEfl::showColorPicker(WKPageRef, WKStringRef initialColor, WKColorPickerResultListenerRef listener, const void* clientInfo)
 {
@@ -141,6 +198,14 @@ PageUIClientEfl::PageUIClientEfl(EwkViewImpl* viewImpl)
     uiClient.runJavaScriptAlert = runJavaScriptAlert;
     uiClient.runJavaScriptConfirm = runJavaScriptConfirm;
     uiClient.runJavaScriptPrompt = runJavaScriptPrompt;
+    uiClient.toolbarsAreVisible = toolbarsAreVisible;
+    uiClient.setToolbarsAreVisible = setToolbarsAreVisible;
+    uiClient.menuBarIsVisible = menuBarIsVisible;
+    uiClient.setMenuBarIsVisible = setMenuBarIsVisible;
+    uiClient.statusBarIsVisible = statusBarIsVisible;
+    uiClient.setStatusBarIsVisible = setStatusBarIsVisible;
+    uiClient.isResizable = isResizable;
+    uiClient.setIsResizable = setIsResizable;
     uiClient.takeFocus = takeFocus;
     uiClient.focus = focus;
     uiClient.unfocus = unfocus;
index 2f54192a2ae0fb7039e12bc914b678c8367f816b..e68414acfb7488a3eb97ffb48e784e010105aaaf 100644 (file)
@@ -50,6 +50,14 @@ private:
     static void runJavaScriptAlert(WKPageRef, WKStringRef, WKFrameRef, const void*);
     static bool runJavaScriptConfirm(WKPageRef, WKStringRef, WKFrameRef, const void*);
     static WKStringRef runJavaScriptPrompt(WKPageRef, WKStringRef, WKStringRef, WKFrameRef, const void*);
+    static bool toolbarsAreVisible(WKPageRef, const void* clientInfo);
+    static void setToolbarsAreVisible(WKPageRef, bool, const void* clientInfo);
+    static bool menuBarIsVisible(WKPageRef, const void* clientInfo);
+    static void setMenuBarIsVisible(WKPageRef, bool, const void* clientInfo);
+    static bool statusBarIsVisible(WKPageRef, const void* clientInfo);
+    static void setStatusBarIsVisible(WKPageRef, bool, const void* clientInfo);
+    static bool isResizable(WKPageRef, const void* clientInfo);
+    static void setIsResizable(WKPageRef, bool, const void* clientInfo);
 #if ENABLE(INPUT_TYPE_COLOR)
     static void showColorPicker(WKPageRef, WKStringRef initialColor, WKColorPickerResultListenerRef, const void*);
     static void hideColorPicker(WKPageRef, const void*);
index a1b8fe86411fbe2262f4fdf4a299e113b08f12cd..412c66ba576706b924f9c42167a67a3a4ac738f7 100644 (file)
@@ -1,3 +1,17 @@
+2012-11-20  Jinwoo Song  <jinwoo7.song@samsung.com>
+
+        [EFL][WK2] Add Ewk_Window_Features API and related UI callbacks
+        https://bugs.webkit.org/show_bug.cgi?id=99114
+
+        Reviewed by Gyuyoung Kim.
+
+        Implemented window_create and window_close smartcallback functions.
+
+        * MiniBrowser/efl/main.c:
+        (on_window_create):
+        (on_window_close):
+        (window_create):
+
 2012-11-20  Ojan Vafai  <ojan@chromium.org>
 
         Simplify builder filters now that we have lists of which builders run which tests
index 92d3f2ff9f3e426ca5a8971310a384566a04c87d..11f065c344d9e1c28b2544b6f1de6c2ed14aa7cd 100644 (file)
@@ -284,20 +284,6 @@ on_back_forward_list_changed(void *user_data, Evas_Object *ewk_view, void *event
     elm_object_disabled_set(window->forward_button, !ewk_view_forward_possible(ewk_view));
 }
 
-static Evas_Object*
-on_new_window(Ewk_View_Smart_Data *sd, Evas_Coord width, Evas_Coord height)
-{
-    Browser_Window *window = window_create(NULL, width, height);
-    windows = eina_list_append(windows, window);
-    return window->ewk_view;
-}
-
-static void
-on_close_window(void *user_data, Evas_Object *ewk_view, void *event_info)
-{
-    window_close((Browser_Window *)user_data);
-}
-
 static void
 on_progress(void *user_data, Evas_Object *ewk_view, void *event_info)
 {
@@ -763,6 +749,39 @@ static Eina_Bool on_fullscreen_exit(Ewk_View_Smart_Data *sd)
     return EINA_TRUE;
 }
 
+static Evas_Object *
+on_window_create(Ewk_View_Smart_Data *smartData, const Ewk_Window_Features *window_features)
+{
+    int x = 0;
+    int y = 0;
+    int width = 0;
+    int height = 0;
+
+    ewk_window_features_geometry_get(window_features, &x, &y, &width, &height);
+
+    if (!width)
+        width = window_width;
+
+    if (!height)
+        height = window_height;
+
+    Browser_Window *window = window_create(NULL, width, height);
+    Evas_Object *new_view = window->ewk_view;
+
+    windows = eina_list_append(windows, window);
+
+    info("minibrowser: location(%d,%d) size=(%d,%d)\n", x, y, width, height);
+
+    return new_view;
+}
+
+static void
+on_window_close(Ewk_View_Smart_Data *smartData)
+{
+    Browser_Window *window = window_find_with_ewk_view(smartData->self);
+    window_close(window);
+}
+
 static void
 auth_popup_close(Auth_Data *auth_data)
 {
@@ -1030,7 +1049,8 @@ static Browser_Window *window_create(const char *url, int width, int height)
     ewkViewClass->window_geometry_set = on_window_geometry_set;
     ewkViewClass->fullscreen_enter = on_fullscreen_enter;
     ewkViewClass->fullscreen_exit = on_fullscreen_exit;
-    ewkViewClass->window_create_new = on_new_window;
+    ewkViewClass->window_create = on_window_create;
+    ewkViewClass->window_close = on_window_close;
 
     Evas *evas = evas_object_evas_get(window->elm_window);
     Evas_Smart *smart = evas_smart_class_new(&ewkViewClass->sc);
@@ -1047,7 +1067,6 @@ static Browser_Window *window_create(const char *url, int width, int height)
     ewk_settings_preferred_minimum_contents_width_set(settings, 0);
 
     evas_object_smart_callback_add(window->ewk_view, "authentication,request", on_authentication_request, window);
-    evas_object_smart_callback_add(window->ewk_view, "close,window", on_close_window, window);
     evas_object_smart_callback_add(window->ewk_view, "download,failed", on_download_failed, window);
     evas_object_smart_callback_add(window->ewk_view, "download,finished", on_download_finished, window);
     evas_object_smart_callback_add(window->ewk_view, "download,request", on_download_request, window);