#include "browser/web_view_browser_message_filter.h"
+#include "browser/sound_effect.h"
#include "common/web_contents_utils.h"
#include "common/render_messages_ewk.h"
#include "common/error_params.h"
web_view_->InvokePlainTextGetCallback(content_text, plain_text_get_callback_id);
}
+ void OnPlayLinkEffect() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ sound_effect::playLinkEffect();
+ }
+
void OnWebAppIconUrlGet(const std::string &icon_url, int callback_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (web_view_)
case EwkViewMsg_DidFailLoadWithError::ID:
case EwkViewHostMsg_HitTestAsyncReply::ID:
case EwkHostMsg_PlainTextGetContents::ID:
+ case EwkHostMsg_PlayLinkEffect::ID:
case EwkHostMsg_WebAppIconUrlGet::ID:
case EwkHostMsg_WebAppIconUrlsGet::ID:
case EwkHostMsg_WebAppCapableGet::ID:
WebViewBrowserMessageFilterPrivate::OnReceivedDidFailLoadWithError)
IPC_MESSAGE_FORWARD(EwkHostMsg_PlainTextGetContents, private_,
WebViewBrowserMessageFilterPrivate::OnPlainTextGetContents)
+ IPC_MESSAGE_FORWARD(EwkHostMsg_PlayLinkEffect, private_,
+ WebViewBrowserMessageFilterPrivate::OnPlayLinkEffect)
IPC_MESSAGE_FORWARD(EwkHostMsg_WebAppIconUrlGet, private_,
WebViewBrowserMessageFilterPrivate::OnWebAppIconUrlGet)
IPC_MESSAGE_FORWARD(EwkHostMsg_WebAppIconUrlsGet, private_,
IPC_STRUCT_TRAITS_BEGIN(tizen_webview::Settings)
IPC_STRUCT_TRAITS_MEMBER(javascript_can_open_windows)
+ IPC_STRUCT_TRAITS_MEMBER(link_effect_enabled)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(ErrorParams)
IPC_MESSAGE_ROUTED1(EflViewMsg_UpdateSettings, tizen_webview::Settings)
+IPC_MESSAGE_ROUTED0(EwkHostMsg_PlayLinkEffect)
+
IPC_MESSAGE_ROUTED2(EwkHostMsg_PlainTextGetContents,
std::string, /* contentText */
int /* callback id */)
, m_useKeyPadWithoutUserAction(true)
, m_textStyleState(true)
, m_autoFitting(false)
- , m_linkEffectEnabled(true)
, m_detectContentsAutomatically(true)
, m_evas_object(evas_object)
#if defined(OS_TIZEN_TV)
void setTextStyleStateState(bool enable) { m_textStyleState = enable; }
bool autoFitting() const {return m_autoFitting; }
void setAutoFitting(bool enable) {m_autoFitting = enable; }
- bool linkEffectEnabled() const { return m_linkEffectEnabled; }
- void setLinkEffectEnabled(bool flag) { m_linkEffectEnabled = flag; }
void setSpdyEnabled(bool flag);
void setDetectContentsAutomatically(bool enable) { m_detectContentsAutomatically = enable; }
bool detectContentsAutomatically() const { return m_detectContentsAutomatically; }
bool m_useKeyPadWithoutUserAction;
bool m_textStyleState;
bool m_autoFitting;
- bool m_linkEffectEnabled;
bool m_detectContentsAutomatically;
Evas_Object* m_evas_object;
Eina_Bool ewk_settings_link_effect_enabled_set(Ewk_Settings* settings, Eina_Bool linkEffectEnabled)
{
- EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
- settings->setLinkEffectEnabled(linkEffectEnabled);
- return true;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
+ settings->getWebViewSettings().link_effect_enabled = linkEffectEnabled;
+ ewkUpdateWebkitPreferences(settings->getEvasObject());
+ return true;
}
Eina_Bool ewk_settings_link_effect_enabled_get(const Ewk_Settings* settings)
{
- EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
- return settings->linkEffectEnabled();
+ EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
+ return settings->getWebViewSettings().link_effect_enabled ? true : false;
}
Eina_Bool ewk_settings_uses_encoding_detector_set(Ewk_Settings* settings, Eina_Bool use)
#include "third_party/WebKit/public/web/WebFormElement.h"
#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebHitTestResult.h"
+#include "third_party/WebKit/public/web/WebInputEvent.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebPageSerializer.h"
#include "third_party/WebKit/public/web/WebView.h"
: 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)
{
}
Send(new EwkHostMsg_WebAppCapableGet(render_view()->GetRoutingID(), capable, callback_id));
}
+void RenderViewObserverEfl::DidHandleGestureEvent(const blink::WebGestureEvent& event)
+{
+ if (event.type == blink::WebInputEvent::GestureTap)
+ HandleTap(event);
+}
+
void RenderViewObserverEfl::OnSetBrowserFont()
{
#if !defined(EWK_BRINGUP)
if (renderer_client_) {
static_cast<ContentRendererClientEfl*>(renderer_client_)->SetWebViewSettings(settings);
}
+ link_effect_enabled_ = settings.link_effect_enabled;
+}
+
+void RenderViewObserverEfl::HandleTap(const blink::WebGestureEvent& event)
+{
+ if (link_effect_enabled_) {
+ const blink::WebHitTestResult web_hit_test_result =
+ render_view()->GetWebView()->hitTestResultAt(
+ blink::WebPoint(event.x, event.y));
+
+ if (!web_hit_test_result.absoluteLinkURL().isEmpty()) {
+ // we are on a link
+ Send(new EwkHostMsg_PlayLinkEffect(render_view()->GetRoutingID()));
+ }
+ }
}
class Settings;
}
+namespace blink {
+class WebGestureEvent;
+}
+
class EwkViewMsg_LoadData_Params;
class Hit_Test_Params;
//So using this notification to update minimum and maximum page scale factor values
virtual void DidUpdateLayout() override;
+ void DidHandleGestureEvent(const blink::WebGestureEvent& event) override;
+
private:
void OnSetContentSecurityPolicy(const std::string& policy, Ewk_CSP_Header_Type header_type);
void OnScale(double scale_factor, int x, int y);
void OnResumeScheduledTasks();
void OnUpdateSettings(const tizen_webview::Settings& settings);
+ void HandleTap(const blink::WebGestureEvent& event);
+
// This function sets CSS "view-mode" media feature value.
void OnSetViewMode(blink::WebViewMode view_mode);
gfx::Size last_sent_contents_size_;
base::OneShotTimer<RenderViewObserverEfl> check_contents_size_timer_;
+ bool link_effect_enabled_;
+
content::ContentRendererClient* renderer_client_;
};
namespace tizen_webview {
struct Settings {
- Settings() : javascript_can_open_windows(false) {}
+ Settings()
+ : javascript_can_open_windows(false),
+ link_effect_enabled(true) {}
+
bool javascript_can_open_windows;
+ bool link_effect_enabled;
};
} // namespace tizen_webview