From 44d5e8905fe11ffae89ec212501e505c26fcd0ae Mon Sep 17 00:00:00 2001 From: "zhishun.zhou" Date: Sat, 18 Oct 2014 17:46:54 +0800 Subject: [PATCH] [Tizen] Implement EWK API for window features This patch implements EWK API for window features. This is code migration from m34 beta to DEV, Origin patch patch info: http://suprem.sec.samsung.net/gerrit/#/c/6721 and http://suprem.sec.samsung.net/gerrit/#/c/6726 Bug: http://107.108.218.239/bugzilla/show_bug.cgi?id=7782 Reviewed by: Antonio Gomes Change-Id: I1b9cdcc0d4435073b32a547b95e81256c65d335f Signed-off-by: zhishun.zhou --- .../efl_integration/public/ewk_window_features.cc | 28 +++++---- .../efl_integration/public/ewk_window_features.h | 4 +- tizen_src/impl/API/ewk_window_features_private.h | 66 ++++++++++++++++++++++ tizen_src/impl/chromium-efl.gyp | 1 + tizen_src/impl/eweb_view_callbacks.h | 10 ++-- 5 files changed, 87 insertions(+), 22 deletions(-) create mode 100644 tizen_src/impl/API/ewk_window_features_private.h diff --git a/tizen_src/ewk/efl_integration/public/ewk_window_features.cc b/tizen_src/ewk/efl_integration/public/ewk_window_features.cc index 2b4901d..ce47a76 100644 --- a/tizen_src/ewk/efl_integration/public/ewk_window_features.cc +++ b/tizen_src/ewk/efl_integration/public/ewk_window_features.cc @@ -23,31 +23,30 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if !defined(EWK_BRINGUP) #include "ewk_window_features.h" #include <../impl/API/ewk_window_features_private.h> #include "eweb_view.h" -void _EWK_Window_Features::setToolbarVisible(bool toolbar_visible) +void _Ewk_Window_Features::setToolbarVisible(bool toolbar_visible) { - toolBar_Visible_ = toolbar_visible; + toolbar_visible_ = toolbar_visible; view_->SmartCallback().call(&toolbar_visible); } -void _EWK_Window_Features::setStatusBarVisible(bool statusbar_visible) +void _Ewk_Window_Features::setStatusBarVisible(bool statusbar_visible) { - statusBar_Visible_ = statusbar_visible; + statusbar_visible_ = statusbar_visible; view_->SmartCallback().call(&statusbar_visible); } -void _EWK_Window_Features::setMenuBarVisible(bool menubar_visible) +void _Ewk_Window_Features::setMenuBarVisible(bool menubar_visible) { - menuBar_Visible_ = menubar_visible; + menubar_visible_ = menubar_visible; view_->SmartCallback().call(&menubar_visible); } -void _EWK_Window_Features::setResizable(bool resizable) +void _Ewk_Window_Features::setResizable(bool resizable) { resizable_ = resizable; view_->SmartCallback().call(&resizable); @@ -56,31 +55,31 @@ void _EWK_Window_Features::setResizable(bool resizable) Eina_Bool ewk_window_features_toolbar_visible_get(const Ewk_Window_Features* window_features) { EINA_SAFETY_ON_NULL_RETURN_VAL(window_features, false); - return window_features->toolBar_Visible_; + return window_features->toolbar_visible_; } Eina_Bool ewk_window_features_statusbar_visible_get(const Ewk_Window_Features* window_features) { EINA_SAFETY_ON_NULL_RETURN_VAL(window_features, false); - return window_features->statusBar_Visible_; + return window_features->statusbar_visible_; } Eina_Bool ewk_window_features_scrollbars_visible_get(const Ewk_Window_Features* window_features) { EINA_SAFETY_ON_NULL_RETURN_VAL(window_features, false); - return window_features->scrollBar_Visible_; + return window_features->scrollbar_visible_; } Eina_Bool ewk_window_features_menubar_visible_get(const Ewk_Window_Features* window_features) { EINA_SAFETY_ON_NULL_RETURN_VAL(window_features, false); - return window_features->menuBar_Visible_; + return window_features->menubar_visible_; } Eina_Bool ewk_window_features_locationbar_visible_get(const Ewk_Window_Features* window_features) { EINA_SAFETY_ON_NULL_RETURN_VAL(window_features, false); - return window_features->locationBar_Visible_; + return window_features->locationbar_visible_; } Eina_Bool ewk_window_features_resizable_get(const Ewk_Window_Features* window_features) @@ -92,7 +91,7 @@ Eina_Bool ewk_window_features_resizable_get(const Ewk_Window_Features* window_fe Eina_Bool ewk_window_features_fullscreen_get(const Ewk_Window_Features* window_features) { EINA_SAFETY_ON_NULL_RETURN_VAL(window_features, false); - return window_features->fullScreen_; + return window_features->fullscreen_; } void ewk_window_features_geometry_get(const Ewk_Window_Features* window_features, float* x, float* y, float* width, float* height) @@ -109,4 +108,3 @@ void ewk_window_features_geometry_get(const Ewk_Window_Features* window_features *height = window_features->height_; } -#endif diff --git a/tizen_src/ewk/efl_integration/public/ewk_window_features.h b/tizen_src/ewk/efl_integration/public/ewk_window_features.h index 171adf7..571d54d 100644 --- a/tizen_src/ewk/efl_integration/public/ewk_window_features.h +++ b/tizen_src/ewk/efl_integration/public/ewk_window_features.h @@ -31,7 +31,6 @@ #ifndef ewk_window_features_h #define ewk_window_features_h -#if !defined(EWK_BRINGUP) #include #include @@ -49,7 +48,7 @@ extern "C" { //EwkObject is removed or deprecated //typedef struct EwkObject Ewk_Window_Features; -typedef struct _EWK_Window_Features Ewk_Window_Features; +typedef struct _Ewk_Window_Features Ewk_Window_Features; /** * Queries the toolbar visibility of the window feature. @@ -132,5 +131,4 @@ EAPI void ewk_window_features_geometry_get(const Ewk_Window_Features *window_fea } #endif -#endif // EWK_BRINGUP #endif // ewk_window_features_h diff --git a/tizen_src/impl/API/ewk_window_features_private.h b/tizen_src/impl/API/ewk_window_features_private.h new file mode 100644 index 0000000..5ce09d6 --- /dev/null +++ b/tizen_src/impl/API/ewk_window_features_private.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2014 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 + +class EWebView; + +struct _Ewk_Window_Features{ + _Ewk_Window_Features(EWebView* ewk_view) + : view_(ewk_view) + , x_(0), y_(0), width_(0), height_(0), menubar_visible_(true) + , statusbar_visible_(true), toolbar_visible_(true), locationbar_visible_(true) + , scrollbar_visible_(true), resizable_(true), fullscreen_(false) + { + } + + ~_Ewk_Window_Features() + { + } + + void setToolbarVisible(bool toolbar_visible); + void setStatusBarVisible(bool statusbar_visible); + void setMenuBarVisible(bool menubar_visible); + void setResizable(bool resizable); + + EWebView* view_; + + float x_; + float y_; + float width_; + float height_; + + bool menubar_visible_; + bool statusbar_visible_; + bool toolbar_visible_; + bool locationbar_visible_; + bool scrollbar_visible_; + bool resizable_; + bool fullscreen_; + +}; + +#endif //ewk_window_features_private_h diff --git a/tizen_src/impl/chromium-efl.gyp b/tizen_src/impl/chromium-efl.gyp index f888365..f89a841 100644 --- a/tizen_src/impl/chromium-efl.gyp +++ b/tizen_src/impl/chromium-efl.gyp @@ -87,6 +87,7 @@ 'API/ewk_user_media_private.h', 'API/ewk_web_application_icon_data_private.h', 'API/ewk_web_application_icon_data_private.cc', + 'API/ewk_window_features_private.h', 'EdgeEffect.cpp', 'EdgeEffect.h', 'browser/autofill/autofill_manager_delegate_efl.cc', diff --git a/tizen_src/impl/eweb_view_callbacks.h b/tizen_src/impl/eweb_view_callbacks.h index ba69f1b..638b53d 100644 --- a/tizen_src/impl/eweb_view_callbacks.h +++ b/tizen_src/impl/eweb_view_callbacks.h @@ -217,14 +217,10 @@ DECLARE_EWK_VIEW_CALLBACK(NewFormSubmissionRequest, "form,submission,request", E DECLARE_EWK_VIEW_CALLBACK(FaviconChanged, "favicon,changed", void); DECLARE_EWK_VIEW_CALLBACK(LoadError, "load,error", Ewk_Error*); DECLARE_EWK_VIEW_CALLBACK(ProvisionalLoadFailed, "load,provisional,failed", Ewk_Error*); -DECLARE_EWK_VIEW_CALLBACK(MenuBarVisible, "menubar,visible", bool*); DECLARE_EWK_VIEW_CALLBACK(NavigationPolicyDecision, "policy,decision,navigation", Ewk_Navigation_Policy_Decision*); -DECLARE_EWK_VIEW_CALLBACK(StatusBarVisible, "statusbar,visible", bool*); DECLARE_EWK_VIEW_CALLBACK(TextFound, "text,found", unsigned*); -DECLARE_EWK_VIEW_CALLBACK(ToolbarVisible, "toolbar,visible", bool*); DECLARE_EWK_VIEW_CALLBACK(TooltipTextUnset, "tooltip,text,unset", void); DECLARE_EWK_VIEW_CALLBACK(Vibrate, "vibrate", uint32_t*); -DECLARE_EWK_VIEW_CALLBACK(WindowResizable, "window,resizable", bool*); */ // Note: type 'void' means that no arguments are expected. @@ -299,6 +295,12 @@ DECLARE_EWK_VIEW_CALLBACK(WebloginReady, "weblogin,ready" , void); #if defined(OS_TIZEN_TV) DECLARE_EWK_VIEW_CALLBACK(NewWindowNavigationPolicyDecision, "policy,decision,new,window", Ewk_Navigation_Policy_Decision*); #endif // OS_TIZEN_TV + +DECLARE_EWK_VIEW_CALLBACK(MenuBarVisible, "menubar,visible", bool*); +DECLARE_EWK_VIEW_CALLBACK(StatusBarVisible, "statusbar,visible", bool*); +DECLARE_EWK_VIEW_CALLBACK(ToolbarVisible, "toolbar,visible", bool*); +DECLARE_EWK_VIEW_CALLBACK(WindowResizable, "window,resizable", bool*); + } #endif -- 2.7.4