Reviewed by Antonio Gomes.
[EFL] Sets default user agent
https://bugs.webkit.org/show_bug.cgi?id=47903
Add macros for WebKit EFL and User Agent.
* cmake/OptionsEfl.cmake:
* cmakeconfig.h.cmake:
2010-12-22 Gyuyoung Kim <gyuyoung.kim@samsung.com>
Reviewed by Antonio Gomes.
[EFL] Sets default user agent
https://bugs.webkit.org/show_bug.cgi?id=47903
If applcation(e.g EWebLauncher) doesn't set user agent, WebKit EFL doesn't
set user agent. However, we need to set user agent by default. Because, some
web sites send different pages according to user agent.
* ewk/ewk_private.h:
* ewk/ewk_settings.cpp:
(_ewk_settings_webkit_platform):
(_ewk_settings_webkit_os_version):
(ewk_settings_default_user_agent_get):
* ewk/ewk_view.cpp:
(_ewk_view_priv_new):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74467
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2010-12-22 Gyuyoung Kim <gyuyoung.kim@samsung.com>
+
+ Reviewed by Antonio Gomes.
+
+ [EFL] Sets default user agent
+ https://bugs.webkit.org/show_bug.cgi?id=47903
+
+ Add macros for WebKit EFL and User Agent.
+
+ * cmake/OptionsEfl.cmake:
+ * cmakeconfig.h.cmake:
+
2010-12-20 Adam Barth <abarth@webkit.org>
Move web sites to Websites directory
+2010-12-22 Gyuyoung Kim <gyuyoung.kim@samsung.com>
+
+ Reviewed by Antonio Gomes.
+
+ [EFL] Sets default user agent
+ https://bugs.webkit.org/show_bug.cgi?id=47903
+
+ If applcation(e.g EWebLauncher) doesn't set user agent, WebKit EFL doesn't
+ set user agent. However, we need to set user agent by default. Because, some
+ web sites send different pages according to user agent.
+
+ * ewk/ewk_private.h:
+ * ewk/ewk_settings.cpp:
+ (_ewk_settings_webkit_platform):
+ (_ewk_settings_webkit_os_version):
+ (ewk_settings_default_user_agent_get):
+ * ewk/ewk_view.cpp:
+ (_ewk_view_priv_new):
+
2010-12-16 Leandro Pereira <leandro@profusion.mobi>
[EFL] Unreviewed build fix.
WebCore::FloatRect ewk_view_page_rect_get(Evas_Object *o);
+const char* ewk_settings_default_user_agent_get();
+
#ifdef __cplusplus
}
#include "Image.h"
#include "IntSize.h"
#include "KURL.h"
+#include "Language.h"
#include "ewk_private.h"
-#include <wtf/text/CString.h>
+#include <Eina.h>
#include <eina_safety_checks.h>
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <sys/utsname.h>
#include <unistd.h>
+#include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
#if USE(SOUP)
#include "ResourceHandle.h"
static const char* _ewk_icon_database_path = 0;
static uint64_t _ewk_default_web_database_quota = 1 * 1024 * 1024;
+static WTF::String _ewk_settings_webkit_platform_get()
+{
+ WTF::String ua_platform;
+#if PLATFORM(X11)
+ ua_platform = "X11";
+#else
+ ua_platform = "Unknown";
+#endif
+ return ua_platform;
+}
+
+static WTF::String _ewk_settings_webkit_os_version_get()
+{
+ WTF::String ua_os_version;
+ struct utsname name;
+
+ if (uname(&name) != -1)
+ ua_os_version = WTF::String(name.sysname) + " " + WTF::String(name.machine);
+ else
+ ua_os_version = "Unknown";
+
+ return ua_os_version;
+}
+
/**
* Returns the default quota for Web Database databases. By default
* this value is 1MB.
EINA_SAFETY_ON_TRUE_RETURN(1);
#endif
}
+
+/**
+* @internal
+* Gets the default user agent string.
+*
+* @return A pointer to an eina_stringshare containing the user agent string.
+*/
+const char* ewk_settings_default_user_agent_get()
+{
+ WTF::String ua_version = makeString(String::number(WEBKIT_USER_AGENT_MAJOR_VERSION), '.', String::number(WEBKIT_USER_AGENT_MINOR_VERSION), '+');
+ WTF::String static_ua = makeString("Mozilla/5.0 (", _ewk_settings_webkit_platform_get(), "; U; ", _ewk_settings_webkit_os_version_get(), "; ", WebCore::defaultLanguage(), ") AppleWebKit/", ua_version) + makeString(" (KHTML, like Gecko) Version/5.0 Safari/", ua_version);
+
+ return eina_stringshare_add(static_ua.utf8().data());
+}
priv->settings.page_cache = priv->page_settings->usesPageCache();
priv->settings.encoding_detector = priv->page_settings->usesEncodingDetector();
+ priv->settings.user_agent = ewk_settings_default_user_agent_get();
+
// Since there's no scale separated from zooming in webkit-efl, this functionality of
// viewport meta tag is implemented using zoom. When scale zoom is supported by webkit-efl,
// this functionality will be modified by the scale zoom patch.
SET(PROJECT_VERSION_PATCH 0)
SET(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
+# -----------------------------------------------------------------------------
+# We mention Safari version because many sites check for it.
+# Sync with WebCore/Configurations/Version.xcconfig whenever Safari is version
+# up.
+# -----------------------------------------------------------------------------
+SET(USER_AGENT_VERSION_MAJOR 534)
+SET(USER_AGENT_VERSION_MINOR 16)
+
ADD_DEFINITIONS(-DWTF_PLATFORM_EFL=1)
SET(WTF_PLATFORM_EFL 1)
#ifndef CMAKECONFIG_H
#define CMAKECONFIG_H
+#define WEBKIT_USER_AGENT_MAJOR_VERSION @USER_AGENT_VERSION_MAJOR@
+#define WEBKIT_USER_AGENT_MINOR_VERSION @USER_AGENT_VERSION_MINOR@
+
#define ENABLE_AS_IMAGE @ENABLE_AS_IMAGE_VALUE@
#define ENABLE_BLOB @ENABLE_BLOB_VALUE@
#define ENABLE_CHANNEL_MESSAGING @ENABLE_CHANNEL_MESSAGING_VALUE@