[WebKit2] [GTK] Add API for controlling the user agent
authormrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Sep 2012 02:37:21 +0000 (02:37 +0000)
committermrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Sep 2012 02:37:21 +0000 (02:37 +0000)
commit0847251a34c9f7dabbfe3b319416a654262ddf1d
tree26739660293ab6849c480795429df6954b1e2cff
parentda89af4b091f23f20ee824e58afc58a24b728973
[WebKit2] [GTK] Add API for controlling the user agent
https://bugs.webkit.org/show_bug.cgi?id=95697

Reviewed by Carlos Garcia Campos.

Add API for changing the user agent in WebKit2. This adds two styles of
setting the user agent: complete override and a method that just inserts
the application name and version, but preserves the carefully crafted user agent
in the library.

* UIProcess/API/gtk/WebKitSettings.cpp:
(_WebKitSettingsPrivate): Added a new field to store the user agent.
This is stored in the private data structure, because we can only
set the user agent when attaching the settings to the page.
(webKitSettingsSetProperty): Add hooks for the new user agent property.
(webKitSettingsGetProperty): Ditto.
(webkit_settings_class_init): Ditto.
(webkitSettingsAttachSettingsToPage): Ditto.
(webkit_settings_get_user_agent): Added.
(webkit_settings_set_user_agent): Added.
(webkit_settings_set_user_agent_with_application_name): Added.
* UIProcess/API/gtk/WebKitSettings.h: Added new methods.
* UIProcess/API/gtk/WebKitWebView.cpp: Update the glue for the settings
when attaching and detaching from WebViews.
* UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Added new methods to
the documentation.
* UIProcess/API/gtk/tests/TestWebKitSettings.cpp: Test the new user agent
property.
(testWebKitSettingsUserAgent): Ditto.
(beforeAll): Ditto.
* UIProcess/gtk/WebPageProxyGtk.cpp:
(WebKit::WebPageProxy::standardUserAgent): Now use the shared WebCore
code when setting the user agent.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@128960 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp
Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h
Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp
Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt
Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitSettings.cpp
Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp