diff options
author | Ben Murdoch <benm@google.com> | 2011-05-24 11:24:40 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-06-02 09:53:15 +0100 |
commit | 81bc750723a18f21cd17d1b173cd2a4dda9cea6e (patch) | |
tree | 7a9e5ed86ff429fd347a25153107221543909b19 /Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp | |
parent | 94088a6d336c1dd80a1e734af51e96abcbb689a7 (diff) | |
download | external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.zip external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.gz external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.bz2 |
Merge WebKit at r80534: Intial merge by Git
Change-Id: Ia7a83357124c9e1cdb1debf55d9661ec0bd09a61
Diffstat (limited to 'Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp')
-rw-r--r-- | Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp | 52 |
1 files changed, 10 insertions, 42 deletions
diff --git a/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp index f70363c..186ad44 100644 --- a/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp +++ b/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp @@ -26,8 +26,8 @@ #include "config.h" #include "WebPageProxy.h" +#include "resource.h" #include <tchar.h> -#include <WebCore/Language.h> #include <WebCore/WebCoreInstanceHandle.h> #include <wtf/StdLibExtras.h> #include <wtf/text/StringConcatenate.h> @@ -62,53 +62,21 @@ static String windowsVersion() static String userVisibleWebKitVersionString() { - String versionStr = "420+"; - void* data = 0; + LPWSTR buildNumberStringPtr; + if (!::LoadStringW(instanceHandle(), BUILD_NUMBER, reinterpret_cast<LPWSTR>(&buildNumberStringPtr), 0) || !buildNumberStringPtr) + return "534+"; - struct LANGANDCODEPAGE { - WORD wLanguage; - WORD wCodePage; - } *lpTranslate; - - TCHAR path[MAX_PATH]; - ::GetModuleFileName(instanceHandle(), path, WTF_ARRAY_LENGTH(path)); - DWORD handle; - DWORD versionSize = ::GetFileVersionInfoSize(path, &handle); - if (!versionSize) - goto exit; - data = fastMalloc(versionSize); - if (!data) - goto exit; - if (!::GetFileVersionInfo(path, 0, versionSize, data)) - goto exit; - UINT cbTranslate; - if (!::VerQueryValue(data, TEXT("\\VarFileInfo\\Translation"), (LPVOID*)&lpTranslate, &cbTranslate)) - goto exit; - TCHAR key[256]; - _stprintf_s(key, WTF_ARRAY_LENGTH(key), TEXT("\\StringFileInfo\\%04x%04x\\ProductVersion"), lpTranslate[0].wLanguage, lpTranslate[0].wCodePage); - LPCTSTR productVersion; - UINT productVersionLength; - if (!::VerQueryValue(data, (LPTSTR)(LPCTSTR)key, (void**)&productVersion, &productVersionLength)) - goto exit; - versionStr = String(productVersion, productVersionLength - 1); - -exit: - if (data) - fastFree(data); - return versionStr; + return buildNumberStringPtr; } String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent) { - DEFINE_STATIC_LOCAL(String, osVersion, (windowsVersion())); - DEFINE_STATIC_LOCAL(String, webKitVersion, (userVisibleWebKitVersionString())); - - // FIXME: We should upate the user agent if the default language changes. - String language = defaultLanguage(); + DEFINE_STATIC_LOCAL(String, osVersion, (windowsVersion())); + DEFINE_STATIC_LOCAL(String, webKitVersion, (userVisibleWebKitVersionString())); - if (applicationNameForUserAgent.isEmpty()) - return makeString("Mozilla/5.0 (Windows; U; ", osVersion, "; ", language, ") AppleWebKit/", webKitVersion, " (KHTML, like Gecko)"); - return makeString("Mozilla/5.0 (Windows; U; ", osVersion, "; ", language, ") AppleWebKit/", webKitVersion, " (KHTML, like Gecko) ", applicationNameForUserAgent); + if (applicationNameForUserAgent.isEmpty()) + return makeString("Mozilla/5.0 (", osVersion, ") AppleWebKit/", webKitVersion, " (KHTML, like Gecko)"); + return makeString("Mozilla/5.0 (", osVersion, ") AppleWebKit/", webKitVersion, " (KHTML, like Gecko) ", applicationNameForUserAgent); } } // namespace WebKit |