diff options
author | pinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-09 18:13:45 +0000 |
---|---|---|
committer | pinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-09 18:13:45 +0000 |
commit | 16dd53084f02c4857d596a98dbd7f861b9dceb80 (patch) | |
tree | 0d047e3204fbc33a2d0fb56f3ea2b9df75cee3f5 /webkit/glue | |
parent | 86ee4bd6f1177d7fc79a6ac7e6c06dd0b8e2365d (diff) | |
download | chromium_src-16dd53084f02c4857d596a98dbd7f861b9dceb80.zip chromium_src-16dd53084f02c4857d596a98dbd7f861b9dceb80.tar.gz chromium_src-16dd53084f02c4857d596a98dbd7f861b9dceb80.tar.bz2 |
stub out win-only routines and impl user agent for MacOS X
Review URL: http://codereview.chromium.org/262
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1904 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r-- | webkit/glue/webkit_glue.cc | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc index 8cf049a..1699f6f 100644 --- a/webkit/glue/webkit_glue.cc +++ b/webkit/glue/webkit_glue.cc @@ -343,9 +343,23 @@ const std::string& GetDefaultUserAgent() { static std::string user_agent; static bool generated_user_agent; if (!generated_user_agent) { + int32 os_major_version = 0; + int32 os_minor_version = 0; + int32 os_bugfix_version = 0; +#if defined(OS_WIN) OSVERSIONINFO info = {0}; info.dwOSVersionInfoSize = sizeof(info); GetVersionEx(&info); + os_major_version = info.dwMajorVersion; + os_minor_version = info.dwMinorVersion; +#elif defined(OS_MACOSX) + Gestalt(gestaltSystemVersionMajor, + reinterpret_cast<SInt32*>(&os_major_version)); + Gestalt(gestaltSystemVersionMinor, + reinterpret_cast<SInt32*>(&os_minor_version)); + Gestalt(gestaltSystemVersionBugFix, + reinterpret_cast<SInt32*>(&os_bugfix_version)); +#endif // Get the product name and version, and replace Safari's Version/X string // with it. This is done to expose our product name in a manner that is @@ -363,10 +377,17 @@ const std::string& GetDefaultUserAgent() { // Derived from Safari's UA string. StringAppendF( &user_agent, +#if defined(OS_WIN) "Mozilla/5.0 (Windows; U; Windows NT %d.%d; en-US) AppleWebKit/%d.%d" +#elif defined(OS_MACOSX) + "Mozilla/5.0 (Macintosh; U; Intel Mac OS X %d_%d_%d; en-US) AppleWebKit/%d.%d" +#endif " (KHTML, like Gecko) %s Safari/%d.%d", - info.dwMajorVersion, - info.dwMinorVersion, + os_major_version, + os_minor_version, +#if defined(OS_MACOSX) + os_bugfix_version, +#endif WEBKIT_VERSION_MAJOR, WEBKIT_VERSION_MINOR, product.c_str(), |