Commit 39622594 authored by kmccullough@apple.com's avatar kmccullough@apple.com

2008-10-16 Kevin McCullough <kmccullough@apple.com>

        Reviewed by Steve Falkenburg.

        <rdar://problem/6292718>
        Implement a standard way to get the UA given an application name.

        * Interfaces/IWebViewPrivate.idl:
        * WebView.cpp:
        (WebView::standardUserAgentWithApplicationName):
        * WebView.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37661 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 38edc137
2008-10-16 Kevin McCullough <kmccullough@apple.com>
Reviewed by Steve Falkenburg.
<rdar://problem/6292718>
Implement a standard way to get the UA given an application name.
* Interfaces/IWebViewPrivate.idl:
* WebView.cpp:
(WebView::standardUserAgentWithApplicationName):
* WebView.h:
2008-10-17 Dan Bernstein <mitz@apple.com>
Reviewed by Sam Weinig.
......
......@@ -131,6 +131,8 @@ interface IWebViewPrivate : IUnknown
HRESULT setDefersCallbacks([in] BOOL defersCallbacks);
HRESULT defersCallbacks([out, retval] BOOL* defersCallbacks);
HRESULT standardUserAgentWithApplicationName([in] BSTR applicationName, [retval][out] BSTR* groupName);
HRESULT setCustomHTMLTokenizerTimeDelay([in] double timeDelay);
HRESULT setCustomHTMLTokenizerChunkSize([in] int chunkSize);
......
......@@ -122,6 +122,9 @@ using std::max;
static HMODULE accessibilityLib;
static HashSet<WebView*> pendingDeleteBackingStoreSet;
static String osVersion();
static String webKitVersion();
WebView* kit(Page* page)
{
return page ? static_cast<WebChromeClient*>(page->chrome()->client())->webView() : 0;
......@@ -1009,6 +1012,11 @@ bool WebView::canHandleRequest(const WebCore::ResourceRequest& request)
#endif
}
String WebView::standardUserAgentWithApplicationName(const String& applicationName)
{
return String::format("Mozilla/5.0 (Windows; U; %s; %s) AppleWebKit/%s (KHTML, like Gecko)%s%s", osVersion().latin1().data(), defaultLanguage().latin1().data(), webKitVersion().latin1().data(), (applicationName.length() ? " " : ""), applicationName.latin1().data());
}
Page* WebView::page()
{
return m_page;
......@@ -1981,7 +1989,7 @@ const String& WebView::userAgentForKURL(const KURL&)
return m_userAgentCustom;
if (!m_userAgentStandard.length())
m_userAgentStandard = String::format("Mozilla/5.0 (Windows; U; %s; %s) AppleWebKit/%s (KHTML, like Gecko)%s%s", osVersion().latin1().data(), defaultLanguage().latin1().data(), webKitVersion().latin1().data(), (m_applicationName.length() ? " " : ""), m_applicationName.latin1().data());
m_userAgentStandard = WebView::standardUserAgentWithApplicationName(m_applicationName);
return m_userAgentStandard;
}
......@@ -4381,6 +4389,27 @@ HRESULT STDMETHODCALLTYPE WebView::canHandleRequest(
return S_OK;
}
HRESULT STDMETHODCALLTYPE WebView::standardUserAgentWithApplicationName(
BSTR applicationName,
BSTR* groupName)
{
if (!groupName) {
ASSERT_NOT_REACHED();
return E_POINTER;
}
*groupName;
if (!applicationName) {
ASSERT_NOT_REACHED();
return E_POINTER;
}
BString applicationNameBString(applicationName);
*groupName = BString(standardUserAgentWithApplicationName(String(applicationNameBString, SysStringLen(applicationNameBString)))).release();
return S_OK;
}
HRESULT STDMETHODCALLTYPE WebView::clearFocusNode()
{
if (m_page && m_page->focusController())
......
......@@ -629,6 +629,10 @@ public:
IWebURLRequest *request,
BOOL *result);
virtual HRESULT STDMETHODCALLTYPE standardUserAgentWithApplicationName(
/* [in] */ BSTR applicationName,
/* [retval][out] */ BSTR *groupName);
virtual HRESULT STDMETHODCALLTYPE clearFocusNode();
virtual HRESULT STDMETHODCALLTYPE setInitialFocus(
......@@ -747,6 +751,8 @@ public:
static bool canHandleRequest(const WebCore::ResourceRequest&);
static WebCore::String standardUserAgentWithApplicationName(const WebCore::String&);
void setIsBeingDestroyed() { m_isBeingDestroyed = true; }
bool isBeingDestroyed() const { return m_isBeingDestroyed; }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment