if (!web_view_)
return;
- if (is_link && web_view_->GetSettings()->getWebViewSettings().link_effect_enabled)
+ if (is_link && web_view_->GetSettings()->getLinkEffectEnabled())
sound_effect::playLinkEffect();
web_view_->HandleTapGestureForSelection(is_content_editable);
}
#include "common/error_params.h"
#include "common/cache_params_efl.h"
#include "common/navigation_policy_params.h"
-#include "common/web_view_settings.h"
+#include "common/web_preferences_efl.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_channel_handle.h"
#include "private/ewk_hit_test_private.h"
IPC_STRUCT_TRAITS_MEMBER(reference_id)
IPC_STRUCT_TRAITS_END()
-IPC_STRUCT_TRAITS_BEGIN(WebViewSettings)
- IPC_STRUCT_TRAITS_MEMBER(javascript_can_open_windows)
- IPC_STRUCT_TRAITS_MEMBER(link_effect_enabled)
+IPC_STRUCT_TRAITS_BEGIN(WebPreferencesEfl)
+ IPC_STRUCT_TRAITS_MEMBER(shrinks_viewport_content_to_fit)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(ErrorParams)
IPC_MESSAGE_ROUTED1(EwkViewMsg_SelectionTextStyleState,
SelectionStylePrams /* params */)
-IPC_MESSAGE_ROUTED1(EflViewMsg_UpdateSettings, WebViewSettings)
+IPC_MESSAGE_ROUTED1(EwkSettingsMsg_UpdateWebKitPreferencesEfl, WebPreferencesEfl)
IPC_MESSAGE_ROUTED2(EwkHostMsg_HandleTapGestureWithContext,
bool /* is_link */,
--- /dev/null
+// Copyright (c) 2014, 2015 Samsung Electronics Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEB_PREFERENCES_EFL_H
+#define WEB_PREFERENCES_EFL_H
+
+// Contains settings from Ewk_Settings that do not belong to content::WebPreferences
+// and need to be sent to renderer.
+struct WebPreferencesEfl {
+ bool shrinks_viewport_content_to_fit =
+#if defined(OS_TIZEN_MOBILE)
+ true;
+#else
+ false;
+#endif
+};
+
+#endif // WEB_PREFERENCES_EFL_H
+++ /dev/null
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef WEB_VIEW_SETTINGS_H
-#define WEB_VIEW_SETTINGS_H
-
-struct WebViewSettings {
- WebViewSettings()
- : javascript_can_open_windows(false),
- link_effect_enabled(true) {}
-
- bool javascript_can_open_windows;
- bool link_effect_enabled;
-};
-
-#endif // WEB_VIEW_SETTINGS_H
'common/version_info.cc',
'common/web_contents_utils.cc',
'common/web_contents_utils.h',
- 'common/web_view_settings.h',
+ 'common/web_preferences_efl.h',
'private/back_forward_list.h',
'private/ewk_auth_challenge_private.h',
render_view_host->UpdateWebkitPreferences(settings_->getPreferences());
IPC::Message* message =
- new EflViewMsg_UpdateSettings(render_view_host->GetRoutingID(),
- settings_->getWebViewSettings());
+ new EwkSettingsMsg_UpdateWebKitPreferencesEfl(render_view_host->GetRoutingID(),
+ settings_->getPreferencesEfl());
if (render_view_host->IsRenderViewLive()) {
render_view_host->Send(message);
#include <Eina.h>
#include <Evas.h>
-#include "common/web_view_settings.h"
#include <content/public/common/web_preferences.h>
+#include "common/web_preferences_efl.h"
#include "public/ewk_settings.h"
class Ewk_Settings {
, m_defaultKeypadEnabled(true)
, m_useKeyPadWithoutUserAction(true)
, m_textStyleState(true)
- , m_autoFitting(false)
, m_detectContentsAutomatically(true)
, m_evas_object(evas_object)
#if defined(OS_TIZEN_TV)
, m_openPanelEnabled(true)
, m_allowRestrictedURL(true)
, m_URLBarHide(false)
+ , m_linkEffectEnabled(true)
{ }
const char* defaultTextEncoding() const {
void setUseKeyPadWithoutUserAction(bool enable) { m_useKeyPadWithoutUserAction = enable; }
bool textStyleStateState() const { return m_textStyleState; }
void setTextStyleStateState(bool enable) { m_textStyleState = enable; }
- bool autoFitting() const {return m_autoFitting; }
- void setAutoFitting(bool enable) {m_autoFitting = enable; }
void setSpdyEnabled(bool flag);
void setDetectContentsAutomatically(bool enable) { m_detectContentsAutomatically = enable; }
bool detectContentsAutomatically() const { return m_detectContentsAutomatically; }
- WebViewSettings& getWebViewSettings() { return m_settings; }
- const WebViewSettings& getWebViewSettings() const { return m_settings; }
Evas_Object* getEvasObject() { return m_evas_object; }
+
content::WebPreferences& getPreferences() { return m_preferences; }
const content::WebPreferences& getPreferences() const { return m_preferences; }
+
+ WebPreferencesEfl& getPreferencesEfl() { return m_preferences_efl; }
+ const WebPreferencesEfl& getPreferencesEfl() const { return m_preferences_efl; }
+
#if defined(OS_TIZEN_TV)
void setCacheBuilderEnabled(bool enable) { m_cacheBuilderEnabled = enable; }
#endif
bool getAllowRestrictedURLEnabled() const { return m_allowRestrictedURL; }
void setURLBarHideEnabled(bool enable) { m_URLBarHide = enable; }
bool getURLBarHideEnabled() const { return m_URLBarHide; }
+ void setLinkEffectEnabled(bool enable) { m_linkEffectEnabled = enable; }
+ bool getLinkEffectEnabled() const { return m_linkEffectEnabled; }
private:
content::WebPreferences m_preferences;
- WebViewSettings m_settings;
+ WebPreferencesEfl m_preferences_efl;
+
bool m_autofillPasswordForm;
bool m_formCandidateData;
bool m_autofillProfileForm;
bool m_openPanelEnabled;
bool m_allowRestrictedURL;
bool m_URLBarHide;
+ bool m_linkEffectEnabled;
};
#endif // ewk_settings_private_h
Eina_Bool ewk_settings_auto_fitting_set(Ewk_Settings* settings, Eina_Bool enable)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
- // FIXME: To be implemented when the functionality is required.
- // To be added in WebkitPreferences -> WebSettings -> Settings
- settings->setAutoFitting(enable);
- settings->getPreferences().initialize_at_minimum_page_scale = enable;
+ settings->getPreferencesEfl().shrinks_viewport_content_to_fit = enable;
ewkUpdateWebkitPreferences(settings->getEvasObject());
return true;
}
Eina_Bool ewk_settings_auto_fitting_get(const Ewk_Settings* settings)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
- // FIXME: To be implemented when the functionality is required.
- // To be added in WebkitPreferences -> WebSettings -> Settings
- return settings->autoFitting();
+ return settings->getPreferencesEfl().shrinks_viewport_content_to_fit;
}
Eina_Bool ewk_settings_force_zoom_set(Ewk_Settings* settings, Eina_Bool enable)
Eina_Bool ewk_settings_link_effect_enabled_set(Ewk_Settings* settings, Eina_Bool linkEffectEnabled)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
- settings->getWebViewSettings().link_effect_enabled = linkEffectEnabled;
- ewkUpdateWebkitPreferences(settings->getEvasObject());
+ settings->setLinkEffectEnabled(linkEffectEnabled);
return true;
}
Eina_Bool ewk_settings_link_effect_enabled_get(const Ewk_Settings* settings)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
- return settings->getWebViewSettings().link_effect_enabled ? true : false;
+ return settings->getLinkEffectEnabled();
}
Eina_Bool ewk_settings_uses_encoding_detector_set(Ewk_Settings* settings, Eina_Bool use)
Eina_Bool ewk_settings_scripts_can_open_windows_set(Ewk_Settings* settings, Eina_Bool enable)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
- settings->getWebViewSettings().javascript_can_open_windows = (enable == true);
+ settings->getPreferences().javascript_can_open_windows_automatically = enable;
ewkUpdateWebkitPreferences(settings->getEvasObject());
return true;
}
Eina_Bool ewk_settings_scripts_can_open_windows_get(const Ewk_Settings* settings)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
- return settings->getWebViewSettings().javascript_can_open_windows ? true : false;
+ return settings->getPreferences().javascript_can_open_windows_automatically;
}
Eina_Bool ewk_settings_encoding_detector_enabled_set(Ewk_Settings* settings, Eina_Bool enable)
WrtWidget* wrt_widget_;
};
-ContentRendererClientEfl::ContentRendererClientEfl() {
+ContentRendererClientEfl::ContentRendererClientEfl()
+ : render_view_(nullptr) {
}
ContentRendererClientEfl::~ContentRendererClientEfl() {
}
void ContentRendererClientEfl::RenderViewCreated(content::RenderView* render_view) {
- content::RenderViewImpl* rvi = static_cast<content::RenderViewImpl*>(render_view);
- ApplyCustomSettings(rvi->webview());
+ ApplyCustomSettings(render_view->GetWebView());
// Deletes itself when render_view is destroyed.
new RenderViewObserverEfl(render_view, this);
#if !defined(EWK_BRINGUP)
render_view->SetWrtUrlParser(wrt_url_parser_.get());
#endif
+ render_view_ = render_view;
}
bool ContentRendererClientEfl::OverrideCreatePlugin(
return true;
}
+bool ContentRendererClientEfl::AllowPopup() {
+ return render_view_
+ ? render_view_->GetWebkitPreferences().javascript_can_open_windows_automatically
+ : false;
+}
+
void ContentRendererClientEfl::WillReleaseScriptContext(blink::WebFrame* frame,
v8::Handle<v8::Context> context,
int world_id) {
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTER_RENDERER_CLIENT_EFL_H
-#define CONTER_RENDERER_CLIENT_EFL_H
+#ifndef CONTENT_RENDERER_CLIENT_EFL_H
+#define CONTENT_RENDERER_CLIENT_EFL_H
-#include "common/web_view_settings.h"
#include "content/public/renderer/content_renderer_client.h"
#include "content/public/renderer/render_frame_observer.h"
#include "renderer/content_renderer_client_efl.h"
v8::Handle<v8::Context>,
int world_id);
- bool AllowPopup() override {
- return m_settings.javascript_can_open_windows;
- }
+ bool AllowPopup() override;
bool WillSendRequest(blink::WebFrame* frame,
ui::PageTransition transition_type,
size_t length) override;
bool IsLinkVisited(unsigned long long link_hash) override;
- void SetWebViewSettings(const WebViewSettings& settings) { m_settings = settings; }
blink::WebSpeechSynthesizer* OverrideSpeechSynthesizer(
blink::WebSpeechSynthesizerClient* client) override;
scoped_ptr<WrtUrlParseImpl> wrt_url_parser_;
scoped_ptr<RenderProcessObserverEfl> render_process_observer_;
scoped_ptr<visitedlink::VisitedLinkSlave> visited_link_slave_;
- WebViewSettings m_settings;
+ content::RenderView* render_view_;
};
#endif
#include "third_party/WebKit/public/web/WebPageSerializer.h"
#include "third_party/WebKit/public/web/WebView.h"
#include "third_party/WebKit/public/web/WebNodeList.h"
+#include "third_party/WebKit/public/web/WebSettings.h"
// XXX: config.h needs to be included before internal blink headers.
// It'd be great if we did not include not internal blibk headers.
: content::RenderViewObserver(render_view),
cached_min_page_scale_factor_(-1.0),
cached_max_page_scale_factor_(-1.0),
- link_effect_enabled_(true),
renderer_client_(render_client)
{
}
IPC_MESSAGE_HANDLER(EwkViewMsg_SetBrowserFont, OnSetBrowserFont);
IPC_MESSAGE_HANDLER(EwkViewMsg_SuspendScheduledTask, OnSuspendScheduledTasks);
IPC_MESSAGE_HANDLER(EwkViewMsg_ResumeScheduledTasks, OnResumeScheduledTasks);
- IPC_MESSAGE_HANDLER(EflViewMsg_UpdateSettings, OnUpdateSettings);
+ IPC_MESSAGE_HANDLER(EwkSettingsMsg_UpdateWebKitPreferencesEfl, OnUpdateWebKitPreferencesEfl);
IPC_MESSAGE_HANDLER(ViewMsg_SetViewMode, OnSetViewMode);
IPC_MESSAGE_UNHANDLED(handled = false)
view->setViewMode(view_mode);
}
-void RenderViewObserverEfl::OnUpdateSettings(const WebViewSettings& settings)
+void RenderViewObserverEfl::OnUpdateWebKitPreferencesEfl(const WebPreferencesEfl& web_preferences_efl)
{
- DCHECK(renderer_client_);
- if (renderer_client_) {
- static_cast<ContentRendererClientEfl*>(renderer_client_)->SetWebViewSettings(settings);
+ // FIXME(g.czajkowski@samsung.com) web_preferences_efl should be probably stored
+ // to be restored when new RenderView is being created.
+ // Otherwise, changed settings will *do not* apply to newly created WebView.
+ blink::WebView* view = render_view()->GetWebView();
+ if (view && view->settings()) {
+ view->settings()->setShrinksViewportContentToFit(web_preferences_efl.shrinks_viewport_content_to_fit);
+ // and more if they exist in web_preferences_efl.
}
- link_effect_enabled_ = settings.link_effect_enabled;
}
void RenderViewObserverEfl::HandleTap(const blink::WebGestureEvent& event)
#include <string>
#include "base/timer/timer.h"
+#include "common/web_preferences_efl.h"
#include "content/public/renderer/render_view_observer.h"
#include "content/public/renderer/render_view_observer.h"
#include "renderer/content_renderer_client_efl.h"
class EwkViewMsg_LoadData_Params;
class Hit_Test_Params;
-class WebViewSettings;
class RenderViewObserverEfl: public content::RenderViewObserver {
public:
void CheckContentsSize();
void OnSuspendScheduledTasks();
void OnResumeScheduledTasks();
- void OnUpdateSettings(const WebViewSettings& settings);
+ void OnUpdateWebKitPreferencesEfl(const WebPreferencesEfl&);
void HandleTap(const blink::WebGestureEvent& event);
gfx::Size last_sent_contents_size_;
base::OneShotTimer check_contents_size_timer_;
- bool link_effect_enabled_;
-
content::ContentRendererClient* renderer_client_;
};
ewk_settings_form_profile_data_enabled_set(GetEwkSettings(), true);
ewk_settings_form_candidate_data_enabled_set(GetEwkSettings(), true);
+ // Auto fit is already turned on for mobile, enable it for "ubrowser --mobile" as well.
+ ewk_settings_auto_fitting_set(GetEwkSettings(), !browser_.IsDesktop());
+
if (elm_win_wm_rotation_supported_get(window_)) {
static const int rots[] = {0, 90, 270};
elm_win_wm_rotation_available_rotations_set(